@mangoweb/scripts-base
Advanced tools
Comparing version 0.0.5 to 0.0.8
@@ -1,5 +0,5 @@ | ||
import { Component } from './Component'; | ||
import { Component } from '../Component'; | ||
declare type EventType = string; | ||
declare type Events = Array<EventType>; | ||
export interface EmitterData { | ||
export interface EmitterProps { | ||
events: EventType | Events; | ||
@@ -12,10 +12,10 @@ } | ||
* | ||
* Expects data = { | ||
* Expects props = { | ||
* events: [ 'event', 'names', 'to', 'trigger' ] - array of events or just single string | ||
* } | ||
*/ | ||
export declare class Emitter extends Component<EmitterData> { | ||
export declare class Emitter extends Component<EmitterProps> { | ||
static componentName: string; | ||
private events; | ||
protected getListeners: () => (["focusin", EventListenerCallback<"focusin">] | ["focusout", EventListenerCallback<"focusout">] | ["fullscreenchange", EventListenerCallback<"fullscreenchange">] | ["fullscreenerror", EventListenerCallback<"fullscreenerror">] | ["abort", EventListenerCallback<"abort">] | ["animationcancel", EventListenerCallback<"animationcancel">] | ["animationend", EventListenerCallback<"animationend">] | ["animationiteration", EventListenerCallback<"animationiteration">] | ["animationstart", EventListenerCallback<"animationstart">] | ["auxclick", EventListenerCallback<"auxclick">] | ["blur", EventListenerCallback<"blur">] | ["cancel", EventListenerCallback<"cancel">] | ["canplay", EventListenerCallback<"canplay">] | ["canplaythrough", EventListenerCallback<"canplaythrough">] | ["change", EventListenerCallback<"change">] | ["click", EventListenerCallback<"click">] | ["close", EventListenerCallback<"close">] | ["contextmenu", EventListenerCallback<"contextmenu">] | ["cuechange", EventListenerCallback<"cuechange">] | ["dblclick", EventListenerCallback<"dblclick">] | ["drag", EventListenerCallback<"drag">] | ["dragend", EventListenerCallback<"dragend">] | ["dragenter", EventListenerCallback<"dragenter">] | ["dragexit", EventListenerCallback<"dragexit">] | ["dragleave", EventListenerCallback<"dragleave">] | ["dragover", EventListenerCallback<"dragover">] | ["dragstart", EventListenerCallback<"dragstart">] | ["drop", EventListenerCallback<"drop">] | ["durationchange", EventListenerCallback<"durationchange">] | ["emptied", EventListenerCallback<"emptied">] | ["ended", EventListenerCallback<"ended">] | ["error", EventListenerCallback<"error">] | ["focus", EventListenerCallback<"focus">] | ["gotpointercapture", EventListenerCallback<"gotpointercapture">] | ["input", EventListenerCallback<"input">] | ["invalid", EventListenerCallback<"invalid">] | ["keydown", EventListenerCallback<"keydown">] | ["keypress", EventListenerCallback<"keypress">] | ["keyup", EventListenerCallback<"keyup">] | ["load", EventListenerCallback<"load">] | ["loadeddata", EventListenerCallback<"loadeddata">] | ["loadedmetadata", EventListenerCallback<"loadedmetadata">] | ["loadend", EventListenerCallback<"loadend">] | ["loadstart", EventListenerCallback<"loadstart">] | ["lostpointercapture", EventListenerCallback<"lostpointercapture">] | ["mousedown", EventListenerCallback<"mousedown">] | ["mouseenter", EventListenerCallback<"mouseenter">] | ["mouseleave", EventListenerCallback<"mouseleave">] | ["mousemove", EventListenerCallback<"mousemove">] | ["mouseout", EventListenerCallback<"mouseout">] | ["mouseover", EventListenerCallback<"mouseover">] | ["mouseup", EventListenerCallback<"mouseup">] | ["pause", EventListenerCallback<"pause">] | ["play", EventListenerCallback<"play">] | ["playing", EventListenerCallback<"playing">] | ["pointercancel", EventListenerCallback<"pointercancel">] | ["pointerdown", EventListenerCallback<"pointerdown">] | ["pointerenter", EventListenerCallback<"pointerenter">] | ["pointerleave", EventListenerCallback<"pointerleave">] | ["pointermove", EventListenerCallback<"pointermove">] | ["pointerout", EventListenerCallback<"pointerout">] | ["pointerover", EventListenerCallback<"pointerover">] | ["pointerup", EventListenerCallback<"pointerup">] | ["progress", EventListenerCallback<"progress">] | ["ratechange", EventListenerCallback<"ratechange">] | ["reset", EventListenerCallback<"reset">] | ["resize", EventListenerCallback<"resize">] | ["scroll", EventListenerCallback<"scroll">] | ["securitypolicyviolation", EventListenerCallback<"securitypolicyviolation">] | ["seeked", EventListenerCallback<"seeked">] | ["seeking", EventListenerCallback<"seeking">] | ["select", EventListenerCallback<"select">] | ["selectionchange", EventListenerCallback<"selectionchange">] | ["selectstart", EventListenerCallback<"selectstart">] | ["stalled", EventListenerCallback<"stalled">] | ["submit", EventListenerCallback<"submit">] | ["suspend", EventListenerCallback<"suspend">] | ["timeupdate", EventListenerCallback<"timeupdate">] | ["toggle", EventListenerCallback<"toggle">] | ["touchcancel", EventListenerCallback<"touchcancel">] | ["touchend", EventListenerCallback<"touchend">] | ["touchmove", EventListenerCallback<"touchmove">] | ["touchstart", EventListenerCallback<"touchstart">] | ["transitioncancel", EventListenerCallback<"transitioncancel">] | ["transitionend", EventListenerCallback<"transitionend">] | ["transitionrun", EventListenerCallback<"transitionrun">] | ["transitionstart", EventListenerCallback<"transitionstart">] | ["volumechange", EventListenerCallback<"volumechange">] | ["waiting", EventListenerCallback<"waiting">] | ["wheel", EventListenerCallback<"wheel">] | ["copy", EventListenerCallback<"copy">] | ["cut", EventListenerCallback<"cut">] | ["paste", EventListenerCallback<"paste">] | ["waiting", string, DelegateEventListenerCallback<"waiting">] | ["cancel", string, DelegateEventListenerCallback<"cancel">] | ["ended", string, DelegateEventListenerCallback<"ended">] | ["change", string, DelegateEventListenerCallback<"change">] | ["input", string, DelegateEventListenerCallback<"input">] | ["select", string, DelegateEventListenerCallback<"select">] | ["fullscreenchange", string, DelegateEventListenerCallback<"fullscreenchange">] | ["fullscreenerror", string, DelegateEventListenerCallback<"fullscreenerror">] | ["animationcancel", string, DelegateEventListenerCallback<"animationcancel">] | ["animationend", string, DelegateEventListenerCallback<"animationend">] | ["animationiteration", string, DelegateEventListenerCallback<"animationiteration">] | ["animationstart", string, DelegateEventListenerCallback<"animationstart">] | ["auxclick", string, DelegateEventListenerCallback<"auxclick">] | ["canplay", string, DelegateEventListenerCallback<"canplay">] | ["canplaythrough", string, DelegateEventListenerCallback<"canplaythrough">] | ["click", string, DelegateEventListenerCallback<"click">] | ["close", string, DelegateEventListenerCallback<"close">] | ["contextmenu", string, DelegateEventListenerCallback<"contextmenu">] | ["cuechange", string, DelegateEventListenerCallback<"cuechange">] | ["dblclick", string, DelegateEventListenerCallback<"dblclick">] | ["drag", string, DelegateEventListenerCallback<"drag">] | ["dragend", string, DelegateEventListenerCallback<"dragend">] | ["dragenter", string, DelegateEventListenerCallback<"dragenter">] | ["dragexit", string, DelegateEventListenerCallback<"dragexit">] | ["dragleave", string, DelegateEventListenerCallback<"dragleave">] | ["dragover", string, DelegateEventListenerCallback<"dragover">] | ["dragstart", string, DelegateEventListenerCallback<"dragstart">] | ["drop", string, DelegateEventListenerCallback<"drop">] | ["durationchange", string, DelegateEventListenerCallback<"durationchange">] | ["emptied", string, DelegateEventListenerCallback<"emptied">] | ["gotpointercapture", string, DelegateEventListenerCallback<"gotpointercapture">] | ["invalid", string, DelegateEventListenerCallback<"invalid">] | ["keydown", string, DelegateEventListenerCallback<"keydown">] | ["keypress", string, DelegateEventListenerCallback<"keypress">] | ["keyup", string, DelegateEventListenerCallback<"keyup">] | ["loadeddata", string, DelegateEventListenerCallback<"loadeddata">] | ["loadedmetadata", string, DelegateEventListenerCallback<"loadedmetadata">] | ["lostpointercapture", string, DelegateEventListenerCallback<"lostpointercapture">] | ["mousedown", string, DelegateEventListenerCallback<"mousedown">] | ["mouseenter", string, DelegateEventListenerCallback<"mouseenter">] | ["mouseleave", string, DelegateEventListenerCallback<"mouseleave">] | ["mousemove", string, DelegateEventListenerCallback<"mousemove">] | ["mouseout", string, DelegateEventListenerCallback<"mouseout">] | ["mouseover", string, DelegateEventListenerCallback<"mouseover">] | ["mouseup", string, DelegateEventListenerCallback<"mouseup">] | ["pause", string, DelegateEventListenerCallback<"pause">] | ["play", string, DelegateEventListenerCallback<"play">] | ["playing", string, DelegateEventListenerCallback<"playing">] | ["pointercancel", string, DelegateEventListenerCallback<"pointercancel">] | ["pointerdown", string, DelegateEventListenerCallback<"pointerdown">] | ["pointerenter", string, DelegateEventListenerCallback<"pointerenter">] | ["pointerleave", string, DelegateEventListenerCallback<"pointerleave">] | ["pointermove", string, DelegateEventListenerCallback<"pointermove">] | ["pointerout", string, DelegateEventListenerCallback<"pointerout">] | ["pointerover", string, DelegateEventListenerCallback<"pointerover">] | ["pointerup", string, DelegateEventListenerCallback<"pointerup">] | ["ratechange", string, DelegateEventListenerCallback<"ratechange">] | ["reset", string, DelegateEventListenerCallback<"reset">] | ["resize", string, DelegateEventListenerCallback<"resize">] | ["securitypolicyviolation", string, DelegateEventListenerCallback<"securitypolicyviolation">] | ["seeked", string, DelegateEventListenerCallback<"seeked">] | ["seeking", string, DelegateEventListenerCallback<"seeking">] | ["selectionchange", string, DelegateEventListenerCallback<"selectionchange">] | ["selectstart", string, DelegateEventListenerCallback<"selectstart">] | ["stalled", string, DelegateEventListenerCallback<"stalled">] | ["submit", string, DelegateEventListenerCallback<"submit">] | ["suspend", string, DelegateEventListenerCallback<"suspend">] | ["timeupdate", string, DelegateEventListenerCallback<"timeupdate">] | ["toggle", string, DelegateEventListenerCallback<"toggle">] | ["touchcancel", string, DelegateEventListenerCallback<"touchcancel">] | ["touchend", string, DelegateEventListenerCallback<"touchend">] | ["touchmove", string, DelegateEventListenerCallback<"touchmove">] | ["touchstart", string, DelegateEventListenerCallback<"touchstart">] | ["transitioncancel", string, DelegateEventListenerCallback<"transitioncancel">] | ["transitionend", string, DelegateEventListenerCallback<"transitionend">] | ["transitionrun", string, DelegateEventListenerCallback<"transitionrun">] | ["transitionstart", string, DelegateEventListenerCallback<"transitionstart">] | ["volumechange", string, DelegateEventListenerCallback<"volumechange">] | ["wheel", string, DelegateEventListenerCallback<"wheel">] | ["copy", string, DelegateEventListenerCallback<"copy">] | ["cut", string, DelegateEventListenerCallback<"cut">] | ["paste", string, DelegateEventListenerCallback<"paste">] | ["focusin", string, DelegateEventListenerCallback<"focusin">] | ["focusout", string, DelegateEventListenerCallback<"focusout">])[]; | ||
protected getListeners: () => (["focusin", import("../componentTypes").EventListenerCallback<"focusin", HTMLElementEventMap>] | ["focusout", import("../componentTypes").EventListenerCallback<"focusout", HTMLElementEventMap>] | ["fullscreenchange", import("../componentTypes").EventListenerCallback<"fullscreenchange", HTMLElementEventMap>] | ["fullscreenerror", import("../componentTypes").EventListenerCallback<"fullscreenerror", HTMLElementEventMap>] | ["abort", import("../componentTypes").EventListenerCallback<"abort", HTMLElementEventMap>] | ["animationcancel", import("../componentTypes").EventListenerCallback<"animationcancel", HTMLElementEventMap>] | ["animationend", import("../componentTypes").EventListenerCallback<"animationend", HTMLElementEventMap>] | ["animationiteration", import("../componentTypes").EventListenerCallback<"animationiteration", HTMLElementEventMap>] | ["animationstart", import("../componentTypes").EventListenerCallback<"animationstart", HTMLElementEventMap>] | ["auxclick", import("../componentTypes").EventListenerCallback<"auxclick", HTMLElementEventMap>] | ["blur", import("../componentTypes").EventListenerCallback<"blur", HTMLElementEventMap>] | ["cancel", import("../componentTypes").EventListenerCallback<"cancel", HTMLElementEventMap>] | ["canplay", import("../componentTypes").EventListenerCallback<"canplay", HTMLElementEventMap>] | ["canplaythrough", import("../componentTypes").EventListenerCallback<"canplaythrough", HTMLElementEventMap>] | ["change", import("../componentTypes").EventListenerCallback<"change", HTMLElementEventMap>] | ["click", import("../componentTypes").EventListenerCallback<"click", HTMLElementEventMap>] | ["close", import("../componentTypes").EventListenerCallback<"close", HTMLElementEventMap>] | ["contextmenu", import("../componentTypes").EventListenerCallback<"contextmenu", HTMLElementEventMap>] | ["cuechange", import("../componentTypes").EventListenerCallback<"cuechange", HTMLElementEventMap>] | ["dblclick", import("../componentTypes").EventListenerCallback<"dblclick", HTMLElementEventMap>] | ["drag", import("../componentTypes").EventListenerCallback<"drag", HTMLElementEventMap>] | ["dragend", import("../componentTypes").EventListenerCallback<"dragend", HTMLElementEventMap>] | ["dragenter", import("../componentTypes").EventListenerCallback<"dragenter", HTMLElementEventMap>] | ["dragexit", import("../componentTypes").EventListenerCallback<"dragexit", HTMLElementEventMap>] | ["dragleave", import("../componentTypes").EventListenerCallback<"dragleave", HTMLElementEventMap>] | ["dragover", import("../componentTypes").EventListenerCallback<"dragover", HTMLElementEventMap>] | ["dragstart", import("../componentTypes").EventListenerCallback<"dragstart", HTMLElementEventMap>] | ["drop", import("../componentTypes").EventListenerCallback<"drop", HTMLElementEventMap>] | ["durationchange", import("../componentTypes").EventListenerCallback<"durationchange", HTMLElementEventMap>] | ["emptied", import("../componentTypes").EventListenerCallback<"emptied", HTMLElementEventMap>] | ["ended", import("../componentTypes").EventListenerCallback<"ended", HTMLElementEventMap>] | ["error", import("../componentTypes").EventListenerCallback<"error", HTMLElementEventMap>] | ["focus", import("../componentTypes").EventListenerCallback<"focus", HTMLElementEventMap>] | ["gotpointercapture", import("../componentTypes").EventListenerCallback<"gotpointercapture", HTMLElementEventMap>] | ["input", import("../componentTypes").EventListenerCallback<"input", HTMLElementEventMap>] | ["invalid", import("../componentTypes").EventListenerCallback<"invalid", HTMLElementEventMap>] | ["keydown", import("../componentTypes").EventListenerCallback<"keydown", HTMLElementEventMap>] | ["keypress", import("../componentTypes").EventListenerCallback<"keypress", HTMLElementEventMap>] | ["keyup", import("../componentTypes").EventListenerCallback<"keyup", HTMLElementEventMap>] | ["load", import("../componentTypes").EventListenerCallback<"load", HTMLElementEventMap>] | ["loadeddata", import("../componentTypes").EventListenerCallback<"loadeddata", HTMLElementEventMap>] | ["loadedmetadata", import("../componentTypes").EventListenerCallback<"loadedmetadata", HTMLElementEventMap>] | ["loadend", import("../componentTypes").EventListenerCallback<"loadend", HTMLElementEventMap>] | ["loadstart", import("../componentTypes").EventListenerCallback<"loadstart", HTMLElementEventMap>] | ["lostpointercapture", import("../componentTypes").EventListenerCallback<"lostpointercapture", HTMLElementEventMap>] | ["mousedown", import("../componentTypes").EventListenerCallback<"mousedown", HTMLElementEventMap>] | ["mouseenter", import("../componentTypes").EventListenerCallback<"mouseenter", HTMLElementEventMap>] | ["mouseleave", import("../componentTypes").EventListenerCallback<"mouseleave", HTMLElementEventMap>] | ["mousemove", import("../componentTypes").EventListenerCallback<"mousemove", HTMLElementEventMap>] | ["mouseout", import("../componentTypes").EventListenerCallback<"mouseout", HTMLElementEventMap>] | ["mouseover", import("../componentTypes").EventListenerCallback<"mouseover", HTMLElementEventMap>] | ["mouseup", import("../componentTypes").EventListenerCallback<"mouseup", HTMLElementEventMap>] | ["pause", import("../componentTypes").EventListenerCallback<"pause", HTMLElementEventMap>] | ["play", import("../componentTypes").EventListenerCallback<"play", HTMLElementEventMap>] | ["playing", import("../componentTypes").EventListenerCallback<"playing", HTMLElementEventMap>] | ["pointercancel", import("../componentTypes").EventListenerCallback<"pointercancel", HTMLElementEventMap>] | ["pointerdown", import("../componentTypes").EventListenerCallback<"pointerdown", HTMLElementEventMap>] | ["pointerenter", import("../componentTypes").EventListenerCallback<"pointerenter", HTMLElementEventMap>] | ["pointerleave", import("../componentTypes").EventListenerCallback<"pointerleave", HTMLElementEventMap>] | ["pointermove", import("../componentTypes").EventListenerCallback<"pointermove", HTMLElementEventMap>] | ["pointerout", import("../componentTypes").EventListenerCallback<"pointerout", HTMLElementEventMap>] | ["pointerover", import("../componentTypes").EventListenerCallback<"pointerover", HTMLElementEventMap>] | ["pointerup", import("../componentTypes").EventListenerCallback<"pointerup", HTMLElementEventMap>] | ["progress", import("../componentTypes").EventListenerCallback<"progress", HTMLElementEventMap>] | ["ratechange", import("../componentTypes").EventListenerCallback<"ratechange", HTMLElementEventMap>] | ["reset", import("../componentTypes").EventListenerCallback<"reset", HTMLElementEventMap>] | ["resize", import("../componentTypes").EventListenerCallback<"resize", HTMLElementEventMap>] | ["scroll", import("../componentTypes").EventListenerCallback<"scroll", HTMLElementEventMap>] | ["securitypolicyviolation", import("../componentTypes").EventListenerCallback<"securitypolicyviolation", HTMLElementEventMap>] | ["seeked", import("../componentTypes").EventListenerCallback<"seeked", HTMLElementEventMap>] | ["seeking", import("../componentTypes").EventListenerCallback<"seeking", HTMLElementEventMap>] | ["select", import("../componentTypes").EventListenerCallback<"select", HTMLElementEventMap>] | ["selectionchange", import("../componentTypes").EventListenerCallback<"selectionchange", HTMLElementEventMap>] | ["selectstart", import("../componentTypes").EventListenerCallback<"selectstart", HTMLElementEventMap>] | ["stalled", import("../componentTypes").EventListenerCallback<"stalled", HTMLElementEventMap>] | ["submit", import("../componentTypes").EventListenerCallback<"submit", HTMLElementEventMap>] | ["suspend", import("../componentTypes").EventListenerCallback<"suspend", HTMLElementEventMap>] | ["timeupdate", import("../componentTypes").EventListenerCallback<"timeupdate", HTMLElementEventMap>] | ["toggle", import("../componentTypes").EventListenerCallback<"toggle", HTMLElementEventMap>] | ["touchcancel", import("../componentTypes").EventListenerCallback<"touchcancel", HTMLElementEventMap>] | ["touchend", import("../componentTypes").EventListenerCallback<"touchend", HTMLElementEventMap>] | ["touchmove", import("../componentTypes").EventListenerCallback<"touchmove", HTMLElementEventMap>] | ["touchstart", import("../componentTypes").EventListenerCallback<"touchstart", HTMLElementEventMap>] | ["transitioncancel", import("../componentTypes").EventListenerCallback<"transitioncancel", HTMLElementEventMap>] | ["transitionend", import("../componentTypes").EventListenerCallback<"transitionend", HTMLElementEventMap>] | ["transitionrun", import("../componentTypes").EventListenerCallback<"transitionrun", HTMLElementEventMap>] | ["transitionstart", import("../componentTypes").EventListenerCallback<"transitionstart", HTMLElementEventMap>] | ["volumechange", import("../componentTypes").EventListenerCallback<"volumechange", HTMLElementEventMap>] | ["waiting", import("../componentTypes").EventListenerCallback<"waiting", HTMLElementEventMap>] | ["wheel", import("../componentTypes").EventListenerCallback<"wheel", HTMLElementEventMap>] | ["copy", import("../componentTypes").EventListenerCallback<"copy", HTMLElementEventMap>] | ["cut", import("../componentTypes").EventListenerCallback<"cut", HTMLElementEventMap>] | ["paste", import("../componentTypes").EventListenerCallback<"paste", HTMLElementEventMap>] | ["waiting", string, import("../componentTypes").DelegateEventListenerCallback<"waiting", HTMLElement, HTMLElementEventMap>] | ["cancel", string, import("../componentTypes").DelegateEventListenerCallback<"cancel", HTMLElement, HTMLElementEventMap>] | ["ended", string, import("../componentTypes").DelegateEventListenerCallback<"ended", HTMLElement, HTMLElementEventMap>] | ["change", string, import("../componentTypes").DelegateEventListenerCallback<"change", HTMLElement, HTMLElementEventMap>] | ["input", string, import("../componentTypes").DelegateEventListenerCallback<"input", HTMLElement, HTMLElementEventMap>] | ["select", string, import("../componentTypes").DelegateEventListenerCallback<"select", HTMLElement, HTMLElementEventMap>] | ["fullscreenchange", string, import("../componentTypes").DelegateEventListenerCallback<"fullscreenchange", HTMLElement, HTMLElementEventMap>] | ["fullscreenerror", string, import("../componentTypes").DelegateEventListenerCallback<"fullscreenerror", HTMLElement, HTMLElementEventMap>] | ["animationcancel", string, import("../componentTypes").DelegateEventListenerCallback<"animationcancel", HTMLElement, HTMLElementEventMap>] | ["animationend", string, import("../componentTypes").DelegateEventListenerCallback<"animationend", HTMLElement, HTMLElementEventMap>] | ["animationiteration", string, import("../componentTypes").DelegateEventListenerCallback<"animationiteration", HTMLElement, HTMLElementEventMap>] | ["animationstart", string, import("../componentTypes").DelegateEventListenerCallback<"animationstart", HTMLElement, HTMLElementEventMap>] | ["auxclick", string, import("../componentTypes").DelegateEventListenerCallback<"auxclick", HTMLElement, HTMLElementEventMap>] | ["canplay", string, import("../componentTypes").DelegateEventListenerCallback<"canplay", HTMLElement, HTMLElementEventMap>] | ["canplaythrough", string, import("../componentTypes").DelegateEventListenerCallback<"canplaythrough", HTMLElement, HTMLElementEventMap>] | ["click", string, import("../componentTypes").DelegateEventListenerCallback<"click", HTMLElement, HTMLElementEventMap>] | ["close", string, import("../componentTypes").DelegateEventListenerCallback<"close", HTMLElement, HTMLElementEventMap>] | ["contextmenu", string, import("../componentTypes").DelegateEventListenerCallback<"contextmenu", HTMLElement, HTMLElementEventMap>] | ["cuechange", string, import("../componentTypes").DelegateEventListenerCallback<"cuechange", HTMLElement, HTMLElementEventMap>] | ["dblclick", string, import("../componentTypes").DelegateEventListenerCallback<"dblclick", HTMLElement, HTMLElementEventMap>] | ["drag", string, import("../componentTypes").DelegateEventListenerCallback<"drag", HTMLElement, HTMLElementEventMap>] | ["dragend", string, import("../componentTypes").DelegateEventListenerCallback<"dragend", HTMLElement, HTMLElementEventMap>] | ["dragenter", string, import("../componentTypes").DelegateEventListenerCallback<"dragenter", HTMLElement, HTMLElementEventMap>] | ["dragexit", string, import("../componentTypes").DelegateEventListenerCallback<"dragexit", HTMLElement, HTMLElementEventMap>] | ["dragleave", string, import("../componentTypes").DelegateEventListenerCallback<"dragleave", HTMLElement, HTMLElementEventMap>] | ["dragover", string, import("../componentTypes").DelegateEventListenerCallback<"dragover", HTMLElement, HTMLElementEventMap>] | ["dragstart", string, import("../componentTypes").DelegateEventListenerCallback<"dragstart", HTMLElement, HTMLElementEventMap>] | ["drop", string, import("../componentTypes").DelegateEventListenerCallback<"drop", HTMLElement, HTMLElementEventMap>] | ["durationchange", string, import("../componentTypes").DelegateEventListenerCallback<"durationchange", HTMLElement, HTMLElementEventMap>] | ["emptied", string, import("../componentTypes").DelegateEventListenerCallback<"emptied", HTMLElement, HTMLElementEventMap>] | ["gotpointercapture", string, import("../componentTypes").DelegateEventListenerCallback<"gotpointercapture", HTMLElement, HTMLElementEventMap>] | ["invalid", string, import("../componentTypes").DelegateEventListenerCallback<"invalid", HTMLElement, HTMLElementEventMap>] | ["keydown", string, import("../componentTypes").DelegateEventListenerCallback<"keydown", HTMLElement, HTMLElementEventMap>] | ["keypress", string, import("../componentTypes").DelegateEventListenerCallback<"keypress", HTMLElement, HTMLElementEventMap>] | ["keyup", string, import("../componentTypes").DelegateEventListenerCallback<"keyup", HTMLElement, HTMLElementEventMap>] | ["loadeddata", string, import("../componentTypes").DelegateEventListenerCallback<"loadeddata", HTMLElement, HTMLElementEventMap>] | ["loadedmetadata", string, import("../componentTypes").DelegateEventListenerCallback<"loadedmetadata", HTMLElement, HTMLElementEventMap>] | ["lostpointercapture", string, import("../componentTypes").DelegateEventListenerCallback<"lostpointercapture", HTMLElement, HTMLElementEventMap>] | ["mousedown", string, import("../componentTypes").DelegateEventListenerCallback<"mousedown", HTMLElement, HTMLElementEventMap>] | ["mouseenter", string, import("../componentTypes").DelegateEventListenerCallback<"mouseenter", HTMLElement, HTMLElementEventMap>] | ["mouseleave", string, import("../componentTypes").DelegateEventListenerCallback<"mouseleave", HTMLElement, HTMLElementEventMap>] | ["mousemove", string, import("../componentTypes").DelegateEventListenerCallback<"mousemove", HTMLElement, HTMLElementEventMap>] | ["mouseout", string, import("../componentTypes").DelegateEventListenerCallback<"mouseout", HTMLElement, HTMLElementEventMap>] | ["mouseover", string, import("../componentTypes").DelegateEventListenerCallback<"mouseover", HTMLElement, HTMLElementEventMap>] | ["mouseup", string, import("../componentTypes").DelegateEventListenerCallback<"mouseup", HTMLElement, HTMLElementEventMap>] | ["pause", string, import("../componentTypes").DelegateEventListenerCallback<"pause", HTMLElement, HTMLElementEventMap>] | ["play", string, import("../componentTypes").DelegateEventListenerCallback<"play", HTMLElement, HTMLElementEventMap>] | ["playing", string, import("../componentTypes").DelegateEventListenerCallback<"playing", HTMLElement, HTMLElementEventMap>] | ["pointercancel", string, import("../componentTypes").DelegateEventListenerCallback<"pointercancel", HTMLElement, HTMLElementEventMap>] | ["pointerdown", string, import("../componentTypes").DelegateEventListenerCallback<"pointerdown", HTMLElement, HTMLElementEventMap>] | ["pointerenter", string, import("../componentTypes").DelegateEventListenerCallback<"pointerenter", HTMLElement, HTMLElementEventMap>] | ["pointerleave", string, import("../componentTypes").DelegateEventListenerCallback<"pointerleave", HTMLElement, HTMLElementEventMap>] | ["pointermove", string, import("../componentTypes").DelegateEventListenerCallback<"pointermove", HTMLElement, HTMLElementEventMap>] | ["pointerout", string, import("../componentTypes").DelegateEventListenerCallback<"pointerout", HTMLElement, HTMLElementEventMap>] | ["pointerover", string, import("../componentTypes").DelegateEventListenerCallback<"pointerover", HTMLElement, HTMLElementEventMap>] | ["pointerup", string, import("../componentTypes").DelegateEventListenerCallback<"pointerup", HTMLElement, HTMLElementEventMap>] | ["ratechange", string, import("../componentTypes").DelegateEventListenerCallback<"ratechange", HTMLElement, HTMLElementEventMap>] | ["reset", string, import("../componentTypes").DelegateEventListenerCallback<"reset", HTMLElement, HTMLElementEventMap>] | ["resize", string, import("../componentTypes").DelegateEventListenerCallback<"resize", HTMLElement, HTMLElementEventMap>] | ["securitypolicyviolation", string, import("../componentTypes").DelegateEventListenerCallback<"securitypolicyviolation", HTMLElement, HTMLElementEventMap>] | ["seeked", string, import("../componentTypes").DelegateEventListenerCallback<"seeked", HTMLElement, HTMLElementEventMap>] | ["seeking", string, import("../componentTypes").DelegateEventListenerCallback<"seeking", HTMLElement, HTMLElementEventMap>] | ["selectionchange", string, import("../componentTypes").DelegateEventListenerCallback<"selectionchange", HTMLElement, HTMLElementEventMap>] | ["selectstart", string, import("../componentTypes").DelegateEventListenerCallback<"selectstart", HTMLElement, HTMLElementEventMap>] | ["stalled", string, import("../componentTypes").DelegateEventListenerCallback<"stalled", HTMLElement, HTMLElementEventMap>] | ["submit", string, import("../componentTypes").DelegateEventListenerCallback<"submit", HTMLElement, HTMLElementEventMap>] | ["suspend", string, import("../componentTypes").DelegateEventListenerCallback<"suspend", HTMLElement, HTMLElementEventMap>] | ["timeupdate", string, import("../componentTypes").DelegateEventListenerCallback<"timeupdate", HTMLElement, HTMLElementEventMap>] | ["toggle", string, import("../componentTypes").DelegateEventListenerCallback<"toggle", HTMLElement, HTMLElementEventMap>] | ["touchcancel", string, import("../componentTypes").DelegateEventListenerCallback<"touchcancel", HTMLElement, HTMLElementEventMap>] | ["touchend", string, import("../componentTypes").DelegateEventListenerCallback<"touchend", HTMLElement, HTMLElementEventMap>] | ["touchmove", string, import("../componentTypes").DelegateEventListenerCallback<"touchmove", HTMLElement, HTMLElementEventMap>] | ["touchstart", string, import("../componentTypes").DelegateEventListenerCallback<"touchstart", HTMLElement, HTMLElementEventMap>] | ["transitioncancel", string, import("../componentTypes").DelegateEventListenerCallback<"transitioncancel", HTMLElement, HTMLElementEventMap>] | ["transitionend", string, import("../componentTypes").DelegateEventListenerCallback<"transitionend", HTMLElement, HTMLElementEventMap>] | ["transitionrun", string, import("../componentTypes").DelegateEventListenerCallback<"transitionrun", HTMLElement, HTMLElementEventMap>] | ["transitionstart", string, import("../componentTypes").DelegateEventListenerCallback<"transitionstart", HTMLElement, HTMLElementEventMap>] | ["volumechange", string, import("../componentTypes").DelegateEventListenerCallback<"volumechange", HTMLElement, HTMLElementEventMap>] | ["wheel", string, import("../componentTypes").DelegateEventListenerCallback<"wheel", HTMLElement, HTMLElementEventMap>] | ["copy", string, import("../componentTypes").DelegateEventListenerCallback<"copy", HTMLElement, HTMLElementEventMap>] | ["cut", string, import("../componentTypes").DelegateEventListenerCallback<"cut", HTMLElement, HTMLElementEventMap>] | ["paste", string, import("../componentTypes").DelegateEventListenerCallback<"paste", HTMLElement, HTMLElementEventMap>] | ["focusin", string, import("../componentTypes").DelegateEventListenerCallback<"focusin", HTMLElement, HTMLElementEventMap>] | ["focusout", string, import("../componentTypes").DelegateEventListenerCallback<"focusout", HTMLElement, HTMLElementEventMap>])[]; | ||
init(): void; | ||
@@ -22,0 +22,0 @@ private handleClick; |
@@ -16,3 +16,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var Component_1 = require("./Component"); | ||
var Component_1 = require("../Component"); | ||
/** | ||
@@ -23,3 +23,3 @@ * Emitter component class | ||
* | ||
* Expects data = { | ||
* Expects props = { | ||
* events: [ 'event', 'names', 'to', 'trigger' ] - array of events or just single string | ||
@@ -37,3 +37,3 @@ * } | ||
Emitter.prototype.init = function () { | ||
this.events = Array.isArray(this.data.events) ? this.data.events : [this.data.events]; | ||
this.events = Array.isArray(this.props.events) ? this.props.events : [this.props.events]; | ||
}; | ||
@@ -40,0 +40,0 @@ Emitter.prototype.handleClick = function (e) { |
@@ -1,9 +0,9 @@ | ||
import { Component } from './Component'; | ||
interface ExampleData { | ||
import { Component } from '../Component'; | ||
interface ExampleProps { | ||
name: string; | ||
numberOfTheDay: number; | ||
} | ||
export declare class Example extends Component<ExampleData> { | ||
export declare class Example extends Component<ExampleProps> { | ||
static componentName: string; | ||
protected getListeners: () => (["focusin", EventListenerCallback<"focusin">] | ["focusout", EventListenerCallback<"focusout">] | ["fullscreenchange", EventListenerCallback<"fullscreenchange">] | ["fullscreenerror", EventListenerCallback<"fullscreenerror">] | ["abort", EventListenerCallback<"abort">] | ["animationcancel", EventListenerCallback<"animationcancel">] | ["animationend", EventListenerCallback<"animationend">] | ["animationiteration", EventListenerCallback<"animationiteration">] | ["animationstart", EventListenerCallback<"animationstart">] | ["auxclick", EventListenerCallback<"auxclick">] | ["blur", EventListenerCallback<"blur">] | ["cancel", EventListenerCallback<"cancel">] | ["canplay", EventListenerCallback<"canplay">] | ["canplaythrough", EventListenerCallback<"canplaythrough">] | ["change", EventListenerCallback<"change">] | ["click", EventListenerCallback<"click">] | ["close", EventListenerCallback<"close">] | ["contextmenu", EventListenerCallback<"contextmenu">] | ["cuechange", EventListenerCallback<"cuechange">] | ["dblclick", EventListenerCallback<"dblclick">] | ["drag", EventListenerCallback<"drag">] | ["dragend", EventListenerCallback<"dragend">] | ["dragenter", EventListenerCallback<"dragenter">] | ["dragexit", EventListenerCallback<"dragexit">] | ["dragleave", EventListenerCallback<"dragleave">] | ["dragover", EventListenerCallback<"dragover">] | ["dragstart", EventListenerCallback<"dragstart">] | ["drop", EventListenerCallback<"drop">] | ["durationchange", EventListenerCallback<"durationchange">] | ["emptied", EventListenerCallback<"emptied">] | ["ended", EventListenerCallback<"ended">] | ["error", EventListenerCallback<"error">] | ["focus", EventListenerCallback<"focus">] | ["gotpointercapture", EventListenerCallback<"gotpointercapture">] | ["input", EventListenerCallback<"input">] | ["invalid", EventListenerCallback<"invalid">] | ["keydown", EventListenerCallback<"keydown">] | ["keypress", EventListenerCallback<"keypress">] | ["keyup", EventListenerCallback<"keyup">] | ["load", EventListenerCallback<"load">] | ["loadeddata", EventListenerCallback<"loadeddata">] | ["loadedmetadata", EventListenerCallback<"loadedmetadata">] | ["loadend", EventListenerCallback<"loadend">] | ["loadstart", EventListenerCallback<"loadstart">] | ["lostpointercapture", EventListenerCallback<"lostpointercapture">] | ["mousedown", EventListenerCallback<"mousedown">] | ["mouseenter", EventListenerCallback<"mouseenter">] | ["mouseleave", EventListenerCallback<"mouseleave">] | ["mousemove", EventListenerCallback<"mousemove">] | ["mouseout", EventListenerCallback<"mouseout">] | ["mouseover", EventListenerCallback<"mouseover">] | ["mouseup", EventListenerCallback<"mouseup">] | ["pause", EventListenerCallback<"pause">] | ["play", EventListenerCallback<"play">] | ["playing", EventListenerCallback<"playing">] | ["pointercancel", EventListenerCallback<"pointercancel">] | ["pointerdown", EventListenerCallback<"pointerdown">] | ["pointerenter", EventListenerCallback<"pointerenter">] | ["pointerleave", EventListenerCallback<"pointerleave">] | ["pointermove", EventListenerCallback<"pointermove">] | ["pointerout", EventListenerCallback<"pointerout">] | ["pointerover", EventListenerCallback<"pointerover">] | ["pointerup", EventListenerCallback<"pointerup">] | ["progress", EventListenerCallback<"progress">] | ["ratechange", EventListenerCallback<"ratechange">] | ["reset", EventListenerCallback<"reset">] | ["resize", EventListenerCallback<"resize">] | ["scroll", EventListenerCallback<"scroll">] | ["securitypolicyviolation", EventListenerCallback<"securitypolicyviolation">] | ["seeked", EventListenerCallback<"seeked">] | ["seeking", EventListenerCallback<"seeking">] | ["select", EventListenerCallback<"select">] | ["selectionchange", EventListenerCallback<"selectionchange">] | ["selectstart", EventListenerCallback<"selectstart">] | ["stalled", EventListenerCallback<"stalled">] | ["submit", EventListenerCallback<"submit">] | ["suspend", EventListenerCallback<"suspend">] | ["timeupdate", EventListenerCallback<"timeupdate">] | ["toggle", EventListenerCallback<"toggle">] | ["touchcancel", EventListenerCallback<"touchcancel">] | ["touchend", EventListenerCallback<"touchend">] | ["touchmove", EventListenerCallback<"touchmove">] | ["touchstart", EventListenerCallback<"touchstart">] | ["transitioncancel", EventListenerCallback<"transitioncancel">] | ["transitionend", EventListenerCallback<"transitionend">] | ["transitionrun", EventListenerCallback<"transitionrun">] | ["transitionstart", EventListenerCallback<"transitionstart">] | ["volumechange", EventListenerCallback<"volumechange">] | ["waiting", EventListenerCallback<"waiting">] | ["wheel", EventListenerCallback<"wheel">] | ["copy", EventListenerCallback<"copy">] | ["cut", EventListenerCallback<"cut">] | ["paste", EventListenerCallback<"paste">] | ["waiting", string, DelegateEventListenerCallback<"waiting">] | ["cancel", string, DelegateEventListenerCallback<"cancel">] | ["ended", string, DelegateEventListenerCallback<"ended">] | ["change", string, DelegateEventListenerCallback<"change">] | ["input", string, DelegateEventListenerCallback<"input">] | ["select", string, DelegateEventListenerCallback<"select">] | ["fullscreenchange", string, DelegateEventListenerCallback<"fullscreenchange">] | ["fullscreenerror", string, DelegateEventListenerCallback<"fullscreenerror">] | ["animationcancel", string, DelegateEventListenerCallback<"animationcancel">] | ["animationend", string, DelegateEventListenerCallback<"animationend">] | ["animationiteration", string, DelegateEventListenerCallback<"animationiteration">] | ["animationstart", string, DelegateEventListenerCallback<"animationstart">] | ["auxclick", string, DelegateEventListenerCallback<"auxclick">] | ["canplay", string, DelegateEventListenerCallback<"canplay">] | ["canplaythrough", string, DelegateEventListenerCallback<"canplaythrough">] | ["click", string, DelegateEventListenerCallback<"click">] | ["close", string, DelegateEventListenerCallback<"close">] | ["contextmenu", string, DelegateEventListenerCallback<"contextmenu">] | ["cuechange", string, DelegateEventListenerCallback<"cuechange">] | ["dblclick", string, DelegateEventListenerCallback<"dblclick">] | ["drag", string, DelegateEventListenerCallback<"drag">] | ["dragend", string, DelegateEventListenerCallback<"dragend">] | ["dragenter", string, DelegateEventListenerCallback<"dragenter">] | ["dragexit", string, DelegateEventListenerCallback<"dragexit">] | ["dragleave", string, DelegateEventListenerCallback<"dragleave">] | ["dragover", string, DelegateEventListenerCallback<"dragover">] | ["dragstart", string, DelegateEventListenerCallback<"dragstart">] | ["drop", string, DelegateEventListenerCallback<"drop">] | ["durationchange", string, DelegateEventListenerCallback<"durationchange">] | ["emptied", string, DelegateEventListenerCallback<"emptied">] | ["gotpointercapture", string, DelegateEventListenerCallback<"gotpointercapture">] | ["invalid", string, DelegateEventListenerCallback<"invalid">] | ["keydown", string, DelegateEventListenerCallback<"keydown">] | ["keypress", string, DelegateEventListenerCallback<"keypress">] | ["keyup", string, DelegateEventListenerCallback<"keyup">] | ["loadeddata", string, DelegateEventListenerCallback<"loadeddata">] | ["loadedmetadata", string, DelegateEventListenerCallback<"loadedmetadata">] | ["lostpointercapture", string, DelegateEventListenerCallback<"lostpointercapture">] | ["mousedown", string, DelegateEventListenerCallback<"mousedown">] | ["mouseenter", string, DelegateEventListenerCallback<"mouseenter">] | ["mouseleave", string, DelegateEventListenerCallback<"mouseleave">] | ["mousemove", string, DelegateEventListenerCallback<"mousemove">] | ["mouseout", string, DelegateEventListenerCallback<"mouseout">] | ["mouseover", string, DelegateEventListenerCallback<"mouseover">] | ["mouseup", string, DelegateEventListenerCallback<"mouseup">] | ["pause", string, DelegateEventListenerCallback<"pause">] | ["play", string, DelegateEventListenerCallback<"play">] | ["playing", string, DelegateEventListenerCallback<"playing">] | ["pointercancel", string, DelegateEventListenerCallback<"pointercancel">] | ["pointerdown", string, DelegateEventListenerCallback<"pointerdown">] | ["pointerenter", string, DelegateEventListenerCallback<"pointerenter">] | ["pointerleave", string, DelegateEventListenerCallback<"pointerleave">] | ["pointermove", string, DelegateEventListenerCallback<"pointermove">] | ["pointerout", string, DelegateEventListenerCallback<"pointerout">] | ["pointerover", string, DelegateEventListenerCallback<"pointerover">] | ["pointerup", string, DelegateEventListenerCallback<"pointerup">] | ["ratechange", string, DelegateEventListenerCallback<"ratechange">] | ["reset", string, DelegateEventListenerCallback<"reset">] | ["resize", string, DelegateEventListenerCallback<"resize">] | ["securitypolicyviolation", string, DelegateEventListenerCallback<"securitypolicyviolation">] | ["seeked", string, DelegateEventListenerCallback<"seeked">] | ["seeking", string, DelegateEventListenerCallback<"seeking">] | ["selectionchange", string, DelegateEventListenerCallback<"selectionchange">] | ["selectstart", string, DelegateEventListenerCallback<"selectstart">] | ["stalled", string, DelegateEventListenerCallback<"stalled">] | ["submit", string, DelegateEventListenerCallback<"submit">] | ["suspend", string, DelegateEventListenerCallback<"suspend">] | ["timeupdate", string, DelegateEventListenerCallback<"timeupdate">] | ["toggle", string, DelegateEventListenerCallback<"toggle">] | ["touchcancel", string, DelegateEventListenerCallback<"touchcancel">] | ["touchend", string, DelegateEventListenerCallback<"touchend">] | ["touchmove", string, DelegateEventListenerCallback<"touchmove">] | ["touchstart", string, DelegateEventListenerCallback<"touchstart">] | ["transitioncancel", string, DelegateEventListenerCallback<"transitioncancel">] | ["transitionend", string, DelegateEventListenerCallback<"transitionend">] | ["transitionrun", string, DelegateEventListenerCallback<"transitionrun">] | ["transitionstart", string, DelegateEventListenerCallback<"transitionstart">] | ["volumechange", string, DelegateEventListenerCallback<"volumechange">] | ["wheel", string, DelegateEventListenerCallback<"wheel">] | ["copy", string, DelegateEventListenerCallback<"copy">] | ["cut", string, DelegateEventListenerCallback<"cut">] | ["paste", string, DelegateEventListenerCallback<"paste">] | ["focusin", string, DelegateEventListenerCallback<"focusin">] | ["focusout", string, DelegateEventListenerCallback<"focusout">])[]; | ||
protected getListeners: () => (["focusin", import("../componentTypes").EventListenerCallback<"focusin", HTMLElementEventMap>] | ["focusout", import("../componentTypes").EventListenerCallback<"focusout", HTMLElementEventMap>] | ["fullscreenchange", import("../componentTypes").EventListenerCallback<"fullscreenchange", HTMLElementEventMap>] | ["fullscreenerror", import("../componentTypes").EventListenerCallback<"fullscreenerror", HTMLElementEventMap>] | ["abort", import("../componentTypes").EventListenerCallback<"abort", HTMLElementEventMap>] | ["animationcancel", import("../componentTypes").EventListenerCallback<"animationcancel", HTMLElementEventMap>] | ["animationend", import("../componentTypes").EventListenerCallback<"animationend", HTMLElementEventMap>] | ["animationiteration", import("../componentTypes").EventListenerCallback<"animationiteration", HTMLElementEventMap>] | ["animationstart", import("../componentTypes").EventListenerCallback<"animationstart", HTMLElementEventMap>] | ["auxclick", import("../componentTypes").EventListenerCallback<"auxclick", HTMLElementEventMap>] | ["blur", import("../componentTypes").EventListenerCallback<"blur", HTMLElementEventMap>] | ["cancel", import("../componentTypes").EventListenerCallback<"cancel", HTMLElementEventMap>] | ["canplay", import("../componentTypes").EventListenerCallback<"canplay", HTMLElementEventMap>] | ["canplaythrough", import("../componentTypes").EventListenerCallback<"canplaythrough", HTMLElementEventMap>] | ["change", import("../componentTypes").EventListenerCallback<"change", HTMLElementEventMap>] | ["click", import("../componentTypes").EventListenerCallback<"click", HTMLElementEventMap>] | ["close", import("../componentTypes").EventListenerCallback<"close", HTMLElementEventMap>] | ["contextmenu", import("../componentTypes").EventListenerCallback<"contextmenu", HTMLElementEventMap>] | ["cuechange", import("../componentTypes").EventListenerCallback<"cuechange", HTMLElementEventMap>] | ["dblclick", import("../componentTypes").EventListenerCallback<"dblclick", HTMLElementEventMap>] | ["drag", import("../componentTypes").EventListenerCallback<"drag", HTMLElementEventMap>] | ["dragend", import("../componentTypes").EventListenerCallback<"dragend", HTMLElementEventMap>] | ["dragenter", import("../componentTypes").EventListenerCallback<"dragenter", HTMLElementEventMap>] | ["dragexit", import("../componentTypes").EventListenerCallback<"dragexit", HTMLElementEventMap>] | ["dragleave", import("../componentTypes").EventListenerCallback<"dragleave", HTMLElementEventMap>] | ["dragover", import("../componentTypes").EventListenerCallback<"dragover", HTMLElementEventMap>] | ["dragstart", import("../componentTypes").EventListenerCallback<"dragstart", HTMLElementEventMap>] | ["drop", import("../componentTypes").EventListenerCallback<"drop", HTMLElementEventMap>] | ["durationchange", import("../componentTypes").EventListenerCallback<"durationchange", HTMLElementEventMap>] | ["emptied", import("../componentTypes").EventListenerCallback<"emptied", HTMLElementEventMap>] | ["ended", import("../componentTypes").EventListenerCallback<"ended", HTMLElementEventMap>] | ["error", import("../componentTypes").EventListenerCallback<"error", HTMLElementEventMap>] | ["focus", import("../componentTypes").EventListenerCallback<"focus", HTMLElementEventMap>] | ["gotpointercapture", import("../componentTypes").EventListenerCallback<"gotpointercapture", HTMLElementEventMap>] | ["input", import("../componentTypes").EventListenerCallback<"input", HTMLElementEventMap>] | ["invalid", import("../componentTypes").EventListenerCallback<"invalid", HTMLElementEventMap>] | ["keydown", import("../componentTypes").EventListenerCallback<"keydown", HTMLElementEventMap>] | ["keypress", import("../componentTypes").EventListenerCallback<"keypress", HTMLElementEventMap>] | ["keyup", import("../componentTypes").EventListenerCallback<"keyup", HTMLElementEventMap>] | ["load", import("../componentTypes").EventListenerCallback<"load", HTMLElementEventMap>] | ["loadeddata", import("../componentTypes").EventListenerCallback<"loadeddata", HTMLElementEventMap>] | ["loadedmetadata", import("../componentTypes").EventListenerCallback<"loadedmetadata", HTMLElementEventMap>] | ["loadend", import("../componentTypes").EventListenerCallback<"loadend", HTMLElementEventMap>] | ["loadstart", import("../componentTypes").EventListenerCallback<"loadstart", HTMLElementEventMap>] | ["lostpointercapture", import("../componentTypes").EventListenerCallback<"lostpointercapture", HTMLElementEventMap>] | ["mousedown", import("../componentTypes").EventListenerCallback<"mousedown", HTMLElementEventMap>] | ["mouseenter", import("../componentTypes").EventListenerCallback<"mouseenter", HTMLElementEventMap>] | ["mouseleave", import("../componentTypes").EventListenerCallback<"mouseleave", HTMLElementEventMap>] | ["mousemove", import("../componentTypes").EventListenerCallback<"mousemove", HTMLElementEventMap>] | ["mouseout", import("../componentTypes").EventListenerCallback<"mouseout", HTMLElementEventMap>] | ["mouseover", import("../componentTypes").EventListenerCallback<"mouseover", HTMLElementEventMap>] | ["mouseup", import("../componentTypes").EventListenerCallback<"mouseup", HTMLElementEventMap>] | ["pause", import("../componentTypes").EventListenerCallback<"pause", HTMLElementEventMap>] | ["play", import("../componentTypes").EventListenerCallback<"play", HTMLElementEventMap>] | ["playing", import("../componentTypes").EventListenerCallback<"playing", HTMLElementEventMap>] | ["pointercancel", import("../componentTypes").EventListenerCallback<"pointercancel", HTMLElementEventMap>] | ["pointerdown", import("../componentTypes").EventListenerCallback<"pointerdown", HTMLElementEventMap>] | ["pointerenter", import("../componentTypes").EventListenerCallback<"pointerenter", HTMLElementEventMap>] | ["pointerleave", import("../componentTypes").EventListenerCallback<"pointerleave", HTMLElementEventMap>] | ["pointermove", import("../componentTypes").EventListenerCallback<"pointermove", HTMLElementEventMap>] | ["pointerout", import("../componentTypes").EventListenerCallback<"pointerout", HTMLElementEventMap>] | ["pointerover", import("../componentTypes").EventListenerCallback<"pointerover", HTMLElementEventMap>] | ["pointerup", import("../componentTypes").EventListenerCallback<"pointerup", HTMLElementEventMap>] | ["progress", import("../componentTypes").EventListenerCallback<"progress", HTMLElementEventMap>] | ["ratechange", import("../componentTypes").EventListenerCallback<"ratechange", HTMLElementEventMap>] | ["reset", import("../componentTypes").EventListenerCallback<"reset", HTMLElementEventMap>] | ["resize", import("../componentTypes").EventListenerCallback<"resize", HTMLElementEventMap>] | ["scroll", import("../componentTypes").EventListenerCallback<"scroll", HTMLElementEventMap>] | ["securitypolicyviolation", import("../componentTypes").EventListenerCallback<"securitypolicyviolation", HTMLElementEventMap>] | ["seeked", import("../componentTypes").EventListenerCallback<"seeked", HTMLElementEventMap>] | ["seeking", import("../componentTypes").EventListenerCallback<"seeking", HTMLElementEventMap>] | ["select", import("../componentTypes").EventListenerCallback<"select", HTMLElementEventMap>] | ["selectionchange", import("../componentTypes").EventListenerCallback<"selectionchange", HTMLElementEventMap>] | ["selectstart", import("../componentTypes").EventListenerCallback<"selectstart", HTMLElementEventMap>] | ["stalled", import("../componentTypes").EventListenerCallback<"stalled", HTMLElementEventMap>] | ["submit", import("../componentTypes").EventListenerCallback<"submit", HTMLElementEventMap>] | ["suspend", import("../componentTypes").EventListenerCallback<"suspend", HTMLElementEventMap>] | ["timeupdate", import("../componentTypes").EventListenerCallback<"timeupdate", HTMLElementEventMap>] | ["toggle", import("../componentTypes").EventListenerCallback<"toggle", HTMLElementEventMap>] | ["touchcancel", import("../componentTypes").EventListenerCallback<"touchcancel", HTMLElementEventMap>] | ["touchend", import("../componentTypes").EventListenerCallback<"touchend", HTMLElementEventMap>] | ["touchmove", import("../componentTypes").EventListenerCallback<"touchmove", HTMLElementEventMap>] | ["touchstart", import("../componentTypes").EventListenerCallback<"touchstart", HTMLElementEventMap>] | ["transitioncancel", import("../componentTypes").EventListenerCallback<"transitioncancel", HTMLElementEventMap>] | ["transitionend", import("../componentTypes").EventListenerCallback<"transitionend", HTMLElementEventMap>] | ["transitionrun", import("../componentTypes").EventListenerCallback<"transitionrun", HTMLElementEventMap>] | ["transitionstart", import("../componentTypes").EventListenerCallback<"transitionstart", HTMLElementEventMap>] | ["volumechange", import("../componentTypes").EventListenerCallback<"volumechange", HTMLElementEventMap>] | ["waiting", import("../componentTypes").EventListenerCallback<"waiting", HTMLElementEventMap>] | ["wheel", import("../componentTypes").EventListenerCallback<"wheel", HTMLElementEventMap>] | ["copy", import("../componentTypes").EventListenerCallback<"copy", HTMLElementEventMap>] | ["cut", import("../componentTypes").EventListenerCallback<"cut", HTMLElementEventMap>] | ["paste", import("../componentTypes").EventListenerCallback<"paste", HTMLElementEventMap>] | ["waiting", string, import("../componentTypes").DelegateEventListenerCallback<"waiting", HTMLElement, HTMLElementEventMap>] | ["cancel", string, import("../componentTypes").DelegateEventListenerCallback<"cancel", HTMLElement, HTMLElementEventMap>] | ["ended", string, import("../componentTypes").DelegateEventListenerCallback<"ended", HTMLElement, HTMLElementEventMap>] | ["change", string, import("../componentTypes").DelegateEventListenerCallback<"change", HTMLElement, HTMLElementEventMap>] | ["input", string, import("../componentTypes").DelegateEventListenerCallback<"input", HTMLElement, HTMLElementEventMap>] | ["select", string, import("../componentTypes").DelegateEventListenerCallback<"select", HTMLElement, HTMLElementEventMap>] | ["fullscreenchange", string, import("../componentTypes").DelegateEventListenerCallback<"fullscreenchange", HTMLElement, HTMLElementEventMap>] | ["fullscreenerror", string, import("../componentTypes").DelegateEventListenerCallback<"fullscreenerror", HTMLElement, HTMLElementEventMap>] | ["animationcancel", string, import("../componentTypes").DelegateEventListenerCallback<"animationcancel", HTMLElement, HTMLElementEventMap>] | ["animationend", string, import("../componentTypes").DelegateEventListenerCallback<"animationend", HTMLElement, HTMLElementEventMap>] | ["animationiteration", string, import("../componentTypes").DelegateEventListenerCallback<"animationiteration", HTMLElement, HTMLElementEventMap>] | ["animationstart", string, import("../componentTypes").DelegateEventListenerCallback<"animationstart", HTMLElement, HTMLElementEventMap>] | ["auxclick", string, import("../componentTypes").DelegateEventListenerCallback<"auxclick", HTMLElement, HTMLElementEventMap>] | ["canplay", string, import("../componentTypes").DelegateEventListenerCallback<"canplay", HTMLElement, HTMLElementEventMap>] | ["canplaythrough", string, import("../componentTypes").DelegateEventListenerCallback<"canplaythrough", HTMLElement, HTMLElementEventMap>] | ["click", string, import("../componentTypes").DelegateEventListenerCallback<"click", HTMLElement, HTMLElementEventMap>] | ["close", string, import("../componentTypes").DelegateEventListenerCallback<"close", HTMLElement, HTMLElementEventMap>] | ["contextmenu", string, import("../componentTypes").DelegateEventListenerCallback<"contextmenu", HTMLElement, HTMLElementEventMap>] | ["cuechange", string, import("../componentTypes").DelegateEventListenerCallback<"cuechange", HTMLElement, HTMLElementEventMap>] | ["dblclick", string, import("../componentTypes").DelegateEventListenerCallback<"dblclick", HTMLElement, HTMLElementEventMap>] | ["drag", string, import("../componentTypes").DelegateEventListenerCallback<"drag", HTMLElement, HTMLElementEventMap>] | ["dragend", string, import("../componentTypes").DelegateEventListenerCallback<"dragend", HTMLElement, HTMLElementEventMap>] | ["dragenter", string, import("../componentTypes").DelegateEventListenerCallback<"dragenter", HTMLElement, HTMLElementEventMap>] | ["dragexit", string, import("../componentTypes").DelegateEventListenerCallback<"dragexit", HTMLElement, HTMLElementEventMap>] | ["dragleave", string, import("../componentTypes").DelegateEventListenerCallback<"dragleave", HTMLElement, HTMLElementEventMap>] | ["dragover", string, import("../componentTypes").DelegateEventListenerCallback<"dragover", HTMLElement, HTMLElementEventMap>] | ["dragstart", string, import("../componentTypes").DelegateEventListenerCallback<"dragstart", HTMLElement, HTMLElementEventMap>] | ["drop", string, import("../componentTypes").DelegateEventListenerCallback<"drop", HTMLElement, HTMLElementEventMap>] | ["durationchange", string, import("../componentTypes").DelegateEventListenerCallback<"durationchange", HTMLElement, HTMLElementEventMap>] | ["emptied", string, import("../componentTypes").DelegateEventListenerCallback<"emptied", HTMLElement, HTMLElementEventMap>] | ["gotpointercapture", string, import("../componentTypes").DelegateEventListenerCallback<"gotpointercapture", HTMLElement, HTMLElementEventMap>] | ["invalid", string, import("../componentTypes").DelegateEventListenerCallback<"invalid", HTMLElement, HTMLElementEventMap>] | ["keydown", string, import("../componentTypes").DelegateEventListenerCallback<"keydown", HTMLElement, HTMLElementEventMap>] | ["keypress", string, import("../componentTypes").DelegateEventListenerCallback<"keypress", HTMLElement, HTMLElementEventMap>] | ["keyup", string, import("../componentTypes").DelegateEventListenerCallback<"keyup", HTMLElement, HTMLElementEventMap>] | ["loadeddata", string, import("../componentTypes").DelegateEventListenerCallback<"loadeddata", HTMLElement, HTMLElementEventMap>] | ["loadedmetadata", string, import("../componentTypes").DelegateEventListenerCallback<"loadedmetadata", HTMLElement, HTMLElementEventMap>] | ["lostpointercapture", string, import("../componentTypes").DelegateEventListenerCallback<"lostpointercapture", HTMLElement, HTMLElementEventMap>] | ["mousedown", string, import("../componentTypes").DelegateEventListenerCallback<"mousedown", HTMLElement, HTMLElementEventMap>] | ["mouseenter", string, import("../componentTypes").DelegateEventListenerCallback<"mouseenter", HTMLElement, HTMLElementEventMap>] | ["mouseleave", string, import("../componentTypes").DelegateEventListenerCallback<"mouseleave", HTMLElement, HTMLElementEventMap>] | ["mousemove", string, import("../componentTypes").DelegateEventListenerCallback<"mousemove", HTMLElement, HTMLElementEventMap>] | ["mouseout", string, import("../componentTypes").DelegateEventListenerCallback<"mouseout", HTMLElement, HTMLElementEventMap>] | ["mouseover", string, import("../componentTypes").DelegateEventListenerCallback<"mouseover", HTMLElement, HTMLElementEventMap>] | ["mouseup", string, import("../componentTypes").DelegateEventListenerCallback<"mouseup", HTMLElement, HTMLElementEventMap>] | ["pause", string, import("../componentTypes").DelegateEventListenerCallback<"pause", HTMLElement, HTMLElementEventMap>] | ["play", string, import("../componentTypes").DelegateEventListenerCallback<"play", HTMLElement, HTMLElementEventMap>] | ["playing", string, import("../componentTypes").DelegateEventListenerCallback<"playing", HTMLElement, HTMLElementEventMap>] | ["pointercancel", string, import("../componentTypes").DelegateEventListenerCallback<"pointercancel", HTMLElement, HTMLElementEventMap>] | ["pointerdown", string, import("../componentTypes").DelegateEventListenerCallback<"pointerdown", HTMLElement, HTMLElementEventMap>] | ["pointerenter", string, import("../componentTypes").DelegateEventListenerCallback<"pointerenter", HTMLElement, HTMLElementEventMap>] | ["pointerleave", string, import("../componentTypes").DelegateEventListenerCallback<"pointerleave", HTMLElement, HTMLElementEventMap>] | ["pointermove", string, import("../componentTypes").DelegateEventListenerCallback<"pointermove", HTMLElement, HTMLElementEventMap>] | ["pointerout", string, import("../componentTypes").DelegateEventListenerCallback<"pointerout", HTMLElement, HTMLElementEventMap>] | ["pointerover", string, import("../componentTypes").DelegateEventListenerCallback<"pointerover", HTMLElement, HTMLElementEventMap>] | ["pointerup", string, import("../componentTypes").DelegateEventListenerCallback<"pointerup", HTMLElement, HTMLElementEventMap>] | ["ratechange", string, import("../componentTypes").DelegateEventListenerCallback<"ratechange", HTMLElement, HTMLElementEventMap>] | ["reset", string, import("../componentTypes").DelegateEventListenerCallback<"reset", HTMLElement, HTMLElementEventMap>] | ["resize", string, import("../componentTypes").DelegateEventListenerCallback<"resize", HTMLElement, HTMLElementEventMap>] | ["securitypolicyviolation", string, import("../componentTypes").DelegateEventListenerCallback<"securitypolicyviolation", HTMLElement, HTMLElementEventMap>] | ["seeked", string, import("../componentTypes").DelegateEventListenerCallback<"seeked", HTMLElement, HTMLElementEventMap>] | ["seeking", string, import("../componentTypes").DelegateEventListenerCallback<"seeking", HTMLElement, HTMLElementEventMap>] | ["selectionchange", string, import("../componentTypes").DelegateEventListenerCallback<"selectionchange", HTMLElement, HTMLElementEventMap>] | ["selectstart", string, import("../componentTypes").DelegateEventListenerCallback<"selectstart", HTMLElement, HTMLElementEventMap>] | ["stalled", string, import("../componentTypes").DelegateEventListenerCallback<"stalled", HTMLElement, HTMLElementEventMap>] | ["submit", string, import("../componentTypes").DelegateEventListenerCallback<"submit", HTMLElement, HTMLElementEventMap>] | ["suspend", string, import("../componentTypes").DelegateEventListenerCallback<"suspend", HTMLElement, HTMLElementEventMap>] | ["timeupdate", string, import("../componentTypes").DelegateEventListenerCallback<"timeupdate", HTMLElement, HTMLElementEventMap>] | ["toggle", string, import("../componentTypes").DelegateEventListenerCallback<"toggle", HTMLElement, HTMLElementEventMap>] | ["touchcancel", string, import("../componentTypes").DelegateEventListenerCallback<"touchcancel", HTMLElement, HTMLElementEventMap>] | ["touchend", string, import("../componentTypes").DelegateEventListenerCallback<"touchend", HTMLElement, HTMLElementEventMap>] | ["touchmove", string, import("../componentTypes").DelegateEventListenerCallback<"touchmove", HTMLElement, HTMLElementEventMap>] | ["touchstart", string, import("../componentTypes").DelegateEventListenerCallback<"touchstart", HTMLElement, HTMLElementEventMap>] | ["transitioncancel", string, import("../componentTypes").DelegateEventListenerCallback<"transitioncancel", HTMLElement, HTMLElementEventMap>] | ["transitionend", string, import("../componentTypes").DelegateEventListenerCallback<"transitionend", HTMLElement, HTMLElementEventMap>] | ["transitionrun", string, import("../componentTypes").DelegateEventListenerCallback<"transitionrun", HTMLElement, HTMLElementEventMap>] | ["transitionstart", string, import("../componentTypes").DelegateEventListenerCallback<"transitionstart", HTMLElement, HTMLElementEventMap>] | ["volumechange", string, import("../componentTypes").DelegateEventListenerCallback<"volumechange", HTMLElement, HTMLElementEventMap>] | ["wheel", string, import("../componentTypes").DelegateEventListenerCallback<"wheel", HTMLElement, HTMLElementEventMap>] | ["copy", string, import("../componentTypes").DelegateEventListenerCallback<"copy", HTMLElement, HTMLElementEventMap>] | ["cut", string, import("../componentTypes").DelegateEventListenerCallback<"cut", HTMLElement, HTMLElementEventMap>] | ["paste", string, import("../componentTypes").DelegateEventListenerCallback<"paste", HTMLElement, HTMLElementEventMap>] | ["focusin", string, import("../componentTypes").DelegateEventListenerCallback<"focusin", HTMLElement, HTMLElementEventMap>] | ["focusout", string, import("../componentTypes").DelegateEventListenerCallback<"focusout", HTMLElement, HTMLElementEventMap>])[]; | ||
init(): void; | ||
@@ -10,0 +10,0 @@ private handleDelegateClick; |
@@ -16,3 +16,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var Component_1 = require("./Component"); | ||
var Component_1 = require("../Component"); | ||
var Example = /** @class */ (function (_super) { | ||
@@ -29,7 +29,7 @@ __extends(Example, _super); | ||
Example.prototype.init = function () { | ||
this.getChild('.example-child', HTMLElement).innerText += " " + this.data.name + "!"; | ||
this.getChild('.example-child', HTMLElement).innerText += " " + this.props.name + "!"; | ||
}; | ||
Example.prototype.handleDelegateClick = function (e) { | ||
console.log(e.delegateTarget); | ||
alert("Hello, " + this.data.name + "! The number of the day is " + this.data.numberOfTheDay.toFixed(0) + "."); | ||
alert("Hello, " + this.props.name + "! The number of the day is " + this.props.numberOfTheDay.toFixed(0) + "."); | ||
}; | ||
@@ -36,0 +36,0 @@ Example.prototype.handleClick = function (e) { |
@@ -1,2 +0,1 @@ | ||
export * from './Component'; | ||
export * from './Emitter'; | ||
@@ -3,0 +2,0 @@ export * from './Example'; |
@@ -6,3 +6,2 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(require("./Component")); | ||
__export(require("./Emitter")); | ||
@@ -9,0 +8,0 @@ __export(require("./Example")); |
@@ -1,3 +0,3 @@ | ||
import { Component } from './Component'; | ||
interface InViewData { | ||
import { Component } from '../Component'; | ||
interface InViewProps { | ||
targets?: string; | ||
@@ -9,3 +9,3 @@ threshold?: number; | ||
} | ||
export declare class InView extends Component<InViewData> { | ||
export declare class InView extends Component<InViewProps> { | ||
static componentName: string; | ||
@@ -17,3 +17,3 @@ private readonly targets; | ||
private readonly CLASSES; | ||
constructor(el: HTMLElement, data: InViewData); | ||
constructor(el: HTMLElement, props: InViewProps); | ||
private observerInit; | ||
@@ -20,0 +20,0 @@ private onScrollInit; |
@@ -16,15 +16,15 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var Component_1 = require("./Component"); | ||
var Component_1 = require("../Component"); | ||
var InView = /** @class */ (function (_super) { | ||
__extends(InView, _super); | ||
function InView(el, data) { | ||
var _this = _super.call(this, el, data) || this; | ||
_this.CLASSES = Object.freeze({ | ||
function InView(el, props) { | ||
var _this = _super.call(this, el, props) || this; | ||
_this.CLASSES = { | ||
topThreshold: 'view-topThreshold', | ||
bottomThreshold: 'view-bottomThreshold', | ||
}); | ||
_this.targets = data.targets ? _this.el.querySelectorAll(data.targets) : [_this.el]; | ||
_this.threshold = _this.getProp('threshold', 0); | ||
_this.detectOnce = _this.getProp('detectOnce', true); | ||
_this.strictTop = _this.getProp('strictTop', false); | ||
}; | ||
_this.targets = props.targets ? _this.el.querySelectorAll(props.targets) : [_this.el]; | ||
_this.threshold = _this.getPropOrElse('threshold', 0); | ||
_this.detectOnce = _this.getPropOrElse('detectOnce', true); | ||
_this.strictTop = _this.getPropOrElse('strictTop', false); | ||
if ('IntersectionObserver' in window) { | ||
@@ -66,6 +66,4 @@ _this.observerInit(); | ||
var targetArea = targetRect.width * targetRect.height; | ||
var intersectionArea = Math.max(0, Math.min(targetRect.left + targetRect.width, window.innerWidth) - | ||
Math.max(targetRect.left, 0)) * // width | ||
Math.max(0, Math.min(targetRect.top + targetRect.height, window.innerHeight) - | ||
Math.max(targetRect.top, 0)); // height | ||
var intersectionArea = Math.max(0, Math.min(targetRect.left + targetRect.width, window.innerWidth) - Math.max(targetRect.left, 0)) * // width | ||
Math.max(0, Math.min(targetRect.top + targetRect.height, window.innerHeight) - Math.max(targetRect.top, 0)); // height | ||
var intersectionRatio = intersectionArea / targetArea; | ||
@@ -81,12 +79,10 @@ _this._updateState(target, intersectionRatio, targetRect.top < window.innerHeight / 2); | ||
var hasBottomClassThreshold = target.classList.contains(this.CLASSES.bottomThreshold); | ||
var strictTop = this.data.hasOwnProperty('detectOnce') && this.data.strictTop ? this.threshold : 0; | ||
var strictTop = this.props.hasOwnProperty('detectOnce') && this.props.strictTop ? this.threshold : 0; | ||
var topThreshold = hasTopClassThreshold ? strictTop : this.threshold; | ||
var isTop = (this.detectOnce && hasTopClassThreshold) || | ||
(intersectionRatio > topThreshold || targetTopAboveViewCenter); | ||
var isBottom = (this.detectOnce && hasBottomClassThreshold) || | ||
(intersectionRatio <= this.threshold && targetTopAboveViewCenter); | ||
var isTop = (this.detectOnce && hasTopClassThreshold) || (intersectionRatio > topThreshold || targetTopAboveViewCenter); | ||
var isBottom = (this.detectOnce && hasBottomClassThreshold) || (intersectionRatio <= this.threshold && targetTopAboveViewCenter); | ||
target.classList.toggle(this.CLASSES.topThreshold, isTop); | ||
target.classList.toggle(this.CLASSES.bottomThreshold, isBottom); | ||
if (this.data.afterUpdate) { | ||
this.data.afterUpdate(isTop, isBottom); | ||
if (this.props.afterUpdate) { | ||
this.props.afterUpdate(isTop, isBottom); | ||
} | ||
@@ -93,0 +89,0 @@ }; |
@@ -1,3 +0,3 @@ | ||
import { Component } from './Component'; | ||
export interface ShapesData { | ||
import { Component } from '../Component'; | ||
export interface ShapesProps { | ||
url: string; | ||
@@ -10,3 +10,3 @@ } | ||
*/ | ||
export declare class Shapes extends Component<ShapesData> { | ||
export declare class Shapes extends Component<ShapesProps> { | ||
static componentName: string; | ||
@@ -13,0 +13,0 @@ init(): void; |
@@ -16,3 +16,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var Component_1 = require("./Component"); | ||
var Component_1 = require("../Component"); | ||
/** | ||
@@ -29,7 +29,8 @@ * Shapes component class | ||
Shapes.prototype.init = function () { | ||
document.implementation.hasFeature('http://www.w3.org/TR/SVG11/feature#BasicStructure', '1.1') && this.injectSprite(); | ||
document.implementation.hasFeature('http://www.w3.org/TR/SVG11/feature#BasicStructure', '1.1') && | ||
this.injectSprite(); | ||
}; | ||
Shapes.prototype.injectSprite = function () { | ||
var _this = this; | ||
fetch(this.data.url) | ||
fetch(this.props.url) | ||
.then(function (response) { | ||
@@ -36,0 +37,0 @@ if (!response.ok) { |
@@ -0,3 +1,5 @@ | ||
/// <reference path="../src/extensions.d.ts" /> | ||
/// <reference path="../src/globals.d.ts" /> | ||
/// <reference path="../src/types.d.ts" /> | ||
export * from './Component'; | ||
export * from './componentTypes'; | ||
export * from './components'; | ||
@@ -4,0 +6,0 @@ export * from './utils'; |
"use strict"; | ||
/// <reference path="extensions.d.ts" /> | ||
/// <reference path="globals.d.ts" /> | ||
/// <reference path="types.d.ts" /> | ||
function __export(m) { | ||
@@ -8,2 +8,3 @@ for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(require("./Component")); | ||
__export(require("./components")); | ||
@@ -10,0 +11,0 @@ __export(require("./utils")); |
@@ -1,3 +0,4 @@ | ||
import { ComponentConstructor } from './components'; | ||
export declare const initializeComponents: (components: ComponentConstructor<any, any>[], initializerName?: "initComponents" | "initAdminComponents" | "initStyleguideComponents") => void; | ||
import { ComponentConstructor } from './Component'; | ||
import { ComponentEl } from './componentTypes'; | ||
export declare const initializeComponents: (components: ComponentConstructor<unknown, ComponentEl, HTMLElementEventMap | SVGElementEventMap | WindowEventMap>[], initializerName?: "initComponents" | "initAdminComponents" | "initStyleguideComponents") => void; | ||
//# sourceMappingURL=initializeComponents.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var components_1 = require("./components"); | ||
var Component_1 = require("./Component"); | ||
exports.initializeComponents = function (components, initializerName) { | ||
@@ -19,13 +19,11 @@ if (initializerName === void 0) { initializerName = 'initComponents'; } | ||
} | ||
var Component_1 = componentsByName[component.name]; // class | ||
var placement = typeof component.place === 'string' | ||
? document.querySelector(component.place) | ||
: component.place || document.body; | ||
var Component = componentsByName[component.name]; // class | ||
var placement = typeof component.place === 'string' ? document.querySelector(component.place) : component.place || document.body; | ||
if (placement) { | ||
try { | ||
var instance = new Component_1(placement, component.data || {}); | ||
var instance = new Component(placement, component.props || {}); | ||
instance.setup(); | ||
} | ||
catch (e) { | ||
if (e instanceof components_1.ComponentInitializationError && DEBUG) { | ||
if (e instanceof Component_1.ComponentInitializationError && DEBUG) { | ||
console.warn("The component '" + component.name + "' failed to initialize. " + e.message); | ||
@@ -32,0 +30,0 @@ } |
export declare const emulateTransitionEnd: (element: Element, callback: (e: Element) => void, duration: number) => void; | ||
//# sourceMappingURL=emulateTransitionEnd.d.ts.map |
@@ -0,0 +0,0 @@ "use strict"; |
export declare const filterNodeList: <E extends HTMLElement>(list: NodeListOf<E> | HTMLCollectionOf<E>, selector: string) => E[]; | ||
//# sourceMappingURL=filterNodeList.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var matchesSelector_1 = require("./matchesSelector"); | ||
exports.filterNodeList = function (list, selector) { | ||
return Array.prototype.filter.call(list, function (item) { return matchesSelector_1.matchesSelector(item, selector); }); | ||
}; | ||
exports.filterNodeList = function (list, selector) { return Array.prototype.filter.call(list, function (item) { return matchesSelector_1.matchesSelector(item, selector); }); }; | ||
//# sourceMappingURL=filterNodeList.js.map |
@@ -0,0 +0,0 @@ export * from './emulateTransitionEnd'; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ declare type ScriptElementConfig = Partial<Omit<HTMLScriptElement, keyof HTMLElement>>; |
@@ -26,2 +26,3 @@ "use strict"; | ||
if (options[keyCast] !== undefined) { | ||
; | ||
script[keyCast] = options[keyCast]; | ||
@@ -28,0 +29,0 @@ } |
export declare const matchesSelector: (element: Element, selector: string) => boolean; | ||
//# sourceMappingURL=matchesSelector.d.ts.map |
@@ -0,0 +0,0 @@ "use strict"; |
{ | ||
"name": "@mangoweb/scripts-base", | ||
"version": "0.0.5", | ||
"version": "0.0.8", | ||
"description": "Simple component model for small to meduim sites. Usable from JS & TS.", | ||
@@ -9,3 +9,5 @@ "main": "lib/index.js", | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
"build": "tsc" | ||
"build": "tsc", | ||
"eslint:lint": "eslint \"src/**/*.{ts,tsx}\" ", | ||
"eslint:fix": "eslint --fix \"src/**/*.{ts,tsx}\" " | ||
}, | ||
@@ -19,2 +21,12 @@ "repository": { | ||
"devDependencies": { | ||
"@mangoweb/eslint-config-ts": "^0.0.0", | ||
"@mangoweb/prettier-config": "^0.0.0", | ||
"@typescript-eslint/eslint-plugin": "^1.9.0", | ||
"@typescript-eslint/parser": "^1.9.0", | ||
"eslint": "^5.16.0", | ||
"eslint-config-prettier": "^5.0.0", | ||
"eslint-plugin-prettier": "^3.1.0", | ||
"eslint-plugin-react": "^7.13.0", | ||
"eslint-plugin-react-hooks": "^1.6.0", | ||
"prettier": "^1.17.0", | ||
"typescript": "^3.5.1" | ||
@@ -25,4 +37,3 @@ }, | ||
"access": "public" | ||
}, | ||
"gitHead": "6c7cdfd5b0ffa9eab4ca7cbd7ec8581382dd558d" | ||
} | ||
} |
@@ -48,5 +48,5 @@ # `@mangoweb/scripts-base` | ||
- Inherit from `Component` | ||
- Define `static displayName: string` | ||
- Define `static componentName: string` | ||
```typescript | ||
import { Component } from '@mangoweb/scripts-base' | ||
import { Component, DelegateEvent, EventListeners } from '@mangoweb/scripts-base' | ||
@@ -58,3 +58,3 @@ interface MyComponentData { | ||
export class MyComponent extends Component<MyComponentData> { | ||
public static displayName = 'MyComponent' | ||
public static componentName = 'MyComponent' | ||
@@ -80,2 +80,13 @@ protected getListeners = (): EventListeners => [ | ||
The `Component` superclass accepts up to three generic parameters, all of which are optional. The first one, the | ||
structure of `data`, defaults to `{}`. The second one is the type of `el`. It defaults to `HTMLElement` but is useful | ||
to change when we want to assert that it is something else (e.g. `Window`, `HTMLBodyElement`, `SVGElement`, etc.). | ||
The last parameter should only be necessary to change in very extreme situations. It is the map from supported event | ||
types to their respective `Event` objects. It should be inferred from the type of `el`, although it may be necessary | ||
to change, should the standard library prove to be incomplete. | ||
The `EventListeners` return type of `getListeners` optionally accepts the same two parameters as the last two of | ||
`Components`. It may be necessary to specify one or both if inference fails. | ||
#### Life-cycle methods | ||
@@ -82,0 +93,0 @@ The following happens to your component during initialization (in that order): |
@@ -1,2 +0,3 @@ | ||
import { Component } from './Component' | ||
import { EventListeners } from '../componentTypes' | ||
import { Component } from '../Component' | ||
@@ -6,3 +7,3 @@ type EventType = string | ||
export interface EmitterData { | ||
export interface EmitterProps { | ||
events: EventType | Events | ||
@@ -15,7 +16,7 @@ } | ||
* | ||
* Expects data = { | ||
* Expects props = { | ||
* events: [ 'event', 'names', 'to', 'trigger' ] - array of events or just single string | ||
* } | ||
*/ | ||
export class Emitter extends Component<EmitterData> { | ||
export class Emitter extends Component<EmitterProps> { | ||
static componentName = 'Emitter' | ||
@@ -28,3 +29,3 @@ | ||
public init() { | ||
this.events = Array.isArray(this.data.events) ? this.data.events : [this.data.events] | ||
this.events = Array.isArray(this.props.events) ? this.props.events : [this.props.events] | ||
} | ||
@@ -35,3 +36,3 @@ | ||
this.events.map((eventType) => { | ||
this.events.map(eventType => { | ||
const event = document.createEvent('Event') | ||
@@ -38,0 +39,0 @@ |
@@ -1,4 +0,5 @@ | ||
import { Component } from './Component' | ||
import { Component } from '../Component' | ||
import { DelegateEvent, EventListeners } from '../componentTypes' | ||
interface ExampleData { | ||
interface ExampleProps { | ||
name: string | ||
@@ -8,3 +9,3 @@ numberOfTheDay: number | ||
export class Example extends Component<ExampleData> { | ||
export class Example extends Component<ExampleProps> { | ||
static componentName = 'Example' | ||
@@ -18,3 +19,3 @@ | ||
public init() { | ||
this.getChild('.example-child', HTMLElement).innerText += ` ${this.data.name}!` | ||
this.getChild('.example-child', HTMLElement).innerText += ` ${this.props.name}!` | ||
} | ||
@@ -24,5 +25,3 @@ | ||
console.log(e.delegateTarget) | ||
alert( | ||
`Hello, ${this.data.name}! The number of the day is ${this.data.numberOfTheDay.toFixed(0)}.` | ||
) | ||
alert(`Hello, ${this.props.name}! The number of the day is ${this.props.numberOfTheDay.toFixed(0)}.`) | ||
} | ||
@@ -29,0 +28,0 @@ |
@@ -1,2 +0,1 @@ | ||
export * from './Component' | ||
export * from './Emitter' | ||
@@ -3,0 +2,0 @@ export * from './Example' |
@@ -1,4 +0,4 @@ | ||
import { Component } from './Component' | ||
import { Component } from '../Component' | ||
interface InViewData { | ||
interface InViewProps { | ||
targets?: string | ||
@@ -11,3 +11,3 @@ threshold?: number | ||
export class InView extends Component<InViewData> { | ||
export class InView extends Component<InViewProps> { | ||
static componentName = 'InView' | ||
@@ -20,14 +20,14 @@ | ||
private readonly CLASSES = Object.freeze({ | ||
private readonly CLASSES = { | ||
topThreshold: 'view-topThreshold', | ||
bottomThreshold: 'view-bottomThreshold', | ||
}) | ||
} as const | ||
public constructor(el: HTMLElement, data: InViewData) { | ||
super(el, data) | ||
public constructor(el: HTMLElement, props: InViewProps) { | ||
super(el, props) | ||
this.targets = data.targets ? this.el.querySelectorAll(data.targets) : [this.el] | ||
this.threshold = this.getProp('threshold', 0) | ||
this.detectOnce = this.getProp('detectOnce', true) | ||
this.strictTop = this.getProp('strictTop', false) | ||
this.targets = props.targets ? this.el.querySelectorAll(props.targets) : [this.el] | ||
this.threshold = this.getPropOrElse('threshold', 0) | ||
this.detectOnce = this.getPropOrElse('detectOnce', true) | ||
this.strictTop = this.getPropOrElse('strictTop', false) | ||
@@ -43,5 +43,5 @@ if ('IntersectionObserver' in window) { | ||
const observer = new IntersectionObserver( | ||
(entries) => { | ||
entries => { | ||
//callback | ||
entries.forEach((entry) => { | ||
entries.forEach(entry => { | ||
if (!entry.rootBounds) { | ||
@@ -52,7 +52,3 @@ return | ||
const intersectionRatio = entry.intersectionRatio | ||
this._updateState( | ||
target, | ||
intersectionRatio, | ||
entry.boundingClientRect.top < entry.rootBounds.height / 2 | ||
) | ||
this._updateState(target, intersectionRatio, entry.boundingClientRect.top < entry.rootBounds.height / 2) | ||
}) | ||
@@ -81,10 +77,5 @@ }, | ||
0, | ||
Math.min(targetRect.left + targetRect.width, window.innerWidth) - | ||
Math.max(targetRect.left, 0) | ||
Math.min(targetRect.left + targetRect.width, window.innerWidth) - Math.max(targetRect.left, 0) | ||
) * // width | ||
Math.max( | ||
0, | ||
Math.min(targetRect.top + targetRect.height, window.innerHeight) - | ||
Math.max(targetRect.top, 0) | ||
) // height | ||
Math.max(0, Math.min(targetRect.top + targetRect.height, window.innerHeight) - Math.max(targetRect.top, 0)) // height | ||
const intersectionRatio = intersectionArea / targetArea | ||
@@ -101,17 +92,14 @@ this._updateState(target, intersectionRatio, targetRect.top < window.innerHeight / 2) | ||
const hasBottomClassThreshold: boolean = target.classList.contains(this.CLASSES.bottomThreshold) | ||
const strictTop = | ||
this.data.hasOwnProperty('detectOnce') && this.data.strictTop ? this.threshold : 0 | ||
const strictTop = this.props.hasOwnProperty('detectOnce') && this.props.strictTop ? this.threshold : 0 | ||
const topThreshold = hasTopClassThreshold ? strictTop : this.threshold | ||
const isTop = | ||
(this.detectOnce && hasTopClassThreshold) || | ||
(intersectionRatio > topThreshold || targetTopAboveViewCenter) | ||
(this.detectOnce && hasTopClassThreshold) || (intersectionRatio > topThreshold || targetTopAboveViewCenter) | ||
const isBottom = | ||
(this.detectOnce && hasBottomClassThreshold) || | ||
(intersectionRatio <= this.threshold && targetTopAboveViewCenter) | ||
(this.detectOnce && hasBottomClassThreshold) || (intersectionRatio <= this.threshold && targetTopAboveViewCenter) | ||
target.classList.toggle(this.CLASSES.topThreshold, isTop) | ||
target.classList.toggle(this.CLASSES.bottomThreshold, isBottom) | ||
if (this.data.afterUpdate) { | ||
this.data.afterUpdate(isTop, isBottom) | ||
if (this.props.afterUpdate) { | ||
this.props.afterUpdate(isTop, isBottom) | ||
} | ||
} | ||
} |
@@ -1,4 +0,4 @@ | ||
import { Component } from './Component' | ||
import { Component } from '../Component' | ||
export interface ShapesData { | ||
export interface ShapesProps { | ||
url: string | ||
@@ -12,14 +12,12 @@ } | ||
*/ | ||
export class Shapes extends Component<ShapesData> { | ||
export class Shapes extends Component<ShapesProps> { | ||
static componentName = 'Shapes' | ||
init() { | ||
document.implementation.hasFeature( | ||
'http://www.w3.org/TR/SVG11/feature#BasicStructure', | ||
'1.1' | ||
) && this.injectSprite() | ||
document.implementation.hasFeature('http://www.w3.org/TR/SVG11/feature#BasicStructure', '1.1') && | ||
this.injectSprite() | ||
} | ||
injectSprite(): void { | ||
fetch(this.data.url) | ||
fetch(this.props.url) | ||
.then((response: Response) => { | ||
@@ -26,0 +24,0 @@ if (!response.ok) { |
@@ -1,9 +0,9 @@ | ||
declare const DEBUG: boolean | ||
interface ComponentDefinition { | ||
name: string | ||
place?: keyof HTMLElementTagNameMap | HTMLElement | ||
data?: any | ||
props?: any | ||
} | ||
declare const DEBUG: boolean | ||
type ComponentInitializer = | ||
@@ -10,0 +10,0 @@ | Array<ComponentDefinition> |
@@ -0,6 +1,9 @@ | ||
/// <reference path="extensions.d.ts" /> | ||
/// <reference path="globals.d.ts" /> | ||
/// <reference path="types.d.ts" /> | ||
export * from './Component' | ||
export * from './componentTypes' | ||
export * from './components' | ||
export * from './utils' | ||
export * from './initializeComponents' |
@@ -1,9 +0,10 @@ | ||
import { Component, ComponentConstructor, ComponentInitializationError, } from './components' | ||
import { ComponentConstructor, ComponentInitializationError } from './Component' | ||
import { ComponentEl } from './componentTypes' | ||
export const initializeComponents = ( | ||
components: Array<ComponentConstructor<any, any>>, | ||
components: Array<ComponentConstructor<unknown, ComponentEl>>, | ||
initializerName: ComponentInitializerName = 'initComponents' | ||
) => { | ||
const componentsByName: { | ||
[name: string]: typeof Component | ||
[name: string]: ComponentConstructor<unknown, ComponentEl> | ||
} = {} | ||
@@ -30,9 +31,7 @@ | ||
const placement = | ||
typeof component.place === 'string' | ||
? document.querySelector(component.place) | ||
: component.place || document.body | ||
typeof component.place === 'string' ? document.querySelector(component.place) : component.place || document.body | ||
if (placement) { | ||
try { | ||
const instance = new Component(placement, component.data || {}) | ||
const instance = new Component(placement, component.props || {}) | ||
@@ -47,5 +46,3 @@ instance.setup() | ||
console.warn( | ||
`Trying to initialize component '${component.name}' but its selector '${ | ||
component.place | ||
}' was not found` | ||
`Trying to initialize component '${component.name}' but its selector '${component.place}' was not found` | ||
) | ||
@@ -56,5 +53,3 @@ } | ||
const componentEndTime = performance.now() | ||
console.log( | ||
`\tComponent: ${component.name}: ${Math.round(componentEndTime - componentStartTime)}ms` | ||
) | ||
console.log(`\tComponent: ${component.name}: ${Math.round(componentEndTime - componentStartTime)}ms`) | ||
} | ||
@@ -61,0 +56,0 @@ } else if (DEBUG) { |
import { matchesSelector } from './matchesSelector' | ||
export const filterNodeList = <E extends HTMLElement>(list: NodeListOf<E> | HTMLCollectionOf<E>, selector: string): Array<E> => | ||
Array.prototype.filter.call(list, (item: E) => matchesSelector(item, selector)) | ||
export const filterNodeList = <E extends HTMLElement>( | ||
list: NodeListOf<E> | HTMLCollectionOf<E>, | ||
selector: string | ||
): Array<E> => Array.prototype.filter.call(list, (item: E) => matchesSelector(item, selector)) |
@@ -32,3 +32,3 @@ const head = document.head | ||
if (options[keyCast] !== undefined) { | ||
(script as any)[keyCast] = options[keyCast] | ||
;(script as any)[keyCast] = options[keyCast] | ||
} | ||
@@ -35,0 +35,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
113962
76
1284
136
11
2