From ee872c633411d2524cafc68d339f016acbfa1fd6 Mon Sep 17 00:00:00 2001 From: mihhail-lapushkin Date: Sun, 14 Sep 2014 00:08:00 +0300 Subject: [PATCH 0001/1358] Added definitions for "cors" and "tea-merge" --- cors/cors-tests.ts | 11 +++++++++++ cors/cors.d.ts | 24 ++++++++++++++++++++++++ tea-merge/tea-merge-tests.ts | 6 ++++++ tea-merge/tea-merge.d.ts | 9 +++++++++ 4 files changed, 50 insertions(+) create mode 100644 cors/cors-tests.ts create mode 100644 cors/cors.d.ts create mode 100644 tea-merge/tea-merge-tests.ts create mode 100644 tea-merge/tea-merge.d.ts diff --git a/cors/cors-tests.ts b/cors/cors-tests.ts new file mode 100644 index 0000000000..a3f5ea10e1 --- /dev/null +++ b/cors/cors-tests.ts @@ -0,0 +1,11 @@ +/// + +import express = require('express'); +import cors = require('cors'); + +var app = express(); +app.use(cors()); +app.use(cors({ + maxAge: 100, + credentials: true +})); diff --git a/cors/cors.d.ts b/cors/cors.d.ts new file mode 100644 index 0000000000..92fdd9634e --- /dev/null +++ b/cors/cors.d.ts @@ -0,0 +1,24 @@ +// Type definitions for cors +// Project: https://github.com/troygoode/node-cors/ +// Definitions by: Mihhail Lapushkin +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "cors" { + import express = require('express'); + + module e { + interface CorsOptions { + origin?: any; + methods?: any; + allowedHeaders?: any; + exposedHeaders?: any; + credentials?: boolean; + maxAge?: number; + } + } + + function e(options?: e.CorsOptions): express.RequestHandler; + export = e; +} \ No newline at end of file diff --git a/tea-merge/tea-merge-tests.ts b/tea-merge/tea-merge-tests.ts new file mode 100644 index 0000000000..9d59bd65e1 --- /dev/null +++ b/tea-merge/tea-merge-tests.ts @@ -0,0 +1,6 @@ +/// + +import merge = require('tea-merge'); + +merge({ a: 1 }, { b: 2 }, { c: 'hello' }); +merge({ a1: true, a2: { b: 'hello' } }, { bca: [], a2: { c: 'world' } }); diff --git a/tea-merge/tea-merge.d.ts b/tea-merge/tea-merge.d.ts new file mode 100644 index 0000000000..2000e9bcd2 --- /dev/null +++ b/tea-merge/tea-merge.d.ts @@ -0,0 +1,9 @@ +// Type definitions for tea-merge +// Project: https://github.com/qualiancy/tea-merge +// Definitions by: Mihhail Lapushkin +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "tea-merge" { + function e(destination: Object, ...sources: Object[]): Object; + export = e; +} \ No newline at end of file From a63e25478678d2cf4e6f646717b06ac30392ace7 Mon Sep 17 00:00:00 2001 From: mihhail-lapushkin Date: Wed, 17 Sep 2014 20:34:25 +0300 Subject: [PATCH 0002/1358] Cordova Contacts plugin fix In find() method the onError callback should be optional. https://cordova.apache.org/docs/en/3.3.0/cordova_contacts_contacts.md.ht ml#contacts.find --- cordova/plugins/Contacts.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cordova/plugins/Contacts.d.ts b/cordova/plugins/Contacts.d.ts index f054c12d09..afc3aa9038 100644 --- a/cordova/plugins/Contacts.d.ts +++ b/cordova/plugins/Contacts.d.ts @@ -32,7 +32,7 @@ interface Contacts { */ find(fields: string[], onSuccess: (contacts: Contact[]) => void, - onError: (error: ContactError) => void, + onError?: (error: ContactError) => void, options?: ContactFindOptions): void; } From a4b7732937f1eebd5902a7d6fc2fd164d8574d67 Mon Sep 17 00:00:00 2001 From: flashandy Date: Sat, 17 Jan 2015 12:10:10 +0100 Subject: [PATCH 0003/1358] Update underscore.d.ts missing declaration for wrapped.pick --- underscore/underscore.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/underscore/underscore.d.ts b/underscore/underscore.d.ts index 8cf92df12b..2b3818c3e6 100644 --- a/underscore/underscore.d.ts +++ b/underscore/underscore.d.ts @@ -3020,6 +3020,7 @@ interface _Chain { * @see _.pick **/ pick(...keys: string[]): _Chain; + pick(keys: string[]): _Chain; pick(fn: (value: any, key: any, object: any) => any): _Chain; /** From 1b718961940d46754115ef6015607fe29a30b521 Mon Sep 17 00:00:00 2001 From: Justin Filip Date: Tue, 3 Mar 2015 16:35:24 -0500 Subject: [PATCH 0004/1358] Updated with new definitions for Foundation 5.2 -- patches from https://github.com/georgemarshall --- foundation/foundation.d.ts | 303 ++++++++++++++++++++++++++++--------- 1 file changed, 235 insertions(+), 68 deletions(-) diff --git a/foundation/foundation.d.ts b/foundation/foundation.d.ts index d74e954e6e..326574ff41 100644 --- a/foundation/foundation.d.ts +++ b/foundation/foundation.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Foundation 3.2 +// Type definitions for Foundation 5.2.1 // Project: http://foundation.zurb.com/ // Definitions by: Boris Yankov // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -6,83 +6,250 @@ /// -interface OrbitOptions { - animation?: string; - animationSpeed?: number; - timer?: boolean; - resetTimerOnClick?: boolean; - advanceSpeed?: number; - pauseOnHover?: boolean; - startClockOnMouseOut?: boolean; - startClockOnMouseOutAfter?: number; - directionalNav?: number; - captions?: number; - captionAnimation?: string; - captionAnimationSpeed?: number; - bullets?: boolean; - bulletThumbs?: boolean; - bulletThumbLocation?: string; - afterSlideChange?: () => void; - fluid?: boolean; +interface AbideOptions { + live_validate?: boolean; + focus_on_invalid?: boolean; + error_labels?: boolean; + timeout?: number; + patterns?: Object; + validators?: { + equalTo?: () => boolean; + }; } -interface RevealOptions { - animation?: string; - animationSpeed?: number; - closeOnBackgroundClick?: boolean; - dismissModalClass?: string; - /** - * The class of the modals background. - */ - bgClass?: string; - open?: () => void; +interface AccordionOptions { + active_class?: string; + multi_expand?: boolean; + toggleable?: boolean; +} + +interface AlertOptions { + callback?: () => void; +} + +interface ClearingOptions { + templates?: { + viewing?: string; + }; +} + +interface DropdownOptions { + active_class?: string; + align?: string; + is_hover?: boolean; opened?: () => void; - close?: () => void; closed?: () => void; - /** - * The modals background object. - */ - bg: JQuery; - /** - * The css property for when the modal is opened and closed. - */ - css: { - open: { - opacity?: number; - visibility?: string; - display: string; - }; - close: { - opacity: number; - visibility: string; - display: string; - }; +} + +interface EqualizerOptions { + use_tallest?: boolean; + before_height_change?: () => void; + after_height_change?: () => void; +} + +interface InterchangeOptions { + load_attr?: string; + named_queries?: Object; + directives?: { + replace?: (el: HTMLElement, path: string, trigger: (...args: any[]) => any) => any; }; } interface JoyrideOptions { - tipLocation?: string; - nubPosition?: string; - scrollSpeed?: number; + expose?: boolean; + modal?: boolean; + tip_location?: string; + nub_position?: string; + scroll_speed?: number; timer?: number; - startTimerOnClick?: boolean; - nextButton?: boolean; - tipAnimation?: string; - pauseAfter?: number[]; - tipAnimationFadeSpeed?: number; - cookieMonster?: boolean; - cookieName?: string; - cookieDomain?: boolean; - tipContainer?: string; - postRideCallback?: () => void; - postStepCallback?: () => void; + start_timer_on_click?: boolean; + start_offset?: number; + next_button?: boolean; + tip_animation?: string; + pause_after?: number[]; + exposed?: HTMLElement[]; + tip_animation_fade_speed?: number; + cookie_monster?: boolean; + cookie_name?: string; + cookie_domain?: boolean; + cookie_expires?: number; + tip_container?: string; + abort_on_close?: boolean; + tip_location_patterns?: { + top?: string[]; + bottom?: string[]; + left?: string[]; + right?: string[]; + }; + post_ride_callback?: () => void; + post_step_callback?: () => void; + pre_step_callback?: () => void; + pre_ride_callback?: () => void; + post_expose_callback?: () => void; + template?: { + link?: string; + timer?: string; + tip?: string; + wrapper?: string; + button?: string; + modal?: string; + expose?: string; + expose_cover?: string; + }; + expose_add_class?: string; +} + +interface MagellanOptions { + active_class?: string; + threshold?: number; + destination_threshold?: number; + throttle_delay?: number; +} + +interface OffCanvasOptions {} + +interface OrbitOptions { + animation?: string; + timer_speed?: number; + pause_on_hover?: boolean; + resume_on_mouseout?: boolean; + next_on_click?: boolean; + animation_speed?: number; + stack_on_small?: boolean; + navigation_arrows?: boolean; + slide_number?: boolean; + slide_number_text?: string; + container_class?: string; + stack_on_small_class?: string; + next_class?: string; + prev_class?: string; + timer_container_class?: string; + timer_paused_class?: string; + timer_progress_class?: string; + slides_container_class?: string; + preloader_class?: string; + slide_selector?: string; + bullets_container_class?: string; + bullets_active_class?: string; + slide_number_class?: string; + caption_class?: string; + active_slide_class?: string; + orbit_transition_class?: string; + bullets?: boolean; + circular?: boolean; + timer?: boolean; + variable_height?: boolean; + swipe?: boolean; + before_slide_change?: () => void; + after_slide_change?: () => void; +} + +interface RevealOptions { + animation?: string; + animation_speed?: number; + close_on_background_click?: boolean; + close_on_esc?: boolean; + dismiss_modal_class?: string; + bg_class?: string; + open?: () => void; + opened?: () => void; + close?: () => void; + closed?: () => void; + bg?: JQuery; + css?: { + open?: Object; + close?: Object; + }; +} + +interface SliderOptions { + start?: number; + end?: number; + step?: number; + initial?: number; + display_selector?: string; + on_change?: () => void; +} + +interface TabOptions { + active_class?: string; + callback?: () => void; + deep_linking?: boolean; + scroll_to_content?: boolean; +} + +interface TooltipOptions { + additional_inheritable_classes?: string[]; + tooltip_class?: string; + append_to?: string; + touch_close_text?: string; + disable_for_touch?: boolean; + hover_delay?: number; + tip_template?: (selector: string, content: string) => string; +} + +interface TopbarOptions{ + index?: number; + sticky_class?: string; + custom_back_text?: boolean; + back_text?: string; + is_hover?: boolean; + mobile_show_parent_link?: boolean; + scrolltop?: boolean; + sticky_on?: string; +} + +interface FoundationOptions { + abide?: AbideOptions; + accordion?: AccordionOptions; + alert?: AlertOptions; + clearing?: ClearingOptions; + dropdown?: DropdownOptions; + interchange?: InterchangeOptions; + joyride?: JoyrideOptions; + magellan?: MagellanOptions; + offcanvas: OffCanvasOptions; + orbit?: OrbitOptions; + reveal?: RevealOptions; + tab?: TabOptions; + tooltip?: TooltipOptions; + topbar?: TopbarOptions; +} + +interface FoundationStatic { + name: string; + version: string; + media_queries: Object; + stylesheet: CSSStyleSheet; + global: { + namespace: string; + }; + init(scope: JQuery): JQuery; + init(scope: JQuery, libraries: FoundationOptions): JQuery; + init(scope: JQuery, libraries: string, method: FoundationOptions): JQuery; + init(scope: JQuery, libraries: string, method: string, options: Object): JQuery; + init_lib(lib: any, args: any): (...args: any[]) => any; + patch(lib: any): void; + inherit(scope: JQuery, methods: string): void; + set_namespace(): void; + libs: Object; + utils: { + S(selector: any, context: any): JQuery; + throttle(func: (...args: any[]) => any, delay: number): (...args: any[]) => any; + debounce(func: (...args: any[]) => any, delay: number, immediate: boolean): (...args: any[]) => any; + data_options(el: JQuery): Object; + register_media(media: string, media_class: string): void; + add_custom_rule(rule: string, media: string): void; + image_loaded(images: JQuery, callback: (...args: any[]) => any): void; + random_str(length?: number): string; + }; } interface JQuery { - orbit(): JQuery; - orbit(OrbitOptions): JQuery; - reveal(): JQuery; - reveal(RevealOptions): JQuery; - joyride(): JQuery; - joyride(JoyrideOptions): JQuery; + foundation(): JQuery; + foundation(libraries: FoundationOptions): JQuery; + foundation(libraries: string, method: FoundationOptions): JQuery; + foundation(libraries: string, method: string, options: Object): JQuery; } + +declare var Foundation: FoundationStatic; From 1bcc72555ee6fa70353326ca3baf2d3b4b7be796 Mon Sep 17 00:00:00 2001 From: Justin Filip Date: Wed, 4 Mar 2015 09:23:34 -0500 Subject: [PATCH 0005/1358] Updated definitions for Foundation 5.5.1. --- CONTRIBUTORS.md | 2 +- foundation/foundation-tests.ts | 379 ++++++++++++++++++++-- foundation/foundation.d.ts | 570 ++++++++++++++++++--------------- 3 files changed, 662 insertions(+), 289 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 88905c88a5..da416132c8 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -220,7 +220,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](ion.rangeSlider/ion.rangeSlider.d.ts) [for Ion.RangeSlider](https://github.com/IonDen/ion.rangeSlider) by [Sixin Li](https://github.com/sixinli) * [:link:](form-data/form-data.d.ts) [form-data](https://github.com/felixge/node-form-data) by [Carlos Ballesteros Velasco](https://github.com/soywiz) * [:link:](formidable/formidable.d.ts) [Formidable](https://github.com/felixge/node-formidable) by [Wim Looman](https://github.com/Nemo157) -* [:link:](foundation/foundation.d.ts) [Foundation](http://foundation.zurb.com) by [Boris Yankov](https://github.com/borisyankov) +* [:link:](foundation/foundation.d.ts) [Foundation](http://foundation.zurb.com) by [Boris Yankov](https://github.com/borisyankov), [George Marshall](https://github.com/georgemarshall), [Boltmade](https://github.com/Boltmade) * [:link:](fpsmeter/FPSMeter.d.ts) [FPSmeter](http://darsa.in/fpsmeter) by [Aaron Lampros](http://github.com/alampros) * [:link:](from/from.d.ts) [from](https://github.com/dominictarr/from) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](fs-extra/fs-extra.d.ts) [fs-extra](https://github.com/jprichardson/node-fs-extra) by [midknight41](https://github.com/midknight41) diff --git a/foundation/foundation-tests.ts b/foundation/foundation-tests.ts index f64c83483a..c95b54a5bb 100644 --- a/foundation/foundation-tests.ts +++ b/foundation/foundation-tests.ts @@ -1,33 +1,346 @@ -/// -/// - -function test_orbit() { - $("#featured").orbit(); - $('#featured').orbit({ - animation: 'fade', - animationSpeed: 800, - timer: true, - resetTimerOnClick: false, - advanceSpeed: 4000, - pauseOnHover: false, - startClockOnMouseOut: false, - startClockOnMouseOutAfter: 1000, - directionalNav: true, - captions: true, - captionAnimation: 'fade', - captionAnimationSpeed: 800, - bullets: false, - bulletThumbs: false, - bulletThumbLocation: '', - afterSlideChange: function () { }, - fluid: true - }); -} - -function test_fluid() { - $("#myModal").reveal(); -} - -function test_joyride() { - $("#chooseID").joyride(); -} \ No newline at end of file +/// +/// + +function empty_callback() : void {} + +function plugin_list() { + return [ + "abide", + "accordion", + "alert", + "clearing", + "dropdown", + "interchange", + "joyride", + "magellan", + "offcanvas", + "orbit", + "reveal", + "slider", + "tab", + "tooltip", + "topbar" + ]; +} + +function abide_patterns() { + var patterns : AbidePatterns; + patterns.alpha = /^[a-zA-Z]+$/; + patterns.alpha_numeric = /^[a-zA-Z0-9]+$/; + patterns.integer = /^[-+]?\d+$/; + patterns.number = /^[-+]?[1-9]\d*$/; + patterns.card = /^[0-9]{8}$/; + patterns.cvv = /^([0-9]){3,4}$/; + patterns.email = /^test@example\.org$/; + patterns.url = /http:\/\/www\.google\.com\//; + patterns.domain = /definitelytyped\.org/; + patterns.datetime = /([0-2][0-9]{3})\-([0-1][0-9])\-([0-3][0-9])T([0-5][0-9])\:([0-5][0-9])\:([0-5][0-9])(Z|([\-\+]([0-1][0-9])\:00))/; + patterns.date = /(?:19|20)[0-9]{2}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-9])|(?:(?!02)(?:0[1-9]|1[0-2])-(?:30))|(?:(?:0[13578]|1[02])-31))/; + patterns.time = /(0[0-9]|1[0-9]|2[0-3])(:[0-5][0-9]){2}/; + patterns.dateISO = /\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}/; + patterns.month_day_year = /(0[1-9]|1[012])[- \/.](0[1-9]|[12][0-9]|3[01])[- \/.](19|20)\d\d/; + patterns.color = /^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/; + return patterns; +} + +function abide_options() { + var opts : AbideOptions = {}; + opts.live_validate = false; + opts.validate_on_blur = true; + opts.focus_on_invalid = true; + opts.error_labels = true; + opts.timeout = 500; + opts.patterns = abide_patterns(); + opts.validators = { + diceRoll: function(el : HTMLInputElement, required : boolean, parent : HTMLElement) { + var possibilities = [true, false]; + return possibilities[Math.round(Math.random())]; + }, + isAllowed: function(el : HTMLInputElement, required : boolean, parent : HTMLElement) { + var possibilities = ["a@zurb.com", "b.zurb.com"]; + return possibilities.indexOf(el.value) > -1; + } + } + return opts; +} + +function accordion_options() { + var opts : AccordionOptions = {}; + opts.content_class = "content"; + opts.active_class = "class-name"; + opts.multi_expand = false; + opts.toggleable = true; + opts.callback = empty_callback; + return opts; +} + +function alert_options() { + var opts : AlertOptions = {}; + opts.callback = empty_callback; + return opts; +} + +function clearing_options() { + var opts : ClearingOptions = {}; + opts.templates = { + viewing : '
Some HTML
' + }; + opts.close_selectors = "#id-value, .class-name"; + opts.open_selectors = "li#id-value"; + opts.skip_selector = ".skip-class"; + opts.touch_label = "Display string"; + opts.init = true; + opts.locked = false; + return opts; +} + +function dropdown_options() { + var opts : DropdownOptions = {}; + opts.active_class = "class-name"; + opts.disabled_class = "disabled-class"; + opts.mega_class = "big"; + opts.align = "top"; + opts.is_hover = false; + opts.hover_timeout = 250; + opts.opened = empty_callback; + opts.closed = empty_callback; + return opts; +} + +function equalizer_options() { + var opts : EqualizerOptions = {}; + opts.use_tallest = true; + opts.equalize_on_stack = false; + return opts; +} + +function interchange_options() { + var opts : InterchangeOptions = {}; + opts.load_attr = "interchange"; + opts.named_queries = { + my_custom_query: "only screen and (max-width: 200px)" + }; + opts.directives = { + replace: empty_callback + }; + return opts; +} + +function joyride_options() { + var opts : JoyrideOptions = {}; + opts.expose = false; + opts.modal = true; + opts.keyboard = true; + opts.tip_location = "bottom"; + opts.nub_position = "left"; + opts.scroll_speed = 2500; + opts.scroll_animation = "lineaer"; + opts.timer = 100; + opts.start_timer_on_click = true; + opts.start_offset = 3; + opts.next_button = false; + opts.prev_button = false; + opts.tip_animation = "pulse"; + opts.pause_after = [4, 7, 10, 14]; + opts.exposed = ["#elm-id-one", "#elm-id-two"]; + opts.tip_animation_fade_speed = 100; + opts.cookie_monster = true; + opts.cookie_name = "ts_joyride"; + opts.cookie_domain = false; + opts.cookie_expires = 7; + opts.tip_container = '#header'; + opts.tip_location_patterns = { + top: ['botom'], + bottom: [], + left: ['right', 'top', 'bottom'], + right: ['left', 'top', 'bottom'] + }; + opts.post_ride_callback = empty_callback; + opts.post_step_callback = empty_callback; + opts.pre_step_callback = empty_callback; + opts.pre_ride_callback = empty_callback; + opts.post_expose_callback = empty_callback; + opts.template = { + link: '×', + timer: '
', + tip: '
', + wrapper: '
', + button: '', + prev_button: '', + modal: '
', + expose: '
', + expose_cover: '
' + }; + opts.expose_add_class = ".expose .class-name"; + return opts; +} + +function magellan_options() { + var opts : MagellanOptions = {}; + opts.active_class = ".active-element"; + opts.threshold = 20; + opts.destination_threshold = 30; + opts.throttle_delay = 24; + opts.fixed_top = 0; + opts.offset_by_height = false; + opts.duration = 1000; + opts.easing = "linear"; + return opts; +} + +function offcanvas_options() { + var opts : OffCanvasOptions = {}; + opts.open_method = "overlap_single"; + opts.close_on_click = true; + return opts; +} + +function orbit_options() { + var opts : OrbitOptions = {}; + opts.animation = 'slide'; + opts.timer_speed = 10000; + opts.pause_on_hover = true; + opts.resume_on_mouseout = false; + opts.next_on_click = true; + opts.animation_speed = 500; + opts.stack_on_small = false; + opts.navigation_arrows = true; + opts.slide_number = true; + opts.slide_number_text = 'of'; + opts.container_class = 'orbit-container'; + opts.stack_on_small_class = 'orbit-stack-on-small'; + opts.next_class = 'orbit-next'; + opts.prev_class = 'orbit-prev'; + opts.timer_container_class = 'orbit-timer'; + opts.timer_paused_class = 'paused'; + opts.timer_progress_class = 'orbit-progress'; + opts.slides_container_class = 'orbit-slides-container'; + opts.preloader_class = 'preloader'; + opts.slide_selector = 'li'; + opts.bullets_container_class = 'orbit-bullets'; + opts.bullets_active_class = 'active'; + opts.slide_number_class = 'orbit-slide-number'; + opts.caption_class = 'orbit-caption'; + opts.active_slide_class = 'active'; + opts.orbit_transition_class = 'orbit-transitioning'; + opts.bullets = true; + opts.circular = true; + opts.timer = true; + opts.variable_height = false; + opts.swipe = true; + opts.before_slide_change = empty_callback; + opts.after_slide_change = empty_callback; + return opts; +} + +function reveal_css_options() { + var opts : RevealCSSOptions = {}; + opts.opacity = 0; + opts.visibility = 'hidden'; + opts.display = "inline-block"; + return opts; +} + +function reveal_options() { + var opts : RevealOptions = {}; + opts.animation = "linear"; + opts.animation_speed = 500; + opts.close_on_background_click = false; + opts.dismiss_modal_class = ".modal-bye-bye"; + opts.multiple_opened = true; + opts.bg_class = ".modal-background"; + opts.root_element = "#element-id.element-class"; + opts.on_ajax_error = empty_callback; + opts.open = empty_callback; + opts.opened = empty_callback; + opts.close = empty_callback; + opts.close = empty_callback; + opts.bg = $("#my-modal-id .background"); + opts.css = { + open: reveal_css_options(), + close: reveal_css_options() + }; + return opts; +} + +function slider_options() { + var opts : SliderOptions; + opts.start = -1000; + opts.end = 1000; + opts.step = 50; + opts.precision = 4; + opts.initial = 0; + opts.vertical = false; + opts.trigger_input_change = true; + opts.on_change = empty_callback; + return opts; +} + +function tab_options() { + var opts : TabOptions = {}; + opts.active_class = "class-name"; + opts.callback = empty_callback; + opts.deep_linking = false; + opts.scroll_to_content = true; + opts.is_hover = false; + return opts; +} + +function tooltip_options() { + var opts : TooltipOptions = {}; + opts.additional_inheritable_classes = ["class1", "class2"]; + opts.tooltip_class = "tooltip"; + opts.append_to = "append-class"; + opts.touch_close_text = "Close"; + opts.disable_for_touch = true; + opts.hover_delay = 100; + opts.show_on = "all"; + opts.tip_template = function (selector, content) { + return '' + content + ''; + }; + return opts; +} + +function topbar_options() { + var opts : TopbarOptions = {}; + opts.index = 1; + opts.sticky_class = "top-bar"; + opts.custom_back_text = true; + opts.back_text = "Return"; + opts.is_hover = false; + opts.mobile_show_parent_link = true; + opts.scrolltop = true; + opts.sticky_on = "all"; + return opts; +} + +function foundation_options() : FoundationOptions { + var opts : FoundationOptions = {}; + opts.abide = abide_options(); + opts.accordion = accordion_options(); + opts.alert = alert_options(); + opts.clearing = clearing_options(); + opts.dropdown = dropdown_options(); + opts.equalizer = equalizer_options(); + opts.joyride = joyride_options(); + opts.magellan = magellan_options(); + opts.offcanvas = offcanvas_options(); + opts.orbit = orbit_options(); + opts.reveal = reveal_options(); + opts.slider = slider_options(); + opts.tab = tab_options(); + opts.tooltip = tooltip_options(); + opts.topbar = topbar_options(); + return opts; +} + +$(document).foundation(); + +$(document).foundation(foundation_options()); + +$(document).foundation("reflow"); +plugin_list().forEach((plugin) => $(document).foundation(plugin, "reflow")); + +$(document).foundation("slider", "set_value", 100); diff --git a/foundation/foundation.d.ts b/foundation/foundation.d.ts index 326574ff41..a531a051e1 100644 --- a/foundation/foundation.d.ts +++ b/foundation/foundation.d.ts @@ -1,255 +1,315 @@ -// Type definitions for Foundation 5.2.1 -// Project: http://foundation.zurb.com/ -// Definitions by: Boris Yankov -// Definitions: https://github.com/borisyankov/DefinitelyTyped - - -/// - -interface AbideOptions { - live_validate?: boolean; - focus_on_invalid?: boolean; - error_labels?: boolean; - timeout?: number; - patterns?: Object; - validators?: { - equalTo?: () => boolean; - }; -} - -interface AccordionOptions { - active_class?: string; - multi_expand?: boolean; - toggleable?: boolean; -} - -interface AlertOptions { - callback?: () => void; -} - -interface ClearingOptions { - templates?: { - viewing?: string; - }; -} - -interface DropdownOptions { - active_class?: string; - align?: string; - is_hover?: boolean; - opened?: () => void; - closed?: () => void; -} - -interface EqualizerOptions { - use_tallest?: boolean; - before_height_change?: () => void; - after_height_change?: () => void; -} - -interface InterchangeOptions { - load_attr?: string; - named_queries?: Object; - directives?: { - replace?: (el: HTMLElement, path: string, trigger: (...args: any[]) => any) => any; - }; -} - -interface JoyrideOptions { - expose?: boolean; - modal?: boolean; - tip_location?: string; - nub_position?: string; - scroll_speed?: number; - timer?: number; - start_timer_on_click?: boolean; - start_offset?: number; - next_button?: boolean; - tip_animation?: string; - pause_after?: number[]; - exposed?: HTMLElement[]; - tip_animation_fade_speed?: number; - cookie_monster?: boolean; - cookie_name?: string; - cookie_domain?: boolean; - cookie_expires?: number; - tip_container?: string; - abort_on_close?: boolean; - tip_location_patterns?: { - top?: string[]; - bottom?: string[]; - left?: string[]; - right?: string[]; - }; - post_ride_callback?: () => void; - post_step_callback?: () => void; - pre_step_callback?: () => void; - pre_ride_callback?: () => void; - post_expose_callback?: () => void; - template?: { - link?: string; - timer?: string; - tip?: string; - wrapper?: string; - button?: string; - modal?: string; - expose?: string; - expose_cover?: string; - }; - expose_add_class?: string; -} - -interface MagellanOptions { - active_class?: string; - threshold?: number; - destination_threshold?: number; - throttle_delay?: number; -} - -interface OffCanvasOptions {} - -interface OrbitOptions { - animation?: string; - timer_speed?: number; - pause_on_hover?: boolean; - resume_on_mouseout?: boolean; - next_on_click?: boolean; - animation_speed?: number; - stack_on_small?: boolean; - navigation_arrows?: boolean; - slide_number?: boolean; - slide_number_text?: string; - container_class?: string; - stack_on_small_class?: string; - next_class?: string; - prev_class?: string; - timer_container_class?: string; - timer_paused_class?: string; - timer_progress_class?: string; - slides_container_class?: string; - preloader_class?: string; - slide_selector?: string; - bullets_container_class?: string; - bullets_active_class?: string; - slide_number_class?: string; - caption_class?: string; - active_slide_class?: string; - orbit_transition_class?: string; - bullets?: boolean; - circular?: boolean; - timer?: boolean; - variable_height?: boolean; - swipe?: boolean; - before_slide_change?: () => void; - after_slide_change?: () => void; -} - -interface RevealOptions { - animation?: string; - animation_speed?: number; - close_on_background_click?: boolean; - close_on_esc?: boolean; - dismiss_modal_class?: string; - bg_class?: string; - open?: () => void; - opened?: () => void; - close?: () => void; - closed?: () => void; - bg?: JQuery; - css?: { - open?: Object; - close?: Object; - }; -} - -interface SliderOptions { - start?: number; - end?: number; - step?: number; - initial?: number; - display_selector?: string; - on_change?: () => void; -} - -interface TabOptions { - active_class?: string; - callback?: () => void; - deep_linking?: boolean; - scroll_to_content?: boolean; -} - -interface TooltipOptions { - additional_inheritable_classes?: string[]; - tooltip_class?: string; - append_to?: string; - touch_close_text?: string; - disable_for_touch?: boolean; - hover_delay?: number; - tip_template?: (selector: string, content: string) => string; -} - -interface TopbarOptions{ - index?: number; - sticky_class?: string; - custom_back_text?: boolean; - back_text?: string; - is_hover?: boolean; - mobile_show_parent_link?: boolean; - scrolltop?: boolean; - sticky_on?: string; -} - -interface FoundationOptions { - abide?: AbideOptions; - accordion?: AccordionOptions; - alert?: AlertOptions; - clearing?: ClearingOptions; - dropdown?: DropdownOptions; - interchange?: InterchangeOptions; - joyride?: JoyrideOptions; - magellan?: MagellanOptions; - offcanvas: OffCanvasOptions; - orbit?: OrbitOptions; - reveal?: RevealOptions; - tab?: TabOptions; - tooltip?: TooltipOptions; - topbar?: TopbarOptions; -} - -interface FoundationStatic { - name: string; - version: string; - media_queries: Object; - stylesheet: CSSStyleSheet; - global: { - namespace: string; - }; - init(scope: JQuery): JQuery; - init(scope: JQuery, libraries: FoundationOptions): JQuery; - init(scope: JQuery, libraries: string, method: FoundationOptions): JQuery; - init(scope: JQuery, libraries: string, method: string, options: Object): JQuery; - init_lib(lib: any, args: any): (...args: any[]) => any; - patch(lib: any): void; - inherit(scope: JQuery, methods: string): void; - set_namespace(): void; - libs: Object; - utils: { - S(selector: any, context: any): JQuery; - throttle(func: (...args: any[]) => any, delay: number): (...args: any[]) => any; - debounce(func: (...args: any[]) => any, delay: number, immediate: boolean): (...args: any[]) => any; - data_options(el: JQuery): Object; - register_media(media: string, media_class: string): void; - add_custom_rule(rule: string, media: string): void; - image_loaded(images: JQuery, callback: (...args: any[]) => any): void; - random_str(length?: number): string; - }; -} - -interface JQuery { - foundation(): JQuery; - foundation(libraries: FoundationOptions): JQuery; - foundation(libraries: string, method: FoundationOptions): JQuery; - foundation(libraries: string, method: string, options: Object): JQuery; -} - -declare var Foundation: FoundationStatic; +// Type definitions for Foundation 5.5.1 +// Project : http://foundation.zurb.com/ +// Definitions by : Boris Yankov +// Definitions : https://github.com/borisyankov/DefinitelyTyped + + +/// + +// http://foundation.zurb.com/docs/components/abide.html#optional-javascript-configuration +interface AbidePatterns { + alpha? : RegExp; + alpha_numeric? : RegExp; + integer? : RegExp; + number? : RegExp; + card? : RegExp; + cvv? : RegExp; + email? : RegExp; + url? : RegExp; + domain? : RegExp; + datetime? : RegExp; + date? : RegExp; + time? : RegExp; + dateISO? : RegExp; + month_day_year? : RegExp; + color? : RegExp; +} + +interface AbideOptions { + live_validate? : boolean; + validate_on_blur? : boolean; + focus_on_invalid? : boolean; + error_labels? : boolean; + timeout? : number; + patterns? : AbidePatterns; + validators? : Object; +} + +// http://foundation.zurb.com/docs/components/accordion.html#optional-javascript-configuration +interface AccordionOptions { + content_class? : string; + active_class? : string; + multi_expand? : boolean; + toggleable? : boolean; + callback? : () => any; +} + +// http://foundation.zurb.com/docs/components/alert_boxes.html +interface AlertOptions { + callback? : () => any; +} + +// http://foundation.zurb.com/docs/components/clearing.html#optional-javascript-configuration +interface ClearingOptions { + templates? : Object; + close_selectors? : string; + open_selectors? : string; + skip_selector? : string; + touch_label? : string; + init? : boolean; + locked? : boolean; +} + +// http://foundation.zurb.com/docs/components/dropdown.html#optional-javascript-configuration +interface DropdownOptions { + active_class? : string; + disabled_class? : string; + mega_class? : string; + align? : string; + is_hover? : boolean; + hover_timeout? : number; + opened? : () => any; + closed? : () => any; +} + +// http://foundation.zurb.com/docs/components/equalizer.html#optional-javascript-configuration +interface EqualizerOptions { + use_tallest? : boolean; + equalize_on_stack? : boolean; +} + +// http://foundation.zurb.com/docs/components/interchange.html#custom-named-queries +interface InterchangeOptions { + load_attr? : string; + named_queries? : Object; + directives? : Object; +} + +// http://foundation.zurb.com/docs/components/joyride.html#optional-javascript-configuration +interface JoyrideOptions { + expose? : boolean; + modal? : boolean; + keyboard? : boolean; + tip_location? : string; + nub_position? : string; + scroll_speed? : number; + scroll_animation? : string; + timer? : number; + start_timer_on_click? : boolean; + start_offset? : number; + next_button? : boolean; + prev_button? : boolean; + tip_animation? : string; + pause_after? : number[]; + exposed? : string[]; + tip_animation_fade_speed? : number; + cookie_monster? : boolean; + cookie_name? : string; + cookie_domain? : boolean; + cookie_expires? : number; + tip_container? : string; + tip_location_patterns? : { + top? : string[]; + bottom? : string[]; + left? : string[]; + right? : string[]; + }; + post_ride_callback? : () => void; + post_step_callback? : () => void; + pre_step_callback? : () => void; + pre_ride_callback? : () => void; + post_expose_callback? : () => void; + template? : { + link? : string; + timer? : string; + tip? : string; + wrapper? : string; + button? : string; + modal? : string; + expose? : string; + expose_cover? : string; + }; + expose_add_class? : string; +} + +// http://foundation.zurb.com/docs/components/magellan.html#js +interface MagellanOptions { + active_class? : string; + threshold? : number; + destination_threshold? : number; + throttle_delay? : number; + fixed_top? : number; + offset_by_height? : boolean; + duration? : number; + easing? : string; +} + +// http://foundation.zurb.com/docs/components/offcanvas.html#optional-javascript-configuration +interface OffCanvasOptions { + open_method? : string; + close_on_click? : boolean; +} + +// http://foundation.zurb.com/docs/components/orbit.html#advanced +interface OrbitOptions { + animation? : string; + timer_speed? : number; + pause_on_hover? : boolean; + resume_on_mouseout? : boolean; + next_on_click? : boolean; + animation_speed? : number; + stack_on_small? : boolean; + navigation_arrows? : boolean; + slide_number? : boolean; + slide_number_text? : string; + container_class? : string; + stack_on_small_class? : string; + next_class? : string; + prev_class? : string; + timer_container_class? : string; + timer_paused_class? : string; + timer_progress_class? : string; + slides_container_class? : string; + preloader_class? : string; + slide_selector? : string; + bullets_container_class? : string; + bullets_active_class? : string; + slide_number_class? : string; + caption_class? : string; + active_slide_class? : string; + orbit_transition_class? : string; + bullets? : boolean; + circular? : boolean; + timer? : boolean; + variable_height? : boolean; + swipe? : boolean; + before_slide_change? : () => any; + after_slide_change? : () => any; +} + +// http://foundation.zurb.com/docs/components/reveal.html +interface RevealCSSOptions { + opacity? : number; + visibility? : string; + display? : string; +} + +interface RevealOptions { + animation? : string; + animation_speed? : number; + close_on_background_click? : boolean; + dismiss_modal_class? : string; + multiple_opened? : boolean; + bg_class? : string; + root_element? : string; + on_ajax_error? : () => any; + open? : () => any; + opened? : () => any; + close? : () => any; + closed? : () => any; + bg? : JQuery; + css? : { + open? : RevealCSSOptions; + close? : RevealCSSOptions; + }; +} + +// http://foundation.zurb.com/docs/components/range_slider.html +interface SliderOptions { + start? : number; + end? : number; + step? : number; + precision? : number; + initial? : number; + vertical? : boolean; + trigger_input_change? : boolean; + on_change? : () => any; +} + +// http://foundation.zurb.com/docs/components/tabs.html +interface TabOptions { + active_class? : string; + callback? : () => any; + deep_linking? : boolean; + scroll_to_content? : boolean; + is_hover? : boolean; +} + +interface TooltipOptions { + additional_inheritable_classes? : string[]; + tooltip_class? : string; + append_to? : string; + touch_close_text? : string; + disable_for_touch? : boolean; + hover_delay? : number; + show_on? : string; + tip_template? : (selector : string, content : string) => string; +} + +interface TopbarOptions { + index? : number; + sticky_class? : string; + custom_back_text? : boolean; + back_text? : string; + is_hover? : boolean; + mobile_show_parent_link? : boolean; + scrolltop? : boolean; + sticky_on? : string; +} + +interface FoundationOptions { + abide? : AbideOptions; + accordion? : AccordionOptions; + alert? : AlertOptions; + clearing? : ClearingOptions; + dropdown? : DropdownOptions; + equalizer? : EqualizerOptions; + interchange? : InterchangeOptions; + joyride? : JoyrideOptions; + magellan? : MagellanOptions; + offcanvas? : OffCanvasOptions; + orbit? : OrbitOptions; + reveal? : RevealOptions; + slider? : SliderOptions; + tab? : TabOptions; + tooltip? : TooltipOptions; + topbar? : TopbarOptions; +} + +interface FoundationStatic { + name : string; + version : string; + media_queries : Object; + stylesheet : CSSStyleSheet; + global : { + namespace : string; + }; + init(scope : JQuery) : JQuery; + init(scope : JQuery, libraries : FoundationOptions) : JQuery; + init(scope : JQuery, libraries : string, method : FoundationOptions) : JQuery; + init(scope : JQuery, libraries : string, method : string, options : Object) : JQuery; + init_lib(lib : any, args : any) : (...args : any[]) => any; + patch(lib : any) : void; + inherit(scope : JQuery, methods : string) : void; + set_namespace() : void; + libs : any; + utils : { + S(selector : any, context : any) : JQuery; + throttle(func : (...args : any[]) => any, delay : number) : (...args : any[]) => any; + debounce(func : (...args : any[]) => any, delay : number, immediate : boolean) : (...args : any[]) => any; + data_options(el : JQuery) : Object; + register_media(media : string, media_class : string) : void; + add_custom_rule(rule : string, media : string) : void; + image_loaded(images : JQuery, callback : (...args : any[]) => any) : void; + random_str(length? : number) : string; + }; +} + +interface JQuery { + foundation() : JQuery; + foundation(libraries : FoundationOptions | string) : JQuery; + foundation(libraries : string, method : FoundationOptions | string) : JQuery; + foundation(libraries : string, method : string, options : Object) : JQuery; +} + +declare var Foundation : FoundationStatic; From 25cad4036620470b17be460cdf823319b345634a Mon Sep 17 00:00:00 2001 From: Justin Filip Date: Sun, 8 Mar 2015 13:47:14 -0400 Subject: [PATCH 0006/1358] Fixed up header to meet spec requirements. --- foundation/foundation.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/foundation/foundation.d.ts b/foundation/foundation.d.ts index a531a051e1..0f4ef3be1f 100644 --- a/foundation/foundation.d.ts +++ b/foundation/foundation.d.ts @@ -1,7 +1,7 @@ -// Type definitions for Foundation 5.5.1 -// Project : http://foundation.zurb.com/ -// Definitions by : Boris Yankov -// Definitions : https://github.com/borisyankov/DefinitelyTyped +// Type definitions for Foundation v5.5.1 +// Project: http://foundation.zurb.com/ +// Definitions by: Boris Yankov +// Definitions: https://github.com/borisyankov/DefinitelyTyped /// From 9e24a051107337c96c1d47b15b540d5e6b75610e Mon Sep 17 00:00:00 2001 From: Justin Filip Date: Sun, 8 Mar 2015 13:54:16 -0400 Subject: [PATCH 0007/1358] Namespace the various Foundation option interfaces to prevent conflicts. --- foundation/foundation-tests.ts | 38 ++++++++--------- foundation/foundation.d.ts | 74 +++++++++++++++++----------------- 2 files changed, 56 insertions(+), 56 deletions(-) diff --git a/foundation/foundation-tests.ts b/foundation/foundation-tests.ts index c95b54a5bb..062fcc04ba 100644 --- a/foundation/foundation-tests.ts +++ b/foundation/foundation-tests.ts @@ -24,7 +24,7 @@ function plugin_list() { } function abide_patterns() { - var patterns : AbidePatterns; + var patterns : FoundationAbidePatterns; patterns.alpha = /^[a-zA-Z]+$/; patterns.alpha_numeric = /^[a-zA-Z0-9]+$/; patterns.integer = /^[-+]?\d+$/; @@ -44,7 +44,7 @@ function abide_patterns() { } function abide_options() { - var opts : AbideOptions = {}; + var opts : FoundationAbideOptions = {}; opts.live_validate = false; opts.validate_on_blur = true; opts.focus_on_invalid = true; @@ -65,7 +65,7 @@ function abide_options() { } function accordion_options() { - var opts : AccordionOptions = {}; + var opts : FoundationAccordionOptions = {}; opts.content_class = "content"; opts.active_class = "class-name"; opts.multi_expand = false; @@ -75,13 +75,13 @@ function accordion_options() { } function alert_options() { - var opts : AlertOptions = {}; + var opts : FoundationAlertOptions = {}; opts.callback = empty_callback; return opts; } function clearing_options() { - var opts : ClearingOptions = {}; + var opts : FoundationClearingOptions = {}; opts.templates = { viewing : '
Some HTML
' }; @@ -95,7 +95,7 @@ function clearing_options() { } function dropdown_options() { - var opts : DropdownOptions = {}; + var opts : FoundationDropdownOptions = {}; opts.active_class = "class-name"; opts.disabled_class = "disabled-class"; opts.mega_class = "big"; @@ -108,14 +108,14 @@ function dropdown_options() { } function equalizer_options() { - var opts : EqualizerOptions = {}; + var opts : FoundationEqualizerOptions = {}; opts.use_tallest = true; opts.equalize_on_stack = false; return opts; } function interchange_options() { - var opts : InterchangeOptions = {}; + var opts : FoundationInterchangeOptions = {}; opts.load_attr = "interchange"; opts.named_queries = { my_custom_query: "only screen and (max-width: 200px)" @@ -127,7 +127,7 @@ function interchange_options() { } function joyride_options() { - var opts : JoyrideOptions = {}; + var opts : FoundationJoyrideOptions = {}; opts.expose = false; opts.modal = true; opts.keyboard = true; @@ -176,7 +176,7 @@ function joyride_options() { } function magellan_options() { - var opts : MagellanOptions = {}; + var opts : FoundationMagellanOptions = {}; opts.active_class = ".active-element"; opts.threshold = 20; opts.destination_threshold = 30; @@ -189,14 +189,14 @@ function magellan_options() { } function offcanvas_options() { - var opts : OffCanvasOptions = {}; + var opts : FoundationOffCanvasOptions = {}; opts.open_method = "overlap_single"; opts.close_on_click = true; return opts; } function orbit_options() { - var opts : OrbitOptions = {}; + var opts : FoundationOrbitOptions = {}; opts.animation = 'slide'; opts.timer_speed = 10000; opts.pause_on_hover = true; @@ -234,7 +234,7 @@ function orbit_options() { } function reveal_css_options() { - var opts : RevealCSSOptions = {}; + var opts : FoundationRevealCSSOptions = {}; opts.opacity = 0; opts.visibility = 'hidden'; opts.display = "inline-block"; @@ -242,7 +242,7 @@ function reveal_css_options() { } function reveal_options() { - var opts : RevealOptions = {}; + var opts : FoundationRevealOptions = {}; opts.animation = "linear"; opts.animation_speed = 500; opts.close_on_background_click = false; @@ -264,7 +264,7 @@ function reveal_options() { } function slider_options() { - var opts : SliderOptions; + var opts : FoundationSliderOptions; opts.start = -1000; opts.end = 1000; opts.step = 50; @@ -277,7 +277,7 @@ function slider_options() { } function tab_options() { - var opts : TabOptions = {}; + var opts : FoundationTabOptions = {}; opts.active_class = "class-name"; opts.callback = empty_callback; opts.deep_linking = false; @@ -287,7 +287,7 @@ function tab_options() { } function tooltip_options() { - var opts : TooltipOptions = {}; + var opts : FoundationTooltipOptions = {}; opts.additional_inheritable_classes = ["class1", "class2"]; opts.tooltip_class = "tooltip"; opts.append_to = "append-class"; @@ -304,7 +304,7 @@ function tooltip_options() { } function topbar_options() { - var opts : TopbarOptions = {}; + var opts : FoundationTopbarOptions = {}; opts.index = 1; opts.sticky_class = "top-bar"; opts.custom_back_text = true; @@ -316,7 +316,7 @@ function topbar_options() { return opts; } -function foundation_options() : FoundationOptions { +function foundation_options() { var opts : FoundationOptions = {}; opts.abide = abide_options(); opts.accordion = accordion_options(); diff --git a/foundation/foundation.d.ts b/foundation/foundation.d.ts index 0f4ef3be1f..ad3696f019 100644 --- a/foundation/foundation.d.ts +++ b/foundation/foundation.d.ts @@ -7,7 +7,7 @@ /// // http://foundation.zurb.com/docs/components/abide.html#optional-javascript-configuration -interface AbidePatterns { +interface FoundationAbidePatterns { alpha? : RegExp; alpha_numeric? : RegExp; integer? : RegExp; @@ -25,18 +25,18 @@ interface AbidePatterns { color? : RegExp; } -interface AbideOptions { +interface FoundationAbideOptions { live_validate? : boolean; validate_on_blur? : boolean; focus_on_invalid? : boolean; error_labels? : boolean; timeout? : number; - patterns? : AbidePatterns; + patterns? : FoundationAbidePatterns; validators? : Object; } // http://foundation.zurb.com/docs/components/accordion.html#optional-javascript-configuration -interface AccordionOptions { +interface FoundationAccordionOptions { content_class? : string; active_class? : string; multi_expand? : boolean; @@ -45,12 +45,12 @@ interface AccordionOptions { } // http://foundation.zurb.com/docs/components/alert_boxes.html -interface AlertOptions { +interface FoundationAlertOptions { callback? : () => any; } // http://foundation.zurb.com/docs/components/clearing.html#optional-javascript-configuration -interface ClearingOptions { +interface FoundationClearingOptions { templates? : Object; close_selectors? : string; open_selectors? : string; @@ -61,7 +61,7 @@ interface ClearingOptions { } // http://foundation.zurb.com/docs/components/dropdown.html#optional-javascript-configuration -interface DropdownOptions { +interface FoundationDropdownOptions { active_class? : string; disabled_class? : string; mega_class? : string; @@ -73,20 +73,20 @@ interface DropdownOptions { } // http://foundation.zurb.com/docs/components/equalizer.html#optional-javascript-configuration -interface EqualizerOptions { +interface FoundationEqualizerOptions { use_tallest? : boolean; equalize_on_stack? : boolean; } // http://foundation.zurb.com/docs/components/interchange.html#custom-named-queries -interface InterchangeOptions { +interface FoundationInterchangeOptions { load_attr? : string; named_queries? : Object; directives? : Object; } // http://foundation.zurb.com/docs/components/joyride.html#optional-javascript-configuration -interface JoyrideOptions { +interface FoundationJoyrideOptions { expose? : boolean; modal? : boolean; keyboard? : boolean; @@ -133,7 +133,7 @@ interface JoyrideOptions { } // http://foundation.zurb.com/docs/components/magellan.html#js -interface MagellanOptions { +interface FoundationMagellanOptions { active_class? : string; threshold? : number; destination_threshold? : number; @@ -145,13 +145,13 @@ interface MagellanOptions { } // http://foundation.zurb.com/docs/components/offcanvas.html#optional-javascript-configuration -interface OffCanvasOptions { +interface FoundationOffCanvasOptions { open_method? : string; close_on_click? : boolean; } // http://foundation.zurb.com/docs/components/orbit.html#advanced -interface OrbitOptions { +interface FoundationOrbitOptions { animation? : string; timer_speed? : number; pause_on_hover? : boolean; @@ -188,13 +188,13 @@ interface OrbitOptions { } // http://foundation.zurb.com/docs/components/reveal.html -interface RevealCSSOptions { +interface FoundationRevealCSSOptions { opacity? : number; visibility? : string; display? : string; } -interface RevealOptions { +interface FoundationRevealOptions { animation? : string; animation_speed? : number; close_on_background_click? : boolean; @@ -209,13 +209,13 @@ interface RevealOptions { closed? : () => any; bg? : JQuery; css? : { - open? : RevealCSSOptions; - close? : RevealCSSOptions; + open? : FoundationRevealCSSOptions; + close? : FoundationRevealCSSOptions; }; } // http://foundation.zurb.com/docs/components/range_slider.html -interface SliderOptions { +interface FoundationSliderOptions { start? : number; end? : number; step? : number; @@ -227,7 +227,7 @@ interface SliderOptions { } // http://foundation.zurb.com/docs/components/tabs.html -interface TabOptions { +interface FoundationTabOptions { active_class? : string; callback? : () => any; deep_linking? : boolean; @@ -235,7 +235,7 @@ interface TabOptions { is_hover? : boolean; } -interface TooltipOptions { +interface FoundationTooltipOptions { additional_inheritable_classes? : string[]; tooltip_class? : string; append_to? : string; @@ -246,7 +246,7 @@ interface TooltipOptions { tip_template? : (selector : string, content : string) => string; } -interface TopbarOptions { +interface FoundationTopbarOptions { index? : number; sticky_class? : string; custom_back_text? : boolean; @@ -258,22 +258,22 @@ interface TopbarOptions { } interface FoundationOptions { - abide? : AbideOptions; - accordion? : AccordionOptions; - alert? : AlertOptions; - clearing? : ClearingOptions; - dropdown? : DropdownOptions; - equalizer? : EqualizerOptions; - interchange? : InterchangeOptions; - joyride? : JoyrideOptions; - magellan? : MagellanOptions; - offcanvas? : OffCanvasOptions; - orbit? : OrbitOptions; - reveal? : RevealOptions; - slider? : SliderOptions; - tab? : TabOptions; - tooltip? : TooltipOptions; - topbar? : TopbarOptions; + abide? : FoundationAbideOptions; + accordion? : FoundationAccordionOptions; + alert? : FoundationAlertOptions; + clearing? : FoundationClearingOptions; + dropdown? : FoundationDropdownOptions; + equalizer? : FoundationEqualizerOptions; + interchange? : FoundationInterchangeOptions; + joyride? : FoundationJoyrideOptions; + magellan? : FoundationMagellanOptions; + offcanvas? : FoundationOffCanvasOptions; + orbit? : FoundationOrbitOptions; + reveal? : FoundationRevealOptions; + slider? : FoundationSliderOptions; + tab? : FoundationTabOptions; + tooltip? : FoundationTooltipOptions; + topbar? : FoundationTopbarOptions; } interface FoundationStatic { From 7dd9a59ab0c37c19178735dfa02b2ad69dde7d82 Mon Sep 17 00:00:00 2001 From: Justin Filip Date: Sun, 15 Mar 2015 14:16:25 -0400 Subject: [PATCH 0008/1358] Don't pollute the global namespace with interfaces used for Foundation. --- foundation/foundation-tests.ts | 38 +-- foundation/foundation.d.ts | 564 +++++++++++++++++---------------- 2 files changed, 302 insertions(+), 300 deletions(-) diff --git a/foundation/foundation-tests.ts b/foundation/foundation-tests.ts index 062fcc04ba..9706fbf97c 100644 --- a/foundation/foundation-tests.ts +++ b/foundation/foundation-tests.ts @@ -24,7 +24,7 @@ function plugin_list() { } function abide_patterns() { - var patterns : FoundationAbidePatterns; + var patterns : Foundation.AbidePatterns = {}; patterns.alpha = /^[a-zA-Z]+$/; patterns.alpha_numeric = /^[a-zA-Z0-9]+$/; patterns.integer = /^[-+]?\d+$/; @@ -44,7 +44,7 @@ function abide_patterns() { } function abide_options() { - var opts : FoundationAbideOptions = {}; + var opts : Foundation.AbideOptions = {}; opts.live_validate = false; opts.validate_on_blur = true; opts.focus_on_invalid = true; @@ -65,7 +65,7 @@ function abide_options() { } function accordion_options() { - var opts : FoundationAccordionOptions = {}; + var opts : Foundation.AccordionOptions = {}; opts.content_class = "content"; opts.active_class = "class-name"; opts.multi_expand = false; @@ -75,13 +75,13 @@ function accordion_options() { } function alert_options() { - var opts : FoundationAlertOptions = {}; + var opts : Foundation.AlertOptions = {}; opts.callback = empty_callback; return opts; } function clearing_options() { - var opts : FoundationClearingOptions = {}; + var opts : Foundation.ClearingOptions = {}; opts.templates = { viewing : '
Some HTML
' }; @@ -95,7 +95,7 @@ function clearing_options() { } function dropdown_options() { - var opts : FoundationDropdownOptions = {}; + var opts : Foundation.DropdownOptions = {}; opts.active_class = "class-name"; opts.disabled_class = "disabled-class"; opts.mega_class = "big"; @@ -108,14 +108,14 @@ function dropdown_options() { } function equalizer_options() { - var opts : FoundationEqualizerOptions = {}; + var opts : Foundation.EqualizerOptions = {}; opts.use_tallest = true; opts.equalize_on_stack = false; return opts; } function interchange_options() { - var opts : FoundationInterchangeOptions = {}; + var opts : Foundation.InterchangeOptions = {}; opts.load_attr = "interchange"; opts.named_queries = { my_custom_query: "only screen and (max-width: 200px)" @@ -127,7 +127,7 @@ function interchange_options() { } function joyride_options() { - var opts : FoundationJoyrideOptions = {}; + var opts : Foundation.JoyrideOptions = {}; opts.expose = false; opts.modal = true; opts.keyboard = true; @@ -176,7 +176,7 @@ function joyride_options() { } function magellan_options() { - var opts : FoundationMagellanOptions = {}; + var opts : Foundation.MagellanOptions = {}; opts.active_class = ".active-element"; opts.threshold = 20; opts.destination_threshold = 30; @@ -189,14 +189,14 @@ function magellan_options() { } function offcanvas_options() { - var opts : FoundationOffCanvasOptions = {}; + var opts : Foundation.OffCanvasOptions = {}; opts.open_method = "overlap_single"; opts.close_on_click = true; return opts; } function orbit_options() { - var opts : FoundationOrbitOptions = {}; + var opts : Foundation.OrbitOptions = {}; opts.animation = 'slide'; opts.timer_speed = 10000; opts.pause_on_hover = true; @@ -234,7 +234,7 @@ function orbit_options() { } function reveal_css_options() { - var opts : FoundationRevealCSSOptions = {}; + var opts : Foundation.RevealCSSOptions = {}; opts.opacity = 0; opts.visibility = 'hidden'; opts.display = "inline-block"; @@ -242,7 +242,7 @@ function reveal_css_options() { } function reveal_options() { - var opts : FoundationRevealOptions = {}; + var opts : Foundation.RevealOptions = {}; opts.animation = "linear"; opts.animation_speed = 500; opts.close_on_background_click = false; @@ -264,7 +264,7 @@ function reveal_options() { } function slider_options() { - var opts : FoundationSliderOptions; + var opts : Foundation.SliderOptions = {}; opts.start = -1000; opts.end = 1000; opts.step = 50; @@ -277,7 +277,7 @@ function slider_options() { } function tab_options() { - var opts : FoundationTabOptions = {}; + var opts : Foundation.TabOptions = {}; opts.active_class = "class-name"; opts.callback = empty_callback; opts.deep_linking = false; @@ -287,7 +287,7 @@ function tab_options() { } function tooltip_options() { - var opts : FoundationTooltipOptions = {}; + var opts : Foundation.TooltipOptions = {}; opts.additional_inheritable_classes = ["class1", "class2"]; opts.tooltip_class = "tooltip"; opts.append_to = "append-class"; @@ -304,7 +304,7 @@ function tooltip_options() { } function topbar_options() { - var opts : FoundationTopbarOptions = {}; + var opts : Foundation.TopbarOptions = {}; opts.index = 1; opts.sticky_class = "top-bar"; opts.custom_back_text = true; @@ -317,7 +317,7 @@ function topbar_options() { } function foundation_options() { - var opts : FoundationOptions = {}; + var opts : Foundation.Options = {}; opts.abide = abide_options(); opts.accordion = accordion_options(); opts.alert = alert_options(); diff --git a/foundation/foundation.d.ts b/foundation/foundation.d.ts index ad3696f019..c2dc4fc244 100644 --- a/foundation/foundation.d.ts +++ b/foundation/foundation.d.ts @@ -6,310 +6,312 @@ /// -// http://foundation.zurb.com/docs/components/abide.html#optional-javascript-configuration -interface FoundationAbidePatterns { - alpha? : RegExp; - alpha_numeric? : RegExp; - integer? : RegExp; - number? : RegExp; - card? : RegExp; - cvv? : RegExp; - email? : RegExp; - url? : RegExp; - domain? : RegExp; - datetime? : RegExp; - date? : RegExp; - time? : RegExp; - dateISO? : RegExp; - month_day_year? : RegExp; - color? : RegExp; -} +declare module Foundation { + // http://foundation.zurb.com/docs/components/abide.html#optional-javascript-configuration + interface AbidePatterns { + alpha? : RegExp; + alpha_numeric? : RegExp; + integer? : RegExp; + number? : RegExp; + card? : RegExp; + cvv? : RegExp; + email? : RegExp; + url? : RegExp; + domain? : RegExp; + datetime? : RegExp; + date? : RegExp; + time? : RegExp; + dateISO? : RegExp; + month_day_year? : RegExp; + color? : RegExp; + } -interface FoundationAbideOptions { - live_validate? : boolean; - validate_on_blur? : boolean; - focus_on_invalid? : boolean; - error_labels? : boolean; - timeout? : number; - patterns? : FoundationAbidePatterns; - validators? : Object; -} + interface AbideOptions { + live_validate? : boolean; + validate_on_blur? : boolean; + focus_on_invalid? : boolean; + error_labels? : boolean; + timeout? : number; + patterns? : AbidePatterns; + validators? : Object; + } -// http://foundation.zurb.com/docs/components/accordion.html#optional-javascript-configuration -interface FoundationAccordionOptions { - content_class? : string; - active_class? : string; - multi_expand? : boolean; - toggleable? : boolean; - callback? : () => any; -} + // http://foundation.zurb.com/docs/components/accordion.html#optional-javascript-configuration + interface AccordionOptions { + content_class? : string; + active_class? : string; + multi_expand? : boolean; + toggleable? : boolean; + callback? : () => any; + } -// http://foundation.zurb.com/docs/components/alert_boxes.html -interface FoundationAlertOptions { - callback? : () => any; -} + // http://foundation.zurb.com/docs/components/alert_boxes.html + interface AlertOptions { + callback? : () => any; + } -// http://foundation.zurb.com/docs/components/clearing.html#optional-javascript-configuration -interface FoundationClearingOptions { - templates? : Object; - close_selectors? : string; - open_selectors? : string; - skip_selector? : string; - touch_label? : string; - init? : boolean; - locked? : boolean; -} + // http://foundation.zurb.com/docs/components/clearing.html#optional-javascript-configuration + interface ClearingOptions { + templates? : Object; + close_selectors? : string; + open_selectors? : string; + skip_selector? : string; + touch_label? : string; + init? : boolean; + locked? : boolean; + } -// http://foundation.zurb.com/docs/components/dropdown.html#optional-javascript-configuration -interface FoundationDropdownOptions { - active_class? : string; - disabled_class? : string; - mega_class? : string; - align? : string; - is_hover? : boolean; - hover_timeout? : number; - opened? : () => any; - closed? : () => any; -} + // http://foundation.zurb.com/docs/components/dropdown.html#optional-javascript-configuration + interface DropdownOptions { + active_class? : string; + disabled_class? : string; + mega_class? : string; + align? : string; + is_hover? : boolean; + hover_timeout? : number; + opened? : () => any; + closed? : () => any; + } -// http://foundation.zurb.com/docs/components/equalizer.html#optional-javascript-configuration -interface FoundationEqualizerOptions { - use_tallest? : boolean; - equalize_on_stack? : boolean; -} + // http://foundation.zurb.com/docs/components/equalizer.html#optional-javascript-configuration + interface EqualizerOptions { + use_tallest? : boolean; + equalize_on_stack? : boolean; + } -// http://foundation.zurb.com/docs/components/interchange.html#custom-named-queries -interface FoundationInterchangeOptions { - load_attr? : string; - named_queries? : Object; - directives? : Object; -} + // http://foundation.zurb.com/docs/components/interchange.html#custom-named-queries + interface InterchangeOptions { + load_attr? : string; + named_queries? : Object; + directives? : Object; + } -// http://foundation.zurb.com/docs/components/joyride.html#optional-javascript-configuration -interface FoundationJoyrideOptions { - expose? : boolean; - modal? : boolean; - keyboard? : boolean; - tip_location? : string; - nub_position? : string; - scroll_speed? : number; - scroll_animation? : string; - timer? : number; - start_timer_on_click? : boolean; - start_offset? : number; - next_button? : boolean; - prev_button? : boolean; - tip_animation? : string; - pause_after? : number[]; - exposed? : string[]; - tip_animation_fade_speed? : number; - cookie_monster? : boolean; - cookie_name? : string; - cookie_domain? : boolean; - cookie_expires? : number; - tip_container? : string; - tip_location_patterns? : { - top? : string[]; - bottom? : string[]; - left? : string[]; - right? : string[]; - }; - post_ride_callback? : () => void; - post_step_callback? : () => void; - pre_step_callback? : () => void; - pre_ride_callback? : () => void; - post_expose_callback? : () => void; - template? : { - link? : string; - timer? : string; - tip? : string; - wrapper? : string; - button? : string; - modal? : string; - expose? : string; - expose_cover? : string; - }; - expose_add_class? : string; -} + // http://foundation.zurb.com/docs/components/joyride.html#optional-javascript-configuration + interface JoyrideOptions { + expose? : boolean; + modal? : boolean; + keyboard? : boolean; + tip_location? : string; + nub_position? : string; + scroll_speed? : number; + scroll_animation? : string; + timer? : number; + start_timer_on_click? : boolean; + start_offset? : number; + next_button? : boolean; + prev_button? : boolean; + tip_animation? : string; + pause_after? : number[]; + exposed? : string[]; + tip_animation_fade_speed? : number; + cookie_monster? : boolean; + cookie_name? : string; + cookie_domain? : boolean; + cookie_expires? : number; + tip_container? : string; + tip_location_patterns? : { + top? : string[]; + bottom? : string[]; + left? : string[]; + right? : string[]; + }; + post_ride_callback? : () => void; + post_step_callback? : () => void; + pre_step_callback? : () => void; + pre_ride_callback? : () => void; + post_expose_callback? : () => void; + template? : { + link? : string; + timer? : string; + tip? : string; + wrapper? : string; + button? : string; + modal? : string; + expose? : string; + expose_cover? : string; + }; + expose_add_class? : string; + } -// http://foundation.zurb.com/docs/components/magellan.html#js -interface FoundationMagellanOptions { - active_class? : string; - threshold? : number; - destination_threshold? : number; - throttle_delay? : number; - fixed_top? : number; - offset_by_height? : boolean; - duration? : number; - easing? : string; -} + // http://foundation.zurb.com/docs/components/magellan.html#js + interface MagellanOptions { + active_class? : string; + threshold? : number; + destination_threshold? : number; + throttle_delay? : number; + fixed_top? : number; + offset_by_height? : boolean; + duration? : number; + easing? : string; + } -// http://foundation.zurb.com/docs/components/offcanvas.html#optional-javascript-configuration -interface FoundationOffCanvasOptions { - open_method? : string; - close_on_click? : boolean; -} + // http://foundation.zurb.com/docs/components/offcanvas.html#optional-javascript-configuration + interface OffCanvasOptions { + open_method? : string; + close_on_click? : boolean; + } -// http://foundation.zurb.com/docs/components/orbit.html#advanced -interface FoundationOrbitOptions { - animation? : string; - timer_speed? : number; - pause_on_hover? : boolean; - resume_on_mouseout? : boolean; - next_on_click? : boolean; - animation_speed? : number; - stack_on_small? : boolean; - navigation_arrows? : boolean; - slide_number? : boolean; - slide_number_text? : string; - container_class? : string; - stack_on_small_class? : string; - next_class? : string; - prev_class? : string; - timer_container_class? : string; - timer_paused_class? : string; - timer_progress_class? : string; - slides_container_class? : string; - preloader_class? : string; - slide_selector? : string; - bullets_container_class? : string; - bullets_active_class? : string; - slide_number_class? : string; - caption_class? : string; - active_slide_class? : string; - orbit_transition_class? : string; - bullets? : boolean; - circular? : boolean; - timer? : boolean; - variable_height? : boolean; - swipe? : boolean; - before_slide_change? : () => any; - after_slide_change? : () => any; -} + // http://foundation.zurb.com/docs/components/orbit.html#advanced + interface OrbitOptions { + animation? : string; + timer_speed? : number; + pause_on_hover? : boolean; + resume_on_mouseout? : boolean; + next_on_click? : boolean; + animation_speed? : number; + stack_on_small? : boolean; + navigation_arrows? : boolean; + slide_number? : boolean; + slide_number_text? : string; + container_class? : string; + stack_on_small_class? : string; + next_class? : string; + prev_class? : string; + timer_container_class? : string; + timer_paused_class? : string; + timer_progress_class? : string; + slides_container_class? : string; + preloader_class? : string; + slide_selector? : string; + bullets_container_class? : string; + bullets_active_class? : string; + slide_number_class? : string; + caption_class? : string; + active_slide_class? : string; + orbit_transition_class? : string; + bullets? : boolean; + circular? : boolean; + timer? : boolean; + variable_height? : boolean; + swipe? : boolean; + before_slide_change? : () => any; + after_slide_change? : () => any; + } -// http://foundation.zurb.com/docs/components/reveal.html -interface FoundationRevealCSSOptions { - opacity? : number; - visibility? : string; - display? : string; -} + // http://foundation.zurb.com/docs/components/reveal.html + interface RevealCSSOptions { + opacity? : number; + visibility? : string; + display? : string; + } -interface FoundationRevealOptions { - animation? : string; - animation_speed? : number; - close_on_background_click? : boolean; - dismiss_modal_class? : string; - multiple_opened? : boolean; - bg_class? : string; - root_element? : string; - on_ajax_error? : () => any; - open? : () => any; - opened? : () => any; - close? : () => any; - closed? : () => any; - bg? : JQuery; - css? : { - open? : FoundationRevealCSSOptions; - close? : FoundationRevealCSSOptions; - }; -} + interface RevealOptions { + animation? : string; + animation_speed? : number; + close_on_background_click? : boolean; + dismiss_modal_class? : string; + multiple_opened? : boolean; + bg_class? : string; + root_element? : string; + on_ajax_error? : () => any; + open? : () => any; + opened? : () => any; + close? : () => any; + closed? : () => any; + bg? : JQuery; + css? : { + open? : RevealCSSOptions; + close? : RevealCSSOptions; + }; + } -// http://foundation.zurb.com/docs/components/range_slider.html -interface FoundationSliderOptions { - start? : number; - end? : number; - step? : number; - precision? : number; - initial? : number; - vertical? : boolean; - trigger_input_change? : boolean; - on_change? : () => any; -} + // http://foundation.zurb.com/docs/components/range_slider.html + interface SliderOptions { + start? : number; + end? : number; + step? : number; + precision? : number; + initial? : number; + vertical? : boolean; + trigger_input_change? : boolean; + on_change? : () => any; + } -// http://foundation.zurb.com/docs/components/tabs.html -interface FoundationTabOptions { - active_class? : string; - callback? : () => any; - deep_linking? : boolean; - scroll_to_content? : boolean; - is_hover? : boolean; -} + // http://foundation.zurb.com/docs/components/tabs.html + interface TabOptions { + active_class? : string; + callback? : () => any; + deep_linking? : boolean; + scroll_to_content? : boolean; + is_hover? : boolean; + } -interface FoundationTooltipOptions { - additional_inheritable_classes? : string[]; - tooltip_class? : string; - append_to? : string; - touch_close_text? : string; - disable_for_touch? : boolean; - hover_delay? : number; - show_on? : string; - tip_template? : (selector : string, content : string) => string; -} + interface TooltipOptions { + additional_inheritable_classes? : string[]; + tooltip_class? : string; + append_to? : string; + touch_close_text? : string; + disable_for_touch? : boolean; + hover_delay? : number; + show_on? : string; + tip_template? : (selector : string, content : string) => string; + } -interface FoundationTopbarOptions { - index? : number; - sticky_class? : string; - custom_back_text? : boolean; - back_text? : string; - is_hover? : boolean; - mobile_show_parent_link? : boolean; - scrolltop? : boolean; - sticky_on? : string; -} + interface TopbarOptions { + index? : number; + sticky_class? : string; + custom_back_text? : boolean; + back_text? : string; + is_hover? : boolean; + mobile_show_parent_link? : boolean; + scrolltop? : boolean; + sticky_on? : string; + } -interface FoundationOptions { - abide? : FoundationAbideOptions; - accordion? : FoundationAccordionOptions; - alert? : FoundationAlertOptions; - clearing? : FoundationClearingOptions; - dropdown? : FoundationDropdownOptions; - equalizer? : FoundationEqualizerOptions; - interchange? : FoundationInterchangeOptions; - joyride? : FoundationJoyrideOptions; - magellan? : FoundationMagellanOptions; - offcanvas? : FoundationOffCanvasOptions; - orbit? : FoundationOrbitOptions; - reveal? : FoundationRevealOptions; - slider? : FoundationSliderOptions; - tab? : FoundationTabOptions; - tooltip? : FoundationTooltipOptions; - topbar? : FoundationTopbarOptions; -} + interface Options { + abide? : AbideOptions; + accordion? : AccordionOptions; + alert? : AlertOptions; + clearing? : ClearingOptions; + dropdown? : DropdownOptions; + equalizer? : EqualizerOptions; + interchange? : InterchangeOptions; + joyride? : JoyrideOptions; + magellan? : MagellanOptions; + offcanvas? : OffCanvasOptions; + orbit? : OrbitOptions; + reveal? : RevealOptions; + slider? : SliderOptions; + tab? : TabOptions; + tooltip? : TooltipOptions; + topbar? : TopbarOptions; + } -interface FoundationStatic { - name : string; - version : string; - media_queries : Object; - stylesheet : CSSStyleSheet; - global : { - namespace : string; - }; - init(scope : JQuery) : JQuery; - init(scope : JQuery, libraries : FoundationOptions) : JQuery; - init(scope : JQuery, libraries : string, method : FoundationOptions) : JQuery; - init(scope : JQuery, libraries : string, method : string, options : Object) : JQuery; - init_lib(lib : any, args : any) : (...args : any[]) => any; - patch(lib : any) : void; - inherit(scope : JQuery, methods : string) : void; - set_namespace() : void; - libs : any; - utils : { - S(selector : any, context : any) : JQuery; - throttle(func : (...args : any[]) => any, delay : number) : (...args : any[]) => any; - debounce(func : (...args : any[]) => any, delay : number, immediate : boolean) : (...args : any[]) => any; - data_options(el : JQuery) : Object; - register_media(media : string, media_class : string) : void; - add_custom_rule(rule : string, media : string) : void; - image_loaded(images : JQuery, callback : (...args : any[]) => any) : void; - random_str(length? : number) : string; - }; + interface FoundationStatic { + name : string; + version : string; + media_queries : Object; + stylesheet : CSSStyleSheet; + global : { + namespace : string; + }; + init(scope : JQuery) : JQuery; + init(scope : JQuery, libraries : Options) : JQuery; + init(scope : JQuery, libraries : string, method : Options) : JQuery; + init(scope : JQuery, libraries : string, method : string, options : Object) : JQuery; + init_lib(lib : any, args : any) : (...args : any[]) => any; + patch(lib : any) : void; + inherit(scope : JQuery, methods : string) : void; + set_namespace() : void; + libs : any; + utils : { + S(selector : any, context : any) : JQuery; + throttle(func : (...args : any[]) => any, delay : number) : (...args : any[]) => any; + debounce(func : (...args : any[]) => any, delay : number, immediate : boolean) : (...args : any[]) => any; + data_options(el : JQuery) : Object; + register_media(media : string, media_class : string) : void; + add_custom_rule(rule : string, media : string) : void; + image_loaded(images : JQuery, callback : (...args : any[]) => any) : void; + random_str(length? : number) : string; + }; + } } interface JQuery { foundation() : JQuery; - foundation(libraries : FoundationOptions | string) : JQuery; - foundation(libraries : string, method : FoundationOptions | string) : JQuery; + foundation(libraries : Foundation.Options | string) : JQuery; + foundation(libraries : string, method : Foundation.Options | string) : JQuery; foundation(libraries : string, method : string, options : Object) : JQuery; } -declare var Foundation : FoundationStatic; +declare var Foundation : Foundation.FoundationStatic; From d2ed7b747941ff02d923a97119cd24caac4516eb Mon Sep 17 00:00:00 2001 From: vvakame Date: Tue, 14 Apr 2015 08:51:08 +0900 Subject: [PATCH 0009/1358] bump tsc version 1.4.1 to 1.5.0-alpha --- npm-shrinkwrap.json | 172 ++++++++++++++++++++++++++++++-------------- package.json | 2 +- 2 files changed, 118 insertions(+), 56 deletions(-) diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 738ac2834f..04fa1a9570 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -8,39 +8,39 @@ "resolved": "https://registry.npmjs.org/definition-tester/-/definition-tester-0.2.0.tgz", "dependencies": { "bluebird": { - "version": "2.7.1", - "from": "bluebird@^2.5.3", - "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-2.7.1.tgz" + "version": "2.9.24", + "from": "bluebird@>=2.5.3 <3.0.0", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-2.9.24.tgz" }, "definition-header": { "version": "0.1.0", - "from": "definition-header@^0.1.0", + "from": "definition-header@>=0.1.0 <0.2.0", "resolved": "https://registry.npmjs.org/definition-header/-/definition-header-0.1.0.tgz", "dependencies": { "joi": { "version": "4.9.0", - "from": "joi@^4.0.0", + "from": "joi@>=4.0.0 <5.0.0", "resolved": "https://registry.npmjs.org/joi/-/joi-4.9.0.tgz", "dependencies": { "hoek": { - "version": "2.11.0", - "from": "hoek@^2.2.x", - "resolved": "https://registry.npmjs.org/hoek/-/hoek-2.11.0.tgz" + "version": "2.12.0", + "from": "hoek@>=2.2.0 <3.0.0", + "resolved": "https://registry.npmjs.org/hoek/-/hoek-2.12.0.tgz" }, "topo": { "version": "1.0.2", - "from": "topo@1.x.x", + "from": "topo@>=1.0.0 <2.0.0", "resolved": "https://registry.npmjs.org/topo/-/topo-1.0.2.tgz" }, "isemail": { "version": "1.1.1", - "from": "isemail@1.x.x", + "from": "isemail@>=1.0.0 <2.0.0", "resolved": "https://registry.npmjs.org/isemail/-/isemail-1.1.1.tgz" }, "moment": { - "version": "2.9.0", - "from": "moment@2.x.x", - "resolved": "https://registry.npmjs.org/moment/-/moment-2.9.0.tgz" + "version": "2.10.2", + "from": "moment@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.10.2.tgz" } } }, @@ -50,76 +50,138 @@ "resolved": "https://registry.npmjs.org/joi-assert/-/joi-assert-0.0.3.tgz", "dependencies": { "assertion-error": { - "version": "1.0.0", - "from": "assertion-error@^1.0.0", - "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.0.0.tgz" + "version": "1.0.1", + "from": "assertion-error@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.0.1.tgz" } } }, "parsimmon": { "version": "0.5.1", - "from": "parsimmon@^0.5.0", + "from": "parsimmon@>=0.5.0 <0.6.0", "resolved": "https://registry.npmjs.org/parsimmon/-/parsimmon-0.5.1.tgz", "dependencies": { "pjs": { "version": "5.1.1", - "from": "pjs@5.x", + "from": "pjs@>=5.0.0 <6.0.0", "resolved": "https://registry.npmjs.org/pjs/-/pjs-5.1.1.tgz" } } }, "xregexp": { "version": "2.0.0", - "from": "xregexp@~2.0.0", + "from": "xregexp@>=2.0.0 <2.1.0", "resolved": "https://registry.npmjs.org/xregexp/-/xregexp-2.0.0.tgz" } } }, "findup-sync": { "version": "0.2.1", - "from": "findup-sync@~0.2.1", - "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-0.2.1.tgz" + "from": "findup-sync@>=0.2.1 <0.3.0", + "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-0.2.1.tgz", + "dependencies": { + "glob": { + "version": "4.3.5", + "from": "glob@>=4.3.0 <4.4.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-4.3.5.tgz", + "dependencies": { + "inflight": { + "version": "1.0.4", + "from": "inflight@>=1.0.4 <2.0.0", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.4.tgz", + "dependencies": { + "wrappy": { + "version": "1.0.1", + "from": "wrappy@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.1.tgz" + } + } + }, + "inherits": { + "version": "2.0.1", + "from": "inherits@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz" + }, + "minimatch": { + "version": "2.0.4", + "from": "minimatch@>=2.0.1 <3.0.0", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-2.0.4.tgz", + "dependencies": { + "brace-expansion": { + "version": "1.1.0", + "from": "brace-expansion@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.0.tgz", + "dependencies": { + "balanced-match": { + "version": "0.2.0", + "from": "balanced-match@>=0.2.0 <0.3.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.2.0.tgz" + }, + "concat-map": { + "version": "0.0.1", + "from": "concat-map@0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz" + } + } + } + } + }, + "once": { + "version": "1.3.1", + "from": "once@>=1.3.0 <2.0.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.3.1.tgz", + "dependencies": { + "wrappy": { + "version": "1.0.1", + "from": "wrappy@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.1.tgz" + } + } + } + } + } + } }, "git-wrapper": { "version": "0.1.1", - "from": "git-wrapper@~0.1.1", + "from": "git-wrapper@>=0.1.1 <0.2.0", "resolved": "https://registry.npmjs.org/git-wrapper/-/git-wrapper-0.1.1.tgz" }, "glob": { - "version": "4.3.5", - "from": "glob@^4.3.2", - "resolved": "https://registry.npmjs.org/glob/-/glob-4.3.5.tgz", + "version": "4.5.3", + "from": "glob@>=4.3.2 <5.0.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-4.5.3.tgz", "dependencies": { "inflight": { "version": "1.0.4", - "from": "inflight@^1.0.4", + "from": "inflight@>=1.0.4 <2.0.0", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.4.tgz", "dependencies": { "wrappy": { "version": "1.0.1", - "from": "wrappy@1", + "from": "wrappy@>=1.0.0 <2.0.0", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.1.tgz" } } }, "inherits": { "version": "2.0.1", - "from": "inherits@2", + "from": "inherits@>=2.0.0 <3.0.0", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz" }, "minimatch": { - "version": "2.0.1", - "from": "minimatch@^2.0.1", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-2.0.1.tgz", + "version": "2.0.4", + "from": "minimatch@>=2.0.1 <3.0.0", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-2.0.4.tgz", "dependencies": { "brace-expansion": { "version": "1.1.0", - "from": "brace-expansion@^1.0.0", + "from": "brace-expansion@>=1.0.0 <2.0.0", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.0.tgz", "dependencies": { "balanced-match": { "version": "0.2.0", - "from": "balanced-match@^0.2.0", + "from": "balanced-match@>=0.2.0 <0.3.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.2.0.tgz" }, "concat-map": { @@ -133,12 +195,12 @@ }, "once": { "version": "1.3.1", - "from": "once@^1.3.0", + "from": "once@>=1.3.0 <2.0.0", "resolved": "https://registry.npmjs.org/once/-/once-1.3.1.tgz", "dependencies": { "wrappy": { "version": "1.0.1", - "from": "wrappy@1", + "from": "wrappy@>=1.0.0 <2.0.0", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.1.tgz" } } @@ -147,17 +209,17 @@ }, "lazy.js": { "version": "0.4.0", - "from": "lazy.js@~0.4.0", + "from": "lazy.js@>=0.4.0 <0.5.0", "resolved": "https://registry.npmjs.org/lazy.js/-/lazy.js-0.4.0.tgz" }, "manticore": { "version": "0.2.4", - "from": "manticore@^0.2.4", + "from": "manticore@>=0.2.4 <0.3.0", "resolved": "https://registry.npmjs.org/manticore/-/manticore-0.2.4.tgz", "dependencies": { "JSONStream": { "version": "0.8.4", - "from": "JSONStream@^0.8.4", + "from": "JSONStream@>=0.8.4 <0.9.0", "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-0.8.4.tgz", "dependencies": { "jsonparse": { @@ -166,30 +228,30 @@ "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-0.0.5.tgz" }, "through": { - "version": "2.3.6", - "from": "through@>=2.2.7 <3", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.6.tgz" + "version": "2.3.7", + "from": "through@>=2.2.7 <3.0.0", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.7.tgz" } } }, "bluebird": { "version": "1.2.4", - "from": "bluebird@^1.2.4", + "from": "bluebird@>=1.2.4 <2.0.0", "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-1.2.4.tgz" }, "through2": { "version": "0.5.1", - "from": "through2@^0.5.1", + "from": "through2@>=0.5.1 <0.6.0", "resolved": "https://registry.npmjs.org/through2/-/through2-0.5.1.tgz", "dependencies": { "readable-stream": { "version": "1.0.33", - "from": "readable-stream@~1.0.17", + "from": "readable-stream@>=1.0.17 <1.1.0", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.33.tgz", "dependencies": { "core-util-is": { "version": "1.0.1", - "from": "core-util-is@~1.0.0", + "from": "core-util-is@>=1.0.0 <1.1.0", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.1.tgz" }, "isarray": { @@ -199,43 +261,43 @@ }, "string_decoder": { "version": "0.10.31", - "from": "string_decoder@~0.10.x", + "from": "string_decoder@>=0.10.0 <0.11.0", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz" }, "inherits": { "version": "2.0.1", - "from": "inherits@~2.0.1", + "from": "inherits@>=2.0.1 <2.1.0", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz" } } }, "xtend": { "version": "3.0.0", - "from": "xtend@~3.0.0", + "from": "xtend@>=3.0.0 <3.1.0", "resolved": "https://registry.npmjs.org/xtend/-/xtend-3.0.0.tgz" } } }, "type-detect": { "version": "0.1.2", - "from": "type-detect@^0.1.2", + "from": "type-detect@>=0.1.2 <0.2.0", "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-0.1.2.tgz" } } }, "optimist": { "version": "0.6.1", - "from": "optimist@~0.6.1", + "from": "optimist@>=0.6.1 <0.7.0", "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", "dependencies": { "wordwrap": { "version": "0.0.2", - "from": "wordwrap@~0.0.2", + "from": "wordwrap@>=0.0.2 <0.1.0", "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz" }, "minimist": { "version": "0.0.10", - "from": "minimist@~0.0.1", + "from": "minimist@>=0.0.1 <0.1.0", "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz" } } @@ -243,9 +305,9 @@ } }, "typescript": { - "version": "1.4.1", - "from": "typescript@1.4.1", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-1.4.1.tgz" + "version": "1.5.0-alpha", + "from": "typescript@1.5.0-alpha", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-1.5.0-alpha.tgz" } } } diff --git a/package.json b/package.json index 10d5c872a8..2630763e69 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,6 @@ }, "devDependencies": { "definition-tester": "0.2.0", - "typescript": "1.4.1" + "typescript": "1.5.0-alpha" } } From 523dc9d4831c6ce242127e4a7c1380ecc906a659 Mon Sep 17 00:00:00 2001 From: vvakame Date: Wed, 15 Apr 2015 23:23:21 +0900 Subject: [PATCH 0010/1358] fix react/react-tests.ts and react/react-addons-tests.ts compile error --- react/react-addons-tests.ts | 2 +- react/react-tests.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/react/react-addons-tests.ts b/react/react-addons-tests.ts index 72d6db4865..f2ebdef37c 100644 --- a/react/react-addons-tests.ts +++ b/react/react-addons-tests.ts @@ -201,7 +201,7 @@ myComponent.reset(); // Attributes // -------------------------------------------------------------------------- -var children = ["Hello world", [null], React.DOM.span(null)]; +var children: any[] = ["Hello world", [null], React.DOM.span(null)]; var divStyle = { // CSSProperties flex: "1 1 main-size", backgroundImage: "url('hello.png')" diff --git a/react/react-tests.ts b/react/react-tests.ts index 2802a34cdf..1fd2670dec 100644 --- a/react/react-tests.ts +++ b/react/react-tests.ts @@ -201,7 +201,7 @@ myComponent.reset(); // Attributes // -------------------------------------------------------------------------- -var children = ["Hello world", [null], React.DOM.span(null)]; +var children: any[] = ["Hello world", [null], React.DOM.span(null)]; var divStyle = { // CSSProperties flex: "1 1 main-size", backgroundImage: "url('hello.png')" From 25407fa708d034e5c420dc2e9a994810501a7512 Mon Sep 17 00:00:00 2001 From: vvakame Date: Wed, 15 Apr 2015 23:25:52 +0900 Subject: [PATCH 0011/1358] fix react/legacy/react-0.12-tests.ts compile error --- react/legacy/react-0.12-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/react/legacy/react-0.12-tests.ts b/react/legacy/react-0.12-tests.ts index 27eae4c64e..98faad6466 100644 --- a/react/legacy/react-0.12-tests.ts +++ b/react/legacy/react-0.12-tests.ts @@ -121,7 +121,7 @@ myComponent.reset(); // Attributes // -------------------------------------------------------------------------- -var children = ["Hello world", [null], React.DOM.span(null)]; +var children: any[] = ["Hello world", [null], React.DOM.span(null)]; var divStyle = { // CSSProperties flex: "1 1 main-size", backgroundImage: "url('hello.png')" From ffa4719d92d613669e9afbe792527d0b21e39b03 Mon Sep 17 00:00:00 2001 From: vvakame Date: Wed, 15 Apr 2015 23:29:38 +0900 Subject: [PATCH 0012/1358] fix passport-local/passport-local-tests.ts compile error --- passport-local/passport-local-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/passport-local/passport-local-tests.ts b/passport-local/passport-local-tests.ts index de799a4d82..c58772eaaa 100644 --- a/passport-local/passport-local-tests.ts +++ b/passport-local/passport-local-tests.ts @@ -26,7 +26,7 @@ class User implements IUser { //#endregion // Sample from https://github.com/jaredhanson/passport-local#configure-strategy -passport.use(new local.Strategy(function (username, password, done) { +passport.use(new local.Strategy((username: any, password: any, done: any) => { User.findOne({ username: username }, function (err, user) { if (err) { return done(err); From 8d7f10e0304131e1526801977f69e836c5f1b305 Mon Sep 17 00:00:00 2001 From: vvakame Date: Wed, 15 Apr 2015 23:32:15 +0900 Subject: [PATCH 0013/1358] fix microsoft-ajax/microsoft.ajax-tests.ts compile error --- microsoft-ajax/microsoft.ajax-tests.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/microsoft-ajax/microsoft.ajax-tests.ts b/microsoft-ajax/microsoft.ajax-tests.ts index 7544b1c9f3..397fcc92c6 100644 --- a/microsoft-ajax/microsoft.ajax-tests.ts +++ b/microsoft-ajax/microsoft.ajax-tests.ts @@ -54,14 +54,14 @@ function BaseClassExtensions_Error_Tests() { } else if (isNaN(input)) { var msg = "A number was not entered. "; - msg += (String).format("Please enter a number between {0} and {1}.", min, max); + msg += (String).format("Please enter a number between {0} and {1}.", min, max); var err = (Error).create(msg); throw err; } else if (input < min || input > max) { msg = "The number entered was outside the acceptable range. "; - msg += (String).format("Please enter a number between {0} and {1}.", min, max); + msg += (String).format("Please enter a number between {0} and {1}.", min, max); var err = (Error).create(msg); @@ -82,12 +82,12 @@ function BaseClassExtensions_Error_Tests() { function BaseClassExtensions_String_Tests() { - (String).format("Please enter a number between {0} and {1}.", 1, 2); - (String).endsWith("test"); - (String).localeFormat("Please enter a number between {0} and {1}", 1, 2); - (String).trim(); - (String).trimEnd(); - (String).trimStart(); + (String).format("Please enter a number between {0} and {1}.", 1, 2); + (String).endsWith("test"); + (String).localeFormat("Please enter a number between {0} and {1}", 1, 2); + (String).trim(); + (String).trimEnd(); + (String).trimStart(); } function BaseClassExtensions_Function_Tests() { @@ -150,7 +150,7 @@ function BaseClassExtensions_Date_Tests() { function BaseClassExtensions_Boolean_Tests() { - (Boolean).parse("false"); + (Boolean).parse("false"); } function BaseClassExtensions_Number_Tests() { From b79d800626c9e98914c82aa095e76857fd8b4c68 Mon Sep 17 00:00:00 2001 From: vvakame Date: Wed, 15 Apr 2015 23:35:12 +0900 Subject: [PATCH 0014/1358] fix jqueryui/jqueryui-tests.ts compile error --- jqueryui/jqueryui-tests.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jqueryui/jqueryui-tests.ts b/jqueryui/jqueryui-tests.ts index 79263027fe..ef02b40d61 100644 --- a/jqueryui/jqueryui-tests.ts +++ b/jqueryui/jqueryui-tests.ts @@ -1618,7 +1618,7 @@ function test_spinner() { }, _parse: function (value) { if (typeof value === "string") { - if (Number(value) == value) { + if (Number(value) == value) { return Number(value); } return 123; @@ -1822,4 +1822,4 @@ function test_widget() { var isDisabled = $(".selector").jQuery.Widget("option", "disabled"); $(".selector").jQuery.Widget("option", "disabled", true); $(".selector").jQuery.Widget("option", { disabled: true }); -} \ No newline at end of file +} From 23d8d30144ccd79f5e8625db65ecffe5a25d9af8 Mon Sep 17 00:00:00 2001 From: vvakame Date: Wed, 15 Apr 2015 23:36:46 +0900 Subject: [PATCH 0015/1358] fix hooker/hooker-tests.ts compile error --- hooker/hooker-tests.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hooker/hooker-tests.ts b/hooker/hooker-tests.ts index d9aea606c2..edd2c25e97 100644 --- a/hooker/hooker-tests.ts +++ b/hooker/hooker-tests.ts @@ -11,11 +11,11 @@ function tests() { hello: 'world' }; hooker.hook(objectToHook, 'hello', () => { }); - hooker.hook(objectToHook, 'hello', () => { + hooker.hook(objectToHook, 'hello', (): any => { return null; }); hooker.hook(objectToHook, ['hello', 'foo'], () => { }); - hooker.hook(objectToHook, ['hello', 'bar'], () => { + hooker.hook(objectToHook, ['hello', 'bar'], (): any => { return null; }); hooker.hook(objectToHook, 'bar', () => { From ad1887a3d3352ce5fefb81b1da2a0074b6bdf126 Mon Sep 17 00:00:00 2001 From: Basarat Syed Date: Thu, 16 Apr 2015 09:25:35 +1000 Subject: [PATCH 0016/1358] fix acl/acl-mongodbBackend.d.ts compile error --- acl/acl.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/acl/acl.d.ts b/acl/acl.d.ts index 5d0498fed9..121541cada 100644 --- a/acl/acl.d.ts +++ b/acl/acl.d.ts @@ -14,7 +14,7 @@ declare module "acl" { type Value = string|number; type Values = Value|Value[]; type Action = () => any; - type Callback = (err: Error) => any; + export type Callback = (err: Error) => any; type AnyCallback = (err: Error, obj: any) => any; type AllowedCallback = (err: Error, allowed: boolean) => any; type GetUserId = (req: http.ServerRequest, res: http.ServerResponse) => Value; @@ -84,7 +84,7 @@ declare module "acl" { // // For internal use // - interface Backend { + export interface Backend { begin: () => T; end: (transaction: T, cb?: Action) => void; clean: (cb?: Action) => void; From c9d2949f7e20b5e6532b89b3f65df23c598a24e4 Mon Sep 17 00:00:00 2001 From: Basarat Syed Date: Thu, 16 Apr 2015 09:27:56 +1000 Subject: [PATCH 0017/1358] fix acl/acl-redisBackend compile error --- acl/acl-redisBackend.d.ts | 2 +- acl/acl.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/acl/acl-redisBackend.d.ts b/acl/acl-redisBackend.d.ts index e199f8b81c..2f222e2525 100644 --- a/acl/acl-redisBackend.d.ts +++ b/acl/acl-redisBackend.d.ts @@ -9,7 +9,7 @@ declare module "acl" { import redis = require('redis'); - interface AclStatic { + export interface AclStatic { redisBackend: RedisBackendStatic; } diff --git a/acl/acl.d.ts b/acl/acl.d.ts index 121541cada..ded8be22b4 100644 --- a/acl/acl.d.ts +++ b/acl/acl.d.ts @@ -19,7 +19,7 @@ declare module "acl" { type AllowedCallback = (err: Error, allowed: boolean) => any; type GetUserId = (req: http.ServerRequest, res: http.ServerResponse) => Value; - interface AclStatic { + export interface AclStatic { new (backend: Backend, logger: Logger, options: Option): Acl; new (backend: Backend, logger: Logger): Acl; new (backend: Backend): Acl; From 316a02d99ee5445daeabd51e883d646c5979437f Mon Sep 17 00:00:00 2001 From: Basarat Syed Date: Thu, 16 Apr 2015 10:00:42 +1000 Subject: [PATCH 0018/1358] tests: revert my ugly hacks. See https://github.com/Microsoft/TypeScript/issues/2784 --- acl/acl-redisBackend.d.ts | 2 +- acl/acl.d.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/acl/acl-redisBackend.d.ts b/acl/acl-redisBackend.d.ts index 2f222e2525..e199f8b81c 100644 --- a/acl/acl-redisBackend.d.ts +++ b/acl/acl-redisBackend.d.ts @@ -9,7 +9,7 @@ declare module "acl" { import redis = require('redis'); - export interface AclStatic { + interface AclStatic { redisBackend: RedisBackendStatic; } diff --git a/acl/acl.d.ts b/acl/acl.d.ts index ded8be22b4..5d0498fed9 100644 --- a/acl/acl.d.ts +++ b/acl/acl.d.ts @@ -14,12 +14,12 @@ declare module "acl" { type Value = string|number; type Values = Value|Value[]; type Action = () => any; - export type Callback = (err: Error) => any; + type Callback = (err: Error) => any; type AnyCallback = (err: Error, obj: any) => any; type AllowedCallback = (err: Error, allowed: boolean) => any; type GetUserId = (req: http.ServerRequest, res: http.ServerResponse) => Value; - export interface AclStatic { + interface AclStatic { new (backend: Backend, logger: Logger, options: Option): Acl; new (backend: Backend, logger: Logger): Acl; new (backend: Backend): Acl; @@ -84,7 +84,7 @@ declare module "acl" { // // For internal use // - export interface Backend { + interface Backend { begin: () => T; end: (transaction: T, cb?: Action) => void; clean: (cb?: Action) => void; From 7faade2b2301cea8758b3bb2a488f771748c584d Mon Sep 17 00:00:00 2001 From: vvakame Date: Wed, 29 Apr 2015 11:15:25 +0900 Subject: [PATCH 0019/1358] suppress `Octal literals are not available when targeting ECMAScript 5 and higher.` --- emscripten/emscripten-tests.ts | 2 +- gulp-concat/gulp-concat-tests.ts | 2 +- jquery.pickadate/jquery.pickadate-tests.ts | 4 ++-- mock-fs/mock-fs-tests.ts | 2 +- vinyl-fs/vinyl-fs-tests.ts | 8 ++++---- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/emscripten/emscripten-tests.ts b/emscripten/emscripten-tests.ts index 2f3a2b09ca..0a614a5405 100644 --- a/emscripten/emscripten-tests.ts +++ b/emscripten/emscripten-tests.ts @@ -50,7 +50,7 @@ function FSTest(): void { FS.symlink('file', 'link'); FS.writeFile('forbidden', 'can\'t touch this'); - FS.chmod('forbidden', 0000); + FS.chmod('forbidden', parseInt("0000", 8)); FS.writeFile('file', 'foobar'); FS.truncate('file', 3); diff --git a/gulp-concat/gulp-concat-tests.ts b/gulp-concat/gulp-concat-tests.ts index a2a475b978..68f6e529d8 100644 --- a/gulp-concat/gulp-concat-tests.ts +++ b/gulp-concat/gulp-concat-tests.ts @@ -18,6 +18,6 @@ gulp.task("concat:newLine", () => { gulp.task("concat:vinyl", () => { gulp.src(["file*.txt"]) - .pipe(concat({ path: "file.txt", stat: { mode: 0666 } })) + .pipe(concat({ path: "file.txt", stat: { mode: parseInt("0666", 8) } })) .pipe(gulp.dest("build")); }); diff --git a/jquery.pickadate/jquery.pickadate-tests.ts b/jquery.pickadate/jquery.pickadate-tests.ts index fde52f3e3e..89c250cf8b 100644 --- a/jquery.pickadate/jquery.pickadate-tests.ts +++ b/jquery.pickadate/jquery.pickadate-tests.ts @@ -282,7 +282,7 @@ picker.set('disable', undefined); picker.set('select', [2013, 3, 20]); // Using JavaScript Date objects. -picker.set('select', new Date(2013,03,20)); +picker.set('select', new Date(2013, 3, 20)); // Using positive integers as UNIX timestamps. picker.set('select', 1365961912346); @@ -417,4 +417,4 @@ picker.on('open', function () { picker.trigger('open'); picker.$node; -picker.$root; \ No newline at end of file +picker.$root; diff --git a/mock-fs/mock-fs-tests.ts b/mock-fs/mock-fs-tests.ts index 3dd9f01210..d4c5eae4f7 100644 --- a/mock-fs/mock-fs-tests.ts +++ b/mock-fs/mock-fs-tests.ts @@ -50,7 +50,7 @@ function d() { function e() { mock({ 'some/dir': mock.directory({ - mode: 0755, + mode: parseInt("0755", 8), items: { file1: 'file one content', file2: new Buffer([8, 6, 7, 5, 3, 0, 9]) diff --git a/vinyl-fs/vinyl-fs-tests.ts b/vinyl-fs/vinyl-fs-tests.ts index 016da5e8b3..335254f793 100644 --- a/vinyl-fs/vinyl-fs-tests.ts +++ b/vinyl-fs/vinyl-fs-tests.ts @@ -227,7 +227,7 @@ var dataWrap = function(fn:any) { }; var realMode = function(n:any) { - return n & 07777; + return n & parseInt("07777", 8); }; describe('dest stream', function() { @@ -370,7 +370,7 @@ describe('dest stream', function() { var expectedContents = fs.readFileSync(inputPath); var expectedCwd = __dirname; var expectedBase = path.join(__dirname, "./out-fixtures"); - var expectedMode = 0655; + var expectedMode = parseInt("0655", 8); var expectedFile = new File({ base: inputBase, @@ -410,7 +410,7 @@ describe('dest stream', function() { var expectedContents = fs.readFileSync(inputPath); var expectedCwd = __dirname; var expectedBase = path.join(__dirname, "./out-fixtures"); - var expectedMode = 0655; + var expectedMode = parseInt("0655", 8); var contentStream = through.obj(); var expectedFile = new File({ @@ -454,7 +454,7 @@ describe('dest stream', function() { var expectedPath = path.join(__dirname, "./out-fixtures/test"); var expectedCwd = __dirname; var expectedBase = path.join(__dirname, "./out-fixtures"); - var expectedMode = 0655; + var expectedMode = parseInt("0655", 8); var expectedFile = new File({ base: inputBase, From 6d64be2b2844adc0f4ea0f128b41faad98a1c96d Mon Sep 17 00:00:00 2001 From: vvakame Date: Wed, 29 Apr 2015 12:03:44 +0900 Subject: [PATCH 0020/1358] merge acl-mongodbBackend.d.ts and acl-redisBackend.d.ts into acl.d.ts --- acl/acl-mongodbBackend-tests.ts | 3 +-- acl/acl-mongodbBackend.d.ts | 22 ---------------------- acl/acl-redisBackend-test.ts | 2 +- acl/acl-redisBackend.d.ts | 21 --------------------- acl/acl.d.ts | 30 ++++++++++++++++++++++++++++++ 5 files changed, 32 insertions(+), 46 deletions(-) delete mode 100644 acl/acl-mongodbBackend.d.ts delete mode 100644 acl/acl-redisBackend.d.ts diff --git a/acl/acl-mongodbBackend-tests.ts b/acl/acl-mongodbBackend-tests.ts index 31411b65c7..01c9af9082 100644 --- a/acl/acl-mongodbBackend-tests.ts +++ b/acl/acl-mongodbBackend-tests.ts @@ -1,4 +1,4 @@ -/// +/// // https://github.com/OptimalBits/node_acl/blob/master/Readme.md import Acl = require('acl'); @@ -14,4 +14,3 @@ acl.allow('guest', 'blogs', 'view'); // allow function accepts arrays as any parameter acl.allow('member', 'blogs', ['edit','view', 'delete']); - diff --git a/acl/acl-mongodbBackend.d.ts b/acl/acl-mongodbBackend.d.ts deleted file mode 100644 index 8dbfb7e905..0000000000 --- a/acl/acl-mongodbBackend.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -// Type definitions for node_acl 0.4.7 -// Project: https://github.com/optimalbits/node_acl -// Definitions by: Qubo -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -/// -/// - -declare module "acl" { - import mongo = require('mongodb'); - - interface AclStatic { - mongodbBackend: MongodbBackendStatic; - } - - interface MongodbBackend extends Backend { } - interface MongodbBackendStatic { - new(db: mongo.Db, prefix: string, useSingle: boolean): MongodbBackend; - new(db: mongo.Db, prefix: string): MongodbBackend; - new(db: mongo.Db): MongodbBackend; - } -} diff --git a/acl/acl-redisBackend-test.ts b/acl/acl-redisBackend-test.ts index e1bf29af49..273aeab3b7 100644 --- a/acl/acl-redisBackend-test.ts +++ b/acl/acl-redisBackend-test.ts @@ -1,4 +1,4 @@ -/// +/// // https://github.com/OptimalBits/node_acl/blob/master/Readme.md import Acl = require('acl'); diff --git a/acl/acl-redisBackend.d.ts b/acl/acl-redisBackend.d.ts deleted file mode 100644 index e199f8b81c..0000000000 --- a/acl/acl-redisBackend.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -// Type definitions for node_acl 0.4.7 -// Project: https://github.com/optimalbits/node_acl -// Definitions by: Qubo -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -/// -/// - -declare module "acl" { - import redis = require('redis'); - - interface AclStatic { - redisBackend: RedisBackendStatic; - } - - interface RedisBackend extends Backend { } - interface RedisBackendStatic { - new(redis: redis.RedisClient, prefix: string): RedisBackend; - new(redis: redis.RedisClient): RedisBackend; - } -} diff --git a/acl/acl.d.ts b/acl/acl.d.ts index 5d0498fed9..57e85d9d58 100644 --- a/acl/acl.d.ts +++ b/acl/acl.d.ts @@ -6,6 +6,9 @@ /// /// +/// +/// + declare module "acl" { import http = require('http'); import Promise = require("bluebird"); @@ -115,6 +118,33 @@ declare module "acl" { end: () => void; } + // for redis backend + import redis = require('redis'); + + interface AclStatic { + redisBackend: RedisBackendStatic; + } + + interface RedisBackend extends Backend { } + interface RedisBackendStatic { + new(redis: redis.RedisClient, prefix: string): RedisBackend; + new(redis: redis.RedisClient): RedisBackend; + } + + // for mongodb backend + import mongo = require('mongodb'); + + interface AclStatic { + mongodbBackend: MongodbBackendStatic; + } + + interface MongodbBackend extends Backend { } + interface MongodbBackendStatic { + new(db: mongo.Db, prefix: string, useSingle: boolean): MongodbBackend; + new(db: mongo.Db, prefix: string): MongodbBackend; + new(db: mongo.Db): MongodbBackend; + } + var _: AclStatic; export = _; } From 609e8e45ca5017c0db5c2513ed9ad52798c4ed1c Mon Sep 17 00:00:00 2001 From: vvakame Date: Fri, 1 May 2015 12:22:00 +0900 Subject: [PATCH 0021/1358] update typescript version 1.5.0-alpha to 1.5.0-beta --- npm-shrinkwrap.json | 18 +++++++++--------- package.json | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 04fa1a9570..d3f7dc16ec 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -8,9 +8,9 @@ "resolved": "https://registry.npmjs.org/definition-tester/-/definition-tester-0.2.0.tgz", "dependencies": { "bluebird": { - "version": "2.9.24", + "version": "2.9.25", "from": "bluebird@>=2.5.3 <3.0.0", - "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-2.9.24.tgz" + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-2.9.25.tgz" }, "definition-header": { "version": "0.1.0", @@ -103,9 +103,9 @@ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz" }, "minimatch": { - "version": "2.0.4", + "version": "2.0.7", "from": "minimatch@>=2.0.1 <3.0.0", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-2.0.4.tgz", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-2.0.7.tgz", "dependencies": { "brace-expansion": { "version": "1.1.0", @@ -170,9 +170,9 @@ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz" }, "minimatch": { - "version": "2.0.4", + "version": "2.0.7", "from": "minimatch@>=2.0.1 <3.0.0", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-2.0.4.tgz", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-2.0.7.tgz", "dependencies": { "brace-expansion": { "version": "1.1.0", @@ -305,9 +305,9 @@ } }, "typescript": { - "version": "1.5.0-alpha", - "from": "typescript@1.5.0-alpha", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-1.5.0-alpha.tgz" + "version": "1.5.0-beta", + "from": "typescript@1.5.0-beta", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-1.5.0-beta.tgz" } } } diff --git a/package.json b/package.json index 2630763e69..d2826fc15f 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,6 @@ }, "devDependencies": { "definition-tester": "0.2.0", - "typescript": "1.5.0-alpha" + "typescript": "1.5.0-beta" } } From c3fce999444a0af7376a1317da93eb15ddd07ee2 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Fri, 8 May 2015 14:19:01 -0700 Subject: [PATCH 0022/1358] Added typings and tests for core-js --- core-js/core-js-tests.ts | Bin 0 -> 45732 bytes core-js/core-js-tests.ts.tscparams | Bin 0 -> 94 bytes core-js/core-js.d.ts | 3037 ++++++++++++++++++++++++++++ 3 files changed, 3037 insertions(+) create mode 100644 core-js/core-js-tests.ts create mode 100644 core-js/core-js-tests.ts.tscparams create mode 100644 core-js/core-js.d.ts diff --git a/core-js/core-js-tests.ts b/core-js/core-js-tests.ts new file mode 100644 index 0000000000000000000000000000000000000000..4b9f6f9d7c63ced3b95e8f3b50ae2ea81e9fae29 GIT binary patch literal 45732 zcmd^Idv6=Z5x>6+^g9SiQOH23v<;8|jblKFlvYV?3s%|`FpNfTGt~>E5=Sob)!WYR zhQpcJ+ZV|bB{C2!i@e==@67D%y!|8O}cSwoeomk7qTl{f0rit+hx(rqTwuN;+Q#%b#QHu1AJkt^-&^W;*tR<) zICstGEp~Y_Zl8>))u`p?Ja|5gV6c#n+UG|kjq4U0aCi)7ZHvw33DNNdNp++7sg>PH z(C)fz_mZUd15tfU6nQwK_W3J%cHZogTyBErW8&?yZNqY5RPacpcHxQSkJn zwGD2wGx^)o@NdG-I^Ay}+|cI{QF_;W(?0R7Z(2TKJFpGaU8>b5q-Ea{R^VG7621}9 zcGtWl+g6yq-|Oa0Wj|o>eeq4H|3NEjmN0r-iI@7uCC4;CE1^tF@U~m4Mt`>NQu_mA z>)Q7<@t|YiqbamESy}vz#tdu%x=>i#Qyt0krxV(q1zH&rPFT<(Sv^K%SEqYHi>F5C zHP9@#-dehlyE4!oZ)oItOU%=*J;lOe__P%yuAk7Sj8P%pwxhW$y|BkD(hU0o+Y96G zm3r8swr0)hXQuTj*_DkJp8xrHx75_pU@0i+H{<~PTkERBXh+#R7*)#pR~_cp#=iQI z_BHuyjutALl(t`xg`)L5JX(Wm$3lfckUb8*Gm{tCB!Vy7_Ws^rsQ|z0U^n5 z+>s}imJqYF@x3Kl%2Nv=M*j`rzb4JWLQWgWH#|&m#aa#9S?D2sHIRkcGW0U-C7SDL z^^oE;T4;5&X;$aqccp7#BOA?27SR4dIvl#OE1G&boh^k>PN)ZFNnL7oCQmFKb-hJa zF$gg!SsFAhXm9WTF>mC#`G?J_{wNQ-&6nhZwkZcvzq-+U+Ind_i`{5`Pvh?^$`nz9 zxFy|O(_aebIek8%r^x?#Hje*4rCP+bnG0``&l}UvkY>ME4g6ZX75qT@DSX6jGa%m$ zuYov#xhrN|1N!@{?WvS)5ElOv#|bzC!t3Wx()KLie2eHmB#(t^4D92?@X~Gjw&i<3 zd|$N~&;u2iEhE8IwWSYR9w6@o*RY@TqpX+WKdYnDZtY zd6eh0*U$>l7RjEo1M3m&a~bn8R_!xXM{meG44QXjo2Z$>LQ{~==;;OhT4hOK3`$M)i0Z36x`vZ+SMHB-#&V29 zNI|P-47A)isBn=O}I(5F3}*?`yI(jYJ6k*V7he7r=E+|FD**{I9mXf)B|6u%<0q-=A90 zHc1ANP)4d`<7ge~X_I6Kt;So61xSqTww5^nU|Y?m@LS!Lp&k$?vTCj4=F5qlE5{o5 zg=eA5L*NngJz38Y$?f||J|%5O#KRfc@FCgEc=BvrtfuVc?Aj80In-Z~S*Z-t9?q^a zu}$)9encJtH4#)%t@rTl*(y*uIiA>KIFc_rw5-o4wvykXoe%poXWpYq?@L+>@bhWk z5;Oj<+7ZpULTt=+dtgq0yb*qJ6!jC`J}*f6FDly}P+RQDN#hak_Rr>D#QQdJ zwM&2P5zcSvufNd0SHavT?2ESZ^+kq1B1xVS)(f&z*gX84c#=4^+Kc&|uZQ=%f=R|5 z#?eLdzWJp2laqb7-H@tns4sT?V7IMQ7_GH*TR{@%%^#aT6fkqU5`6;grT~p2^(EoW zQ-_#0CeM^_1x~Mut&mHUTVYpN4Ng?IYOun}YVf{otGB4)*60?|lB>{p$#B&OEl&zE zJf=vAOv}R4c(B?&xEvF0?Q&cd2kkzob&(VJkQ|Bm3+p9_?>5u=mTdccS}*Z^u>;e$ z#?C>Ga}1qlq*nGdE!1PDpdh}^_>^m&cn5u2(IYUN1rgbK) z7#+8<=YZxa$fOTxY)b8^3_~hGoN1NXb2fEMzOmGjb9&^&Sd%HWMifOft${plXMxAW zKW3k0$Tt+(1GLi&y>>{vN^KCA`?TY^#Miy!9}Y2463<RK5S?KL6!KP+2L>{+`|VYb~#;9^@eAD$U|U1CvA+i`rjhEg;zOf$1{AuDOrTbBi3?6 zZDCvN5w)%2UiYj8(FChAyvLq*Bh+OthzmDvo(|b_{ZMLzvY%=|{zO`bvvqC5{nthI z;Dfp5xfw@0wJ~{y5f1so25q(>&p8j-CHWyzZqmG>S0e> zPl&Y_oKE>=IwrJ|%$`zkvd6X5NTiV#9Hndve&XS!p1_db_35S4#6Ug6t&`>k-$FLJ8I7DhzPizxqJqbIy;%FnD^tv$ym zjzcI((aMc$59^+Z>`nbK&r9pF5F6z%KNg?PFkthNi|Cvq-;Se>?Ky6J7`}mik7(X> zLRr%#{jc~qhQP|#L0jM>X->@Nf<`D~5VLH2<3wM?Ak_e%S68laht+q4pyaq47Q?(6_CsUiB}Q z4f~bFB%XrVkGzG#`Q;s_uWuR4IVhIv6?tdmfO0Bo7Hsf*a@wXGqp>R=`=8Qtvee8g ze2K&?}v3C-@F)fkLeBZj@7GMT65H@lfd@%|caNPm`pt(yN2hYVT&&hsm=nhpQF{!1FU~oG)MA~W4_e4u(;!6-M60&V$9p!FBYpQPxh zoW8)g#W!;Ax2~A@cD8=-BvHNdF?(55r8W6@>5S|9q3IPH*d%+%(Xvez!}sXKH16#W zH>mM_M5$HsvS(=+7}y8Sc9504VR4ctxWS zw}J2}8s$5E2L@tUtjB8a@&)IIZ9cp~w=h@^;dO85=Yq~JZW8B+@_c$teV4WNZQ5CM zH?^b`Oq{d#cZVo!@rYfhj9aW!_KAn|Vh36Iz=<`1R9@LoP|C)g~V}2 zPlY1B0FIuT&e2tZGMs945h(sNW*DRPCOgM)a{|tAB95>{v9Awxjh(@I=9N!k=}FR* z^~o6#k&d^kx?ZgF*>T|%u*at-QbX=?=Vy1w%EPm% zq1JZ^4}RUAz~&arc}YgdhfdpB-4)T~DPzxVDNAw1yO7b6CCzs4t-r3XjJA3Dsy~&u zRpOrMPFt9#LbHa|&H-}S(r3kcQ9h$nHEN+aVS~Fax_1Sloj>~nUk{1GpLL&Jkd5Q4 zSh~f?v`}5d?>_|mYZ_aUO=JBCx1KBI7LRYq-grRmai4+QzOEy1(C%FieX`z?2;3M| zfP=dVaee@;kzb*DQbW6(qhPA>zB`OYwnv<=w^GFUP2o>kDvs5*Rq!F6Lv`n8on0HW zl_$tdeYxD1fEy0^Zm{?>u|}LQ00hmfECjL0ZYxi#&20Rw5B}VS#x&pGp4v&n3Qtcd zG(_-A;-Y)c{H&RWk18Sy1|I=FWPcQg2LrBxJ+aji@FPm)FGa~??^19G%9e1Va|--XCCXI=?N!v&=& zn1WMAsipS^vN%NUJY@BHDI8t8C7dJhS@J(Aa+|DD(dgv-q)i}P>Pl7)- zg86Q)vNd>!{!e942hr%?d07Atb2wq}>I zPf(dY|HwQD_pnEgvPyK9MhlSIlR&Vp-yGBdc1jBxcp zTnET=rems0Gq2m>4zm=^?1RwL-zpHxvILrDS+m1U(GjOTzdyzMPkfTPc3fgxG$VoC z%9ekGsMNZ(Kk4b$L$t?g%USt&K@v&bK`egF>I16=W18)&6ye##4y9&hpYxrfn9pM# z>(`*w?{U2F{p?PaaBV_y=3!tShe)69ud-Neo$}cEvehT=I>rwEen$^R1=ioOr};En zJJ<2U?>$);DJvhjk;6P=WN>8T-!e-0DY6&5U#8Rw8IHUILDzc(2Hs6RjyzX7*TJgg zUF&_@v%J||rIm{W-PWruTje@u%b|Z2DfoHWYqG*Oll`%^J%%&);Jqq>Cr$}R60Gsz zUhN$kA9(lLCe>c}FHg6ON&D2U6?fq%cd@?vG^UaJ%RF#V{Mx^ZSK_m@;n*ynY+SCH zEvG2oGP45AUr(}ftizPvn z-QCy4p_&d?Z_@I}uQG8>jcW(7F%DS@Y_t*z{8g*)_|XDBxw5owoQC6eeL0PJka})IkL%YW<5mwF zTCU}WtCHQQs%!A8L$lrG@K~uE$qg{&bZz%TTOxR$?0==)xNovRfOEi&i!!= zjy%`+MmUe_E|h?-t8u&ShUbFS|7vSW`N&m5<&4Fdk$_h3*VB4;S{ubm64wYYr^b6l5#7&ww_3ab z6=ysLQEaNEoV5xJZT)MoO<8#r?&Uq-tS@;}rB)sD?f>3qoXu)`oJi!IJlgZuV81E>U)SSoF!fZWg?E$K9B_ZS4pXy_rzYD`8vNcU zzn@?89BuD8k~ooiu9;t|MGe=0^4K_E-yF~Ga_u{lv*$|GC*-_|?SVBx|L#bIvHE^R zd8>P;B72iz=Z)ws`|v8tqV*6nXcP{_y{ahBkcW?2ep^=(`-HJnAZ-2RnvwCD6LK($oc5;L}Z>vfS4 t+cowI;?yASce5t8axkfurxuLq_B8JQ3`EgC3JbW*0F;b@k_drFg1{6k51bH%3%`HQZ5WltKw)ELChDACdeNzx aN+WTqW=YgnKC3Jo|Hc{FnY3_8mIq$Ba}rDd literal 0 HcmV?d00001 diff --git a/core-js/core-js.d.ts b/core-js/core-js.d.ts new file mode 100644 index 0000000000..476ab99162 --- /dev/null +++ b/core-js/core-js.d.ts @@ -0,0 +1,3037 @@ +// Type definitions for core-js v0.9.7 +// Project: https://github.com/zloirock/core-js/ +// Definitions by: Ron Buckton +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/* ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + +declare type PropertyKey = string | number | symbol; + +// ############################################################################################# +// ECMAScript 6: Object & Function +// Modules: es6.object.assign, es6.object.is, es6.object.set-prototype-of, +// es6.object.to-string, es6.function.name and es6.function.has-instance. +// ############################################################################################# + +interface ObjectConstructor { + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param sources One or more source objects to copy properties from. + */ + assign(target: any, ...sources: any[]): any; + + /** + * Returns true if the values are the same value, false otherwise. + * @param value1 The first value. + * @param value2 The second value. + */ + is(value1: any, value2: any): boolean; + + /** + * Sets the prototype of a specified object o to object proto or null. Returns the object o. + * @param o The object to change its prototype. + * @param proto The value of the new prototype or null. + * @remarks Requires `__proto__` support. + */ + setPrototypeOf(o: any, proto: any): any; +} + +interface Function { + /** + * Returns the name of the function. Function names are read-only and can not be changed. + */ + name: string; + + /** + * Determines if a constructor object recognizes an object as one of the + * constructor’s instances. + * @param value The object to test. + */ + [Symbol.hasInstance](value: any): boolean; +} + +// ############################################################################################# +// ECMAScript 6: Array +// Modules: es6.array.from, es6.array.of, es6.array.copy-within, es6.array.fill, es6.array.find, +// and es6.array.find-index +// ############################################################################################# + +interface ArrayLike { + length: number; + [n: number]: T; +} + +interface Array { + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: T, index: number, obj: Array) => boolean, thisArg?: any): T; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: T) => boolean, thisArg?: any): number; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: T, start?: number, end?: number): T[]; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): T[]; + + [Symbol.unscopables]: any; +} + +interface ArrayConstructor { + /** + * Creates an array from an array-like object. + * @param arrayLike An array-like object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): Array; + + /** + * Creates an array from an iterable object. + * @param iterable An iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(iterable: Iterable, mapfn: (v: T, k: number) => U, thisArg?: any): Array; + + /** + * Creates an array from an array-like object. + * @param arrayLike An array-like object to convert to an array. + */ + from(arrayLike: ArrayLike): Array; + + /** + * Creates an array from an iterable object. + * @param iterable An iterable object to convert to an array. + */ + from(iterable: Iterable): Array; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: T[]): Array; +} + +// ############################################################################################# +// ECMAScript 6: String & RegExp +// Modules: es6.string.from-code-point, es6.string.raw, es6.string.code-point-at, +// es6.string.ends-with, es6.string.includes, es6.string.repeat, +// es6.string.starts-with, and es6.regexp +// ############################################################################################# + +interface String { + /** + * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point + * value of the UTF-16 encoded code point starting at the string element at position pos in + * the String resulting from converting this object to a String. + * If there is no element at that position, the result is undefined. + * If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos. + */ + codePointAt(pos: number): number; + + /** + * Returns true if searchString appears as a substring of the result of converting this + * object to a String, at one or more positions that are + * greater than or equal to position; otherwise, returns false. + * @param searchString search string + * @param position If position is undefined, 0 is assumed, so as to search all of the String. + */ + includes(searchString: string, position?: number): boolean; + + /** + * Returns true if the sequence of elements of searchString converted to a String is the + * same as the corresponding elements of this object (converted to a String) starting at + * endPosition – length(this). Otherwise returns false. + */ + endsWith(searchString: string, endPosition?: number): boolean; + + /** + * Returns a String value that is made from count copies appended together. If count is 0, + * T is the empty String is returned. + * @param count number of copies to append + */ + repeat(count: number): string; + + /** + * Returns true if the sequence of elements of searchString converted to a String is the + * same as the corresponding elements of this object (converted to a String) starting at + * position. Otherwise returns false. + */ + startsWith(searchString: string, position?: number): boolean; +} + +interface StringConstructor { + /** + * Return the String value whose elements are, in order, the elements in the List elements. + * If length is 0, the empty string is returned. + */ + fromCodePoint(...codePoints: number[]): string; + + /** + * String.raw is intended for use as a tag function of a Tagged Template String. When called + * as such the first argument will be a well formed template call site object and the rest + * parameter will contain the substitution values. + * @param template A well-formed template string call site representation. + * @param substitutions A set of substitution values. + */ + raw(template: TemplateStringsArray, ...substitutions: any[]): string; +} + +interface RegExp { + /** + * Returns a string indicating the flags of the regular expression in question. This field is read-only. + * The characters in this string are sequenced and concatenated in the following order: + * + * - "g" for global + * - "i" for ignoreCase + * - "m" for multiline + * - "u" for unicode + * - "y" for sticky + * + * If no flags are set, the value is the empty string. + */ + flags: string; +} + +// ############################################################################################# +// ECMAScript 6: Number & Math +// Modules: es6.number.constructor, es6.number.statics, and es6.math +// ############################################################################################# + +interface NumberConstructor { + /** + * The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1 + * that is representable as a Number value, which is approximately: + * 2.2204460492503130808472633361816 x 10‍−‍16. + */ + EPSILON: number; + + /** + * Returns true if passed value is finite. + * Unlike the global isFininte, Number.isFinite doesn't forcibly convert the parameter to a + * number. Only finite values of the type number, result in true. + * @param number A numeric value. + */ + isFinite(number: number): boolean; + + /** + * Returns true if the value passed is an integer, false otherwise. + * @param number A numeric value. + */ + isInteger(number: number): boolean; + + /** + * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a + * number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter + * to a number. Only values of the type number, that are also NaN, result in true. + * @param number A numeric value. + */ + isNaN(number: number): boolean; + + /** + * Returns true if the value passed is a safe integer. + * @param number A numeric value. + */ + isSafeInteger(number: number): boolean; + + /** + * The value of the largest integer n such that n and n + 1 are both exactly representable as + * a Number value. + * The value of Number.MIN_SAFE_INTEGER is 9007199254740991 2^53 − 1. + */ + MAX_SAFE_INTEGER: number; + + /** + * The value of the smallest integer n such that n and n − 1 are both exactly representable as + * a Number value. + * The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−(2^53 − 1)). + */ + MIN_SAFE_INTEGER: number; + + /** + * Converts a string to a floating-point number. + * @param string A string that contains a floating-point number. + */ + parseFloat(string: string): number; + + /** + * Converts A string to an integer. + * @param s A string to convert into a number. + * @param radix A value between 2 and 36 that specifies the base of the number in numString. + * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. + * All other strings are considered decimal. + */ + parseInt(string: string, radix?: number): number; +} + +interface Math { + /** + * Returns the number of leading zero bits in the 32-bit binary representation of a number. + * @param x A numeric expression. + */ + clz32(x: number): number; + + /** + * Returns the result of 32-bit multiplication of two numbers. + * @param x First number + * @param y Second number + */ + imul(x: number, y: number): number; + + /** + * Returns the sign of the x, indicating whether x is positive, negative or zero. + * @param x The numeric expression to test + */ + sign(x: number): number; + + /** + * Returns the base 10 logarithm of a number. + * @param x A numeric expression. + */ + log10(x: number): number; + + /** + * Returns the base 2 logarithm of a number. + * @param x A numeric expression. + */ + log2(x: number): number; + + /** + * Returns the natural logarithm of 1 + x. + * @param x A numeric expression. + */ + log1p(x: number): number; + + /** + * Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of + * the natural logarithms). + * @param x A numeric expression. + */ + expm1(x: number): number; + + /** + * Returns the hyperbolic cosine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + cosh(x: number): number; + + /** + * Returns the hyperbolic sine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + sinh(x: number): number; + + /** + * Returns the hyperbolic tangent of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + tanh(x: number): number; + + /** + * Returns the inverse hyperbolic cosine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + acosh(x: number): number; + + /** + * Returns the inverse hyperbolic sine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + asinh(x: number): number; + + /** + * Returns the inverse hyperbolic tangent of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + atanh(x: number): number; + + /** + * Returns the square root of the sum of squares of its arguments. + * @param values Values to compute the square root for. + * If no arguments are passed, the result is +0. + * If there is only one argument, the result is the absolute value. + * If any argument is +Infinity or -Infinity, the result is +Infinity. + * If any argument is NaN, the result is NaN. + * If all arguments are either +0 or −0, the result is +0. + */ + hypot(...values: number[]): number; + + /** + * Returns the integral part of the a numeric expression, x, removing any fractional digits. + * If x is already an integer, the result is x. + * @param x A numeric expression. + */ + trunc(x: number): number; + + /** + * Returns the nearest single precision float representation of a number. + * @param x A numeric expression. + */ + fround(x: number): number; + + /** + * Returns an implementation-dependent approximation to the cube root of number. + * @param x A numeric expression. + */ + cbrt(x: number): number; +} + +// ############################################################################################# +// ECMAScript 6: Symbols +// Modules: es6.symbol +// ############################################################################################# + +interface Symbol { + /** Returns a string representation of an object. */ + toString(): string; + + [Symbol.toStringTag]: string; +} + +interface SymbolConstructor { + /** + * A reference to the prototype. + */ + prototype: Symbol; + + /** + * Returns a new unique Symbol value. + * @param description Description of the new Symbol object. + */ + (description?: string|number): symbol; + + /** + * Returns a Symbol object from the global symbol registry matching the given key if found. + * Otherwise, returns a new symbol with this key. + * @param key key to search for. + */ + for(key: string): symbol; + + /** + * Returns a key from the global symbol registry matching the given Symbol if found. + * Otherwise, returns a undefined. + * @param sym Symbol to find the key for. + */ + keyFor(sym: symbol): string; + + // Well-known Symbols + + /** + * A method that determines if a constructor object recognizes an object as one of the + * constructor’s instances. Called by the semantics of the instanceof operator. + */ + hasInstance: symbol; + + /** + * A Boolean value that if true indicates that an object should flatten to its array elements + * by Array.prototype.concat. + */ + isConcatSpreadable: symbol; + + /** + * A method that returns the default iterator for an object. Called by the semantics of the + * for-of statement. + */ + iterator: symbol; + + /** + * A regular expression method that matches the regular expression against a string. Called + * by the String.prototype.match method. + */ + match: symbol; + + /** + * A regular expression method that replaces matched substrings of a string. Called by the + * String.prototype.replace method. + */ + replace: symbol; + + /** + * A regular expression method that returns the index within a string that matches the + * regular expression. Called by the String.prototype.search method. + */ + search: symbol; + + /** + * A function valued property that is the constructor function that is used to create + * derived objects. + */ + species: symbol; + + /** + * A regular expression method that splits a string at the indices that match the regular + * expression. Called by the String.prototype.split method. + */ + split: symbol; + + /** + * A method that converts an object to a corresponding primitive value.Called by the ToPrimitive + * abstract operation. + */ + toPrimitive: symbol; + + /** + * A String value that is used in the creation of the default string description of an object. + * Called by the built-in method Object.prototype.toString. + */ + toStringTag: symbol; + + /** + * An Object whose own property names are property names that are excluded from the with + * environment bindings of the associated objects. + */ + unscopables: symbol; + + /** + * Non-standard. Use simple mode for core-js symbols. See https://github.com/zloirock/core-js/#caveats-when-using-symbol-polyfill + */ + useSimple(): void; + + /** + * Non-standard. Use setter mode for core-js symbols. See https://github.com/zloirock/core-js/#caveats-when-using-symbol-polyfill + */ + userSetter(): void; +} + +declare var Symbol: SymbolConstructor; + +interface Object { + /** + * Determines whether an object has a property with the specified name. + * @param v A property name. + */ + hasOwnProperty(v: PropertyKey): boolean; + + /** + * Determines whether a specified property is enumerable. + * @param v A property name. + */ + propertyIsEnumerable(v: PropertyKey): boolean; +} + +interface ObjectConstructor { + /** + * Returns an array of all symbol properties found directly on object o. + * @param o Object to retrieve the symbols from. + */ + getOwnPropertySymbols(o: any): symbol[]; + + /** + * Gets the own property descriptor of the specified object. + * An own property descriptor is one that is defined directly on the object and is not + * inherited from the object's prototype. + * @param o Object that contains the property. + * @param p Name of the property. + */ + getOwnPropertyDescriptor(o: any, propertyKey: PropertyKey): PropertyDescriptor; + + /** + * Adds a property to an object, or modifies attributes of an existing property. + * @param o Object on which to add or modify the property. This can be a native JavaScript + * object (that is, a user-defined object or a built in object) or a DOM object. + * @param p The property name. + * @param attributes Descriptor for the property. It can be for a data property or an accessor + * property. + */ + defineProperty(o: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): any; +} + +interface Math { + [Symbol.toStringTag]: string; +} + +interface JSON { + [Symbol.toStringTag]: string; +} + +// ############################################################################################# +// ECMAScript 6: Collections +// Modules: es6.map, es6.set, es6.weak-map, and es6.weak-set +// ############################################################################################# + +interface Map { + clear(): void; + delete(key: K): boolean; + forEach(callbackfn: (value: V, index: K, map: Map) => void, thisArg?: any): void; + get(key: K): V; + has(key: K): boolean; + set(key: K, value?: V): Map; + size: number; +} + +interface MapConstructor { + new (): Map; + new (iterable: Iterable<[K, V]>): Map; + prototype: Map; +} + +declare var Map: MapConstructor; + +interface Set { + add(value: T): Set; + clear(): void; + delete(value: T): boolean; + forEach(callbackfn: (value: T, index: T, set: Set) => void, thisArg?: any): void; + has(value: T): boolean; + size: number; +} + +interface SetConstructor { + new (): Set; + new (iterable: Iterable): Set; + prototype: Set; +} + +declare var Set: SetConstructor; + +interface WeakMap { + delete(key: K): boolean; + get(key: K): V; + has(key: K): boolean; + set(key: K, value?: V): WeakMap; +} + +interface WeakMapConstructor { + new (): WeakMap; + new (iterable: Iterable<[K, V]>): WeakMap; + prototype: WeakMap; +} + +declare var WeakMap: WeakMapConstructor; + +interface WeakSet { + add(value: T): WeakSet; + delete(value: T): boolean; + has(value: T): boolean; +} + +interface WeakSetConstructor { + new (): WeakSet; + new (iterable: Iterable): WeakSet; + prototype: WeakSet; +} + +declare var WeakSet: WeakSetConstructor; + +// ############################################################################################# +// ECMAScript 6: Iterators +// Modules: es6.string.iterator, es6.array.iterator, es6.map, es6.set, web.dom.iterable +// ############################################################################################# + +interface IteratorResult { + done: boolean; + value?: T; +} + +interface Iterator { + next(value?: any): IteratorResult; + return?(value?: any): IteratorResult; + throw?(e?: any): IteratorResult; +} + +interface Iterable { + [Symbol.iterator](): Iterator; +} + +interface IterableIterator extends Iterator { + [Symbol.iterator](): IterableIterator; +} + +interface String { + /** Iterator */ + [Symbol.iterator](): IterableIterator; +} + +interface Array { + /** Iterator */ + [Symbol.iterator](): IterableIterator; + + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, T]>; + + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Map { + entries(): IterableIterator<[K, V]>; + keys(): IterableIterator; + values(): IterableIterator; + [Symbol.iterator](): IterableIterator<[K, V]>; +} + +interface Set { + entries(): IterableIterator<[T, T]>; + keys(): IterableIterator; + values(): IterableIterator; + [Symbol.iterator](): IterableIterator; +} + +interface NodeList { + [Symbol.iterator](): IterableIterator; +} + +interface $for extends IterableIterator { + of(callbackfn: (value: T, key: any) => void, thisArg?: any): void; + array(): T[]; + array(callbackfn: (value: T, key: any) => U, thisArg?: any): U[]; + filter(callbackfn: (value: T, key: any) => boolean, thisArg?: any): $for; + map(callbackfn: (value: T, key: any) => U, thisArg?: any): $for; +} + +declare function $for(iterable: Iterable): $for; + +// ############################################################################################# +// ECMAScript 6: Promises +// Modules: es6.promise +// ############################################################################################# + +interface PromiseLike { + /** + * Attaches callbacks for the resolution and/or rejection of the Promise. + * @param onfulfilled The callback to execute when the Promise is resolved. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): PromiseLike; + then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): PromiseLike; +} + +/** + * Represents the completion of an asynchronous operation + */ +interface Promise { + /** + * Attaches callbacks for the resolution and/or rejection of the Promise. + * @param onfulfilled The callback to execute when the Promise is resolved. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; + then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): Promise; + + /** + * Attaches a callback for only the rejection of the Promise. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of the callback. + */ + catch(onrejected?: (reason: any) => T | PromiseLike): Promise; + catch(onrejected?: (reason: any) => void): Promise; +} + +interface PromiseConstructor { + /** + * A reference to the prototype. + */ + prototype: Promise; + + /** + * Creates a new Promise. + * @param executor A callback used to initialize the promise. This callback is passed two arguments: + * a resolve callback used resolve the promise with a value or the result of another promise, + * and a reject callback used to reject the promise with a provided reason or error. + */ + new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void): Promise; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: Iterable>): Promise; + + /** + * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved + * or rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + race(values: Iterable>): Promise; + + /** + * Creates a new rejected promise for the provided reason. + * @param reason The reason the promise was rejected. + * @returns A new rejected Promise. + */ + reject(reason: any): Promise; + + /** + * Creates a new rejected promise for the provided reason. + * @param reason The reason the promise was rejected. + * @returns A new rejected Promise. + */ + reject(reason: any): Promise; + + /** + * Creates a new resolved promise for the provided value. + * @param value A promise. + * @returns A promise whose internal state matches the provided promise. + */ + resolve(value: T | PromiseLike): Promise; + + /** + * Creates a new resolved promise . + * @returns A resolved promise. + */ + resolve(): Promise; +} + +declare var Promise: PromiseConstructor; + +// ############################################################################################# +// ECMAScript 6: Reflect +// Modules: es6.reflect +// ############################################################################################# + +declare module Reflect { + function apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any; + function construct(target: Function, argumentsList: ArrayLike, newTarget?: any): any; + function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean; + function deleteProperty(target: any, propertyKey: PropertyKey): boolean; + function enumerate(target: any): IterableIterator; + function get(target: any, propertyKey: PropertyKey, receiver?: any): any; + function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor; + function getPrototypeOf(target: any): any; + function has(target: any, propertyKey: PropertyKey): boolean; + function isExtensible(target: any): boolean; + function ownKeys(target: any): Array; + function preventExtensions(target: any): boolean; + function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean; + function setPrototypeOf(target: any, proto: any): boolean; +} + +// ############################################################################################# +// ECMAScript 7 +// Modules: es7.array.includes, es7.string.at, es7.string.lpad, es7.string.rpad, +// es7.object.to-array, es7.object.get-own-property-descriptors, es7.regexp.escape, +// es7.map.to-json, and es7.set.to-json +// ############################################################################################# + +interface Array { + includes(value: T, fromIndex?: number): boolean; +} + +interface String { + at(index: number): string; + lpad(length: number, fillStr?: string): string; + rpad(length: number, fillStr?: string): string; +} + +interface ObjectConstructor { + values(object: any): any[]; + entries(object: any): [string, any][]; + getOwnPropertyDescriptors(object: any): PropertyDescriptorMap; +} + +interface RegExpConstructor { + escape(str: string): string; +} + +interface Map { + toJSON(): any; +} + +interface Set { + toJSON(): any; +} + +// ############################################################################################# +// Mozilla JavaScript: Array generics +// Modules: js.array.statics +// ############################################################################################# + +interface ArrayConstructor { + /** + * Appends new elements to an array, and returns the new length of the array. + * @param items New elements of the Array. + */ + push(array: ArrayLike, ...items: T[]): number; + /** + * Removes the last element from an array and returns it. + */ + pop(array: ArrayLike): T; + /** + * Combines two or more arrays. + * @param items Additional items to add to the end of array1. + */ + concat(array: ArrayLike, ...items: (T[]| T)[]): T[]; + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma. + */ + join(array: ArrayLike, separator?: string): string; + /** + * Reverses the elements in an Array. + */ + reverse(array: ArrayLike): T[]; + /** + * Removes the first element from an array and returns it. + */ + shift(array: ArrayLike): T; + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(array: ArrayLike, start?: number, end?: number): T[]; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(array: ArrayLike, compareFn?: (a: T, b: T) => number): T[]; + + /** + * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. + * @param start The zero-based location in the array from which to start removing elements. + */ + splice(array: ArrayLike, start: number): T[]; + + /** + * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. + * @param start The zero-based location in the array from which to start removing elements. + * @param deleteCount The number of elements to remove. + * @param items Elements to insert into the array in place of the deleted elements. + */ + splice(array: ArrayLike, start: number, deleteCount: number, ...items: T[]): T[]; + + /** + * Inserts new elements at the start of an array. + * @param items Elements to insert at the start of the Array. + */ + unshift(array: ArrayLike, ...items: T[]): number; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. + */ + indexOf(array: ArrayLike, searchElement: T, fromIndex?: number): number; + + /** + * Returns the index of the last occurrence of a specified value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array. + */ + lastIndexOf(array: ArrayLike, earchElement: T, fromIndex?: number): number; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + every(array: ArrayLike, callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + some(array: ArrayLike, callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + forEach(array: ArrayLike, callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; + + /** + * Calls a defined callback function on each element of an array, and returns an array that contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + map(array: ArrayLike, callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + filter(array: ArrayLike, callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): T[]; + + /** + * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduce(array: ArrayLike, callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduce(array: ArrayLike, callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduceRight(array: ArrayLike, callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduceRight(array: ArrayLike, callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; + + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(array: ArrayLike): IterableIterator<[number, T]>; + + /** + * Returns an list of keys in the array + */ + keys(array: ArrayLike): IterableIterator; + + /** + * Returns an list of values in the array + */ + values(array: ArrayLike): IterableIterator; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(array: ArrayLike, predicate: (value: T, index: number, obj: Array) => boolean, thisArg?: any): T; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(array: ArrayLike, predicate: (value: T) => boolean, thisArg?: any): number; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(array: ArrayLike, value: T, start?: number, end?: number): T[]; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(array: ArrayLike, target: number, start: number, end?: number): T[]; + + includes(array: ArrayLike, value: T, fromIndex?: number): boolean; + turn(array: ArrayLike, callbackfn: (memo: U, value: T, index: number, array: Array) => void, memo?: U): U; + turn(array: ArrayLike, callbackfn: (memo: Array, value: T, index: number, array: Array) => void, memo?: Array): Array; +} + +// ############################################################################################# +// Object - https://github.com/zloirock/core-js/#object +// Modules: core.object +// ############################################################################################# + +interface ObjectConstructor { + /** + * Non-standard. + */ + isObject(value: any): boolean; + + /** + * Non-standard. + */ + classof(value: any): string; + + /** + * Non-standard. + */ + define(target: T, mixin: any): T; + + /** + * Non-standard. + */ + make(proto: T, mixin?: any): T; +} + +// ############################################################################################# +// Console - https://github.com/zloirock/core-js/#console +// Modules: core.log +// ############################################################################################# + +interface Log extends Console { + (message?: any, ...optionalParams: any[]): void; + enable(): void; + disable(): void; +} + +/** + * Non-standard. + */ +declare var log: Log; + +// ############################################################################################# +// Dict - https://github.com/zloirock/core-js/#dict +// Modules: core.dict +// ############################################################################################# + +interface Dict { + [key: string]: T; + [key: number]: T; + //[key: symbol]: T; +} + +interface DictConstructor { + prototype: Dict; + + new (value?: Dict): Dict; + new (value?: any): Dict; + (value?: Dict): Dict; + (value?: any): Dict; + + isDict(value: any): boolean; + values(object: Dict): IterableIterator; + keys(object: Dict): IterableIterator; + entries(object: Dict): IterableIterator<[PropertyKey, T]>; + has(object: Dict, key: PropertyKey): boolean; + get(object: Dict, key: PropertyKey): T; + set(object: Dict, key: PropertyKey, value: T): Dict; + forEach(object: Dict, callbackfn: (value: T, key: PropertyKey, dict: Dict) => void, thisArg?: any): void; + map(object: Dict, callbackfn: (value: T, key: PropertyKey, dict: Dict) => U, thisArg?: any): Dict; + mapPairs(object: Dict, callbackfn: (value: T, key: PropertyKey, dict: Dict) => [PropertyKey, U], thisArg?: any): Dict; + filter(object: Dict, callbackfn: (value: T, key: PropertyKey, dict: Dict) => boolean, thisArg?: any): Dict; + some(object: Dict, callbackfn: (value: T, key: PropertyKey, dict: Dict) => boolean, thisArg?: any): boolean; + every(object: Dict, callbackfn: (value: T, key: PropertyKey, dict: Dict) => boolean, thisArg?: any): boolean; + find(object: Dict, callbackfn: (value: T, key: PropertyKey, dict: Dict) => boolean, thisArg?: any): T; + findKey(object: Dict, callbackfn: (value: T, key: PropertyKey, dict: Dict) => boolean, thisArg?: any): PropertyKey; + keyOf(object: Dict, value: T): PropertyKey; + includes(object: Dict, value: T): boolean; + reduce(object: Dict, callbackfn: (previousValue: U, value: T, key: PropertyKey, dict: Dict) => U, initialValue: U): U; + reduce(object: Dict, callbackfn: (previousValue: T, value: T, key: PropertyKey, dict: Dict) => T, initialValue?: T): T; + turn(object: Dict, callbackfn: (memo: Dict, value: T, key: PropertyKey, dict: Dict) => void, memo: Dict): Dict; + turn(object: Dict, callbackfn: (memo: Dict, value: T, key: PropertyKey, dict: Dict) => void, memo?: Dict): Dict; +} + +/** + * Non-standard. + */ +declare var Dict: DictConstructor; + +// ############################################################################################# +// Partial application - https://github.com/zloirock/core-js/#partial-application +// Modules: core.function.part +// ############################################################################################# + +interface Function { + /** + * Non-standard. + */ + part(...args: any[]): any; +} + +// ############################################################################################# +// Date formatting - https://github.com/zloirock/core-js/#date-formatting +// Modules: core.date +// ############################################################################################# + +interface Date { + /** + * Non-standard. + */ + format(template: string, locale?: string): string; + + /** + * Non-standard. + */ + formatUTC(template: string, locale?: string): string; +} + +// ############################################################################################# +// Array - https://github.com/zloirock/core-js/#array +// Modules: core.array.turn +// ############################################################################################# + +interface Array { + /** + * Non-standard. + */ + turn(callbackfn: (memo: U, value: T, index: number, array: Array) => void, memo?: U): U; + + /** + * Non-standard. + */ + turn(callbackfn: (memo: Array, value: T, index: number, array: Array) => void, memo?: Array): Array; +} + +// ############################################################################################# +// Number - https://github.com/zloirock/core-js/#number +// Modules: core.number.iterator +// ############################################################################################# + +interface Number { + /** + * Non-standard. + */ + [Symbol.iterator](): IterableIterator; +} + +// ############################################################################################# +// Escaping characters - https://github.com/zloirock/core-js/#escaping-characters +// Modules: core.string.escape-html +// ############################################################################################# + +interface String { + /** + * Non-standard. + */ + escapeHTML(): string; + + /** + * Non-standard. + */ + unescapeHTML(): string; +} + +// ############################################################################################# +// delay - https://github.com/zloirock/core-js/#delay +// Modules: core.delay +// ############################################################################################# + +declare function delay(msec: number): Promise; + +declare module core { + module Reflect { + function apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any; + function construct(target: Function, argumentsList: ArrayLike): any; + function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean; + function deleteProperty(target: any, propertyKey: PropertyKey): boolean; + function enumerate(target: any): IterableIterator; + function get(target: any, propertyKey: PropertyKey, receiver?: any): any; + function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor; + function getPrototypeOf(target: any): any; + function has(target: any, propertyKey: string): boolean; + function has(target: any, propertyKey: symbol): boolean; + function isExtensible(target: any): boolean; + function ownKeys(target: any): Array; + function preventExtensions(target: any): boolean; + function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean; + function setPrototypeOf(target: any, proto: any): boolean; + } + + var Object: { + getPrototypeOf(o: any): any; + getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor; + getOwnPropertyNames(o: any): string[]; + create(o: any, properties?: PropertyDescriptorMap): any; + defineProperty(o: any, p: string, attributes: PropertyDescriptor): any; + defineProperties(o: any, properties: PropertyDescriptorMap): any; + seal(o: T): T; + freeze(o: T): T; + preventExtensions(o: T): T; + isSealed(o: any): boolean; + isFrozen(o: any): boolean; + isExtensible(o: any): boolean; + keys(o: any): string[]; + assign(target: any, ...sources: any[]): any; + is(value1: any, value2: any): boolean; + setPrototypeOf(o: any, proto: any): any; + getOwnPropertySymbols(o: any): symbol[]; + getOwnPropertyDescriptor(o: any, propertyKey: PropertyKey): PropertyDescriptor; + defineProperty(o: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): any; + values(object: any): any[]; + entries(object: any): any[]; + getOwnPropertyDescriptors(object: any): PropertyDescriptorMap; + isObject(value: any): boolean; + classof(value: any): string; + define(target: T, mixin: any): T; + make(proto: T, mixin?: any): T; + }; + + var Function: { + bind(target: Function, thisArg: any, ...argArray: any[]): any; + part(target: Function, ...args: any[]): any; + }; + + var Array: { + from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): Array; + from(iterable: Iterable, mapfn: (v: T, k: number) => U, thisArg?: any): Array; + from(arrayLike: ArrayLike): Array; + from(iterable: Iterable): Array; + of(...items: T[]): Array; + push(array: ArrayLike, ...items: T[]): number; + pop(array: ArrayLike): T; + concat(array: ArrayLike, ...items: (T[]| T)[]): T[]; + join(array: ArrayLike, separator?: string): string; + reverse(array: ArrayLike): T[]; + shift(array: ArrayLike): T; + slice(array: ArrayLike, start?: number, end?: number): T[]; + sort(array: ArrayLike, compareFn?: (a: T, b: T) => number): T[]; + splice(array: ArrayLike, start: number): T[]; + splice(array: ArrayLike, start: number, deleteCount: number, ...items: T[]): T[]; + unshift(array: ArrayLike, ...items: T[]): number; + indexOf(array: ArrayLike, searchElement: T, fromIndex?: number): number; + lastIndexOf(array: ArrayLike, earchElement: T, fromIndex?: number): number; + every(array: ArrayLike, callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; + some(array: ArrayLike, callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; + forEach(array: ArrayLike, callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; + map(array: ArrayLike, callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; + filter(array: ArrayLike, callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): T[]; + reduce(array: ArrayLike, callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; + reduce(array: ArrayLike, callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; + reduceRight(array: ArrayLike, callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; + reduceRight(array: ArrayLike, callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; + entries(array: ArrayLike): IterableIterator<[number, T]>; + keys(array: ArrayLike): IterableIterator; + values(array: ArrayLike): IterableIterator; + find(array: ArrayLike, predicate: (value: T, index: number, obj: Array) => boolean, thisArg?: any): T; + findIndex(array: ArrayLike, predicate: (value: T) => boolean, thisArg?: any): number; + fill(array: ArrayLike, value: T, start?: number, end?: number): T[]; + copyWithin(array: ArrayLike, target: number, start: number, end?: number): T[]; + includes(array: ArrayLike, value: T, fromIndex?: number): boolean; + turn(array: ArrayLike, callbackfn: (memo: Array, value: T, index: number, array: Array) => void, memo?: Array): Array; + turn(array: ArrayLike, callbackfn: (memo: U, value: T, index: number, array: Array) => void, memo?: U): U; + }; + + var String: { + codePointAt(text: string, pos: number): number; + includes(text: string, searchString: string, position?: number): boolean; + endsWith(text: string, searchString: string, endPosition?: number): boolean; + repeat(text: string, count: number): string; + fromCodePoint(...codePoints: number[]): string; + raw(template: TemplateStringsArray, ...substitutions: any[]): string; + startsWith(text: string, searchString: string, position?: number): boolean; + at(text: string, index: number): string; + lpad(text: string, length: number, fillStr?: string): string; + rpad(text: string, length: number, fillStr?: string): string; + escapeHTML(text: string): string; + unescapeHTML(text: string): string; + }; + + var Date: { + now(): number; + toISOString(date: Date): string; + format(date: Date, template: string, locale?: string): string; + formatUTC(date: Date, template: string, locale?: string): string; + }; + + var Number: { + EPSILON: number; + isFinite(number: number): boolean; + isInteger(number: number): boolean; + isNaN(number: number): boolean; + isSafeInteger(number: number): boolean; + MAX_SAFE_INTEGER: number; + MIN_SAFE_INTEGER: number; + parseFloat(string: string): number; + parseInt(string: string, radix?: number): number; + clz32(x: number): number; + imul(x: number, y: number): number; + sign(x: number): number; + log10(x: number): number; + log2(x: number): number; + log1p(x: number): number; + expm1(x: number): number; + cosh(x: number): number; + sinh(x: number): number; + tanh(x: number): number; + acosh(x: number): number; + asinh(x: number): number; + atanh(x: number): number; + hypot(...values: number[]): number; + trunc(x: number): number; + fround(x: number): number; + cbrt(x: number): number; + random(lim?: number): number; + }; + + var Math: { + clz32(x: number): number; + imul(x: number, y: number): number; + sign(x: number): number; + log10(x: number): number; + log2(x: number): number; + log1p(x: number): number; + expm1(x: number): number; + cosh(x: number): number; + sinh(x: number): number; + tanh(x: number): number; + acosh(x: number): number; + asinh(x: number): number; + atanh(x: number): number; + hypot(...values: number[]): number; + trunc(x: number): number; + fround(x: number): number; + cbrt(x: number): number; + }; + + var RegExp: { + escape(str: string): string; + }; + + var Map: MapConstructor; + var Set: SetConstructor; + var WeakMap: WeakMapConstructor; + var WeakSet: WeakSetConstructor; + var Promise: PromiseConstructor; + var Symbol: SymbolConstructor; + var Dict: DictConstructor; + var global: any; + var log: Log; + var _: boolean; + + function setTimeout(handler: any, timeout?: any, ...args: any[]): number; + + function setInterval(handler: any, timeout?: any, ...args: any[]): number; + + function setImmediate(expression: any, ...args: any[]): number; + + function clearImmediate(handle: number): void; + + function $for(iterable: Iterable): $for; + + function isIterable(value: any): boolean; + + function getIterator(iterable: Iterable): Iterator; + + interface Locale { + weekdays: string; + months: string; + } + + function addLocale(lang: string, locale: Locale): typeof core; + + function locale(lang?: string): string; + + function delay(msec: number): Promise; +} + +declare module "core-js" { + export = core; +} +declare module "core-js/shim" { + export = core; +} +declare module "core-js/core" { + export = core; +} +declare module "core-js/core/$for" { + import $for = core.$for; + export = $for; +} +declare module "core-js/core/_" { + var _: typeof core._; + export = _; +} +declare module "core-js/core/array" { + var Array: typeof core.Array; + export = Array; +} +declare module "core-js/core/date" { + var Date: typeof core.Date; + export = Date; +} +declare module "core-js/core/delay" { + var delay: typeof core.delay; + export = delay; +} +declare module "core-js/core/dict" { + var Dict: typeof core.Dict; + export = Dict; +} +declare module "core-js/core/function" { + var Function: typeof core.Function; + export = Function; +} +declare module "core-js/core/global" { + var global: typeof core.global; + export = global; +} +declare module "core-js/core/log" { + var log: typeof core.log; + export = log; +} +declare module "core-js/core/number" { + var Number: typeof core.Number; + export = Number; +} +declare module "core-js/core/object" { + var Object: typeof core.Object; + export = Object; +} +declare module "core-js/core/string" { + var String: typeof core.String; + export = String; +} +declare module "core-js/fn/$for" { + import $for = core.$for; + export = $for; +} +declare module "core-js/fn/_" { + var _: typeof core._; + export = _; +} +declare module "core-js/fn/clear-immediate" { + var clearImmediate: typeof core.clearImmediate; + export = clearImmediate; +} +declare module "core-js/fn/delay" { + var delay: typeof core.delay; + export = delay; +} +declare module "core-js/fn/dict" { + var Dict: typeof core.Dict; + export = Dict; +} +declare module "core-js/fn/get-iterator" { + var getIterator: typeof core.getIterator; + export = getIterator; +} +declare module "core-js/fn/global" { + var global: typeof core.global; + export = global; +} +declare module "core-js/fn/is-iterable" { + var isIterable: typeof core.isIterable; + export = isIterable; +} +declare module "core-js/fn/log" { + var log: typeof core.log; + export = log; +} +declare module "core-js/fn/map" { + var Map: typeof core.Map; + export = Map; +} +declare module "core-js/fn/promise" { + var Promise: typeof core.Promise; + export = Promise; +} +declare module "core-js/fn/set" { + var Set: typeof core.Set; + export = Set; +} +declare module "core-js/fn/set-immediate" { + var setImmediate: typeof core.setImmediate; + export = setImmediate; +} +declare module "core-js/fn/set-interval" { + var setInterval: typeof core.setInterval; + export = setInterval; +} +declare module "core-js/fn/set-timeout" { + var setTimeout: typeof core.setTimeout; + export = setTimeout; +} +declare module "core-js/fn/weak-map" { + var WeakMap: typeof core.WeakMap; + export = WeakMap; +} +declare module "core-js/fn/weak-set" { + var WeakSet: typeof core.WeakSet; + export = WeakSet; +} +declare module "core-js/fn/array" { + var Array: typeof core.Array; + export = Array; +} +declare module "core-js/fn/array/concat" { + var concat: typeof core.Array.concat; + export = concat; +} +declare module "core-js/fn/array/copy-within" { + var copyWithin: typeof core.Array.copyWithin; + export = copyWithin; +} +declare module "core-js/fn/array/entries" { + var entries: typeof core.Array.entries; + export = entries; +} +declare module "core-js/fn/array/every" { + var every: typeof core.Array.every; + export = every; +} +declare module "core-js/fn/array/fill" { + var fill: typeof core.Array.fill; + export = fill; +} +declare module "core-js/fn/array/filter" { + var filter: typeof core.Array.filter; + export = filter; +} +declare module "core-js/fn/array/find" { + var find: typeof core.Array.find; + export = find; +} +declare module "core-js/fn/array/find-index" { + var findIndex: typeof core.Array.findIndex; + export = findIndex; +} +declare module "core-js/fn/array/for-each" { + var forEach: typeof core.Array.forEach; + export = forEach; +} +declare module "core-js/fn/array/from" { + var from: typeof core.Array.from; + export = from; +} +declare module "core-js/fn/array/includes" { + var includes: typeof core.Array.includes; + export = includes; +} +declare module "core-js/fn/array/index-of" { + var indexOf: typeof core.Array.indexOf; + export = indexOf; +} +declare module "core-js/fn/array/join" { + var join: typeof core.Array.join; + export = join; +} +declare module "core-js/fn/array/keys" { + var keys: typeof core.Array.keys; + export = keys; +} +declare module "core-js/fn/array/last-index-of" { + var lastIndexOf: typeof core.Array.lastIndexOf; + export = lastIndexOf; +} +declare module "core-js/fn/array/map" { + var map: typeof core.Array.map; + export = map; +} +declare module "core-js/fn/array/of" { + var of: typeof core.Array.of; + export = of; +} +declare module "core-js/fn/array/pop" { + var pop: typeof core.Array.pop; + export = pop; +} +declare module "core-js/fn/array/push" { + var push: typeof core.Array.push; + export = push; +} +declare module "core-js/fn/array/reduce" { + var reduce: typeof core.Array.reduce; + export = reduce; +} +declare module "core-js/fn/array/reduce-right" { + var reduceRight: typeof core.Array.reduceRight; + export = reduceRight; +} +declare module "core-js/fn/array/reverse" { + var reverse: typeof core.Array.reverse; + export = reverse; +} +declare module "core-js/fn/array/shift" { + var shift: typeof core.Array.shift; + export = shift; +} +declare module "core-js/fn/array/slice" { + var slice: typeof core.Array.slice; + export = slice; +} +declare module "core-js/fn/array/some" { + var some: typeof core.Array.some; + export = some; +} +declare module "core-js/fn/array/sort" { + var sort: typeof core.Array.sort; + export = sort; +} +declare module "core-js/fn/array/splice" { + var splice: typeof core.Array.splice; + export = splice; +} +declare module "core-js/fn/array/turn" { + var turn: typeof core.Array.turn; + export = turn; +} +declare module "core-js/fn/array/unshift" { + var unshift: typeof core.Array.unshift; + export = unshift; +} +declare module "core-js/fn/array/values" { + var values: typeof core.Array.values; + export = values; +} +declare module "core-js/fn/date" { + var Date: typeof core.Date; + export = Date; +} +declare module "core-js/fn/date/add-locale" { + var addLocale: typeof core.addLocale; + export = addLocale; +} +declare module "core-js/fn/date/format" { + var format: typeof core.Date.format; + export = format; +} +declare module "core-js/fn/date/formatUTC" { + var formatUTC: typeof core.Date.formatUTC; + export = formatUTC; +} +declare module "core-js/fn/function" { + var Function: typeof core.Function; + export = Function; +} +declare module "core-js/fn/function/has-instance" { + var hasInstance: (value: any) => boolean; + export = hasInstance; +} +declare module "core-js/fn/function/name" +{ +} +declare module "core-js/fn/function/part" { + var part: typeof core.Function.part; + export = part; +} +declare module "core-js/fn/math" { + var Math: typeof core.Math; + export = Math; +} +declare module "core-js/fn/math/acosh" { + var acosh: typeof core.Math.acosh; + export = acosh; +} +declare module "core-js/fn/math/asinh" { + var asinh: typeof core.Math.asinh; + export = asinh; +} +declare module "core-js/fn/math/atanh" { + var atanh: typeof core.Math.atanh; + export = atanh; +} +declare module "core-js/fn/math/cbrt" { + var cbrt: typeof core.Math.cbrt; + export = cbrt; +} +declare module "core-js/fn/math/clz32" { + var clz32: typeof core.Math.clz32; + export = clz32; +} +declare module "core-js/fn/math/cosh" { + var cosh: typeof core.Math.cosh; + export = cosh; +} +declare module "core-js/fn/math/expm1" { + var expm1: typeof core.Math.expm1; + export = expm1; +} +declare module "core-js/fn/math/fround" { + var fround: typeof core.Math.fround; + export = fround; +} +declare module "core-js/fn/math/hypot" { + var hypot: typeof core.Math.hypot; + export = hypot; +} +declare module "core-js/fn/math/imul" { + var imul: typeof core.Math.imul; + export = imul; +} +declare module "core-js/fn/math/log10" { + var log10: typeof core.Math.log10; + export = log10; +} +declare module "core-js/fn/math/log1p" { + var log1p: typeof core.Math.log1p; + export = log1p; +} +declare module "core-js/fn/math/log2" { + var log2: typeof core.Math.log2; + export = log2; +} +declare module "core-js/fn/math/sign" { + var sign: typeof core.Math.sign; + export = sign; +} +declare module "core-js/fn/math/sinh" { + var sinh: typeof core.Math.sinh; + export = sinh; +} +declare module "core-js/fn/math/tanh" { + var tanh: typeof core.Math.tanh; + export = tanh; +} +declare module "core-js/fn/math/trunc" { + var trunc: typeof core.Math.trunc; + export = trunc; +} +declare module "core-js/fn/number" { + var Number: typeof core.Number; + export = Number; +} +declare module "core-js/fn/number/epsilon" { + var EPSILON: typeof core.Number.EPSILON; + export = EPSILON; +} +declare module "core-js/fn/number/is-finite" { + var isFinite: typeof core.Number.isFinite; + export = isFinite; +} +declare module "core-js/fn/number/is-integer" { + var isInteger: typeof core.Number.isInteger; + export = isInteger; +} +declare module "core-js/fn/number/is-nan" { + var isNaN: typeof core.Number.isNaN; + export = isNaN; +} +declare module "core-js/fn/number/is-safe-integer" { + var isSafeInteger: typeof core.Number.isSafeInteger; + export = isSafeInteger; +} +declare module "core-js/fn/number/max-safe-integer" { + var MAX_SAFE_INTEGER: typeof core.Number.MAX_SAFE_INTEGER; + export = MAX_SAFE_INTEGER; +} +declare module "core-js/fn/number/min-safe-interger" { + var MIN_SAFE_INTEGER: typeof core.Number.MIN_SAFE_INTEGER; + export = MIN_SAFE_INTEGER; +} +declare module "core-js/fn/number/parse-float" { + var parseFloat: typeof core.Number.parseFloat; + export = parseFloat; +} +declare module "core-js/fn/number/parse-int" { + var parseInt: typeof core.Number.parseInt; + export = parseInt; +} +declare module "core-js/fn/number/random" { + var random: typeof core.Number.random; + export = random; +} +declare module "core-js/fn/object" { + var Object: typeof core.Object; + export = Object; +} +declare module "core-js/fn/object/assign" { + var assign: typeof core.Object.assign; + export = assign; +} +declare module "core-js/fn/object/classof" { + var classof: typeof core.Object.classof; + export = classof; +} +declare module "core-js/fn/object/create" { + var create: typeof core.Object.create; + export = create; +} +declare module "core-js/fn/object/define" { + var define: typeof core.Object.define; + export = define; +} +declare module "core-js/fn/object/define-properties" { + var defineProperties: typeof core.Object.defineProperties; + export = defineProperties; +} +declare module "core-js/fn/object/define-property" { + var defineProperty: typeof core.Object.defineProperty; + export = defineProperty; +} +declare module "core-js/fn/object/entries" { + var entries: typeof core.Object.entries; + export = entries; +} +declare module "core-js/fn/object/freeze" { + var freeze: typeof core.Object.freeze; + export = freeze; +} +declare module "core-js/fn/object/get-own-property-descriptor" { + var getOwnPropertyDescriptor: typeof core.Object.getOwnPropertyDescriptor; + export = getOwnPropertyDescriptor; +} +declare module "core-js/fn/object/get-own-property-descriptors" { + var getOwnPropertyDescriptors: typeof core.Object.getOwnPropertyDescriptors; + export = getOwnPropertyDescriptors; +} +declare module "core-js/fn/object/get-own-property-names" { + var getOwnPropertyNames: typeof core.Object.getOwnPropertyNames; + export = getOwnPropertyNames; +} +declare module "core-js/fn/object/get-own-property-symbols" { + var getOwnPropertySymbols: typeof core.Object.getOwnPropertySymbols; + export = getOwnPropertySymbols; +} +declare module "core-js/fn/object/get-prototype-of" { + var getPrototypeOf: typeof core.Object.getPrototypeOf; + export = getPrototypeOf; +} +declare module "core-js/fn/object/is" { + var is: typeof core.Object.is; + export = is; +} +declare module "core-js/fn/object/is-extensible" { + var isExtensible: typeof core.Object.isExtensible; + export = isExtensible; +} +declare module "core-js/fn/object/is-frozen" { + var isFrozen: typeof core.Object.isFrozen; + export = isFrozen; +} +declare module "core-js/fn/object/is-object" { + var isObject: typeof core.Object.isObject; + export = isObject; +} +declare module "core-js/fn/object/is-sealed" { + var isSealed: typeof core.Object.isSealed; + export = isSealed; +} +declare module "core-js/fn/object/keys" { + var keys: typeof core.Object.keys; + export = keys; +} +declare module "core-js/fn/object/make" { + var make: typeof core.Object.make; + export = make; +} +declare module "core-js/fn/object/prevent-extensions" { + var preventExtensions: typeof core.Object.preventExtensions; + export = preventExtensions; +} +declare module "core-js/fn/object/seal" { + var seal: typeof core.Object.seal; + export = seal; +} +declare module "core-js/fn/object/set-prototype-of" { + var setPrototypeOf: typeof core.Object.setPrototypeOf; + export = setPrototypeOf; +} +declare module "core-js/fn/object/values" { + var values: typeof core.Object.values; + export = values; +} +declare module "core-js/fn/reflect" { + var Reflect: typeof core.Reflect; + export = Reflect; +} +declare module "core-js/fn/reflect/apply" { + var apply: typeof core.Reflect.apply; + export = apply; +} +declare module "core-js/fn/reflect/construct" { + var construct: typeof core.Reflect.construct; + export = construct; +} +declare module "core-js/fn/reflect/define-property" { + var defineProperty: typeof core.Reflect.defineProperty; + export = defineProperty; +} +declare module "core-js/fn/reflect/delete-property" { + var deleteProperty: typeof core.Reflect.deleteProperty; + export = deleteProperty; +} +declare module "core-js/fn/reflect/enumerate" { + var enumerate: typeof core.Reflect.enumerate; + export = enumerate; +} +declare module "core-js/fn/reflect/get" { + var get: typeof core.Reflect.get; + export = get; +} +declare module "core-js/fn/reflect/get-own-property-descriptor" { + var getOwnPropertyDescriptor: typeof core.Reflect.getOwnPropertyDescriptor; + export = getOwnPropertyDescriptor; +} +declare module "core-js/fn/reflect/get-prototype-of" { + var getPrototypeOf: typeof core.Reflect.getPrototypeOf; + export = getPrototypeOf; +} +declare module "core-js/fn/reflect/has" { + var has: typeof core.Reflect.has; + export = has; +} +declare module "core-js/fn/reflect/is-extensible" { + var isExtensible: typeof core.Reflect.isExtensible; + export = isExtensible; +} +declare module "core-js/fn/reflect/own-keys" { + var ownKeys: typeof core.Reflect.ownKeys; + export = ownKeys; +} +declare module "core-js/fn/reflect/prevent-extensions" { + var preventExtensions: typeof core.Reflect.preventExtensions; + export = preventExtensions; +} +declare module "core-js/fn/reflect/set" { + var set: typeof core.Reflect.set; + export = set; +} +declare module "core-js/fn/reflect/set-prototype-of" { + var setPrototypeOf: typeof core.Reflect.setPrototypeOf; + export = setPrototypeOf; +} +declare module "core-js/fn/regexp" { + var RegExp: typeof core.RegExp; + export = RegExp; +} +declare module "core-js/fn/regexp/escape" { + var escape: typeof core.RegExp.escape; + export = escape; +} +declare module "core-js/fn/string" { + var String: typeof core.String; + export = String; +} +declare module "core-js/fn/string/at" { + var at: typeof core.String.at; + export = at; +} +declare module "core-js/fn/string/code-point-at" { + var codePointAt: typeof core.String.codePointAt; + export = codePointAt; +} +declare module "core-js/fn/string/ends-with" { + var endsWith: typeof core.String.endsWith; + export = endsWith; +} +declare module "core-js/fn/string/escape-html" { + var escapeHTML: typeof core.String.escapeHTML; + export = escapeHTML; +} +declare module "core-js/fn/string/from-code-point" { + var fromCodePoint: typeof core.String.fromCodePoint; + export = fromCodePoint; +} +declare module "core-js/fn/string/includes" { + var includes: typeof core.String.includes; + export = includes; +} +declare module "core-js/fn/string/lpad" { + var lpad: typeof core.String.lpad; + export = lpad; +} +declare module "core-js/fn/string/raw" { + var raw: typeof core.String.raw; + export = raw; +} +declare module "core-js/fn/string/repeat" { + var repeat: typeof core.String.repeat; + export = repeat; +} +declare module "core-js/fn/string/rpad" { + var rpad: typeof core.String.rpad; + export = rpad; +} +declare module "core-js/fn/string/starts-with" { + var startsWith: typeof core.String.startsWith; + export = startsWith; +} +declare module "core-js/fn/string/unescape-html" { + var unescapeHTML: typeof core.String.unescapeHTML; + export = unescapeHTML; +} +declare module "core-js/fn/symbol" { + var Symbol: typeof core.Symbol; + export = Symbol; +} +declare module "core-js/fn/symbol/for" { + var _for: typeof core.Symbol.for; + export = _for; +} +declare module "core-js/fn/symbol/has-instance" { + var hasInstance: typeof core.Symbol.hasInstance; + export = hasInstance; +} +declare module "core-js/fn/symbol/is-concat-spreadable" { + var isConcatSpreadable: typeof core.Symbol.isConcatSpreadable; + export = isConcatSpreadable; +} +declare module "core-js/fn/symbol/iterator" { + var iterator: typeof core.Symbol.iterator; + export = iterator; +} +declare module "core-js/fn/symbol/key-for" { + var keyFor: typeof core.Symbol.keyFor; + export = keyFor; +} +declare module "core-js/fn/symbol/match" { + var match: typeof core.Symbol.match; + export = match; +} +declare module "core-js/fn/symbol/replace" { + var replace: typeof core.Symbol.replace; + export = replace; +} +declare module "core-js/fn/symbol/search" { + var search: typeof core.Symbol.search; + export = search; +} +declare module "core-js/fn/symbol/species" { + var species: typeof core.Symbol.species; + export = species; +} +declare module "core-js/fn/symbol/split" { + var split: typeof core.Symbol.split; + export = split; +} +declare module "core-js/fn/symbol/to-primitive" { + var toPrimitive: typeof core.Symbol.toPrimitive; + export = toPrimitive; +} +declare module "core-js/fn/symbol/to-string-tag" { + var toStringTag: typeof core.Symbol.toStringTag; + export = toStringTag; +} +declare module "core-js/fn/symbol/unscopables" { + var unscopables: typeof core.Symbol.unscopables; + export = unscopables; +} +declare module "core-js/es5" { + export = core; +} +declare module "core-js/es6" { + export = core; +} +declare module "core-js/es6/array" { + var Array: typeof core.Array; + export = Array; +} +declare module "core-js/es6/function" { + var Function: typeof core.Function; + export = Function; +} +declare module "core-js/es6/map" { + var Map: typeof core.Map; + export = Map; +} +declare module "core-js/es6/math" { + var Math: typeof core.Math; + export = Math; +} +declare module "core-js/es6/number" { + var Number: typeof core.Number; + export = Number; +} +declare module "core-js/es6/object" { + var Object: typeof core.Object; + export = Object; +} +declare module "core-js/es6/promise" { + var Promise: typeof core.Promise; + export = Promise; +} +declare module "core-js/es6/reflect" { + var Reflect: typeof core.Reflect; + export = Reflect; +} +declare module "core-js/es6/regexp" { + var RegExp: typeof core.RegExp; + export = RegExp; +} +declare module "core-js/es6/set" { + var Set: typeof core.Set; + export = Set; +} +declare module "core-js/es6/string" { + var String: typeof core.String; + export = String; +} +declare module "core-js/es6/symbol" { + var Symbol: typeof core.Symbol; + export = Symbol; +} +declare module "core-js/es6/weak-map" { + var WeakMap: typeof core.WeakMap; + export = WeakMap; +} +declare module "core-js/es6/weak-set" { + var WeakSet: typeof core.WeakSet; + export = WeakSet; +} +declare module "core-js/es7" { + export = core; +} +declare module "core-js/es7/array" { + var Array: typeof core.Array; + export = Array; +} +declare module "core-js/es7/map" { + var Map: typeof core.Map; + export = Map; +} +declare module "core-js/es7/object" { + var Object: typeof core.Object; + export = Object; +} +declare module "core-js/es7/regexp" { + var RegExp: typeof core.RegExp; + export = RegExp; +} +declare module "core-js/es7/set" { + var Set: typeof core.Set; + export = Set; +} +declare module "core-js/es7/string" { + var String: typeof core.String; + export = String; +} +declare module "core-js/js" { + export = core; +} +declare module "core-js/js/array" { + var Array: typeof core.Array; + export = Array; +} +declare module "core-js/web" { + export = core; +} +declare module "core-js/web/dom" { + export = core; +} +declare module "core-js/web/immediate" { + export = core; +} +declare module "core-js/web/timers" { + export = core; +} +declare module "core-js/libary" { + export = core; +} +declare module "core-js/libary/shim" { + export = core; +} +declare module "core-js/libary/core" { + export = core; +} +declare module "core-js/libary/core/$for" { + import $for = core.$for; + export = $for; +} +declare module "core-js/libary/core/_" { + var _: typeof core._; + export = _; +} +declare module "core-js/libary/core/array" { + var Array: typeof core.Array; + export = Array; +} +declare module "core-js/libary/core/date" { + var Date: typeof core.Date; + export = Date; +} +declare module "core-js/libary/core/delay" { + var delay: typeof core.delay; + export = delay; +} +declare module "core-js/libary/core/dict" { + var Dict: typeof core.Dict; + export = Dict; +} +declare module "core-js/libary/core/function" { + var Function: typeof core.Function; + export = Function; +} +declare module "core-js/libary/core/global" { + var global: typeof core.global; + export = global; +} +declare module "core-js/libary/core/log" { + var log: typeof core.log; + export = log; +} +declare module "core-js/libary/core/number" { + var Number: typeof core.Number; + export = Number; +} +declare module "core-js/libary/core/object" { + var Object: typeof core.Object; + export = Object; +} +declare module "core-js/libary/core/string" { + var String: typeof core.String; + export = String; +} +declare module "core-js/libary/fn/$for" { + import $for = core.$for; + export = $for; +} +declare module "core-js/libary/fn/_" { + var _: typeof core._; + export = _; +} +declare module "core-js/libary/fn/clear-immediate" { + var clearImmediate: typeof core.clearImmediate; + export = clearImmediate; +} +declare module "core-js/libary/fn/delay" { + var delay: typeof core.delay; + export = delay; +} +declare module "core-js/libary/fn/dict" { + var Dict: typeof core.Dict; + export = Dict; +} +declare module "core-js/libary/fn/get-iterator" { + var getIterator: typeof core.getIterator; + export = getIterator; +} +declare module "core-js/libary/fn/global" { + var global: typeof core.global; + export = global; +} +declare module "core-js/libary/fn/is-iterable" { + var isIterable: typeof core.isIterable; + export = isIterable; +} +declare module "core-js/libary/fn/log" { + var log: typeof core.log; + export = log; +} +declare module "core-js/libary/fn/map" { + var Map: typeof core.Map; + export = Map; +} +declare module "core-js/libary/fn/promise" { + var Promise: typeof core.Promise; + export = Promise; +} +declare module "core-js/libary/fn/set" { + var Set: typeof core.Set; + export = Set; +} +declare module "core-js/libary/fn/set-immediate" { + var setImmediate: typeof core.setImmediate; + export = setImmediate; +} +declare module "core-js/libary/fn/set-interval" { + var setInterval: typeof core.setInterval; + export = setInterval; +} +declare module "core-js/libary/fn/set-timeout" { + var setTimeout: typeof core.setTimeout; + export = setTimeout; +} +declare module "core-js/libary/fn/weak-map" { + var WeakMap: typeof core.WeakMap; + export = WeakMap; +} +declare module "core-js/libary/fn/weak-set" { + var WeakSet: typeof core.WeakSet; + export = WeakSet; +} +declare module "core-js/libary/fn/array" { + var Array: typeof core.Array; + export = Array; +} +declare module "core-js/libary/fn/array/concat" { + var concat: typeof core.Array.concat; + export = concat; +} +declare module "core-js/libary/fn/array/copy-within" { + var copyWithin: typeof core.Array.copyWithin; + export = copyWithin; +} +declare module "core-js/libary/fn/array/entries" { + var entries: typeof core.Array.entries; + export = entries; +} +declare module "core-js/libary/fn/array/every" { + var every: typeof core.Array.every; + export = every; +} +declare module "core-js/libary/fn/array/fill" { + var fill: typeof core.Array.fill; + export = fill; +} +declare module "core-js/libary/fn/array/filter" { + var filter: typeof core.Array.filter; + export = filter; +} +declare module "core-js/libary/fn/array/find" { + var find: typeof core.Array.find; + export = find; +} +declare module "core-js/libary/fn/array/find-index" { + var findIndex: typeof core.Array.findIndex; + export = findIndex; +} +declare module "core-js/libary/fn/array/for-each" { + var forEach: typeof core.Array.forEach; + export = forEach; +} +declare module "core-js/libary/fn/array/from" { + var from: typeof core.Array.from; + export = from; +} +declare module "core-js/libary/fn/array/includes" { + var includes: typeof core.Array.includes; + export = includes; +} +declare module "core-js/libary/fn/array/index-of" { + var indexOf: typeof core.Array.indexOf; + export = indexOf; +} +declare module "core-js/libary/fn/array/join" { + var join: typeof core.Array.join; + export = join; +} +declare module "core-js/libary/fn/array/keys" { + var keys: typeof core.Array.keys; + export = keys; +} +declare module "core-js/libary/fn/array/last-index-of" { + var lastIndexOf: typeof core.Array.lastIndexOf; + export = lastIndexOf; +} +declare module "core-js/libary/fn/array/map" { + var map: typeof core.Array.map; + export = map; +} +declare module "core-js/libary/fn/array/of" { + var of: typeof core.Array.of; + export = of; +} +declare module "core-js/libary/fn/array/pop" { + var pop: typeof core.Array.pop; + export = pop; +} +declare module "core-js/libary/fn/array/push" { + var push: typeof core.Array.push; + export = push; +} +declare module "core-js/libary/fn/array/reduce" { + var reduce: typeof core.Array.reduce; + export = reduce; +} +declare module "core-js/libary/fn/array/reduce-right" { + var reduceRight: typeof core.Array.reduceRight; + export = reduceRight; +} +declare module "core-js/libary/fn/array/reverse" { + var reverse: typeof core.Array.reverse; + export = reverse; +} +declare module "core-js/libary/fn/array/shift" { + var shift: typeof core.Array.shift; + export = shift; +} +declare module "core-js/libary/fn/array/slice" { + var slice: typeof core.Array.slice; + export = slice; +} +declare module "core-js/libary/fn/array/some" { + var some: typeof core.Array.some; + export = some; +} +declare module "core-js/libary/fn/array/sort" { + var sort: typeof core.Array.sort; + export = sort; +} +declare module "core-js/libary/fn/array/splice" { + var splice: typeof core.Array.splice; + export = splice; +} +declare module "core-js/libary/fn/array/turn" { + var turn: typeof core.Array.turn; + export = turn; +} +declare module "core-js/libary/fn/array/unshift" { + var unshift: typeof core.Array.unshift; + export = unshift; +} +declare module "core-js/libary/fn/array/values" { + var values: typeof core.Array.values; + export = values; +} +declare module "core-js/libary/fn/date" { + var Date: typeof core.Date; + export = Date; +} +declare module "core-js/libary/fn/date/add-locale" { + var addLocale: typeof core.addLocale; + export = addLocale; +} +declare module "core-js/libary/fn/date/format" { + var format: typeof core.Date.format; + export = format; +} +declare module "core-js/libary/fn/date/formatUTC" { + var formatUTC: typeof core.Date.formatUTC; + export = formatUTC; +} +declare module "core-js/libary/fn/function" { + var Function: typeof core.Function; + export = Function; +} +declare module "core-js/libary/fn/function/has-instance" { + var hasInstance: (value: any) => boolean; + export = hasInstance; +} +declare module "core-js/libary/fn/function/name" { +} +declare module "core-js/libary/fn/function/part" { + var part: typeof core.Function.part; + export = part; +} +declare module "core-js/libary/fn/math" { + var Math: typeof core.Math; + export = Math; +} +declare module "core-js/libary/fn/math/acosh" { + var acosh: typeof core.Math.acosh; + export = acosh; +} +declare module "core-js/libary/fn/math/asinh" { + var asinh: typeof core.Math.asinh; + export = asinh; +} +declare module "core-js/libary/fn/math/atanh" { + var atanh: typeof core.Math.atanh; + export = atanh; +} +declare module "core-js/libary/fn/math/cbrt" { + var cbrt: typeof core.Math.cbrt; + export = cbrt; +} +declare module "core-js/libary/fn/math/clz32" { + var clz32: typeof core.Math.clz32; + export = clz32; +} +declare module "core-js/libary/fn/math/cosh" { + var cosh: typeof core.Math.cosh; + export = cosh; +} +declare module "core-js/libary/fn/math/expm1" { + var expm1: typeof core.Math.expm1; + export = expm1; +} +declare module "core-js/libary/fn/math/fround" { + var fround: typeof core.Math.fround; + export = fround; +} +declare module "core-js/libary/fn/math/hypot" { + var hypot: typeof core.Math.hypot; + export = hypot; +} +declare module "core-js/libary/fn/math/imul" { + var imul: typeof core.Math.imul; + export = imul; +} +declare module "core-js/libary/fn/math/log10" { + var log10: typeof core.Math.log10; + export = log10; +} +declare module "core-js/libary/fn/math/log1p" { + var log1p: typeof core.Math.log1p; + export = log1p; +} +declare module "core-js/libary/fn/math/log2" { + var log2: typeof core.Math.log2; + export = log2; +} +declare module "core-js/libary/fn/math/sign" { + var sign: typeof core.Math.sign; + export = sign; +} +declare module "core-js/libary/fn/math/sinh" { + var sinh: typeof core.Math.sinh; + export = sinh; +} +declare module "core-js/libary/fn/math/tanh" { + var tanh: typeof core.Math.tanh; + export = tanh; +} +declare module "core-js/libary/fn/math/trunc" { + var trunc: typeof core.Math.trunc; + export = trunc; +} +declare module "core-js/libary/fn/number" { + var Number: typeof core.Number; + export = Number; +} +declare module "core-js/libary/fn/number/epsilon" { + var EPSILON: typeof core.Number.EPSILON; + export = EPSILON; +} +declare module "core-js/libary/fn/number/is-finite" { + var isFinite: typeof core.Number.isFinite; + export = isFinite; +} +declare module "core-js/libary/fn/number/is-integer" { + var isInteger: typeof core.Number.isInteger; + export = isInteger; +} +declare module "core-js/libary/fn/number/is-nan" { + var isNaN: typeof core.Number.isNaN; + export = isNaN; +} +declare module "core-js/libary/fn/number/is-safe-integer" { + var isSafeInteger: typeof core.Number.isSafeInteger; + export = isSafeInteger; +} +declare module "core-js/libary/fn/number/max-safe-integer" { + var MAX_SAFE_INTEGER: typeof core.Number.MAX_SAFE_INTEGER; + export = MAX_SAFE_INTEGER; +} +declare module "core-js/libary/fn/number/min-safe-interger" { + var MIN_SAFE_INTEGER: typeof core.Number.MIN_SAFE_INTEGER; + export = MIN_SAFE_INTEGER; +} +declare module "core-js/libary/fn/number/parse-float" { + var parseFloat: typeof core.Number.parseFloat; + export = parseFloat; +} +declare module "core-js/libary/fn/number/parse-int" { + var parseInt: typeof core.Number.parseInt; + export = parseInt; +} +declare module "core-js/libary/fn/number/random" { + var random: typeof core.Number.random; + export = random; +} +declare module "core-js/libary/fn/object" { + var Object: typeof core.Object; + export = Object; +} +declare module "core-js/libary/fn/object/assign" { + var assign: typeof core.Object.assign; + export = assign; +} +declare module "core-js/libary/fn/object/classof" { + var classof: typeof core.Object.classof; + export = classof; +} +declare module "core-js/libary/fn/object/create" { + var create: typeof core.Object.create; + export = create; +} +declare module "core-js/libary/fn/object/define" { + var define: typeof core.Object.define; + export = define; +} +declare module "core-js/libary/fn/object/define-properties" { + var defineProperties: typeof core.Object.defineProperties; + export = defineProperties; +} +declare module "core-js/libary/fn/object/define-property" { + var defineProperty: typeof core.Object.defineProperty; + export = defineProperty; +} +declare module "core-js/libary/fn/object/entries" { + var entries: typeof core.Object.entries; + export = entries; +} +declare module "core-js/libary/fn/object/freeze" { + var freeze: typeof core.Object.freeze; + export = freeze; +} +declare module "core-js/libary/fn/object/get-own-property-descriptor" { + var getOwnPropertyDescriptor: typeof core.Object.getOwnPropertyDescriptor; + export = getOwnPropertyDescriptor; +} +declare module "core-js/libary/fn/object/get-own-property-descriptors" { + var getOwnPropertyDescriptors: typeof core.Object.getOwnPropertyDescriptors; + export = getOwnPropertyDescriptors; +} +declare module "core-js/libary/fn/object/get-own-property-names" { + var getOwnPropertyNames: typeof core.Object.getOwnPropertyNames; + export = getOwnPropertyNames; +} +declare module "core-js/libary/fn/object/get-own-property-symbols" { + var getOwnPropertySymbols: typeof core.Object.getOwnPropertySymbols; + export = getOwnPropertySymbols; +} +declare module "core-js/libary/fn/object/get-prototype-of" { + var getPrototypeOf: typeof core.Object.getPrototypeOf; + export = getPrototypeOf; +} +declare module "core-js/libary/fn/object/is" { + var is: typeof core.Object.is; + export = is; +} +declare module "core-js/libary/fn/object/is-extensible" { + var isExtensible: typeof core.Object.isExtensible; + export = isExtensible; +} +declare module "core-js/libary/fn/object/is-frozen" { + var isFrozen: typeof core.Object.isFrozen; + export = isFrozen; +} +declare module "core-js/libary/fn/object/is-object" { + var isObject: typeof core.Object.isObject; + export = isObject; +} +declare module "core-js/libary/fn/object/is-sealed" { + var isSealed: typeof core.Object.isSealed; + export = isSealed; +} +declare module "core-js/libary/fn/object/keys" { + var keys: typeof core.Object.keys; + export = keys; +} +declare module "core-js/libary/fn/object/make" { + var make: typeof core.Object.make; + export = make; +} +declare module "core-js/libary/fn/object/prevent-extensions" { + var preventExtensions: typeof core.Object.preventExtensions; + export = preventExtensions; +} +declare module "core-js/libary/fn/object/seal" { + var seal: typeof core.Object.seal; + export = seal; +} +declare module "core-js/libary/fn/object/set-prototype-of" { + var setPrototypeOf: typeof core.Object.setPrototypeOf; + export = setPrototypeOf; +} +declare module "core-js/libary/fn/object/values" { + var values: typeof core.Object.values; + export = values; +} +declare module "core-js/libary/fn/reflect" { + var Reflect: typeof core.Reflect; + export = Reflect; +} +declare module "core-js/libary/fn/reflect/apply" { + var apply: typeof core.Reflect.apply; + export = apply; +} +declare module "core-js/libary/fn/reflect/construct" { + var construct: typeof core.Reflect.construct; + export = construct; +} +declare module "core-js/libary/fn/reflect/define-property" { + var defineProperty: typeof core.Reflect.defineProperty; + export = defineProperty; +} +declare module "core-js/libary/fn/reflect/delete-property" { + var deleteProperty: typeof core.Reflect.deleteProperty; + export = deleteProperty; +} +declare module "core-js/libary/fn/reflect/enumerate" { + var enumerate: typeof core.Reflect.enumerate; + export = enumerate; +} +declare module "core-js/libary/fn/reflect/get" { + var get: typeof core.Reflect.get; + export = get; +} +declare module "core-js/libary/fn/reflect/get-own-property-descriptor" { + var getOwnPropertyDescriptor: typeof core.Reflect.getOwnPropertyDescriptor; + export = getOwnPropertyDescriptor; +} +declare module "core-js/libary/fn/reflect/get-prototype-of" { + var getPrototypeOf: typeof core.Reflect.getPrototypeOf; + export = getPrototypeOf; +} +declare module "core-js/libary/fn/reflect/has" { + var has: typeof core.Reflect.has; + export = has; +} +declare module "core-js/libary/fn/reflect/is-extensible" { + var isExtensible: typeof core.Reflect.isExtensible; + export = isExtensible; +} +declare module "core-js/libary/fn/reflect/own-keys" { + var ownKeys: typeof core.Reflect.ownKeys; + export = ownKeys; +} +declare module "core-js/libary/fn/reflect/prevent-extensions" { + var preventExtensions: typeof core.Reflect.preventExtensions; + export = preventExtensions; +} +declare module "core-js/libary/fn/reflect/set" { + var set: typeof core.Reflect.set; + export = set; +} +declare module "core-js/libary/fn/reflect/set-prototype-of" { + var setPrototypeOf: typeof core.Reflect.setPrototypeOf; + export = setPrototypeOf; +} +declare module "core-js/libary/fn/regexp" { + var RegExp: typeof core.RegExp; + export = RegExp; +} +declare module "core-js/libary/fn/regexp/escape" { + var escape: typeof core.RegExp.escape; + export = escape; +} +declare module "core-js/libary/fn/string" { + var String: typeof core.String; + export = String; +} +declare module "core-js/libary/fn/string/at" { + var at: typeof core.String.at; + export = at; +} +declare module "core-js/libary/fn/string/code-point-at" { + var codePointAt: typeof core.String.codePointAt; + export = codePointAt; +} +declare module "core-js/libary/fn/string/ends-with" { + var endsWith: typeof core.String.endsWith; + export = endsWith; +} +declare module "core-js/libary/fn/string/escape-html" { + var escapeHTML: typeof core.String.escapeHTML; + export = escapeHTML; +} +declare module "core-js/libary/fn/string/from-code-point" { + var fromCodePoint: typeof core.String.fromCodePoint; + export = fromCodePoint; +} +declare module "core-js/libary/fn/string/includes" { + var includes: typeof core.String.includes; + export = includes; +} +declare module "core-js/libary/fn/string/lpad" { + var lpad: typeof core.String.lpad; + export = lpad; +} +declare module "core-js/libary/fn/string/raw" { + var raw: typeof core.String.raw; + export = raw; +} +declare module "core-js/libary/fn/string/repeat" { + var repeat: typeof core.String.repeat; + export = repeat; +} +declare module "core-js/libary/fn/string/rpad" { + var rpad: typeof core.String.rpad; + export = rpad; +} +declare module "core-js/libary/fn/string/starts-with" { + var startsWith: typeof core.String.startsWith; + export = startsWith; +} +declare module "core-js/libary/fn/string/unescape-html" { + var unescapeHTML: typeof core.String.unescapeHTML; + export = unescapeHTML; +} +declare module "core-js/libary/fn/symbol" { + var Symbol: typeof core.Symbol; + export = Symbol; +} +declare module "core-js/libary/fn/symbol/for" { + var _for: typeof core.Symbol.for; + export = _for; +} +declare module "core-js/libary/fn/symbol/has-instance" { + var hasInstance: typeof core.Symbol.hasInstance; + export = hasInstance; +} +declare module "core-js/libary/fn/symbol/is-concat-spreadable" { + var isConcatSpreadable: typeof core.Symbol.isConcatSpreadable; + export = isConcatSpreadable; +} +declare module "core-js/libary/fn/symbol/iterator" { + var iterator: typeof core.Symbol.iterator; + export = iterator; +} +declare module "core-js/libary/fn/symbol/key-for" { + var keyFor: typeof core.Symbol.keyFor; + export = keyFor; +} +declare module "core-js/libary/fn/symbol/match" { + var match: typeof core.Symbol.match; + export = match; +} +declare module "core-js/libary/fn/symbol/replace" { + var replace: typeof core.Symbol.replace; + export = replace; +} +declare module "core-js/libary/fn/symbol/search" { + var search: typeof core.Symbol.search; + export = search; +} +declare module "core-js/libary/fn/symbol/species" { + var species: typeof core.Symbol.species; + export = species; +} +declare module "core-js/libary/fn/symbol/split" { + var split: typeof core.Symbol.split; + export = split; +} +declare module "core-js/libary/fn/symbol/to-primitive" { + var toPrimitive: typeof core.Symbol.toPrimitive; + export = toPrimitive; +} +declare module "core-js/libary/fn/symbol/to-string-tag" { + var toStringTag: typeof core.Symbol.toStringTag; + export = toStringTag; +} +declare module "core-js/libary/fn/symbol/unscopables" { + var unscopables: typeof core.Symbol.unscopables; + export = unscopables; +} +declare module "core-js/libary/es5" { + export = core; +} +declare module "core-js/libary/es6" { + export = core; +} +declare module "core-js/libary/es6/array" { + var Array: typeof core.Array; + export = Array; +} +declare module "core-js/libary/es6/function" { + var Function: typeof core.Function; + export = Function; +} +declare module "core-js/libary/es6/map" { + var Map: typeof core.Map; + export = Map; +} +declare module "core-js/libary/es6/math" { + var Math: typeof core.Math; + export = Math; +} +declare module "core-js/libary/es6/number" { + var Number: typeof core.Number; + export = Number; +} +declare module "core-js/libary/es6/object" { + var Object: typeof core.Object; + export = Object; +} +declare module "core-js/libary/es6/promise" { + var Promise: typeof core.Promise; + export = Promise; +} +declare module "core-js/libary/es6/reflect" { + var Reflect: typeof core.Reflect; + export = Reflect; +} +declare module "core-js/libary/es6/regexp" { + var RegExp: typeof core.RegExp; + export = RegExp; +} +declare module "core-js/libary/es6/set" { + var Set: typeof core.Set; + export = Set; +} +declare module "core-js/libary/es6/string" { + var String: typeof core.String; + export = String; +} +declare module "core-js/libary/es6/symbol" { + var Symbol: typeof core.Symbol; + export = Symbol; +} +declare module "core-js/libary/es6/weak-map" { + var WeakMap: typeof core.WeakMap; + export = WeakMap; +} +declare module "core-js/libary/es6/weak-set" { + var WeakSet: typeof core.WeakSet; + export = WeakSet; +} +declare module "core-js/libary/es7" { + export = core; +} +declare module "core-js/libary/es7/array" { + var Array: typeof core.Array; + export = Array; +} +declare module "core-js/libary/es7/map" { + var Map: typeof core.Map; + export = Map; +} +declare module "core-js/libary/es7/object" { + var Object: typeof core.Object; + export = Object; +} +declare module "core-js/libary/es7/regexp" { + var RegExp: typeof core.RegExp; + export = RegExp; +} +declare module "core-js/libary/es7/set" { + var Set: typeof core.Set; + export = Set; +} +declare module "core-js/libary/es7/string" { + var String: typeof core.String; + export = String; +} +declare module "core-js/libary/js" { + export = core; +} +declare module "core-js/libary/js/array" { + var Array: typeof core.Array; + export = Array; +} +declare module "core-js/libary/web" { + export = core; +} +declare module "core-js/libary/web/dom" { + export = core; +} +declare module "core-js/libary/web/immediate" { + export = core; +} +declare module "core-js/libary/web/timers" { + export = core; +} From 52444b5afa70f89d846fa4e0d8671bc90fc169b7 Mon Sep 17 00:00:00 2001 From: Ralf Kruse Date: Sun, 10 May 2015 02:23:43 +0200 Subject: [PATCH 0023/1358] getElementByPoint returns Snap.Element --- snapsvg/snapsvg.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snapsvg/snapsvg.d.ts b/snapsvg/snapsvg.d.ts index a900680bc6..cce6e67503 100644 --- a/snapsvg/snapsvg.d.ts +++ b/snapsvg/snapsvg.d.ts @@ -43,7 +43,7 @@ declare module Snap { export function ajax(url:string,callback:Function,scope?:Object):XMLHttpRequest; export function format(token:string,json:Object):string; export function fragment(varargs:any):Fragment; - export function getElementByPoint(x:number,y:number):Object; + export function getElementByPoint(x:number,y:number):Snap.Element; export function is(o:any,type:string):boolean; export function load(url:string,callback:Function,scope?:Object):void; export function plugin(f:Function):void; From bfcc6ddbc0c3d3761d7935f60cf46bf99a24ff1f Mon Sep 17 00:00:00 2001 From: Ralf Kruse Date: Sun, 10 May 2015 02:24:05 +0200 Subject: [PATCH 0024/1358] Snap.Element has an id property --- snapsvg/snapsvg.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/snapsvg/snapsvg.d.ts b/snapsvg/snapsvg.d.ts index cce6e67503..c7add11655 100644 --- a/snapsvg/snapsvg.d.ts +++ b/snapsvg/snapsvg.d.ts @@ -131,6 +131,7 @@ declare module Snap { getSubpath(from:number,to:number):string; getTotalLength():number; hasClass(value:string):boolean; + id:string; inAnim():Object; innerSVG():string; insertAfter(el:Snap.Element):Snap.Element; From b29697846d7c2469b63a5ae4e2ba5cb968aa8d4c Mon Sep 17 00:00:00 2001 From: Chris Barr Date: Mon, 11 May 2015 09:19:22 -0400 Subject: [PATCH 0025/1358] Adding missing property & other minor changes * the `permissionLevel` property was missing * `needsPermission` and `isSupported` are properties, not functions * Spelling fixes in comments --- notifyjs/notifyjs.d.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/notifyjs/notifyjs.d.ts b/notifyjs/notifyjs.d.ts index 0cff4e0c52..5fe321efaf 100644 --- a/notifyjs/notifyjs.d.ts +++ b/notifyjs/notifyjs.d.ts @@ -10,20 +10,25 @@ declare var Notify: { * Check is permission is needed for the user to receive notifications. * @return true : needs permission, false : does not need */ - needsPermission() : boolean; + needsPermission : boolean; /** * Asks the user for permission to display notifications - * @param onPermissionGrantedCallback A callback for permmision is granted. - * @param onPermissionDeniedCallback A callback for permmision is denied. + * @param onPermissionGrantedCallback A callback for permission is granted. + * @param onPermissionDeniedCallback A callback for permission is denied. */ requestPermission(onPermissionGrantedCallback?: ()=> any, onPermissionDeniedCallback? : ()=> any) : void; /** * return true if the browser supports HTML5 Notification - * @param true : the browser supports HTML5 Notification, false ; the browswer does not supports HTML5 Notification. + * @param true : the browser supports HTML5 Notification, false ; the browser does not supports HTML5 Notification. */ - isSupported() : boolean; + isSupported: boolean; + + /** + * shows the user's current permission level (granted, denied or default), returns null if notifications are not supported. + */ + permissionLevel: string; } declare module notifyjs { From 139d9e9386d4501cb9768ad8c8942079a1a0861e Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Mon, 11 May 2015 08:18:16 -0700 Subject: [PATCH 0026/1358] Update core-js-tests.ts --- core-js/core-js-tests.ts | Bin 45732 -> 22819 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/core-js/core-js-tests.ts b/core-js/core-js-tests.ts index 4b9f6f9d7c63ced3b95e8f3b50ae2ea81e9fae29..8a4ec2c0b83c0c1c1299584a6cdeb8fa9eecc456 100644 GIT binary patch literal 22819 zcmc&+{camK693-7DO0hC?p7q-4n-dqvTD$(iBIaAr6hlKStz|FgThn>?@7L{+L7sbrotH!r>! zm6aNPsMB%U)ZZk#FSob0xALM<)g%MVd5OQ1-;*!V@{p9TGgBmsRUF|1t)%DSrxqR2RGYoS(yDF#BqV|)cswyk_9A^z$4)I@U_^2T1 zc~#C;)!hE947YRA2s-G00?AE#V`LrUM}`$*s3p~dX>UogXl@oulf z94NG$cHs^RNCJI#+b>w_+5lpQ3sB z$k7?LxOdF7ffJhxhK`tCi{f}eglngFIr9$C(n)tHOuDv2|l0eS(j0b6t%*57pn1X`LoJC0%bq>MgO6Dt*aPh z0t2oF3yAz_;`k1I_+vQTYMJ=d>&t;m7%?v1AVM;WOrR6IU%j%aR7+_{-g5 z|Jz$w&A)xhe|UtWS0@J-Y^%xlW{FMyoV;EXqb4s4hB+z6i>bmguIlg8l2_q0tLyx_ z*m0Zk+WUmf4xzxNY;NajSWb2lCYG3g9AZs5G-gk&6B#@$vYEn)HRe%l>rGY<^P+At zBspmxYTDkKbDH!*QVrkST%)nB7>emne}H#fN$k09mK zsS7sAi}8+cFUAfGLNSIFjMbMuG|*ZAk1h_M5|@KHWvW*+7dhrG=szYN9UvDVgr820 zMdZlUoCGtSs^Yr2p<&$SE(KEWFRa}G2++Tb(E&3iwJ2&JP;ysO;@Tm6K*RHN4&0sy z3l3!NXNz56>>pkv4!BELJc-oFF10s)7&a7m7l979n{#j{fd~^;17+y`eHe4#&N`h# z)Ym(z(6M!JW>XlBko62D@{wChUzL5<{wv=t*f48ipb*;Y4`_QWn0Ch^DpVNYI&ttUD?puA zEUb&Kr3*kWc$3F-^U4g&zE8GKv;+VX^jmf{`b}D^bTZAZYkc*gn!x1rZV4uLf+9s| zaC*-KO=7{T79-@*+B~Eks%Y{N^k^n|W~e-6zVt1ZPM}fEe0p?#as1}&6e^?%md3n( zofn7-?abMZV^m$PRTb$u%}yh&7uiI4IJCY9wUdK?{d#fm`sml=(|1RIJ9-Ny+}`8U z6}|JUs@3ahnKgr&jKo3YE{wUNLyVV@XztR{^y}VVHTSkHpDm`=25l=Pj2*yfdHvmA z!nQ6w0-JZh;MBA4I&Gt}zUeg8dC_e`;@EAaz!!NBV5m?ITaPW#-=>4@>$;Gp911dsYCp`j4G@imXqM2i^5b%$~gO6U=PBD zPouABpIxTP6gxSFKdz68#Y|TOecUJnQ;;O@g69c5$WG{5H4Y=Xw;piLHXknoYbz^* zY=;WIG}-HdGdD8&SRs2?Rt=gM5P93Df>u}`JgR>-LASX~!mwz5>k0OGBpb4-X5Vxko<5(JvoS%@fPR~VLP?@-SUVL%gsOwumA5rn5zBNKH5GNBQ8hF5$^$Gz?bnexi%NCroj)?JYWk2|PMQG09uW+{Mc^ zN(>Muz(8zhE;twLRv~ctb56^FuGbN4>ke_uNj{}qrmdVhNGk?}t!Nx)xIX+n2xG_^ z=^!W)#gGJ3Paj+%?QKuZOhvl6QN=*7agx!vb`T=K8p6husn8-3_N_o@E#aQ1fjIZ1 zL&k_D!WNS6NhV5KMn0e+fHi=Iw*v2YoG@# z>7?pjv~+xOC-89@dnC#}n@^^IhfHdOsi>)J6p`8mLuS{*cKl*BU~6_8qG+Ln_`PtQ z+YcM!JMPQt+J@*J>#iBzi;g4418BJ-dHik2Q%J|*@BXxW^IylLJRw$@dmCpx3)Y6I zsW>96qT~k12rV5cLLJA=Hwy$~As?#t z7&VXEjSa!07_Zt#eTVq`* z*L4~f&y#dr*9{3c(#D8DVN{(u*Q1&0)SyyzIsK$|l1kAdvAsK+coSkfp19hel7Z-)&vp)8+1JR&*MVjg@FDFw z(4viw4A8p0G|RlYDy1`$*lb99Fa-u)A0NAv^7@G0H`O`L5=6}sm1Wj{R=1AS<>vwo za%%0;!F7U9C^!o-9GYrkE(l7Xvc#xM=BCL=n{|MFAE;x2gI1Z zZ7OQl=jY_}THADaLLWw;N$c7+^`UPpt|#SJ+)B@qpR!Mxej>52uP!Ios!$a!Ao{kA zN0zKf7&Bi_?1N2xvEYCvD4j2G`^~iwxqjf>LSRdQLIt6md+@v_OSGf?p#{X^j7@+C z3rBDu36rK&)BOPC4ltXZi(!E&PU1eI2hWR($3cCQPkaWJGFwmcPA&`A5bua`P?xxX z=l1L*13X~mEN>^l>s0=Ww=3*aE~piQE^URwE@v_d&WwsT^Zy7xw`1ToSD=P)j$3$s z9)UL|F2fd{MQLHDS>5ncg_ZEMd>yc{(X8EeD0}CRkfp%O2lLif>_wD$`JUBzCCgGv zwk~JBDPS%*6xsP$pQ>im+{P~loU*sKe^K5J8!Mrf%Ix43r-u^ zOupM?mXKzVllDp*NkBnMub8>wJx?LONlW6ifPaQN>)4j6uw@kIL)sLsHBRuIQt5 ztk#_#swDwDGCz1o(g(|t$-&69**AN2e5R2mRZ#HceGfs5^V)v*!8cS*Pte!ZGre4o zDA_hYd8rZn`YvGB5n@52_$5DWjdkR7Q9ss!stR>EMBqSl3~>mu1E-n7rT)~rVhh7m z+un0=w7c-R-{O)#Q%joH+`%3hF3T=)b0u-y%D-e)_NrMt3a{szAbJCvG@?Vm%0Lx2 zr_ZUJ^58+YE!oAprAElQGHRkiXE?-a5FTbVhz#XWHUmO9M+6ptV{C_V{eRPiM^9PoDcTkEpG(bb{dStQ!vw+0jV z^`OUMqt|WLIewra&!!2T3+E^)<2B*B$tIqr6Y9`GjpUy8M}i2vkCd6m@RLwF#F(VS z0B8I(&wX%0$vb}CFhNFur^yZ8FRrUv`f0>rixyEULG&R*M4PmErQzubBjln-mG&IV zY5&K&SGKDUPND4sDq^jxW3FsOG|TNNxqKg7NA&BKT%c3)Ov8u4_=bzLjL1rPiNYs5@+hkXgzkFA7zO_AnBk}rFl2ETaX zZ9hghqLX?GaHE?HH`h>euGiHtAMyir*rG<%Ess(4jey}zGn@9KaSC>|oQVJZ-N_rS p1nI^_p}DcmeQ*R_<2CmBQI3Hl`fS^u*f{KyHG7kfht{_t{s$y5#1H@g literal 45732 zcmd^Idv6=Z5x>6+^g9SiQOH23v<;8|jblKFlvYV?3s%|`FpNfTGt~>E5=Sob)!WYR zhQpcJ+ZV|bB{C2!i@e==@67D%y!|8O}cSwoeomk7qTl{f0rit+hx(rqTwuN;+Q#%b#QHu1AJkt^-&^W;*tR<) zICstGEp~Y_Zl8>))u`p?Ja|5gV6c#n+UG|kjq4U0aCi)7ZHvw33DNNdNp++7sg>PH z(C)fz_mZUd15tfU6nQwK_W3J%cHZogTyBErW8&?yZNqY5RPacpcHxQSkJn zwGD2wGx^)o@NdG-I^Ay}+|cI{QF_;W(?0R7Z(2TKJFpGaU8>b5q-Ea{R^VG7621}9 zcGtWl+g6yq-|Oa0Wj|o>eeq4H|3NEjmN0r-iI@7uCC4;CE1^tF@U~m4Mt`>NQu_mA z>)Q7<@t|YiqbamESy}vz#tdu%x=>i#Qyt0krxV(q1zH&rPFT<(Sv^K%SEqYHi>F5C zHP9@#-dehlyE4!oZ)oItOU%=*J;lOe__P%yuAk7Sj8P%pwxhW$y|BkD(hU0o+Y96G zm3r8swr0)hXQuTj*_DkJp8xrHx75_pU@0i+H{<~PTkERBXh+#R7*)#pR~_cp#=iQI z_BHuyjutALl(t`xg`)L5JX(Wm$3lfckUb8*Gm{tCB!Vy7_Ws^rsQ|z0U^n5 z+>s}imJqYF@x3Kl%2Nv=M*j`rzb4JWLQWgWH#|&m#aa#9S?D2sHIRkcGW0U-C7SDL z^^oE;T4;5&X;$aqccp7#BOA?27SR4dIvl#OE1G&boh^k>PN)ZFNnL7oCQmFKb-hJa zF$gg!SsFAhXm9WTF>mC#`G?J_{wNQ-&6nhZwkZcvzq-+U+Ind_i`{5`Pvh?^$`nz9 zxFy|O(_aebIek8%r^x?#Hje*4rCP+bnG0``&l}UvkY>ME4g6ZX75qT@DSX6jGa%m$ zuYov#xhrN|1N!@{?WvS)5ElOv#|bzC!t3Wx()KLie2eHmB#(t^4D92?@X~Gjw&i<3 zd|$N~&;u2iEhE8IwWSYR9w6@o*RY@TqpX+WKdYnDZtY zd6eh0*U$>l7RjEo1M3m&a~bn8R_!xXM{meG44QXjo2Z$>LQ{~==;;OhT4hOK3`$M)i0Z36x`vZ+SMHB-#&V29 zNI|P-47A)isBn=O}I(5F3}*?`yI(jYJ6k*V7he7r=E+|FD**{I9mXf)B|6u%<0q-=A90 zHc1ANP)4d`<7ge~X_I6Kt;So61xSqTww5^nU|Y?m@LS!Lp&k$?vTCj4=F5qlE5{o5 zg=eA5L*NngJz38Y$?f||J|%5O#KRfc@FCgEc=BvrtfuVc?Aj80In-Z~S*Z-t9?q^a zu}$)9encJtH4#)%t@rTl*(y*uIiA>KIFc_rw5-o4wvykXoe%poXWpYq?@L+>@bhWk z5;Oj<+7ZpULTt=+dtgq0yb*qJ6!jC`J}*f6FDly}P+RQDN#hak_Rr>D#QQdJ zwM&2P5zcSvufNd0SHavT?2ESZ^+kq1B1xVS)(f&z*gX84c#=4^+Kc&|uZQ=%f=R|5 z#?eLdzWJp2laqb7-H@tns4sT?V7IMQ7_GH*TR{@%%^#aT6fkqU5`6;grT~p2^(EoW zQ-_#0CeM^_1x~Mut&mHUTVYpN4Ng?IYOun}YVf{otGB4)*60?|lB>{p$#B&OEl&zE zJf=vAOv}R4c(B?&xEvF0?Q&cd2kkzob&(VJkQ|Bm3+p9_?>5u=mTdccS}*Z^u>;e$ z#?C>Ga}1qlq*nGdE!1PDpdh}^_>^m&cn5u2(IYUN1rgbK) z7#+8<=YZxa$fOTxY)b8^3_~hGoN1NXb2fEMzOmGjb9&^&Sd%HWMifOft${plXMxAW zKW3k0$Tt+(1GLi&y>>{vN^KCA`?TY^#Miy!9}Y2463<RK5S?KL6!KP+2L>{+`|VYb~#;9^@eAD$U|U1CvA+i`rjhEg;zOf$1{AuDOrTbBi3?6 zZDCvN5w)%2UiYj8(FChAyvLq*Bh+OthzmDvo(|b_{ZMLzvY%=|{zO`bvvqC5{nthI z;Dfp5xfw@0wJ~{y5f1so25q(>&p8j-CHWyzZqmG>S0e> zPl&Y_oKE>=IwrJ|%$`zkvd6X5NTiV#9Hndve&XS!p1_db_35S4#6Ug6t&`>k-$FLJ8I7DhzPizxqJqbIy;%FnD^tv$ym zjzcI((aMc$59^+Z>`nbK&r9pF5F6z%KNg?PFkthNi|Cvq-;Se>?Ky6J7`}mik7(X> zLRr%#{jc~qhQP|#L0jM>X->@Nf<`D~5VLH2<3wM?Ak_e%S68laht+q4pyaq47Q?(6_CsUiB}Q z4f~bFB%XrVkGzG#`Q;s_uWuR4IVhIv6?tdmfO0Bo7Hsf*a@wXGqp>R=`=8Qtvee8g ze2K&?}v3C-@F)fkLeBZj@7GMT65H@lfd@%|caNPm`pt(yN2hYVT&&hsm=nhpQF{!1FU~oG)MA~W4_e4u(;!6-M60&V$9p!FBYpQPxh zoW8)g#W!;Ax2~A@cD8=-BvHNdF?(55r8W6@>5S|9q3IPH*d%+%(Xvez!}sXKH16#W zH>mM_M5$HsvS(=+7}y8Sc9504VR4ctxWS zw}J2}8s$5E2L@tUtjB8a@&)IIZ9cp~w=h@^;dO85=Yq~JZW8B+@_c$teV4WNZQ5CM zH?^b`Oq{d#cZVo!@rYfhj9aW!_KAn|Vh36Iz=<`1R9@LoP|C)g~V}2 zPlY1B0FIuT&e2tZGMs945h(sNW*DRPCOgM)a{|tAB95>{v9Awxjh(@I=9N!k=}FR* z^~o6#k&d^kx?ZgF*>T|%u*at-QbX=?=Vy1w%EPm% zq1JZ^4}RUAz~&arc}YgdhfdpB-4)T~DPzxVDNAw1yO7b6CCzs4t-r3XjJA3Dsy~&u zRpOrMPFt9#LbHa|&H-}S(r3kcQ9h$nHEN+aVS~Fax_1Sloj>~nUk{1GpLL&Jkd5Q4 zSh~f?v`}5d?>_|mYZ_aUO=JBCx1KBI7LRYq-grRmai4+QzOEy1(C%FieX`z?2;3M| zfP=dVaee@;kzb*DQbW6(qhPA>zB`OYwnv<=w^GFUP2o>kDvs5*Rq!F6Lv`n8on0HW zl_$tdeYxD1fEy0^Zm{?>u|}LQ00hmfECjL0ZYxi#&20Rw5B}VS#x&pGp4v&n3Qtcd zG(_-A;-Y)c{H&RWk18Sy1|I=FWPcQg2LrBxJ+aji@FPm)FGa~??^19G%9e1Va|--XCCXI=?N!v&=& zn1WMAsipS^vN%NUJY@BHDI8t8C7dJhS@J(Aa+|DD(dgv-q)i}P>Pl7)- zg86Q)vNd>!{!e942hr%?d07Atb2wq}>I zPf(dY|HwQD_pnEgvPyK9MhlSIlR&Vp-yGBdc1jBxcp zTnET=rems0Gq2m>4zm=^?1RwL-zpHxvILrDS+m1U(GjOTzdyzMPkfTPc3fgxG$VoC z%9ekGsMNZ(Kk4b$L$t?g%USt&K@v&bK`egF>I16=W18)&6ye##4y9&hpYxrfn9pM# z>(`*w?{U2F{p?PaaBV_y=3!tShe)69ud-Neo$}cEvehT=I>rwEen$^R1=ioOr};En zJJ<2U?>$);DJvhjk;6P=WN>8T-!e-0DY6&5U#8Rw8IHUILDzc(2Hs6RjyzX7*TJgg zUF&_@v%J||rIm{W-PWruTje@u%b|Z2DfoHWYqG*Oll`%^J%%&);Jqq>Cr$}R60Gsz zUhN$kA9(lLCe>c}FHg6ON&D2U6?fq%cd@?vG^UaJ%RF#V{Mx^ZSK_m@;n*ynY+SCH zEvG2oGP45AUr(}ftizPvn z-QCy4p_&d?Z_@I}uQG8>jcW(7F%DS@Y_t*z{8g*)_|XDBxw5owoQC6eeL0PJka})IkL%YW<5mwF zTCU}WtCHQQs%!A8L$lrG@K~uE$qg{&bZz%TTOxR$?0==)xNovRfOEi&i!!= zjy%`+MmUe_E|h?-t8u&ShUbFS|7vSW`N&m5<&4Fdk$_h3*VB4;S{ubm64wYYr^b6l5#7&ww_3ab z6=ysLQEaNEoV5xJZT)MoO<8#r?&Uq-tS@;}rB)sD?f>3qoXu)`oJi!IJlgZuV81E>U)SSoF!fZWg?E$K9B_ZS4pXy_rzYD`8vNcU zzn@?89BuD8k~ooiu9;t|MGe=0^4K_E-yF~Ga_u{lv*$|GC*-_|?SVBx|L#bIvHE^R zd8>P;B72iz=Z)ws`|v8tqV*6nXcP{_y{ahBkcW?2ep^=(`-HJnAZ-2RnvwCD6LK($oc5;L}Z>vfS4 t+cowI;?yASce5t8axkfurxuLq_B8 Date: Mon, 11 May 2015 10:37:10 -0700 Subject: [PATCH 0027/1358] Added typings for es6-collections --- es6-collections/es6-collections-tests.ts | 59 +++++++++ .../es6-collections-tests.ts.tscparams | 1 + es6-collections/es6-collections.d.ts | 113 ++++++++++++++++++ 3 files changed, 173 insertions(+) create mode 100644 es6-collections/es6-collections-tests.ts create mode 100644 es6-collections/es6-collections-tests.ts.tscparams create mode 100644 es6-collections/es6-collections.d.ts diff --git a/es6-collections/es6-collections-tests.ts b/es6-collections/es6-collections-tests.ts new file mode 100644 index 0000000000..2569942722 --- /dev/null +++ b/es6-collections/es6-collections-tests.ts @@ -0,0 +1,59 @@ +/// + +interface Point { x: number; y: number; } +let a: any; +let s: string; +let b: boolean; +let i: number; +let pt: Point; +let arrayOfPoint: Point[]; +let arrayOfStringPoint: [string, Point][]; +let arrayOfPointString: [Point, string][]; +let map: Map; +let set: Set; +let weakMap: WeakMap; +let weakSet: WeakSet; +let iteratorOfString: Iterator; +let iteratorOfStringPoint: Iterator<[String, Point]>; +let iteratorOfPoint: Iterator; +let iteratorOfPointPoint: Iterator<[Point, Point]>; + +map = new Map(); +map = new Map(arrayOfStringPoint); +map.clear(); +b = map.delete(s); +map.forEach((value: Point, key: string, map: Map) => { }, a); +pt = map.get(s); +b = map.has(s); +map = map.set(s, pt); +iteratorOfStringPoint = map.entries(); +iteratorOfString = map.keys(); +iteratorOfPoint = map.values(); +i = map.size; + +set = new Set(); +set = new Set(arrayOfPoint); +set.clear(); +b = set.delete(pt); +set.forEach((value: Point, key: Point, set: Set) => { }, a); +b = set.has(pt); +set = set.add(pt); +iteratorOfPointPoint = set.entries(); +iteratorOfPoint = set.keys(); +iteratorOfPoint = set.values(); +i = set.size; + +weakMap = new WeakMap(); +weakMap = new WeakMap(arrayOfPointString); +weakMap.clear(); +b = weakMap.delete(pt); +s = weakMap.get(pt); +b = weakMap.has(pt); +weakMap = weakMap.set(pt, s); + +weakSet = new WeakSet(); +weakSet = new WeakSet(arrayOfPoint); +weakSet.clear(); +b = weakSet.delete(pt); +b = weakSet.has(pt); +weakSet = weakSet.add(pt); \ No newline at end of file diff --git a/es6-collections/es6-collections-tests.ts.tscparams b/es6-collections/es6-collections-tests.ts.tscparams new file mode 100644 index 0000000000..4169d3605f --- /dev/null +++ b/es6-collections/es6-collections-tests.ts.tscparams @@ -0,0 +1 @@ +--noImplicitAny --module commonjs --target es5 \ No newline at end of file diff --git a/es6-collections/es6-collections.d.ts b/es6-collections/es6-collections.d.ts new file mode 100644 index 0000000000..54bcbca01d --- /dev/null +++ b/es6-collections/es6-collections.d.ts @@ -0,0 +1,113 @@ +// Type definitions for es6-collections v0.5.1 +// Project: https://github.com/WebReflection/es6-collections/ +// Definitions by: Ron Buckton +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/* ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + +interface IteratorResult { + done: boolean; + value?: T; +} + +interface Iterator { + next(value?: any): IteratorResult; + return?(value?: any): IteratorResult; + throw?(e?: any): IteratorResult; +} + +interface ForEachable { + forEach(callbackfn: (value: T) => void): void; +} + +interface Map { + clear(): void; + delete(key: K): boolean; + forEach(callbackfn: (value: V, index: K, map: Map) => void, thisArg?: any): void; + get(key: K): V; + has(key: K): boolean; + set(key: K, value?: V): Map; + entries(): Iterator<[K, V]>; + keys(): Iterator; + values(): Iterator; + size: number; +} + +interface MapConstructor { + new (): Map; + new (iterable: ForEachable<[K, V]>): Map; + prototype: Map; +} + +declare var Map: MapConstructor; + +interface Set { + add(value: T): Set; + clear(): void; + delete(value: T): boolean; + forEach(callbackfn: (value: T, index: T, set: Set) => void, thisArg?: any): void; + has(value: T): boolean; + entries(): Iterator<[T, T]>; + keys(): Iterator; + values(): Iterator; + size: number; +} + +interface SetConstructor { + new (): Set; + new (iterable: ForEachable): Set; + prototype: Set; +} + +declare var Set: SetConstructor; + +interface WeakMap { + delete(key: K): boolean; + clear(): void; + get(key: K): V; + has(key: K): boolean; + set(key: K, value?: V): WeakMap; +} + +interface WeakMapConstructor { + new (): WeakMap; + new (iterable: ForEachable<[K, V]>): WeakMap; + prototype: WeakMap; +} + +declare var WeakMap: WeakMapConstructor; + +interface WeakSet { + delete(value: T): boolean; + clear(): void; + add(value: T): WeakSet; + has(value: T): boolean; +} + +interface WeakSetConstructor { + new (): WeakSet; + new (iterable: ForEachable): WeakSet; + prototype: WeakSet; +} + +declare var WeakSet: WeakSetConstructor; + +declare module "es6-collections" { + var Map: MapConstructor; + var Set: SetConstructor; + var WeakMap: WeakMapConstructor; + var WeakSet: WeakSetConstructor; +} \ No newline at end of file From 9b14d38a1ac99f5e6374c2f94bc251350cb2b52a Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Mon, 11 May 2015 11:34:57 -0700 Subject: [PATCH 0028/1358] Added typings for es6-shim --- es6-shim/es6-shim-tests.ts | 222 +++++++++ es6-shim/es6-shim-tests.ts.tscparams | 1 + es6-shim/es6-shim.d.ts | 673 +++++++++++++++++++++++++++ 3 files changed, 896 insertions(+) create mode 100644 es6-shim/es6-shim-tests.ts create mode 100644 es6-shim/es6-shim-tests.ts.tscparams create mode 100644 es6-shim/es6-shim.d.ts diff --git a/es6-shim/es6-shim-tests.ts b/es6-shim/es6-shim-tests.ts new file mode 100644 index 0000000000..3bcb0ba7de --- /dev/null +++ b/es6-shim/es6-shim-tests.ts @@ -0,0 +1,222 @@ +/// + +interface Point { x: number; y: number; } +interface Point3D extends Point { z: number; } + +let a: any; +let s: string; +let i: number; +let b: boolean; +let f: () => void; +let o: Object; +let r: RegExp; +let sym: symbol; +let e: Error; +let date: Date; +let key: PropertyKey; +let point: Point; +let point3d: Point3D; +let arrayOfPoint: Point[]; +let arrayOfPoint3D: Point3D[]; +let arrayOfSymbol: symbol[]; +let arrayOfPropertyKey: PropertyKey[]; +let arrayOfAny: any[]; +let arrayOfStringAny: [string, any][]; +let arrayLikeOfAny: ArrayLike; +let iterableOfPoint: IterableShim; +let iterableOfStringPoint: IterableShim<[string, Point]>; +let iterableOfPointPoint3D: IterableShim<[Point, Point3D]>; +let iterableIteratorOfPoint: IterableIteratorShim; +let iterableIteratorOfNumberPoint: IterableIteratorShim<[number, Point]>; +let iterableIteratorOfNumber: IterableIteratorShim; +let iterableIteratorOfString: IterableIteratorShim; +let iterableIteratorOfPointPoint: IterableIteratorShim<[Point, Point]>; +let iterableIteratorOfNode: IterableIteratorShim; +let iterableIteratorOfStringPoint: IterableIteratorShim<[string, Point]>; +let iterableIteratorOfAny: IterableIteratorShim; +let iterableIteratorOfPropertyKey: IterableIteratorShim; +let iterableIteratorOfPropertyKeyPoint: IterableIteratorShim<[PropertyKey, Point]>; +let nodeList: NodeList; +let pd: PropertyDescriptor; +let pdm: PropertyDescriptorMap; +let map: Map; +let set: Set; +let weakMap: WeakMap; +let weakSet: WeakSet; +let promiseLikeOfPoint: PromiseLike; +let promiseLikeOfPoint3D: PromiseLike; +let promiseOfPoint: Promise; +let promiseOfPoint3D: Promise; +let promiseOfArrayOfPoint: Promise; +let promiseOfVoid: Promise; + +point = Object.assign(point, point); +b = Object.is(point, point); +Object.setPrototypeOf(point, point); +point = arrayOfPoint.find(p => b); +i = arrayOfPoint.findIndex(p => b); +arrayOfPoint = arrayOfPoint.fill(point, i, arrayOfPoint.length); +arrayOfPoint = arrayOfPoint.copyWithin(i, i, i); +arrayOfPoint = Array.from(arrayOfPoint); +arrayOfPoint = Array.from(iterableOfPoint); +arrayOfPoint3D = Array.from(arrayOfPoint, point => point3d); +arrayOfPoint3D = Array.from(arrayOfPoint, point => point3d, a); +arrayOfPoint3D = Array.from(iterableOfPoint, point => point3d); +arrayOfPoint3D = Array.from(iterableOfPoint, point => point3d, a); +arrayOfPoint = Array.of(point, point); +i = s.codePointAt(i); +b = s.includes(s, i); +b = s.endsWith(s, i); +s = s.repeat(i); +b = s.startsWith(s, i); +s = String.fromCodePoint(i, i); +s = String.raw`abc`; +s = r.flags; +i = Number.EPSILON; +b = Number.isFinite(i); +b = Number.isInteger(i); +b = Number.isNaN(i); +b = Number.isSafeInteger(i); +i = Number.MAX_SAFE_INTEGER; +i = Number.MIN_SAFE_INTEGER; +i = Number.parseFloat(s); +i = Number.parseInt(s); +i = Number.parseInt(s, i); +i = Math.clz32(i); +i = Math.imul(i, i); +i = Math.sign(i); +i = Math.log10(i); +i = Math.log2(i); +i = Math.log1p(i); +i = Math.expm1(i); +i = Math.cosh(i); +i = Math.sinh(i); +i = Math.tanh(i); +i = Math.acosh(i); +i = Math.asinh(i); +i = Math.atanh(i); +i = Math.hypot(i, i); +i = Math.trunc(i); +i = Math.fround(i); +i = Math.cbrt(i); +map.clear(); +map.delete(s); +map.forEach((value: Point, key: string) => { }); +point = map.get(s); +b = map.has(s); +map = map.set(s, point); +i = map.size; +map = new Map(); +map = new Map(iterableOfStringPoint); +set.clear(); +set.delete(point); +set.forEach((value: Point, key: Point) => { }); +b = set.has(point); +set = set.add(point); +i = set.size; +set = new Set(); +set = new Set(iterableOfPoint); +weakMap.delete(point); +point3d = weakMap.get(point); +b = weakMap.has(point); +weakMap = weakMap.set(point, point3d); +weakMap = new WeakMap(); +weakMap = new WeakMap(iterableOfPointPoint3D); +weakSet.delete(point); +weakSet = weakSet.add(point); +b = weakSet.has(point); +weakSet = new WeakSet(); +weakSet = new WeakSet(iterableOfPoint); +iterableIteratorOfNumberPoint = arrayOfPoint.entries(); +iterableIteratorOfNumber = arrayOfPoint.keys(); +iterableIteratorOfPoint = arrayOfPoint.values(); +iterableIteratorOfPointPoint = set.entries(); +iterableIteratorOfPoint = set.keys(); +iterableIteratorOfPoint = set.values(); +promiseLikeOfPoint.then((point: Point) => { }); +promiseLikeOfPoint = promiseLikeOfPoint.then(); +promiseLikeOfPoint = promiseLikeOfPoint.then(p => point); +promiseLikeOfPoint = promiseLikeOfPoint.then(p => promiseLikeOfPoint); +promiseLikeOfPoint = promiseLikeOfPoint.then(p => point, e => point); +promiseLikeOfPoint = promiseLikeOfPoint.then(p => promiseLikeOfPoint, e => point); +promiseLikeOfPoint = promiseLikeOfPoint.then(p => point, e => promiseLikeOfPoint); +promiseLikeOfPoint = promiseLikeOfPoint.then(p => point, e => { }); +promiseLikeOfPoint = promiseLikeOfPoint.then(p => promiseLikeOfPoint, e => { }); +promiseLikeOfPoint3D = promiseLikeOfPoint.then(p => point3d); +promiseLikeOfPoint3D = promiseLikeOfPoint.then(p => promiseLikeOfPoint3D); +promiseLikeOfPoint3D = promiseLikeOfPoint.then(p => point3d, e => point3d); +promiseLikeOfPoint3D = promiseLikeOfPoint.then(p => promiseLikeOfPoint3D, e => point3d); +promiseLikeOfPoint3D = promiseLikeOfPoint.then(p => point3d, e => promiseLikeOfPoint3D); +promiseLikeOfPoint3D = promiseLikeOfPoint.then(p => point3d, e => { }); +promiseLikeOfPoint3D = promiseLikeOfPoint.then(p => promiseLikeOfPoint3D, e => { }); +promiseOfPoint.then((point: Point) => { }); +promiseOfPoint = promiseOfPoint.then(); +promiseOfPoint = promiseOfPoint.then(p => point); +promiseOfPoint = promiseOfPoint.then(p => promiseOfPoint); +promiseOfPoint = promiseOfPoint.then(p => promiseLikeOfPoint); +promiseOfPoint = promiseOfPoint.then(p => point, e => point); +promiseOfPoint = promiseOfPoint.then(p => promiseOfPoint, e => point); +promiseOfPoint = promiseOfPoint.then(p => promiseLikeOfPoint, e => point); +promiseOfPoint = promiseOfPoint.then(p => point, e => promiseOfPoint); +promiseOfPoint = promiseOfPoint.then(p => point, e => promiseLikeOfPoint); +promiseOfPoint = promiseOfPoint.then(p => point, e => { }); +promiseOfPoint = promiseOfPoint.then(p => promiseOfPoint, e => { }); +promiseOfPoint = promiseOfPoint.then(p => promiseLikeOfPoint, e => { }); +promiseOfPoint3D = promiseOfPoint.then(p => point3d); +promiseOfPoint3D = promiseOfPoint.then(p => promiseOfPoint3D); +promiseOfPoint3D = promiseOfPoint.then(p => promiseLikeOfPoint3D); +promiseOfPoint3D = promiseOfPoint.then(p => point3d, e => point3d); +promiseOfPoint3D = promiseOfPoint.then(p => promiseOfPoint3D, e => point3d); +promiseOfPoint3D = promiseOfPoint.then(p => promiseLikeOfPoint3D, e => point3d); +promiseOfPoint3D = promiseOfPoint.then(p => point3d, e => promiseOfPoint3D); +promiseOfPoint3D = promiseOfPoint.then(p => point3d, e => promiseLikeOfPoint3D); +promiseOfPoint3D = promiseOfPoint.then(p => point3d, e => { }); +promiseOfPoint3D = promiseOfPoint.then(p => promiseOfPoint3D, e => { }); +promiseOfPoint3D = promiseOfPoint.then(p => promiseLikeOfPoint3D, e => { }); +promiseOfPoint = promiseOfPoint.catch(e => point); +promiseOfPoint = promiseOfPoint.catch(e => promiseOfPoint); +promiseOfPoint = promiseOfPoint.catch(e => promiseLikeOfPoint); +promiseOfPoint = promiseOfPoint.catch(e => { }); +promiseOfPoint3D = promiseOfPoint.catch(e => point3d); +promiseOfPoint3D = promiseOfPoint.catch(e => promiseOfPoint3D); +promiseOfPoint3D = promiseOfPoint.catch(e => promiseLikeOfPoint3D); +promiseOfPoint = new Promise((resolve, reject) => resolve(point)); +promiseOfPoint = new Promise((resolve, reject) => resolve(promiseOfPoint)); +promiseOfPoint = new Promise((resolve, reject) => resolve(promiseLikeOfPoint)); +promiseOfPoint = new Promise((resolve, reject) => reject(e)); +promiseOfArrayOfPoint = Promise.all(arrayOfPoint); +promiseOfArrayOfPoint = Promise.all(iterableOfPoint); +promiseOfPoint = Promise.race(arrayOfPoint); +promiseOfPoint = Promise.race(iterableOfPoint); +promiseOfVoid = Promise.resolve(); +promiseOfPoint = Promise.resolve(point3d); +promiseOfPoint = Promise.resolve(promiseOfPoint); +promiseOfPoint = Promise.resolve(promiseLikeOfPoint); +promiseOfVoid = Promise.reject(e); +promiseOfPoint = Promise.reject(e); +a = Reflect.apply(f, a, arrayLikeOfAny); +a = Reflect.construct(f, arrayLikeOfAny); +b = Reflect.defineProperty(a, s, pd); +b = Reflect.defineProperty(a, i, pd); +b = Reflect.defineProperty(a, sym, pd); +b = Reflect.deleteProperty(a, s); +b = Reflect.deleteProperty(a, i); +b = Reflect.deleteProperty(a, sym); +iterableIteratorOfAny = Reflect.enumerate(a); +a = Reflect.get(a, s, a); +a = Reflect.get(a, i, a); +a = Reflect.get(a, sym, a); +pd = Reflect.getOwnPropertyDescriptor(a, s); +pd = Reflect.getOwnPropertyDescriptor(a, i); +pd = Reflect.getOwnPropertyDescriptor(a, sym); +a = Reflect.getPrototypeOf(a); +b = Reflect.has(a, s); +b = Reflect.has(a, i); +b = Reflect.has(a, sym); +b = Reflect.isExtensible(a); +arrayOfPropertyKey = Reflect.ownKeys(a); +b = Reflect.preventExtensions(a); +b = Reflect.set(a, s, a, a); +b = Reflect.set(a, i, a, a); +b = Reflect.set(a, sym, a, a); +b = Reflect.setPrototypeOf(a, a); \ No newline at end of file diff --git a/es6-shim/es6-shim-tests.ts.tscparams b/es6-shim/es6-shim-tests.ts.tscparams new file mode 100644 index 0000000000..4169d3605f --- /dev/null +++ b/es6-shim/es6-shim-tests.ts.tscparams @@ -0,0 +1 @@ +--noImplicitAny --module commonjs --target es5 \ No newline at end of file diff --git a/es6-shim/es6-shim.d.ts b/es6-shim/es6-shim.d.ts new file mode 100644 index 0000000000..cff5a9b7e4 --- /dev/null +++ b/es6-shim/es6-shim.d.ts @@ -0,0 +1,673 @@ +// Type definitions for es6-shim v0.31.2 +// Project: https://github.com/paulmillr/es6-shim +// Definitions by: Ron Buckton +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare type PropertyKey = string | number | symbol; + +interface IteratorResult { + done: boolean; + value?: T; +} + +interface IterableShim { + /** + * Shim for an ES6 iterable. Not intended for direct use by user code. + */ + "_es6-shim iterator_"(): Iterator; +} + +interface Iterator { + next(value?: any): IteratorResult; + return?(value?: any): IteratorResult; + throw?(e?: any): IteratorResult; +} + +interface IterableIteratorShim extends IterableShim, Iterator { + /** + * Shim for an ES6 iterable iterator. Not intended for direct use by user code. + */ + "_es6-shim iterator_"(): IterableIteratorShim; +} + +interface StringConstructor { + /** + * Return the String value whose elements are, in order, the elements in the List elements. + * If length is 0, the empty string is returned. + */ + fromCodePoint(...codePoints: number[]): string; + + /** + * String.raw is intended for use as a tag function of a Tagged Template String. When called + * as such the first argument will be a well formed template call site object and the rest + * parameter will contain the substitution values. + * @param template A well-formed template string call site representation. + * @param substitutions A set of substitution values. + */ + raw(template: TemplateStringsArray, ...substitutions: any[]): string; +} + +interface String { + /** + * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point + * value of the UTF-16 encoded code point starting at the string element at position pos in + * the String resulting from converting this object to a String. + * If there is no element at that position, the result is undefined. + * If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos. + */ + codePointAt(pos: number): number; + + /** + * Returns true if searchString appears as a substring of the result of converting this + * object to a String, at one or more positions that are + * greater than or equal to position; otherwise, returns false. + * @param searchString search string + * @param position If position is undefined, 0 is assumed, so as to search all of the String. + */ + includes(searchString: string, position?: number): boolean; + + /** + * Returns true if the sequence of elements of searchString converted to a String is the + * same as the corresponding elements of this object (converted to a String) starting at + * endPosition – length(this). Otherwise returns false. + */ + endsWith(searchString: string, endPosition?: number): boolean; + + /** + * Returns a String value that is made from count copies appended together. If count is 0, + * T is the empty String is returned. + * @param count number of copies to append + */ + repeat(count: number): string; + + /** + * Returns true if the sequence of elements of searchString converted to a String is the + * same as the corresponding elements of this object (converted to a String) starting at + * position. Otherwise returns false. + */ + startsWith(searchString: string, position?: number): boolean; + + /** + * Returns an HTML anchor element and sets the name attribute to the text value + * @param name + */ + anchor(name: string): string; + + /** Returns a HTML element */ + big(): string; + + /** Returns a HTML element */ + blink(): string; + + /** Returns a HTML element */ + bold(): string; + + /** Returns a HTML element */ + fixed(): string + + /** Returns a HTML element and sets the color attribute value */ + fontcolor(color: string): string + + /** Returns a HTML element and sets the size attribute value */ + fontsize(size: number): string; + + /** Returns a HTML element and sets the size attribute value */ + fontsize(size: string): string; + + /** Returns an HTML element */ + italics(): string; + + /** Returns an HTML element and sets the href attribute value */ + link(url: string): string; + + /** Returns a HTML element */ + small(): string; + + /** Returns a HTML element */ + strike(): string; + + /** Returns a HTML element */ + sub(): string; + + /** Returns a HTML element */ + sup(): string; + + /** + * Shim for an ES6 iterable. Not intended for direct use by user code. + */ + "_es6-shim iterator_"(): IterableIteratorShim; +} + +interface ArrayLike { + length: number; + [n: number]: T; +} + +interface ArrayConstructor { + /** + * Creates an array from an array-like object. + * @param arrayLike An array-like object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): Array; + + /** + * Creates an array from an iterable object. + * @param iterable An iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(iterable: IterableShim, mapfn: (v: T, k: number) => U, thisArg?: any): Array; + + /** + * Creates an array from an array-like object. + * @param arrayLike An array-like object to convert to an array. + */ + from(arrayLike: ArrayLike): Array; + + /** + * Creates an array from an iterable object. + * @param iterable An iterable object to convert to an array. + */ + from(iterable: IterableShim): Array; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: T[]): Array; +} + +interface Array { + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: T, index: number, obj: Array) => boolean, thisArg?: any): T; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: T) => boolean, thisArg?: any): number; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: T, start?: number, end?: number): T[]; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): T[]; + + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIteratorShim<[number, T]>; + + /** + * Returns an list of keys in the array + */ + keys(): IterableIteratorShim; + + /** + * Returns an list of values in the array + */ + values(): IterableIteratorShim; + + /** + * Shim for an ES6 iterable. Not intended for direct use by user code. + */ + "_es6-shim iterator_"(): IterableIteratorShim; +} + +interface NumberConstructor { + /** + * The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1 + * that is representable as a Number value, which is approximately: + * 2.2204460492503130808472633361816 x 10‍−‍16. + */ + EPSILON: number; + + /** + * Returns true if passed value is finite. + * Unlike the global isFininte, Number.isFinite doesn't forcibly convert the parameter to a + * number. Only finite values of the type number, result in true. + * @param number A numeric value. + */ + isFinite(number: number): boolean; + + /** + * Returns true if the value passed is an integer, false otherwise. + * @param number A numeric value. + */ + isInteger(number: number): boolean; + + /** + * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a + * number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter + * to a number. Only values of the type number, that are also NaN, result in true. + * @param number A numeric value. + */ + isNaN(number: number): boolean; + + /** + * Returns true if the value passed is a safe integer. + * @param number A numeric value. + */ + isSafeInteger(number: number): boolean; + + /** + * The value of the largest integer n such that n and n + 1 are both exactly representable as + * a Number value. + * The value of Number.MIN_SAFE_INTEGER is 9007199254740991 2^53 − 1. + */ + MAX_SAFE_INTEGER: number; + + /** + * The value of the smallest integer n such that n and n − 1 are both exactly representable as + * a Number value. + * The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−(2^53 − 1)). + */ + MIN_SAFE_INTEGER: number; + + /** + * Converts a string to a floating-point number. + * @param string A string that contains a floating-point number. + */ + parseFloat(string: string): number; + + /** + * Converts A string to an integer. + * @param s A string to convert into a number. + * @param radix A value between 2 and 36 that specifies the base of the number in numString. + * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. + * All other strings are considered decimal. + */ + parseInt(string: string, radix?: number): number; +} + +interface ObjectConstructor { + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param sources One or more source objects to copy properties from. + */ + assign(target: any, ...sources: any[]): any; + + /** + * Returns true if the values are the same value, false otherwise. + * @param value1 The first value. + * @param value2 The second value. + */ + is(value1: any, value2: any): boolean; + + /** + * Sets the prototype of a specified object o to object proto or null. Returns the object o. + * @param o The object to change its prototype. + * @param proto The value of the new prototype or null. + * @remarks Requires `__proto__` support. + */ + setPrototypeOf(o: any, proto: any): any; +} + +interface RegExp { + /** + * Returns a string indicating the flags of the regular expression in question. This field is read-only. + * The characters in this string are sequenced and concatenated in the following order: + * + * - "g" for global + * - "i" for ignoreCase + * - "m" for multiline + * - "u" for unicode + * - "y" for sticky + * + * If no flags are set, the value is the empty string. + */ + flags: string; +} + +interface Math { + /** + * Returns the number of leading zero bits in the 32-bit binary representation of a number. + * @param x A numeric expression. + */ + clz32(x: number): number; + + /** + * Returns the result of 32-bit multiplication of two numbers. + * @param x First number + * @param y Second number + */ + imul(x: number, y: number): number; + + /** + * Returns the sign of the x, indicating whether x is positive, negative or zero. + * @param x The numeric expression to test + */ + sign(x: number): number; + + /** + * Returns the base 10 logarithm of a number. + * @param x A numeric expression. + */ + log10(x: number): number; + + /** + * Returns the base 2 logarithm of a number. + * @param x A numeric expression. + */ + log2(x: number): number; + + /** + * Returns the natural logarithm of 1 + x. + * @param x A numeric expression. + */ + log1p(x: number): number; + + /** + * Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of + * the natural logarithms). + * @param x A numeric expression. + */ + expm1(x: number): number; + + /** + * Returns the hyperbolic cosine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + cosh(x: number): number; + + /** + * Returns the hyperbolic sine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + sinh(x: number): number; + + /** + * Returns the hyperbolic tangent of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + tanh(x: number): number; + + /** + * Returns the inverse hyperbolic cosine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + acosh(x: number): number; + + /** + * Returns the inverse hyperbolic sine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + asinh(x: number): number; + + /** + * Returns the inverse hyperbolic tangent of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + atanh(x: number): number; + + /** + * Returns the square root of the sum of squares of its arguments. + * @param values Values to compute the square root for. + * If no arguments are passed, the result is +0. + * If there is only one argument, the result is the absolute value. + * If any argument is +Infinity or -Infinity, the result is +Infinity. + * If any argument is NaN, the result is NaN. + * If all arguments are either +0 or −0, the result is +0. + */ + hypot(...values: number[]): number; + + /** + * Returns the integral part of the a numeric expression, x, removing any fractional digits. + * If x is already an integer, the result is x. + * @param x A numeric expression. + */ + trunc(x: number): number; + + /** + * Returns the nearest single precision float representation of a number. + * @param x A numeric expression. + */ + fround(x: number): number; + + /** + * Returns an implementation-dependent approximation to the cube root of number. + * @param x A numeric expression. + */ + cbrt(x: number): number; +} + +interface PromiseLike { + /** + * Attaches callbacks for the resolution and/or rejection of the Promise. + * @param onfulfilled The callback to execute when the Promise is resolved. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): PromiseLike; + then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): PromiseLike; +} + +/** + * Represents the completion of an asynchronous operation + */ +interface Promise { + /** + * Attaches callbacks for the resolution and/or rejection of the Promise. + * @param onfulfilled The callback to execute when the Promise is resolved. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; + then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): Promise; + + /** + * Attaches a callback for only the rejection of the Promise. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of the callback. + */ + catch(onrejected?: (reason: any) => T | PromiseLike): Promise; + catch(onrejected?: (reason: any) => void): Promise; +} + +interface PromiseConstructor { + /** + * A reference to the prototype. + */ + prototype: Promise; + + /** + * Creates a new Promise. + * @param executor A callback used to initialize the promise. This callback is passed two arguments: + * a resolve callback used resolve the promise with a value or the result of another promise, + * and a reject callback used to reject the promise with a provided reason or error. + */ + new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void): Promise; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: IterableShim>): Promise; + + /** + * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved + * or rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + race(values: IterableShim>): Promise; + + /** + * Creates a new rejected promise for the provided reason. + * @param reason The reason the promise was rejected. + * @returns A new rejected Promise. + */ + reject(reason: any): Promise; + + /** + * Creates a new rejected promise for the provided reason. + * @param reason The reason the promise was rejected. + * @returns A new rejected Promise. + */ + reject(reason: any): Promise; + + /** + * Creates a new resolved promise for the provided value. + * @param value A promise. + * @returns A promise whose internal state matches the provided promise. + */ + resolve(value: T | PromiseLike): Promise; + + /** + * Creates a new resolved promise . + * @returns A resolved promise. + */ + resolve(): Promise; +} + +declare var Promise: PromiseConstructor; + +interface Map { + clear(): void; + delete(key: K): boolean; + forEach(callbackfn: (value: V, index: K, map: Map) => void, thisArg?: any): void; + get(key: K): V; + has(key: K): boolean; + set(key: K, value?: V): Map; + size: number; + entries(): IterableIteratorShim<[K, V]>; + keys(): IterableIteratorShim; + values(): IterableIteratorShim; +} + +interface MapConstructor { + new (): Map; + new (iterable: IterableShim<[K, V]>): Map; + prototype: Map; +} + +declare var Map: MapConstructor; + +interface Set { + add(value: T): Set; + clear(): void; + delete(value: T): boolean; + forEach(callbackfn: (value: T, index: T, set: Set) => void, thisArg?: any): void; + has(value: T): boolean; + size: number; + entries(): IterableIteratorShim<[T, T]>; + keys(): IterableIteratorShim; + values(): IterableIteratorShim; +} + +interface SetConstructor { + new (): Set; + new (iterable: IterableShim): Set; + prototype: Set; +} + +declare var Set: SetConstructor; + +interface WeakMap { + delete(key: K): boolean; + get(key: K): V; + has(key: K): boolean; + set(key: K, value?: V): WeakMap; +} + +interface WeakMapConstructor { + new (): WeakMap; + new (iterable: IterableShim<[K, V]>): WeakMap; + prototype: WeakMap; +} + +declare var WeakMap: WeakMapConstructor; + +interface WeakSet { + add(value: T): WeakSet; + delete(value: T): boolean; + has(value: T): boolean; +} + +interface WeakSetConstructor { + new (): WeakSet; + new (iterable: IterableShim): WeakSet; + prototype: WeakSet; +} + +declare var WeakSet: WeakSetConstructor; + +declare module Reflect { + function apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any; + function construct(target: Function, argumentsList: ArrayLike): any; + function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean; + function deleteProperty(target: any, propertyKey: PropertyKey): boolean; + function enumerate(target: any): IterableIteratorShim; + function get(target: any, propertyKey: PropertyKey, receiver?: any): any; + function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor; + function getPrototypeOf(target: any): any; + function has(target: any, propertyKey: PropertyKey): boolean; + function isExtensible(target: any): boolean; + function ownKeys(target: any): Array; + function preventExtensions(target: any): boolean; + function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean; + function setPrototypeOf(target: any, proto: any): boolean; +} + +declare module "es6-shim" { + var String: StringConstructor; + var Array: ArrayConstructor; + var Number: NumberConstructor; + var Math: Math; + var Object: ObjectConstructor; + var Map: MapConstructor; + var Set: SetConstructor; + var WeakMap: WeakMapConstructor; + var WeakSet: WeakSetConstructor; + var Promise: PromiseConstructor; + module Reflect { + function apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any; + function construct(target: Function, argumentsList: ArrayLike): any; + function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean; + function deleteProperty(target: any, propertyKey: PropertyKey): boolean; + function enumerate(target: any): Iterator; + function get(target: any, propertyKey: PropertyKey, receiver?: any): any; + function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor; + function getPrototypeOf(target: any): any; + function has(target: any, propertyKey: PropertyKey): boolean; + function isExtensible(target: any): boolean; + function ownKeys(target: any): Array; + function preventExtensions(target: any): boolean; + function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean; + function setPrototypeOf(target: any, proto: any): boolean; + } +} \ No newline at end of file From 75f03d73ce8a8a10f4594bd6500d6f207b2e8191 Mon Sep 17 00:00:00 2001 From: Chris Barr Date: Tue, 12 May 2015 08:13:37 -0400 Subject: [PATCH 0029/1358] Adding missing `timeout` property, changing others to be properties instead of functions, spelling fixes --- notifyjs/notifyjs-tests.ts | 6 ++++-- notifyjs/notifyjs.d.ts | 25 ++++++++++++++++++------- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/notifyjs/notifyjs-tests.ts b/notifyjs/notifyjs-tests.ts index 8771224c8e..3289791dee 100644 --- a/notifyjs/notifyjs-tests.ts +++ b/notifyjs/notifyjs-tests.ts @@ -14,6 +14,7 @@ function test_Notify_constructor() { body : "fuga", icon : "./logo.png", tag : "user", + timeout: 2, notifyShow : (e:Event)=> console.log("notifyShow", e), notifyClose : ()=> console.log("notifyClose"), notifyClick : ()=> console.log("notifyClick"), @@ -26,9 +27,10 @@ function test_Notify_constructor() { } function test_Notify_static_methods() { - Notify.needsPermission(); + Notify.needsPermission; Notify.requestPermission(); Notify.requestPermission(()=> console.log("onPermissionGrantedCallback")); Notify.requestPermission(()=> console.log("onPermissionGrantedCallback"), ()=> console.log("onPermissionDeniedCallback")); - Notify.isSupported(); + Notify.isSupported; + Notify.permissionLevel; } diff --git a/notifyjs/notifyjs.d.ts b/notifyjs/notifyjs.d.ts index f36b8fbcd0..dc7bc57fe0 100644 --- a/notifyjs/notifyjs.d.ts +++ b/notifyjs/notifyjs.d.ts @@ -1,4 +1,4 @@ -// Type definitions for notify.js 1.2.0 +// Type definitions for notify.js 1.2.3 // Project: https://github.com/alexgibson/notify.js // Definitions by: soundTricker // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -10,20 +10,26 @@ declare var Notify: { * Check is permission is needed for the user to receive notifications. * @return true : needs permission, false : does not need */ - needsPermission() : boolean; + needsPermission : boolean; /** * Asks the user for permission to display notifications - * @param onPermissionGrantedCallback A callback for permmision is granted. - * @param onPermissionDeniedCallback A callback for permmision is denied. + * @param onPermissionGrantedCallback A callback for permission is granted. + * @param onPermissionDeniedCallback A callback for permission is denied. */ requestPermission(onPermissionGrantedCallback?: ()=> any, onPermissionDeniedCallback? : ()=> any) : void; /** * return true if the browser supports HTML5 Notification - * @param true : the browser supports HTML5 Notification, false ; the browswer does not supports HTML5 Notification. + * @param true : the browser supports HTML5 Notification, false ; the browser does not supports HTML5 Notification. */ - isSupported() : boolean; + isSupported: boolean; + + /** + * shows the user's current permission level (granted, denied or default), returns null if notifications are not supported. + * @return 'granted' : permission has been given, 'denied' : permission has been denied, 'default' : permission has not yet been set, null : notifications are not supported + */ + permissionLevel: string; } declare module notifyjs { @@ -72,6 +78,11 @@ declare module notifyjs { * unique identifier to stop duplicate notifications */ tag? : string; + + /** + * number of seconds to close the notification automatically + */ + timeout? : number; /** * callback when notification is shown @@ -98,4 +109,4 @@ declare module notifyjs { */ permissionDenied? : Function; } -} +} \ No newline at end of file From 3f15066480dd9a016203bc258858ab16eb50ea13 Mon Sep 17 00:00:00 2001 From: Aaron Dandy Date: Tue, 12 May 2015 11:48:26 -0700 Subject: [PATCH 0030/1358] Update auth0.d.ts for typescript 1.5.0-beta --- auth0/auth0.d.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/auth0/auth0.d.ts b/auth0/auth0.d.ts index 5d3149ead4..3562e50d5a 100644 --- a/auth0/auth0.d.ts +++ b/auth0/auth0.d.ts @@ -9,10 +9,6 @@ interface Window { token: string; } -interface Location { - origin: string; -} - /** This is the interface for the main Auth0 client. */ interface Auth0Static { From 5bf40c59d1cc2c29a79dbfa9e09892d43d2f21d7 Mon Sep 17 00:00:00 2001 From: Nick Lee Date: Sat, 16 May 2015 15:25:33 -0400 Subject: [PATCH 0031/1358] Added an interface for the object returned during synchronous validations. --- joi/joi.d.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/joi/joi.d.ts b/joi/joi.d.ts index 951fc40457..ad9eb174d5 100644 --- a/joi/joi.d.ts +++ b/joi/joi.d.ts @@ -61,6 +61,11 @@ declare module 'joi' { options?: ValidationOptions; } + export interface ValidationResult { + error: ValidationError; + value: T; + } + export interface SchemaMap { [key: string]: Schema; } @@ -461,8 +466,7 @@ declare module 'joi' { */ export function validate(value: T, schema: Schema, callback: (err: ValidationError, value: T) => void): void; export function validate(value: T, schema: Object, callback: (err: ValidationError, value: T) => void): void; - export function validate(value: T, schema: Schema, options?: ValidationOptions, callback?: (err: ValidationError, value: T) => void): void; - export function validate(value: T, schema: Object, options?: ValidationOptions, callback?: (err: ValidationError, value: T) => void): void; + export function validate(value: T, schema: Object, options?: ValidationOptions, callback?: (err: ValidationError, value: T) => void): ValidationResult; /** * Converts literal schema definition to joi schema object (or returns the same back if already a joi schema object). From c068c64bce9a2cfe7826e46dfe69a922978f9952 Mon Sep 17 00:00:00 2001 From: gandjustas Date: Sun, 17 May 2015 00:47:08 +0300 Subject: [PATCH 0032/1358] Refactored sharepoint.d.ts to use microsoft.ajax.d.ts, added\fixed some definitions --- README.md | 0 angularjs/angular.d.ts | 0 chrome/chrome.d.ts | 0 microsoft-ajax/microsoft.ajax.d.ts | 992 ++++++----------- sharepoint/SharePoint.d.ts | 1642 ++++++++++++++++++++++++---- 5 files changed, 1768 insertions(+), 866 deletions(-) mode change 100644 => 100755 README.md mode change 100755 => 100644 angularjs/angular.d.ts mode change 100755 => 100644 chrome/chrome.d.ts diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts old mode 100755 new mode 100644 diff --git a/chrome/chrome.d.ts b/chrome/chrome.d.ts old mode 100755 new mode 100644 diff --git a/microsoft-ajax/microsoft.ajax.d.ts b/microsoft-ajax/microsoft.ajax.d.ts index 1c8968f440..7100b8c515 100644 --- a/microsoft-ajax/microsoft.ajax.d.ts +++ b/microsoft-ajax/microsoft.ajax.d.ts @@ -18,7 +18,7 @@ * Object Type Extensions * @see {@link http://msdn.microsoft.com/en-us/library/bb397554(v=vs.100).aspx} */ -interface Object { +interface ObjectConstructor { /** * Formats a number by using the invariant culture. */ @@ -34,173 +34,9 @@ interface Object { * Array Type Extensions * @see {@link http://msdn.microsoft.com/en-us/library/bb383786(v=vs.100).aspx} */ -interface Array { - - //#region lib.d.ts - - new (arrayLength?: number): any[]; - new (arrayLength: number): T[]; - new (...items: T[]): T[]; - (arrayLength?: number): any[]; - (arrayLength: number): T[]; - (...items: T[]): T[]; - isArray(arg: any): boolean; - prototype: Array; - - ///** - // * Returns a string representation of an array. - // */ - //toString(): string; - //toLocaleString(): string; - ///** - // * Combines two or more arrays. - // * @param items Additional items to add to the end of array1. - // */ - //concat(...items: U[]): T[]; - ///** - // * Combines two or more arrays. - // * @param items Additional items to add to the end of array1. - // */ - //concat(...items: T[]): T[]; - ///** - // * Adds all the elements of an array separated by the specified separator string. - // * @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma. - // */ - //join(separator?: string): string; - ///** - // * Removes the last element from an array and returns it. - // */ - //pop(): T; - ///** - // * Appends new elements to an array, and returns the new length of the array. - // * @param items New elements of the Array. - // */ - //push(...items: T[]): number; - ///** - // * Reverses the elements in an Array. - // */ - //reverse(): T[]; - ///** - // * Removes the first element from an array and returns it. - // */ - //shift(): T; - ///** - // * Returns a section of an array. - // * @param start The beginning of the specified portion of the array. - // * @param end The end of the specified portion of the array. - // */ - //slice(start?: number, end?: number): T[]; - - ///** - // * Sorts an array. - // * @param compareFn The name of the function used to determine the order of the elements. If omitted, the elements are sorted in ascending, ASCII character order. - // */ - //sort(compareFn?: (a: T, b: T) => number): T[]; - - ///** - // * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. - // * @param start The zero-based location in the array from which to start removing elements. - // */ - //splice(start: number): T[]; - - ///** - // * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. - // * @param start The zero-based location in the array from which to start removing elements. - // * @param deleteCount The number of elements to remove. - // * @param items Elements to insert into the array in place of the deleted elements. - // */ - //splice(start: number, deleteCount: number, ...items: T[]): T[]; - - ///** - // * Inserts new elements at the start of an array. - // * @param items Elements to insert at the start of the Array. - // */ - //unshift(...items: T[]): number; - - ///** - // * Returns the index of the first occurrence of a value in an array. - // * @param searchElement The value to locate in the array. - // * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. - // */ - //indexOf(searchElement: T, fromIndex?: number): number; - - ///** - // * Returns the index of the last occurrence of a specified value in an array. - // * @param searchElement The value to locate in the array. - // * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array. - // */ - //lastIndexOf(searchElement: T, fromIndex?: number): number; - - ///** - // * Determines whether all the members of an array satisfy the specified test. - // * @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array. - // * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - // */ - //every(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; - - ///** - // * Determines whether the specified callback function returns true for any element of an array. - // * @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array. - // * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - // */ - //some(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; - - ///** - // * Performs the specified action for each element in an array. - // * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. - // * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - // */ - //forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; - - ///** - // * Calls a defined callback function on each element of an array, and returns an array that contains the results. - // * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. - // * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - // */ - //map(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; - - ///** - // * Returns the elements of an array that meet the condition specified in a callback function. - // * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array. - // * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - // */ - //filter(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): T[]; - - ///** - // * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - // * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. - // * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - // */ - //reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; - ///** - // * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - // * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. - // * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - // */ - //reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; - - ///** - // * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - // * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. - // * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - // */ - //reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; - ///** - // * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - // * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. - // * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - // */ - //reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; - - ///** - // * Gets or sets the length of the array. This is a number one higher than the highest element defined in an array. - // */ - //length: number; - - //[n: number]: T; - - //#endregion +interface ArrayConstructor { + //#region Extensions /** @@ -210,55 +46,55 @@ interface Array { * @param item * */ - add(array: any[], element: any): void; + add(array: T[], element: T): void; /** * Copies all the elements of the specified array to the end of an Array object. */ - addRange(array: any, items: any): void; + addRange(array: T[], items: T[]): void; /** * Removes all elements from an Array object. */ - clear(): void; + clear(array: T[]): void; /** * Creates a shallow copy of an Array object. */ - clone(): any[]; + clone(array: T[]): T[]; /** * Determines whether an element is in an Array object. */ - contains(element: any): boolean; + contains(array: T[], element: T): boolean; /** * Removes the first element from an Array object. */ - dequeue(): any; + dequeue(array: T[]): T; /** * Adds an element to the end of an Array object. Use the add function instead of the Array.enqueue function. */ - enqueue(element: any): void; + enqueue(array: T[], element: T): void; /** * Performs a specified action on each element of an Array object. */ - forEach(array: any[], method: Function, instance: any[]): void; + forEach(array: T[], method: (element: T, index: number, array: T[]) => void, instance: any): void; /** * Searches for the specified element of an Array object and returns its index. */ - indexOf(array: any[], item: any, startIndex?: number): number; + indexOf(array: T[], item: T, startIndex?: number): number; /** * Inserts a value at the specified location in an Array object. */ - insert(array: any[], index: number, item: any); + insert(array: T[], index: number, item: T): void; /** * Creates an Array object from a string representation. */ - parse(value: string): any[]; + parse(value: string): T[]; /** * Removes the first occurrence of an element in an Array object. */ - remove(array: any[], item: any): boolean; + remove(array: T[], item: T): boolean; /** * Removes an element at the specified location in an Array object. */ - removeAt(array: any[], index: number): void; + removeAt(array: T[], index: number): void; //#endregion } @@ -277,6 +113,10 @@ interface Number { * Formats a number by using the current culture. */ localeFormat(format: string): string; +} + +interface NumberConstructor { + /** * Returns a numeric value from a string representation of a number. This function is static and can be called without creating an instance of the object. */ @@ -297,11 +137,14 @@ interface Date { /** * Formats a date by using the invariant (culture-independent) culture. */ - format(value: string): string; + format(format: string): string; /** * Formats a date by using the current culture. This function is static and can be invoked without creating an instance of the object. */ - localeFormat(value: string): string; + localeFormat(format: string): string; +} + +interface DateConstructor { /** * Creates a date from a locale-specific string by using the current culture. This function is static and can be invoked without creating an instance of the object. * @exception (Debug) formats contains an invalid format. @@ -310,9 +153,8 @@ interface Date { * @param formats * (Optional) An array of custom formats. */ - parseLocale(value: string): string; - parseLocale(value: string, formats?: string[]): string; - parseLocale(value: string, ...formats: string[]): string; + parseLocale(value: string, formats?: string[]): Date; + parseLocale(value: string, ...formats: string[]): Date; /** * Creates a date from a string by using the invariant culture. This function is static and can be invoked without creating an instance of the object. * @return If value is a valid string representation of a date in the invariant format, an object of type Date; otherwise, null. @@ -321,352 +163,172 @@ interface Date { * @param formats * (Optional) An array of custom formats. */ - parseInvariant(value: string): string; parseInvariant(value: string, formats?: string[]): string; parseInvariant(value: string, ...formats: string[]): string; } -declare module MicrosoftAjaxBaseTypeExtensions { + +/** +* Provides static functions that extend the built-in ECMAScript (JavaScript) Function type by including exception +* details and support for application-compilation modes (debug or release). +* @see {@link http://msdn.microsoft.com/en-us/library/dd409270(v=vs.100).aspx} +*/ +interface FunctionConstructor { + + //#region Extensions /** - * Provides static functions that extend the built-in ECMAScript (JavaScript) Function type by including exception - * details and support for application-compilation modes (debug or release). - * @see {@link http://msdn.microsoft.com/en-us/library/dd409270(v=vs.100).aspx} - */ - interface Function { - - //#region lib.d.ts - - /** - * Creates a new function. - * @param args A list of arguments the function accepts. - */ - new (...args: string[]): Function; - (...args: string[]): Function; - prototype: Function; - - //#endregion - - //#region Extensions - - /** - * Creates a delegate function that retains the context first used during an objects creation. - * @see {@link http://msdn.microsoft.com/en-us/library/dd393582(v=vs.100).aspx } - */ - createCallback(method: Function, ...context: any[]): Function; - /** - * Creates a callback function that retains the parameter initially used during an object's creation. - * @see {@link http://msdn.microsoft.com/en-us/library/dd409287(v=vs.100).aspx } - */ - createDelegate(instance: any, method: Function): Function; - - /** - * A function that does nothing. - * @see {@link http://msdn.microsoft.com/en-us/library/dd393667(v=vs.100).aspx } - */ - emptyMethod(): Function; - - /** - * Validates the parameters to a method are as expected. - * @see {@link http://msdn.microsoft.com/en-us/library/dd393712(v=vs.100).aspx } - */ - validateParameters(parameters: any, expectedParameters: Object[], validateParameterCount?: boolean): any; - - //#endregion - } + * Creates a delegate function that retains the context first used during an objects creation. + * @see {@link http://msdn.microsoft.com/en-us/library/dd393582(v=vs.100).aspx } + */ + createCallback(method: Function, ...context: any[]): Function; + /** + * Creates a callback function that retains the parameter initially used during an object's creation. + * @see {@link http://msdn.microsoft.com/en-us/library/dd409287(v=vs.100).aspx } + */ + createDelegate(instance: any, method: Function): Function; /** - * Provides static functions that extend the built-in ECMAScript (JavaScript) Error type by including exception details and support for application-compilation modes (debug or release). - * Error Type Extensions - * @see {@link http://msdn.microsoft.com/en-us/library/bb310947(v=vs.100).aspx} - */ - interface Error { - - //#region lib.d.ts - - name: string; - message: string; - - new (message?: string): Error; - (message?: string): Error; - prototype: Error; - - //#endregion - - //#region Extensions - - /** - * Creates an Error object that represents the Sys.ParameterCountException exception. - */ - parameterCount(message?: string): Error; - /** - * Creates an Error object that represents the Sys.NotImplementedException exception. - */ - notImplemented(message?: string): Error; - /** - * Creates an Error object that represents the Sys.ArgumentException exception. - */ - argument(paramName?: any, message?: string): Error; - /** - * Creates an Error object that represents the Sys.ArgumentNullException exception. - */ - argumentNull(paramName?: any, message?: string): Error; - /** - * Creates an Error object that represents the Sys.ArgumentOutOfRangeException exception. - */ - argumentOutOfRange(paramName?: string, actualValue?: any, message?: string): Error; - /** - * Creates an Error object that represents the Sys.ArgumentTypeException exception. - */ - argumentType(paramName?: string, actualType?: any, expectedType?: any, message?: string): Error; - /** - * Creates an Error object that represents the Sys.ArgumentUndefinedException exception. - */ - argumentUndefined(paramName?: string, message?: string): Error; - /** - * Creates an Error object that can contain additional error information. - */ - create(message?: string, errorInfo?: Object): Error; - /** - * Creates an Error object that represents the Sys.FormatException exception. - */ - format(message?: string): Error; - /** - * Creates an Error object that represents the Sys.InvalidOperationException exception. - */ - invalidOperation(message?: string): Error; - /** - * Updates the fileName and lineNumber properties of an Error instance to indicate where the error was thrown instead of where the error was created. Use this function if you are creating custom error types. - */ - popStackFrame(): void; - - //#endregion - } + * A function that does nothing. + * @see {@link http://msdn.microsoft.com/en-us/library/dd393667(v=vs.100).aspx } + */ + emptyMethod(): Function; /** - * Provides extensions to the base ECMAScript (JavaScript) String object by including static and instance methods. - * String Type Extensions - * @see {@link http://msdn.microsoft.com/en-us/library/bb397472(v=vs.100).aspx} - */ - interface String { + * Validates the parameters to a method are as expected. + * @see {@link http://msdn.microsoft.com/en-us/library/dd393712(v=vs.100).aspx } + */ + validateParameters(parameters: any, expectedParameters: Object[], validateParameterCount?: boolean): any; - //#region lib.d.ts + //#endregion +} - new (value?: any): String; - (value?: any): string; - prototype: String; - fromCharCode(...codes: number[]): string; +/** +* Provides static functions that extend the built-in ECMAScript (JavaScript) Error type by including exception details and support for application-compilation modes (debug or release). +* Error Type Extensions +* @see {@link http://msdn.microsoft.com/en-us/library/bb310947(v=vs.100).aspx} +*/ +interface ErrorConstructor { - /** Returns a string representation of a string. */ - toString(): string; - - /** - * Returns the character at the specified index. - * @param pos The zero-based index of the desired character. - */ - charAt(pos: number): string; - - /** - * Returns the Unicode value of the character at the specified location. - * @param index The zero-based index of the desired character. If there is no character at the specified index, NaN is returned. - */ - charCodeAt(index: number): number; - - /** - * Returns a string that contains the concatenation of two or more strings. - * @param strings The strings to append to the end of the string. - */ - concat(...strings: string[]): string; - - /** - * Returns the position of the first occurrence of a substring. - * @param searchString The substring to search for in the string - * @param position The index at which to begin searching the String object. If omitted, search starts at the beginning of the string. - */ - indexOf(searchString: string, position?: number): number; - - /** - * Returns the last occurrence of a substring in the string. - * @param searchString The substring to search for. - * @param position The index at which to begin searching. If omitted, the search begins at the end of the string. - */ - lastIndexOf(searchString: string, position?: number): number; - - /** - * Determines whether two strings are equivalent in the current locale. - * @param that String to compare to target string - */ - localeCompare(that: string): number; - - /** - * Matches a string with a regular expression, and returns an array containing the results of that search. - * @param regexp A variable name or string literal containing the regular expression pattern and flags. - */ - match(regexp: string): string[]; - - /** - * Matches a string with a regular expression, and returns an array containing the results of that search. - * @param regexp A regular expression object that contains the regular expression pattern and applicable flags. - */ - match(regexp: RegExp): string[]; - - /** - * Replaces text in a string, using a regular expression or search string. - * @param searchValue A String object or string literal that represents the regular expression - * @param replaceValue A String object or string literal containing the text to replace for every successful match of rgExp in stringObj. - */ - replace(searchValue: string, replaceValue: string): string; - - /** - * Replaces text in a string, using a regular expression or search string. - * @param searchValue A String object or string literal that represents the regular expression - * @param replaceValue A function that returns the replacement text. - */ - replace(searchValue: string, replaceValue: (substring: string, ...args: any[]) => string): string; - - /** - * Replaces text in a string, using a regular expression or search string. - * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags - * @param replaceValue A String object or string literal containing the text to replace for every successful match of rgExp in stringObj. - */ - replace(searchValue: RegExp, replaceValue: string): string; - - /** - * Replaces text in a string, using a regular expression or search string. - * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags - * @param replaceValue A function that returns the replacement text. - */ - replace(searchValue: RegExp, replaceValue: (substring: string, ...args: any[]) => string): string; - - /** - * Finds the first substring match in a regular expression search. - * @param regexp The regular expression pattern and applicable flags. - */ - search(regexp: string): number; - - /** - * Finds the first substring match in a regular expression search. - * @param regexp The regular expression pattern and applicable flags. - */ - search(regexp: RegExp): number; - - /** - * Returns a section of a string. - * @param start The index to the beginning of the specified portion of stringObj. - * @param end The index to the end of the specified portion of stringObj. The substring includes the characters up to, but not including, the character indicated by end. - * If this value is not specified, the substring continues to the end of stringObj. - */ - slice(start?: number, end?: number): string; - - /** - * Split a string into substrings using the specified separator and return them as an array. - * @param separator A string that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. - * @param limit A value used to limit the number of elements returned in the array. - */ - split(separator: string, limit?: number): string[]; - - /** - * Split a string into substrings using the specified separator and return them as an array. - * @param separator A Regular Express that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. - * @param limit A value used to limit the number of elements returned in the array. - */ - split(separator: RegExp, limit?: number): string[]; - - /** - * Returns the substring at the specified location within a String object. - * @param start The zero-based index number indicating the beginning of the substring. - * @param end Zero-based index number indicating the end of the substring. The substring includes the characters up to, but not including, the character indicated by end. - * If end is omitted, the characters from start through the end of the original string are returned. - */ - substring(start: number, end?: number): string; - - /** Converts all the alphabetic characters in a string to lowercase. */ - toLowerCase(): string; - - /** Converts all alphabetic characters to lowercase, taking into account the host environment's current locale. */ - toLocaleLowerCase(): string; - - /** Converts all the alphabetic characters in a string to uppercase. */ - toUpperCase(): string; - - /** Returns a string where all alphabetic characters have been converted to uppercase, taking into account the host environment's current locale. */ - toLocaleUpperCase(): string; - - /** Returns the length of a String object. */ - length: number; - - // IE extensions - /** - * Gets a substring beginning at the specified location and having the specified length. - * @param from The starting position of the desired substring. The index of the first character in the string is zero. - * @param length The number of characters to include in the returned substring. - */ - substr(from: number, length?: number): string; - - [index: number]: string; - - //#endregion - - //#region Extensions - - /** - * Formats a number by using the invariant culture. - * @returns true if the end of the String object matches suffix; otherwise, false. - */ - endsWith(suffix: string): boolean; - /** - * Replaces each format item in a String object with the text equivalent of a corresponding object's value. - * @returns A copy of the string with the formatting applied. - */ - format(format: string, ...args: any[]): string; - /** - * Replaces the format items in a String object with the text equivalent of a corresponding object's value. The current culture is used to format dates and numbers. - * @returns A copy of the string with the formatting applied. - */ - localeFormat(format: string, ...args: any[]): string; - /** - * Removes leading and trailing white-space characters from a String object. - * @returns A copy of the string with all white-space characters removed from the start and end of the string. - */ - trim(): string; - /** - * Removes trailing white-space characters from a String object. - * @returns A copy of the string with all white-space characters removed from the end of the string. - */ - trimEnd(): string; - /** - * Removes leading white-space characters from a String object. - * @returns A copy of the string with all white-space characters removed from the start of the string. - */ - trimStart(): string; - - //#endregion - } + //#region Extensions /** - * Provides extensions to the base ECMAScript (JavaScript) Boolean object. - * Boolean Type Extensions - * @see {@link http://msdn.microsoft.com/en-us/library/bb397557(v=vs.100).aspx} + * Creates an Error object that represents the Sys.ParameterCountException exception. */ - interface Boolean { + parameterCount(message?: string): Error; + /** + * Creates an Error object that represents the Sys.NotImplementedException exception. + */ + notImplemented(message?: string): Error; + /** + * Creates an Error object that represents the Sys.ArgumentException exception. + */ + argument(paramName?: any, message?: string): Error; + /** + * Creates an Error object that represents the Sys.ArgumentNullException exception. + */ + argumentNull(paramName?: any, message?: string): Error; + /** + * Creates an Error object that represents the Sys.ArgumentOutOfRangeException exception. + */ + argumentOutOfRange(paramName?: string, actualValue?: any, message?: string): Error; + /** + * Creates an Error object that represents the Sys.ArgumentTypeException exception. + */ + argumentType(paramName?: string, actualType?: any, expectedType?: any, message?: string): Error; + /** + * Creates an Error object that represents the Sys.ArgumentUndefinedException exception. + */ + argumentUndefined(paramName?: string, message?: string): Error; + /** + * Creates an Error object that can contain additional error information. + */ + create(message?: string, errorInfo?: Object): Error; + /** + * Creates an Error object that represents the Sys.FormatException exception. + */ + format(message?: string): Error; + /** + * Creates an Error object that represents the Sys.InvalidOperationException exception. + */ + invalidOperation(message?: string): Error; - //#region lib.d.ts - new (value?: any): Boolean; - (value?: any): boolean; - prototype: Boolean; + //#endregion +} - //#endregion +interface Error { + /** + * Updates the fileName and lineNumber properties of an Error instance to indicate where the error was thrown instead of where the error was created. Use this function if you are creating custom error types. + */ + popStackFrame(): void; +} - //#region Extensions - /** - * Converts a string representation of a logical value to its Boolean object equivalent. - */ - parse(value: string): Boolean; - //#endregion - } +interface String { + + //#region Extensions + + /** + * Formats a number by using the invariant culture. + * @returns true if the end of the String object matches suffix; otherwise, false. + */ + endsWith(suffix: string): boolean; + + /** + * Removes leading and trailing white-space characters from a String object. + * @returns A copy of the string with all white-space characters removed from the start and end of the string. + */ + trim(): string; + /** + * Removes trailing white-space characters from a String object. + * @returns A copy of the string with all white-space characters removed from the end of the string. + */ + trimEnd(): string; + /** + * Removes leading white-space characters from a String object. + * @returns A copy of the string with all white-space characters removed from the start of the string. + */ + trimStart(): string; + + //#endregion +} + +/** +* Provides extensions to the base ECMAScript (JavaScript) String object by including static and instance methods. +* String Type Extensions +* @see {@link http://msdn.microsoft.com/en-us/library/bb397472(v=vs.100).aspx} +*/ +interface StringConstructor { + /** +* Replaces each format item in a String object with the text equivalent of a corresponding object's value. +* @returns A copy of the string with the formatting applied. +*/ + format(format: string, ...args: any[]): string; + /** + * Replaces the format items in a String object with the text equivalent of a corresponding object's value. The current culture is used to format dates and numbers. + * @returns A copy of the string with the formatting applied. + */ + localeFormat(format: string, ...args: any[]): string; +} + + +/** +* Provides extensions to the base ECMAScript (JavaScript) Boolean object. +* Boolean Type Extensions +* @see {@link http://msdn.microsoft.com/en-us/library/bb397557(v=vs.100).aspx} +*/ +interface BooleanConstructor { + + //#region Extensions + + /** + * Converts a string representation of a logical value to its Boolean object equivalent. + */ + parse(value: string): Boolean; + + //#endregion } //#endregion @@ -908,7 +570,7 @@ declare function $find(id: string, parent?: HTMLElement): Sys.Component; * @param handler The event handler to add. * @param autoRemove (Optional) A boolean value that determines whether the handler should be removed automatically when the element is disposed. */ -declare function $addHandler(element: Sys.UI.DomElement, eventName: string, handler: Function, autoRemove?: boolean): void; +declare function $addHandler(element: HTMLElement, eventName: string, handler: (e: Sys.UI.DomEvent) => void, autoRemove?: boolean): void; /** * Provides a shortcut to the addHandlers method of the Sys.UI.DomEvent class. This member is static and can be invoked without creating an instance of the class. @@ -918,7 +580,7 @@ declare function $addHandler(element: Sys.UI.DomElement, eventName: string, hand * @param handlerOwner (Optional) The object instance that is the context for the delegates that should be created from the handlers. * @param autoRemove (Optional) A boolean value that determines whether the handler should be removed automatically when the element is disposed. */ -declare function $addHandlers(element: Sys.UI.DomElement, events: any, handlerOwner?: any, autoRemove?: boolean): void; +declare function $addHandlers(element: HTMLElement, events: { [event: string]: (e: Sys.UI.DomEvent) => void }, handlerOwner?: any, autoRemove?: boolean): void; /** * Provides a shortcut to the clearHandlers method of the Sys.UI.DomEvent class. This member is static and can be invoked without creating an instance of the class. @@ -926,21 +588,19 @@ declare function $addHandlers(element: Sys.UI.DomElement, events: any, handlerOw * @see {@link http://msdn.microsoft.com/en-us/library/bb310959(v=vs.100).aspx} * @param The DOM element that exposes the events. */ -declare function $clearHandlers(element: Sys.UI.DomElement): void; +declare function $clearHandlers(element: HTMLElement): void; /** -* Provides a shortcut to the getElementById method of the Sys.UI.DomElement class. This member is static and can be invoked without creating an instance of the class. +* Provides a shortcut to the getElementById method of the HTMLElement class. This member is static and can be invoked without creating an instance of the class. * @see {@link http://msdn.microsoft.com/en-us/library/bb397717(v=vs.100).aspx} * @param id * The ID of the DOM element to find. * @param element * The parent element to search. The default is the document element. * @return -* The Sys.UI.DomElement +* The HTMLElement */ -declare function $get(id: string): any; // Examples use HTMLElement and DomElement declare function $get(id: string, element?: HTMLElement): HTMLElement; -declare function $get(id: string, element?: Sys.UI.DomElement): Sys.UI.DomElement; /** * Provides a shortcut to the removeHandler method of the Sys.UI.DomEvent class. This member is static and can be invoked without creating an instance of the class. @@ -949,9 +609,7 @@ declare function $get(id: string, element?: Sys.UI.DomElement): Sys.UI.DomElemen * @param eventName The name of the DOM event. * @param handler The event handler to remove. */ -declare function $removeHandler(element: any, eventName: string, handler: Function): void; -declare function $removeHandler(element: HTMLElement, eventName: string, handler: Function): void; -declare function $removeHandler(element: Sys.UI.DomElement, eventName: string, handler: Function): void; +declare function $removeHandler(element: HTMLElement, eventName: string, handler: (e: Sys.UI.DomEvent) => void): void; //#endregion @@ -973,7 +631,7 @@ declare module Sys { * The members can be invoked without creating an instance of the class. * @see {@link http://msdn.microsoft.com/en-us/library/bb384161(v=vs.100).aspx} */ - interface Application { + interface Application extends Component, IContainer { //#region Constructors @@ -986,27 +644,27 @@ declare module Sys { /** * Raised after all scripts have been loaded but before objects are created. */ - add_init(handler: Function): void; + add_init(handler: (sender: Application, eventArgs: EventArgs) => void): void; /** * Raised after all scripts have been loaded but before objects are created. */ - remove_init(handler: Function): void; + remove_init(handler: (sender: Application, eventArgs: EventArgs) => void): void; /** * Raised after all scripts have been loaded and after the objects in the application have been created and initialized. */ - add_load(handler: Function): void; + add_load(handler: (sender: Application, eventArgs: ApplicationLoadEventArgs) => void): void; /** * Raised after all scripts have been loaded and after the objects in the application have been created and initialized. */ - remove_load(handler: Function): void; + remove_load(handler: (sender: Application, eventArgs: ApplicationLoadEventArgs) => void): void; /** * Occurs when the user clicks the browser's Back or Forward button. */ - add_navigate(handler: Function): void; + add_navigate(handler: (sender: Application, eventArgs: HistoryEventArgs) => void): void; /** * Occurs when the user clicks the browser's Back or Forward button. */ - remove_navigate(handler: Function): void; + remove_navigate(handler: (sender: Application, eventArgs: HistoryEventArgs) => void): void; /** * Raised before all objects in the client application are disposed, typically when the DOM window.unload event is raised. @@ -2175,67 +1833,67 @@ declare module Sys { //#endregion //#region Exception Types + // Really not a types + ///** + //* Raised when a function or method is invoked and at least one of the passed arguments does not meet the parameter specification of the called function or method. + //*/ + //class ArgumentException { - /** - * Raised when a function or method is invoked and at least one of the passed arguments does not meet the parameter specification of the called function or method. - */ - class ArgumentException { + //} + ///** + //* Raised when an argument has an invalid value of null. + //*/ + //class ArgumentNullException { - } - /** - * Raised when an argument has an invalid value of null. - */ - class ArgumentNullException { + //} + ///** + //* Raised when an argument value is outside an acceptable range. + //*/ + //class ArgumentOutOfRangeException { - } - /** - * Raised when an argument value is outside an acceptable range. - */ - class ArgumentOutOfRangeException { + //} + ///** + //* Raised when a parameter is not an allowed type. + //*/ + //class ArgumentTypeException { - } - /** - * Raised when a parameter is not an allowed type. - */ - class ArgumentTypeException { + //} + ///** + //* Raised when an argument for a required method parameter is undefined. + //*/ + //class ArgumentUndefinedException { - } - /** - * Raised when an argument for a required method parameter is undefined. - */ - class ArgumentUndefinedException { + //} + ///** + //* + //*/ + //class FormatException { - } - /** - * - */ - class FormatException { + //} + ///** + //* Raised when a call to a method has failed, but the reason was not invalid arguments. + //*/ + //class InvalidOperationException { - } - /** - * Raised when a call to a method has failed, but the reason was not invalid arguments. - */ - class InvalidOperationException { + //} + ///** + //* Raised when a requested method is not supported by an object. + //*/ + //class NotImplementedException { - } - /** - * Raised when a requested method is not supported by an object. - */ - class NotImplementedException { + //} + ///** + //* Raised when an invalid number of arguments have been passed to a function. + //*/ + //class ParameterCountException { - } - /** - * Raised when an invalid number of arguments have been passed to a function. - */ - class ParameterCountException { + //} + ///** + //* Raised by the Microsoft Ajax Library framework when a script does not load successfully. This exception should not be thrown by the developer. + //*/ + //class ScriptLoadFailedException { - } - /** - * Raised by the Microsoft Ajax Library framework when a script does not load successfully. This exception should not be thrown by the developer. - */ - class ScriptLoadFailedException { - - } + //} //#endregion @@ -2252,7 +1910,28 @@ declare module Sys { * Enables your application to call Web services asynchronously by using ECMAScript (JavaScript). * @see {@link http://msdn.microsoft.com/en-us/library/bb310823(v=vs.100).aspx} */ - // Cannot create definitions for generated proxy classes. + class WebServiceProxy { + static invoke( + servicePath: string, + methodName: string, + useGet?: boolean, + params?: any, + onSuccess?: (result: string, eventArgs: EventArgs) => void, + onFailure?: (error: WebServiceError) => void, + userContext?: any, + timeout?: number, + enableJsonp?: boolean, + jsonpCallbackParameter?: string): WebRequest; + } + + class WebServiceError { + get_errorObject(): any; + get_exceptionType(): any; + get_message(): string; + get_stackTrace(): string; + get_statusCode(): number; + get_timedOut(): boolean; + } /** * Contains information about a Web request that is ready to be sent to the current Sys.Net.WebRequestExecutor instance. @@ -2261,7 +1940,7 @@ declare module Sys { * * @see {@link http://msdn.microsoft.com/en-us/library/bb397488(v=vs.100).aspx} */ - class NetWorkRequestEventArgs { + class NetworkRequestEventArgs { //#region Constructors @@ -2310,6 +1989,19 @@ declare module Sys { //#endregion //#region Members + get_url(): string; + set_url(value: string): void; + get_httpVerb(): string; + set_httpVerb(value: string): void; + get_timeout(): number; + set_timeout(value: number): void; + get_body(): string; + set_body(value: string): void; + get_headers(): { [key: string]: string; }; + get_userContext(): any; + set_userContext(value: any): void; + get_executor(): WebRequestExecutor; + set_executor(value: WebRequestExecutor): void; /** * Registers a handler for the completed request event of the Web request. @@ -2387,7 +2079,7 @@ declare module Sys { * Gets the value of the specified response header. * @return The specified response header. */ - getResponseHeader(): string; + getResponseHeader(key: string): string; //#endregion @@ -2478,13 +2170,13 @@ declare module Sys { * @param handler * The function registered to handle the completed request event. */ - add_completedRequest(handler: (sender: any, eventArgs: any) => void): void; + add_completedRequest(handler: (sender: WebRequestExecutor, eventArgs: EventArgs) => void): void; /** * Registers a handler for processing the invoking request event of the WebRequestManager. * @param handler * The function registered to handle the invoking request event. */ - add_invokingRequest(handler: (sender: any, networkRequestEventArgs: any) => void): void; + add_invokingRequest(handler: (sender: WebRequestExecutor, networkRequestEventArgs: NetworkRequestEventArgs) => void): void; /** * Sends Web requests to the default network executor. * This member supports the client-script infrastructure and is not intended to be used directly from your code. @@ -2498,14 +2190,14 @@ declare module Sys { * @param handler * The function that handles the completed request event. */ - remove_completedRequest(handler: Function): void; + remove_completedRequest(handler: (sender: WebRequestExecutor, eventArgs: EventArgs) => void): void; /** * Removes the event handler set by the add_invokingRequest method. * Use the remove_invokingRequest method to remove the event handler you set using the add_invokingRequest method. * @param handler * The function that handles the invoking request event. */ - remove_invokingRequest(handler: Function): void; + remove_invokingRequest(handler: (sender: WebRequestExecutor, networkRequestEventArgs: NetworkRequestEventArgs) => void): void; //#endregion @@ -2943,16 +2635,16 @@ declare module Sys { * Gets a Sys.UI.Behavior instance with the specified name property from the specified HTML Document Object Model (DOM) element. This member a static member and can be invoked without creating an instance of the class. * @return The specified Behavior object, if found; otherwise, null. */ - static getBehaviorByName(element: Sys.UI.DomElement, name: string): Behavior; + static getBehaviorByName(element: HTMLElement, name: string): Behavior; /** * Gets an array of Sys.UI.Behavior objects that are of the specified type from the specified HTML Document Object Model (DOM) element. This method is static and can be invoked without creating an instance of the class. * @return An array of all Behavior objects of the specified type that are associated with the specified DOM element, if found; otherwise, an empty array. */ - static getBehaviorsByType(element: Sys.UI.DomElement, type: Sys.UI.Behavior): Behavior[]; + static getBehaviorsByType(element: HTMLElement, type: Sys.UI.Behavior): Behavior[]; /** * Gets the Sys.UI.Behavior objects that are associated with the specified HTML Document Object Model (DOM) element. This member is static and can be invoked without creating an instance of the class. * @param element - * The Sys.UI.DomElement object to search. + * The HTMLElement object to search. * @return An array of references to Behavior objects, or null if no references exist. */ static getBehaviors(element: DomElement): Behavior[]; @@ -2971,10 +2663,10 @@ declare module Sys { * Gets the HTML Document Object Model (DOM) element that the current Sys.UI.Behavior object is associated with. * @return The DOM element that the current Behavior object is associated with. */ - get_element(): Sys.UI.DomElement; + get_element(): HTMLElement; /** * Gets or sets the identifier for the Sys.UI.Behavior object. - * A generated identifier that consists of the ID of the associated Sys.UI.DomElement, the "$" character, and the name value of the Behavior object. + * A generated identifier that consists of the ID of the associated HTMLElement, the "$" character, and the name value of the Behavior object. */ get_id(): string; /** @@ -3050,11 +2742,11 @@ declare module Sys { * When called from a derived class, initializes a new instance of that class. * The Control constructor is a complete constructor function. However, because the Control class is an abstract base class, the constructor should be called only from derived classes. * @param element - * The Sys.UI.DomElement object that the control will be associated with. + * The HTMLElement object that the control will be associated with. * * @throws Error.invalidOperation Function */ - constructor(element: Sys.UI.DomElement); + constructor(element: HTMLElement); //#endregion @@ -3122,6 +2814,33 @@ declare module Sys { toggleCssClass(className: string): void; //#endregion + + //#region Properties + + /** + * Gets the HTML Document Object Model (DOM) element that the current Sys.UI.Control object is associated with. + * @return The DOM element that the current Control object is associated with. + */ + get_element(): HTMLElement; + /** + * Gets or sets the identifier for the Sys.UI.Control object. + * A generated identifier that consists of the ID of the associated HTMLElement, the "$" character, and the name value of the Control object. + */ + get_id(): string; + /** + * Gets or sets the identifier for the Sys.UI.Control object. + * @param value + * The string value to use as the identifier. + */ + set_id(value: string): void; + /* + * Gets or sets the name of the Sys.UI.Control object. + * If you do not explicitly set the name property, getting the property value sets it to its default value, which is equal to the type of the Control object. The name property remains null until it is accessed. + * @param value + * A string value to use as the name. + */ + + //#endregion } /** * Defines static methods and properties that provide helper APIs for manipulating and inspecting DOM elements. @@ -3131,11 +2850,7 @@ declare module Sys { //#region Constructors - /** - * Initializes a new instance of the Sys.UI.DomElement class. - */ - constructor(): void; - + //#endregion //#region Methods @@ -3144,38 +2859,38 @@ declare module Sys { * Adds a CSS class to a DOM element if the class is not already part of the DOM element. This member is static and can be invoked without creating an instance of the class. * If the element does not support a CSS class, no change is made to the element. * @param element - * The Sys.UI.DomElement object to add the CSS class to. + * The HTMLElement object to add the CSS class to. * @param className * The name of the CSS class to add. */ - addCssClass(element: Sys.UI.DomElement, className: string): void; + addCssClass(element: HTMLElement, className: string): void; /** * Gets a value that indicates whether the DOM element contains the specified CSS class. This member is static and can be invoked without creating an instance of the class. * @param element - * The Sys.UI.DomElement object to test for the CSS class. + * The HTMLElement object to test for the CSS class. * @param className * The name of the CSS class to test for. * @return * true if the element contains the specified CSS class; otherwise, false. */ - containsCssClass(element: Sys.UI.DomElement, className: string): boolean; + containsCssClass(element: HTMLElement, className: string): boolean; /** * Gets a set of integer coordinates that represent the position, width, and height of a DOM element. This member is static and can be invoked without creating an instance of the class. * * @param element - * The Sys.UI.DomElement instance to get the coordinates of. + * The HTMLElement instance to get the coordinates of. * @return * An object of the JavaScript type Object that contains the x-coordinate and y-coordinate of the upper-left corner, the width, and the height of the element in pixels. */ - getBounds(element: Sys.UI.DomElement): Object; + getBounds(element: HTMLElement): { x: number; y: number; width: number; height: number; }; /** * @param id * The ID of the element to find. * @param element * (optional) The parent element to search in. The default is the document element. */ - getElementById(id: string): Sys.UI.DomElement; - getElementById(id: string, element?: Sys.UI.DomElement): Sys.UI.DomElement; + getElementById(id: string): HTMLElement; + getElementById(id: string, element?: HTMLElement): HTMLElement; getElementById(id: string, element?: HTMLElement): HTMLElement; getElementById(id: string, element: any): any; /** @@ -3185,17 +2900,15 @@ declare module Sys { * @return * An object of the JavaScript type Object that contains the x-coordinate and y-coordinate of the element in pixels. */ - getLocation(element: Sys.UI.DomElement): Sys.UI.Point; - getLocation(element: any): Object; + getLocation(element: HTMLElement): Sys.UI.Point; /* - * Returns a value that represents the layout characteristics of a DOM element when it is hidden by invoking the Sys.UI.DomElement.setVisible method. This member is static and can be invoked without creating an instance of the class. + * Returns a value that represents the layout characteristics of a DOM element when it is hidden by invoking the HTMLElement.setVisible method. This member is static and can be invoked without creating an instance of the class. * @param element * The target DOM element. * @return * A Sys.UI.VisibilityMode enumeration value that indicates the layout characteristics of element when it is hidden by invoking the setVisible method. */ - getVisibilityMode(element: Sys.UI.DomElement): Sys.UI.VisibilityMode; - getVisibilityMode(element: any): Sys.UI.VisibilityMode; + getVisibilityMode(element: HTMLElement): Sys.UI.VisibilityMode; /** * Gets a value that indicates whether a DOM element is currently visible on the Web page. This member is static and can be invoked without creating an instance of the class. * @param element @@ -3219,16 +2932,15 @@ declare module Sys { * @param args * The event arguments */ - raiseBubbleEvent(source: Sys.UI.DomElement, args: EventArgs): void; - raiseBubbleEvent(source: any, args: any): void; + raiseBubbleEvent(source: HTMLElement, args: EventArgs): void; /** * Removes a CSS class from a DOM element. This member is static and can be invoked without creating an instance of the class. If the element does not include a CSS class, no change is made to the element. * @param element - * The Sys.UI.DomElement object to remove the CSS class from. + * The HTMLElement object to remove the CSS class from. * @param className * The name of the CSS class to remove. */ - removeCssClass(element: Sys.UI.DomElement, className: string): void; + removeCssClass(element: HTMLElement, className: string): void; removeCssClass(element: HTMLElement, className: string): void; removeCssClass(element: any, className: string): void; /** @@ -3241,9 +2953,7 @@ declare module Sys { * @return * A DOM element. */ - resolveElement(elementOrElementId: Sys.UI.DomElement, containerElement?: Sys.UI.DomElement): Sys.UI.DomElement; - resolveElement(elementOrElementId: HTMLElement, containerElement?: HTMLElement): HTMLElement; - resolveElement(elementOrElementId: string): any; + resolveElement(elementOrElementId: string|HTMLElement, containerElement?: HTMLElement): HTMLElement; /** * Sets the position of a DOM element. This member is static and can be invoked without creating an instance of the class. * he left and top style attributes (upper-left corner) of an element specify the relative position of an element. @@ -3252,14 +2962,12 @@ declare module Sys { * @param x The x-coordinate in pixels. * @param y The y-coordinate in pixels. */ - setLocation(element: Sys.UI.DomElement, x: number, y: number): void; setLocation(element: HTMLElement, x: number, y: number): void; - setLocation(element: any, x: number, y: number): void; /** - * Sets the layout characteristics of a DOM element when it is hidden by invoking the Sys.UI.DomElement.setVisible method. + * Sets the layout characteristics of a DOM element when it is hidden by invoking the HTMLElement.setVisible method. * This member is static and can be invoked without creating an instance of the class. * - * Use the setVisibilityMode method to set the layout characteristics of a DOM element when it is hidden by invoking the Sys.UI.DomElement.setVisible method. + * Use the setVisibilityMode method to set the layout characteristics of a DOM element when it is hidden by invoking the HTMLElement.setVisible method. * For example, if value is set to Sys.UI.VisibilityMode.collapse, the element uses no space on the page when the setVisible method is called to hide the element. * * @param element @@ -3267,41 +2975,37 @@ declare module Sys { * @param value * A Sys.UI.VisibilityMode enumeration value. */ - setVisibilityMode(element: Sys.UI.DomElement, value: Sys.UI.VisibilityMode): void; + setVisibilityMode(element: HTMLElement, value: Sys.UI.VisibilityMode): void; /** * Sets a DOM element to be visible or hidden. This member is static and can be invoked without creating an instance of the class. * * Use the setVisible method to set a DOM element as visible or hidden on the Web page. * If you invoke this method with value set to false for an element whose visibility mode is set to "hide," the element will not be visible. * However, it will occupy space on the page. If the element's visibility mode is set to "collapse," the element will occupy no space in the page. - * For more information about how to set the layout characteristics of hidden DOM elements, see Sys.UI.DomElement setVisibilityMode Method. + * For more information about how to set the layout characteristics of hidden DOM elements, see HTMLElement setVisibilityMode Method. * * @param element * The target DOM element. * @param value * true to make element visible on the Web page; false to hide element. */ - setVisible(element: Sys.UI.DomElement, value: boolean): void; setVisible(element: HTMLElement, value: boolean): void; - setVisible(element: any, value: boolean): void; /** * Toggles a CSS class in a DOM element. This member is static and can be invoked without creating an instance of the class. * Use the toggleCssClass method to hide a CSS class of an element if it is shown, or to show a CSS class of an element if it is hidden. * * @param element - * The Sys.UI.DomElement object to toggle. + * The HTMLElement object to toggle. * @param className * The name of the CSS class to toggle. */ - toggleCssClass(element: Sys.UI.DomElement, className: string): void; toggleCssClass(element: HTMLElement, className: string): void; - toggleCssClass(element: any, className: string): void; //#endregion } - var DomElement: Sys.UI.DomElement; + var DomElement: DomElement; /** * Provides cross-browser access to DOM event properties and helper APIs that are used to attach handlers to DOM element events. @@ -3312,12 +3016,11 @@ declare module Sys { //#region Constructors /** - * Initializes a new instance of the Sys.UI.DomEvent class and associates it with the specified DomElement object. + * Initializes a new instance of the Sys.UI.DomEvent class and associates it with the specified HTMLElement object. * @param domElement - * The DomElement object to associate with the event. + * The HTMLElement object to associate with the event. */ - constructor(domElement: DomElement); - constructor(domElement: any); + constructor(domElement: HTMLElement); //#endregion @@ -3337,7 +3040,7 @@ declare module Sys { * @param autoRemove * (Optional) A boolean value that determines whether the handler should be removed automatically when the element is disposed. */ - static addHandler(element: any, eventName: string, handler: Function, autoRemove?: boolean): void; + static addHandler(element: HTMLElement, eventName: string, handler: (e: DomEvent) => void, autoRemove?: boolean); /** * Adds a list of DOM event handlers to the DOM element that exposes the events. This member is static and can be invoked without creating an instance of the class. * Use the addHandlers method to add a list of DOM event handlers to the element that exposes the event. @@ -3359,7 +3062,7 @@ declare module Sys { * @throws Error.invalidOperation - (Debug) One of the handlers specified in events is not a function. * */ - static addHandlers(element: any, events: any, handlerOwner?: any, autoRemove?: boolean): void; + static addHandlers(element: HTMLElement, events: { [event: string]: (e: DomEvent) => void }, handlerOwner?: any, autoRemove?: boolean): void; /** * Removes all DOM event handlers from a DOM element that were added through the Sys.UI.DomEvent addHandler or the Sys.UI.DomEvent addHandlers methods. * This member is static and can be invoked without creating an instance of the class. @@ -3368,7 +3071,7 @@ declare module Sys { * @param element * The element that exposes the events. */ - static clearHandlers(element: any): void; + static clearHandlers(element: HTMLElement): void; /** * Removes a DOM event handler from the DOM element that exposes the event. This member is static and can be invoked without creating an instance of the class. * @@ -3379,7 +3082,7 @@ declare module Sys { * @param handler * The event handler to remove. */ - static removeHandler(element: any, eventName: string, handler: Function): void; + static removeHandler(element: HTMLElement, eventName: string, handler: (e: DomEvent) => void): void; /** * Prevents the default DOM event action from happening. * Use the preventDefault method to prevent the default event action for the browser from occurring. @@ -3544,10 +3247,21 @@ declare module Sys { * Describes mouse button locations. */ enum MouseButton { - // todo + /** + * Represents the left mouse button. + */ + leftButton, + /** + * Represents the middle mouse button. + */ + middleButton, + /** + * Represents the right mouse button. + */ + rightButton } /** - * Creates an object that contains a set of integer coordinates that represent a position. The getLocation method of the Sys.UI.DomElement class returns a Point object. + * Creates an object that contains a set of integer coordinates that represent a position. The getLocation method of the HTMLElement class returns a Point object. * @see {@link http://msdn.microsoft.com/en-us/library/bb383992(v=vs.100).aspx} * */ class Point { @@ -3829,7 +3543,7 @@ declare module Sys { * The pageLoading event of the Sys.WebForms.PageRequestManager class uses a PageLoadingEventArgs object to return its event data. * @return An array of
elements that will be deleted from the DOM. If no elements will be deleted, the property returns null. */ - get_panelsDeleted(): HTMLDivElement[]; + get_panelsDeleting(): HTMLDivElement[]; /** * Gets an array of HTML
elements that represent UpdatePanel controls that will be updated in the DOM as a result of the current asynchronous postback. * If the contents of any UpdatePanel controls will be updated as the result of a partial-page update, the panelsUpdating property contains an array that references the corresponding
elements. diff --git a/sharepoint/SharePoint.d.ts b/sharepoint/SharePoint.d.ts index 1f7a2feaf4..026658ef8d 100644 --- a/sharepoint/SharePoint.d.ts +++ b/sharepoint/SharePoint.d.ts @@ -1,157 +1,13 @@ -// Type definitions for sptypescript +// Type definitions for sptypescript // Project: http://sptypescript.codeplex.com -// Definitions by: Stanislav Vyshchepan , Andrey Markeev +// Definitions by: Stanislav Vyshchepan and Andrey Markeev // Definitions: https://github.com/borisyankov/DefinitelyTyped -declare module Sys { - export class EventArgs { - static Empty: Sys.EventArgs; - } - export class StringBuilder { - /** Appends a string to the string builder */ - append(s: string): void; - /** Appends a line to the string builder */ - appendLine(s: string): void; - /** Clears the contents of the string builder */ - clear(): void; - /** Indicates wherever the string builder is empty */ - isEmpty(): boolean; - /** Gets the contents of the string builder as a string */ - toString(): string; - } - export class Component { - get_id(): string; - static create(type: Component, properties?: any, events?: any, references?: any, element?: Node); - initialize(): void; - updated(): void; - } - - export interface IContainer { - addComponent(component: Component): void; - findComponent(id: string): Component; - getComponents(): Component[]; - removeComponent(component: Component); - } - - export class Application extends Component implements IContainer { - addComponent(component: Component): void; - findComponent(id: string): Component; - getComponents(): Component[]; - removeComponent(component: Component); - - static add_load(handler: (sender: Application, eventArgs: ApplicationLoadEventArgs) => void); - static remove_load(handler: (sender: Application, eventArgs: ApplicationLoadEventArgs) => void); - } - - export class ApplicationLoadEventArgs { - constructor(components: Component[], isPartialLoad: boolean); - public components: Component[]; - public isPartialLoad: boolean; - } - - module UI { - export class Control extends Component { } - export class DomEvent { - static addHandler(element: HTMLElement, eventName: string, handler: (e: Event) => void); - static removeHandler(element: HTMLElement, eventName: string, handler: (e: Event) => void); - } - - export class DomElement { - static getBounds(element: HTMLElement): { x: number; y: number; width: number; height: number; }; - } - } - module Net { - export class WebRequest { - get_url(): string; - set_url(value: string): void; - get_httpVerb(): string; - set_httpVerb(value: string): void; - get_timeout(): number; - set_timeout(value: number): void; - get_body(): string; - set_body(value: string): void; - get_headers(): { [key: string]: string; }; - get_userContext(): any; - set_userContext(value: any): void; - get_executor(): WebRequestExecutor; - set_executor(value: WebRequestExecutor): void; - - getResolvedUrl(); string; - invoke(): void; - completed(args: Sys.EventArgs): void; - - add_completed(handler: (executor: WebRequestExecutor, args: Sys.EventArgs) => void): void; - remove_completed(handler: (executor: WebRequestExecutor, args: Sys.EventArgs) => void): void; - } - - export class WebRequestExecutor { - get_aborted(): boolean; - get_responseAvailable(): boolean; - get_responseData(): string; - get_object(): any; - get_started(): boolean; - get_statusCode(): number; - get_statusText(): string; - get_timedOut(): boolean; - get_xml(): Document; - get_webRequest(): WebRequest; - abort(): void; - executeRequest(): void; - getAllResponseHeaders(): string; - getResponseHeader(key: string): string; - } - - export class NetworkRequestEventArgs extends EventArgs { - get_webRequest(): WebRequest; - } - - - export class WebRequestManager { - static get_defaultExecutorType(): string; - static set_defaultExecutorType(value: string): void; - static get_defaultTimeout(): number; - static set_defaultTimeout(value: number): void; - - static executeRequest(request: WebRequest): void; - static add_completedRequest(handler: (executor: WebRequestExecutor, args: Sys.EventArgs) => void): void; - static remove_completedRequest(handler: (executor: WebRequestExecutor, args: Sys.EventArgs) => void): void; - static add_invokingRequest(handler: (executor: WebRequestExecutor, args: NetworkRequestEventArgs) => void): void; - static remove_invokingRequest(handler: (executor: WebRequestExecutor, args: NetworkRequestEventArgs) => void): void; - } - - export class WebServiceProxy { - static invoke( - servicePath: string, - methodName: string, - useGet?: boolean, - params?: any, - onSuccess?: (result: string, eventArgs: EventArgs) => void, - onFailure?: (error: WebServiceError) => void, - userContext?: any, - timeout?: number, - enableJsonp?: boolean, - jsonpCallbackParameter?: string): WebRequest; - } - - export class WebServiceError { - get_errorObject(): any; - get_exceptionType(): any; - get_message(): string; - get_stackTrace(): string; - get_statusCode(): number; - get_timedOut(): boolean; - } - } - interface IDisposable { - dispose(): void; - } - -} - -declare var $get: { (id: string): HTMLElement; }; -declare var $addHandler: { (element: HTMLElement, eventName: string, handler: (e: Event) => void): void; }; -declare var $removeHandler: { (element: HTMLElement, eventName: string, handler: (e: Event) => void): void; }; +/// +declare var _spBodyOnLoadFunctions: Function[]; +declare var _spBodyOnLoadFunctionNames: string[]; +declare var _spBodyOnLoadCalled: boolean; declare module SP { export class SOD { @@ -463,7 +319,8 @@ interface ContextInfo extends SPClientTemplates.RenderContext { } -declare function GetCurrentCtx():ContextInfo; +declare function GetCurrentCtx(): ContextInfo; +declare function SetFullScreenMode(fullscreen: boolean); declare module SP { export enum RequestExecutorErrors { requestAbortedOrTimedout, @@ -490,7 +347,7 @@ declare module SP { method?: string; headers?: { [key: string]: string; }; /** Can be string or bytearray depending on binaryStringRequestBody field */ - body?: any; + body?: string|Uint8Array; binaryStringRequestBody?: boolean; /** Currently need fix to get ginary response. Details: http://techmikael.blogspot.ru/2013/07/how-to-copy-files-between-sites-using.html */ @@ -509,7 +366,7 @@ declare module SP { headers?: { [key: string]: string; }; contentType?: string; /** Can be string or bytearray depending on request.binaryStringResponseBody field */ - body?: any; + body?: string|Uint8Array; state?: any; } @@ -1116,8 +973,8 @@ declare module SPClientTemplates { Type: string; } -/** Represents field schema in Grid mode and on list forms. - Consider casting objects of this type to more specific field types, e.g. FieldSchemaInForm_Lookup */ + /** Represents field schema in Grid mode and on list forms. + Consider casting objects of this type to more specific field types, e.g. FieldSchemaInForm_Lookup */ export interface FieldSchema_InForm extends FieldSchema { /** Description for this field. */ Description: string; @@ -1166,6 +1023,7 @@ declare module SPClientTemplates { FormUniqueId: string; ListData: ListData_InForm; ListSchema: ListSchema_InForm; + CSRCustomLayout?: boolean; } @@ -1389,7 +1247,7 @@ declare module SPClientTemplates { StateInitDone: boolean; TableCbxFocusHandler: any; TableMouseOverHandler: any; - TotalListItems: any; + TotalListItems: number; verEnabled: number; /** Guid of the view. */ view: string; @@ -1404,10 +1262,10 @@ declare module SPClientTemplates { } export interface RenderContext_FieldInView extends RenderContext_ItemInView { /** If in grid mode (context.inGridMode == true), cast to FieldSchema_InForm, otherwise cast to FieldSchema_InView */ - CurrentFieldSchema: any; + CurrentFieldSchema: FieldSchema_InForm | FieldSchema_InView; CurrentFieldValue: any; FieldControlsModes: { [fieldInternalName: string]: ClientControlMode; }; - FormContext: any; + FormContext: ClientFormContext; FormUniqueId: string; } @@ -1417,6 +1275,7 @@ declare module SPClientTemplates { export interface Group { Items: Item[]; } + type RenderCallback = (ctx: RenderContext) => void; export interface RenderContext { BaseViewID?: number; @@ -1426,8 +1285,8 @@ declare module SPClientTemplates { CurrentSelectedItems?: any; CurrentUICultureName?: string; ListTemplateType?: number; - OnPostRender?: any; - OnPreRender?: any; + OnPostRender?: RenderCallback | RenderCallback[]; + OnPreRender?: RenderCallback | RenderCallback[]; onRefreshFailed?: any; RenderBody?: (renderContext: RenderContext) => string; RenderFieldByName?: (renderContext: RenderContext, fieldName: string) => string; @@ -1484,18 +1343,18 @@ declare module SPClientTemplates { } export interface Templates { - View?: (renderContext: any) => string; // TODO: determine appropriate context type and purpose of this template - Body?: (renderContext: any) => string; // TODO: determine appropriate context type and purpose of this template + View?: RenderCallback | string; // TODO: determine appropriate context type and purpose of this template + Body?: RenderCallback | string; // TODO: determine appropriate context type and purpose of this template /** Defines templates for rendering groups (aggregations). */ - Group?: GroupCallback; + Group?: GroupCallback| string; /** Defines templates for list items rendering. */ - Item?: ItemCallback; + Item?: ItemCallback| string; /** Defines template for rendering list view header. Can be either string or SingleTemplateCallback */ - Header?: SingleTemplateCallback; + Header?: SingleTemplateCallback| string; /** Defines template for rendering list view footer. Can be either string or SingleTemplateCallback */ - Footer?: SingleTemplateCallback; + Footer?: SingleTemplateCallback| string; /** Defines templates for fields rendering. The field is specified by it's internal name. */ Fields?: FieldTemplates; } @@ -1505,18 +1364,18 @@ declare module SPClientTemplates { } export interface TemplateOverrides { - View?: (renderContext: any) => string; // TODO: determine appropriate context type and purpose of this template - Body?: (renderContext: any) => string; // TODO: determine appropriate context type and purpose of this template + View?: RenderCallback | string; // TODO: determine appropriate context type and purpose of this template + Body?: RenderCallback | string; // TODO: determine appropriate context type and purpose of this template /** Defines templates for rendering groups (aggregations). */ - Group?: GroupCallback; + Group?: GroupCallback| string; /** Defines templates for list items rendering. */ - Item?: ItemCallback; + Item?: ItemCallback| string; /** Defines template for rendering list view header. Can be either string or SingleTemplateCallback */ - Header?: SingleTemplateCallback; + Header?: SingleTemplateCallback| string; /** Defines template for rendering list view footer. Can be either string or SingleTemplateCallback */ - Footer?: SingleTemplateCallback; + Footer?: SingleTemplateCallback| string; /** Defines templates for fields rendering. The field is specified by it's internal name. */ Fields?: FieldTemplateMap; } @@ -1525,10 +1384,10 @@ declare module SPClientTemplates { Templates?: TemplateOverrides; /** �allbacks called before rendering starts. Can be function (ctx: RenderContext) => void or array of functions.*/ - OnPreRender?: any; + OnPreRender?: RenderCallback | RenderCallback[]; /** �allbacks called after rendered html inserted into DOM. Can be function (ctx: RenderContext) => void or array of functions.*/ - OnPostRender?: any; + OnPostRender?: RenderCallback | RenderCallback[]; /** View style (SPView.StyleID) for which the templates should be applied. If not defined, the templates will be applied only to default view style. */ @@ -1538,11 +1397,11 @@ declare module SPClientTemplates { ListTemplateType?: number; /** Base view ID (SPView.BaseViewID) for which the template should be applied. If not defined, the templates will be applied to all views. */ - BaseViewID?: any; + BaseViewID?: number|string; } export class TemplateManager { static RegisterTemplateOverrides(renderCtx: TemplateOverridesOptions): void; - static GetTemplates(renderCtx: any): Templates; + static GetTemplates(renderCtx: RenderContext): Templates; } export interface ClientUserValue { @@ -1616,13 +1475,13 @@ declare module SPClientTemplates { EnableVesioning: boolean; Id: string; }; - registerInitCallback(fieldname: string, callback: () => void ): void; - registerFocusCallback(fieldname: string, callback: () => void ): void; - registerValidationErrorCallback(fieldname: string, callback: (error: any) => void ): void; + registerInitCallback(fieldname: string, callback: () => void): void; + registerFocusCallback(fieldname: string, callback: () => void): void; + registerValidationErrorCallback(fieldname: string, callback: (error: any) => void): void; registerGetValueCallback(fieldname: string, callback: () => any): void; updateControlValue(fieldname: string, value: any): void; registerClientValidator(fieldname: string, validator: SPClientForms.ClientValidation.ValidatorSet): void; - registerHasValueChangedCallback(fieldname: string, callback: (eventArg?: any) => void ); + registerHasValueChangedCallback(fieldname: string, callback: (eventArg?: any) => void); } } @@ -1653,6 +1512,14 @@ declare module SPClientForms { } } +declare class SPMgr { + NewGroup(listItem: Object, fieldName: string): boolean; + RenderHeader(renderCtx: SPClientTemplates.RenderContext, field: SPClientTemplates.FieldSchema): string; + RenderField(renderCtx: SPClientTemplates.RenderContext, field: SPClientTemplates.FieldSchema, listItem: Object, listSchema: SPClientTemplates.ListSchema): string; + RenderFieldByName(renderCtx: SPClientTemplates.RenderContext, fieldName: string, listItem: Object, listSchema: SPClientTemplates.ListSchema): string; +} + +declare var spMgr: SPMgr; declare module SPAnimation { export enum Attribute { @@ -7241,7 +7108,7 @@ declare module SP { } export class Status { - static addStatus(strTitle: string, strHtml: string, atBegining: boolean): string; + static addStatus(strTitle: string, strHtml?: string, atBegining?: boolean): string; static appendStatus(sid: string, strTitle: string, strHtml: string): string; static updateStatus(sid: string, strHtml: string): void; static setStatusPriColor(sid: string, strColor: string): void; @@ -7378,19 +7245,19 @@ declare module SP { @param url overrides options.url @param callback overrides options.dialogResultValueCallback @param args overrides options.args */ - static commonModalDialogOpen(url: string, options: SP.UI.IDialogOptions, callback: SP.UI.DialogReturnValueCallback, args: any): void; + static commonModalDialogOpen(url: string, options: SP.UI.IDialogOptions, callback?: SP.UI.DialogReturnValueCallback, args?: any): void; /** Refresh the page if specified dialogResult equals to SP.UI.DialogResult.OK */ static RefreshPage(dialogResult: SP.UI.DialogResult): void; /** Show page specified by the url in a modal dialog. If the dialog returns SP.UI.DialogResult.OK, the page is refreshed. */ static ShowPopupDialog(url: string): void; /** Show modal dialog specified by url, callback, height and width. */ - static OpenPopUpPage(url: string, callback: SP.UI.DialogReturnValueCallback, width: number, height: number): void; + static OpenPopUpPage(url: string, callback: SP.UI.DialogReturnValueCallback, width?: number, height?: number): void; /** Displays a wait/loading modal dialog with the specified title, message, height and width. Height and width are defined in pixels. Cancel/close button is not shown. */ - static showWaitScreenWithNoClose(title: string, message: string, height: number, width: number): SP.UI.ModalDialog; + static showWaitScreenWithNoClose(title: string, message?: string, height?: number, width?: number): SP.UI.ModalDialog; /** Displays a wait/loading modal dialog with the specified title, message, height and width. Height and width are defined in pixels. Cancel button is shown. If user clicks it, the callbackFunc is called. */ - static showWaitScreenSize(title: string, message: string, callbackFunc: SP.UI.DialogReturnValueCallback, height: number, width: number): SP.UI.ModalDialog; + static showWaitScreenSize(title: string, message?: string, callbackFunc?: SP.UI.DialogReturnValueCallback, height?: number, width?: number): SP.UI.ModalDialog; static showPlatformFirstRunDialog(url: string, callbackFunc: SP.UI.DialogReturnValueCallback): SP.UI.ModalDialog; - static get_childDialog: any; + static get_childDialog: ModalDialog; /** Closes the dialog using the specified dialog result. */ close(dialogResult: SP.UI.DialogResult): void; } @@ -7469,6 +7336,11 @@ declare module SP { } } + export module Workplace { + export function add_resized(handler: Function); + export function remove_resized(handler:Function); + } + export module UIUtility { export function generateRandomElementId(): string; export function cancelEvent(evt: Event): void; @@ -8410,11 +8282,11 @@ declare module SP.WorkflowServices { /** RestrictToScope is a GUID value, used in conjunction with the RestrictToType property to further restrict the scope of the definition. For example, if the RestrictToType is "List", then setting the RestrictToScope to a particular list identifier limits the definition to be associable only to the specified list. If the RestrictToType is "List" but the RestrictToScope is null or the empty string, then the definition is associable to any list. */ - get_restrictScope(): string; + get_restrictToScope(): string; /** RestrictToScope is a GUID value, used in conjunction with the RestrictToType property to further restrict the scope of the definition. For example, if the RestrictToType is "List", then setting the RestrictToScope to a particular list identifier limits the definition to be associable only to the specified list. If the RestrictToType is "List" but the RestrictToScope is null or the empty string, then the definition is associable to any list. */ - set_restrictScope(value: string): string; + set_restrictToScope(value: string): string; /** RestrictToType determines the possible event source type for a workflow subscription that uses this definition. Possible values include "List", "Site", the empty string, or null. */ get_restrictToType(): string; @@ -9441,6 +9313,7 @@ interface ISPClientAutoFillData { AutoFillMenuOptionType?: number; } + declare class SPClientPeoplePicker { static ValueName: string; // = 'Key'; static DisplayTextName: string; // = 'DisplayText'; @@ -9460,54 +9333,112 @@ declare class SPClientPeoplePicker { }; static InitializeStandalonePeoplePicker(clientId: string, value: ISPClientPeoplePickerEntity[], schema: ISPClientPeoplePickerSchema): void; + static ParseUserKeyPaste(userKey: string): string; + static GetTopLevelControl(elmChild: HTMLElement): HTMLElement; + static AugmentEntity(entity: ISPClientPeoplePickerEntity): ISPClientPeoplePickerEntity; + static AugmentEntitySuggestions(pickerObj: SPClientPeoplePicker, allEntities: ISPClientPeoplePickerEntity[], mergeLocal?: boolean): ISPClientPeoplePickerEntity[]; + static PickerObjectFromSubElement(elmSubElement: HTMLElement): SPClientPeoplePicker; + static TestLocalMatch(strSearchLower: string, dataEntity: ISPClientPeoplePickerEntity): boolean; + static BuildUnresolvedEntity(key: string, dispText: string): ISPClientPeoplePickerEntity; + static AddAutoFillMetaData(pickerObj: SPClientPeoplePicker, options: ISPClientPeoplePickerEntity[], numOpts: number): ISPClientPeoplePickerEntity[]; + static BuildAutoFillMenuItems(pickerObj: SPClientPeoplePicker, options: ISPClientPeoplePickerEntity[]): ISPClientPeoplePickerEntity[]; + static IsUserEntity(entity: ISPClientPeoplePickerEntity): boolean; + static CreateSPPrincipalType(acctStr: string): number; - public TopLevelElementId: string;// '', - public EditorElementId: string;//'', - public AutoFillElementId: string;//'', - public ResolvedListElementId: string;//'', - public InitialHelpTextElementId: string;//'', - public WaitImageId: string;//'', - public HiddenInputId: string;//'', - public AllowEmpty: boolean;//true, - public ForceClaims: boolean;//false, - public AutoFillEnabled: boolean;//true, - public AllowMultipleUsers: boolean;//false, + + public TopLevelElementId: string; // '', + public EditorElementId: string; //'', + public AutoFillElementId: string; //'', + public ResolvedListElementId: string; //'', + public InitialHelpTextElementId: string; //'', + public WaitImageId: string; //'', + public HiddenInputId: string; //'', + public AllowEmpty: boolean; //true, + public ForceClaims: boolean; //false, + public AutoFillEnabled: boolean; //true, + public AllowMultipleUsers: boolean; //false, public OnValueChangedClientScript: (pickerElementId: string, users: ISPClientPeoplePickerEntity[]) => void; public OnUserResolvedClientScript: (pickerElementId: string, users: ISPClientPeoplePickerEntity[]) => void; public OnControlValidateClientScript: (pickerElementId: string, users: ISPClientPeoplePickerEntity[]) => void; - public UrlZone: string;//null, - public AllUrlZones: boolean;//false, - public SharePointGroupID: number;//0, - public AllowEmailAddresses: boolean;//false, + public UrlZone: SP.UrlZone; //null, + public AllUrlZones: boolean; //false, + public SharePointGroupID: number; //0, + public AllowEmailAddresses: boolean; //false, public PPMRU: SPClientPeoplePickerMRU; - public UseLocalSuggestionCache: boolean;//true, - public CurrentQueryStr: string;//'', - public LatestSearchQueryStr: string;// '', + public UseLocalSuggestionCache: boolean; //true, + public CurrentQueryStr: string; //'', + public LatestSearchQueryStr: string; // '', public InitialSuggestions: ISPClientPeoplePickerEntity[]; public CurrentLocalSuggestions: ISPClientPeoplePickerEntity[]; public CurrentLocalSuggestionsDict: ISPClientPeoplePickerEntity; - public VisibleSuggestions: number;//5, - public PrincipalAccountType: string;//'', + public VisibleSuggestions: number; //5, + public PrincipalAccountType: string; //'', public PrincipalAccountTypeEnum: SP.Utilities.PrincipalType; - public EnabledClaimProviders: string;//'', - public SearchPrincipalSource: SP.Utilities.PrincipalSource;//null, - public ResolvePrincipalSource: SP.Utilities.PrincipalSource;//null, - public MaximumEntitySuggestions: number;//30, - public EditorWidthSet: boolean;//false, - public QueryScriptInit: boolean;//false, - public AutoFillControl: string;//null, - public TotalUserCount: number;//0, - public UnresolvedUserCount: number;//0, - public UserQueryDict: ISPClientPeoplePickerEntity; - public ProcessedUserList: ISPClientPeoplePickerEntity; - public HasInputError: boolean;//false, - public HasServerError: boolean;//false, - public ShowUserPresence: boolean;//true, - public TerminatingCharacter: string;//';', - public UnresolvedUserElmIdToReplace: string;//'', - public WebApplicationID: SP.Guid;//'{00000000-0000-0000-0000-000000000000}', - + public EnabledClaimProviders: string; //'', + public SearchPrincipalSource: SP.Utilities.PrincipalSource; //null, + public ResolvePrincipalSource: SP.Utilities.PrincipalSource; //null, + public MaximumEntitySuggestions: number; //30, + public EditorWidthSet: boolean; //false, + public QueryScriptInit: boolean; //false, + public AutoFillControl: SPClientAutoFill; //null, + public TotalUserCount: number; //0, + public UnresolvedUserCount: number; //0, + public UserQueryDict: { [index: string]: SP.StringResult }; + public ProcessedUserList: { [index: string]: SPClientPeoplePickerProcessedUser }; + public HasInputError: boolean; //false, + public HasServerError: boolean; //false, + public ShowUserPresence: boolean; //true, + public TerminatingCharacter: string; //';', + public UnresolvedUserElmIdToReplace: string; //'', + public WebApplicationID: SP.Guid; //'{00000000-0000-0000-0000-000000000000}', public GetAllUserInfo(): ISPClientPeoplePickerEntity[]; + + public SetInitialValue(entities: ISPClientPeoplePickerEntity[], initialErrorMsg?: string): void + public AddUserKeys(userKeys: string, bSearch: boolean): void; + public BatchAddUserKeysOperation(allKeys: string[], numProcessed: number); + public ResolveAllUsers(fnContinuation: () => void): void; + public ExecutePickerQuery(queryIds: string, onSuccess: (queryId: string, result: SP.StringResult) => void, onFailure: (queryId: string, result: SP.StringResult) => void, fnContinuation: () => void): void; + public AddUnresolvedUserFromEditor(bRunQuery?: boolean): void; + public AddUnresolvedUser(unresolvedUserObj: ISPClientPeoplePickerEntity, bRunQuery?: boolean): void; + public UpdateUnresolvedUser(results: SP.StringResult, user: ISPClientPeoplePickerEntity): void; + public AddPickerSearchQuery(queryStr: string): string; + public AddPickerResolveQuery(queryStr: string): string; + public GetPeoplePickerQueryParameters(): SP.UI.ApplicationPages.ClientPeoplePickerQueryParameters; + public AddProcessedUser(userObject: ISPClientPeoplePickerEntity, fResolved?: boolean): string; + public DeleteProcessedUser(elmToRemove: HTMLElement): void; + public OnControlValueChanged(): void; + public OnControlResolvedUserChanged(): void; + public EnsureAutoFillControl(): void; + public ShowAutoFill(resultsTable: ISPClientAutoFillData[]): void; + public FocusAutoFill(): void; + public BlurAutoFill(): void; + public IsAutoFillOpen(): boolean; + public EnsureEditorWidth(): void; + public SetFocusOnEditorEnd(): void; + public ToggleWaitImageDisplay(bShowImage?: boolean): void; + public SaveAllUserKeysToHiddenInput(): void; + public GetCurrentEditorValue(): string; + public GetControlValueAsJSObject(): ISPClientPeoplePickerEntity[]; + public GetAllUserKeys(): string; + public GetControlValueAsText(): string; + public IsEmpty(): boolean; + public IterateEachProcessedUser(fnCallback: (index: number, user: SPClientPeoplePickerProcessedUser) => void): void; + public HasResolvedUsers(): boolean; + public Validate(): void; + public ValidateCurrentState(): void + public GetUnresolvedEntityErrorMessage(): string; + public ShowErrorMessage(msg: string): void; + public ClearServerError(): void; + public SetServerError(): void; + public OnControlValidate(): void; + public SetEnabledState(bEnabled: boolean): void; + public DisplayLocalSuggestions(): void; + public CompileLocalSuggestions(input: string): void; + public PlanningGlobalSearch(): boolean; + public AddLoadingSuggestionMenuOption(): void; + public ShowingLocalSuggestions(): boolean; + public ShouldUsePPMRU(): boolean; + public AddResolvedUserToLocalCache(resolvedEntity: ISPClientPeoplePickerEntity, resolveText: string); } interface ISPClientPeoplePickerSchema { @@ -9583,11 +9514,38 @@ interface ISPClientPeoplePickerEntity { Department: string; Email: string; }; - MultipleMatches: Object[]; + MultipleMatches: ISPClientPeoplePickerEntity[]; DomainText?: string; [key: string]: any; } +declare class SPClientPeoplePickerProcessedUser { + UserContainerElementId: string;// '', + DisplayElementId: string;// '', + PresenceElementId: string;// '', + DeleteUserElementId: string;// '', + SID: string;// '', + DisplayName: string;// '', + SIPAddress: string;// '', + UserInfo: ISPClientPeoplePickerEntity;// null, + ResolvedUser: boolean;// true, + Suggestions: ISPClientAutoFillData[];// null, + ErrorDescription: string;// '', + ResolveText: string;// '', + public UpdateResolvedUser(newUserInfo: ISPClientPeoplePickerEntity, strNewElementId: string): void; + public UpdateSuggestions(entity: ISPClientPeoplePickerEntity); + public BuildUserHTML(): string; + public UpdateUserMaxWidth(): void; + public ResolvedAsUnverifiedEmail(): string; + + static BuildUserPresenceHtml(elmId: string, strSip: string, bResolved?: boolean): string; + static GetUserContainerElement(elmChild: HTMLElement): HTMLElement; + static HandleProcessedUserClick(ndClicked: HTMLElement): void; + static DeleteProcessedUser(elmToRemove: HTMLElement): void; + static HandleDeleteProcessedUserKey(e: Event): void; + static HandleResolveProcessedUserKey(e: Event): void; +} + declare module Microsoft { export module Office { export module Server { @@ -9757,4 +9715,1234 @@ declare module SPThemeUtils { export function Suspend(): void; } +declare module SP { + export module JsGrid { + export enum TextDirection { + Default, //0, + RightToLeft, //1, + LeftToRight //2 + } + + export enum PaneId { + MainGrid, //0, + PivotedGrid, //1, + Gantt //2 + } + + export enum PaneLayout { + GridOnly, //0, + GridAndGantt, //1, + GridAndPivotedGrid //2 + + } + export enum EditMode { + ReadOnly, //0, + ReadWrite, //1, + ReadOnlyDefer, //2, + ReadWriteDefer, //3, + Defer //4 + } + + export enum GanttDrawBarFlags { + LeftLink, //0x01, + RightLink //0x02 + + } + export enum GanttBarDateType { + Start, //0, + End //1 + } + + export enum ValidationState { + Valid, //0, + Pending, //1, + Invalid //2 + } + + export enum HierarchyMode { + None, //0, + Standard, //1, + Grouping //2 + } + + export enum EditActorWriteType { + Both, //1, + LocalizedOnly, //2, + DataOnly, //3, + Either //4 + } + + export enum EditActorReadType { + Both, //1, + LocalizedOnly, //2, + DataOnly //3 + } + + export enum EditActorUpdateType { + Committed, //0, + Uncommitted, //1 + } + + export enum SortMode { + Ascending, //1, + Descending, //-1, + None //0 + } + + export module RowHeaderStyleId { + export var Transfer: string; //'Transfer', + export var Conflict: string; //'Conflict' + + } + + export module RowHeaderAutoStyleId { + export var Dirty:string; //'Dirty', + export var Error: string; //'Error', + export var NewRow: string; //'NewRow' + } + + export enum RowHeaderStatePriorities { + Dirty, //10, + Transfer, //30, + CellError, //40, + Conflict, //50, + RowError, //60, + NewRow //90 + } + + export enum UpdateSerializeMode { + Cancel, //0, + Default, //1, + PropDataOnly, //2, + PropLocalizedOnly, //3, + PropBoth //4 + } + + export enum UpdateTrackingMode { + PropData, //2, + PropLocalized, //3, + PropBoth //4 + } + + export module UserAction { + export var UserEdit:string; //'User Edit':string; + export var DeleteRecord:string; //'Delete Record':string; + export var InsertRecord:string; //'Insert Record':string; + export var Indent:string; //'Indent':string; + export var Outdent:string; //'Outdent':string; + export var Fill:string; //'Fill':string; + export var Paste:string; //'Paste':string; + export var CutPaste: string; //'Cut/Paste' + } + + export enum ReadOnlyActiveState { + ReadOnlyActive, //0, + ReadOnlyDisabled, //1 + } + + export interface IValue { + data?: any; + localized?:string; + } + + + export class JsGridControl { + constructor(parentNode: HTMLElement, bShowLoadingBanner: boolean); + /** Returns true if Init method has been executed successfully */ + IsInitialized(): boolean; + /** Replaces the control TableCache object with the provided one */ + ResetData(cache: SP.JsGrid.TableCache): void; + /** Initialize the control */ + Init(parameters: SP.JsGrid.JsGridControl.Parameters): void; + Cleanup(): void; + /** Removes all event handlers and markup associated with the control */ + Dispose(): void; + + // todo + NotifyDataAvailable(): void; + NotifySave(): void; + NotifyHide(): void; + NotifyResize(): void; + ClearTableView(): void; + HideInitialLoadingBanner(): void; + ShowInitialGridErrorMsg(errorMsg: string): void; + ShowGridErrorMsg(errorMsg: string): void; + LaunchPrintView(additionalScriptFiles, beforeInitFnName, beforeInitFnArgsObj, title, bEnableGantt, optGanttDelegateNames, optInitTableViewParamsFnName, optInitTableViewParamsFnArgsObj, optInitGanttStylesFnName, optInitGanttStylesFnArgsObj): void; + GetAllDataJson(fnOnFinished, optFnGetCellStyleID?): void; + SetTableView(tableViewParams): void; + SetRowView(rowViewParams): void; + + /** Enable grid after Disable. */ + Enable(): void; + /** Covers the grid with the semi-transparent panel, preventing any operations with it. + Additionally, displays loading animated gif and optMsg as the message next to it. + If optMsg is not specified, displays "Loading..." text. */ + Disable(optMsg?: string): void; + /** Enables grid editing */ + EnableEditing(): void; + /** Disables grid editing: all the records become readonly */ + DisableEditing(): void; + /** Switches the currently selected cell into edit mode: displays edit control and sets focus into it. + Returns true if success. */ + TryBeginEdit(): boolean; + FinalizeEditing(fnContinue, fnError): void; + /** Get diff tracker object that tracks changes to the grid data. */ + GetDiffTracker(): SP.JsGrid.Internal.DiffTracker; + /** Moves focus to the JsGrid control */ + Focus(): void; + + /** Try saving the new record row (aka entry row) if it was edited. */ + TryCommitFirstEntryRecords(fnCommitComplete: { (): void }): void; + /** Removes all new record rows (aka entry rows), including unsaved and even empty ones. + The latter seems to be a bug, as I haven't found any easy way to restore the empty entry row. */ + ClearUncommitedEntryRecords(): void; + /** Returns true if there are any unsaved new record rows (aka entry rows). */ + AnyUncommitedEntryRecords(): boolean; + + + // todo + AnyUncomittedProvisionalRecords(): boolean; + + /** Gets record based on the recordKey + @recordKey internal unique id of a row. You can get recordKey from view index via GetRecordKeyByViewIndex method. */ + GetRecord(recordKey: number): IRecord; + /** Get entry record with the specified key. + Entry record is a special type of record because it represents a new record that doesn't exist yet. */ + GetEntryRecord(key): any; + /** Determine if the specified record key identifies valid entry row. */ + IsEntryRecord(recordKey: number): boolean; + /** Determine whether the specified cell is editable. */ + IsCellEditable(record: IRecord, fieldKey: string, optPaneId?): boolean; + /** Adds one of builtin row state indicator icons into the row header. + Please pass one of the values of SP.JsGrid.RowHeaderStyleId + Row header is the leftmost gray column of the table. */ + AddBuiltInRowHeaderState(recordKey: number, rowHeaderStateId: string): void; + /** Adds the specified state into the row header. + There can be several row header states for one row. Only one is shown (according to the Priority). + Row header is the leftmost gray column of the table. */ + AddRowHeaderState(recordKey: number, rowHeaderState: SP.JsGrid.RowHeaderState): void; + /** Removes header state with specified id from the row. */ + RemoveRowHeaderState(recordKey: number, rowHeaderStateId: string): void; + + GetCheckSelectionManager(): any; + UpdateProperties(propertyUpdates, changeName, optChangeKey?): any; + GetLastRecordKey(): string; + InsertProvisionalRecordBefore(beforeRecordKey: number, newRecord, initialValues): any; + InsertProvisionalRecordAfter(afterRecordKey: number, newRecord, initialValues): any; + IsProvisionalRecordKey(recordKey: number): boolean; + InsertRecordBefore(beforeRecordKey: number, newRecord, optChangeKey?): any; + InsertRecordAfter(afterRecordKey: number, newRecord, optChangeKey?): any; + InsertHiddenRecord(recordKey: number, changeKey, optAfterRecordKey?): any; + DeleteRecords(recordKeys, optChangeKey?): any; + IndentRecords(recordKeys, optChangeKey?): any; + OutdentRecords(recordKeys, optChangeKey?): any; + ReorderRecords(beginRecordKey: number, endRecordKey: number, afterRecordKey: number, bSelectAfterwards: boolean): any; + GetContiguousRowSelectionWithoutEntryRecords(): { begin; end; keys }; + CanMoveRecordsUpByOne(recordKeys): boolean; + CanMoveRecordsDownByOne(recordKeys): boolean; + MoveRecordsUpByOne(recordKeys): any; + MoveRecordsDownByOne(recordKeys): any; + GetReorderRange(recordKeys): any; + GetNodeExpandCollapseState(recordKey): any; + ToggleExpandCollapse(recordKey: number): void; + + /** Attach event handler to a particular event type */ + AttachEvent(eventType: JsGrid.EventType, fnOnEvent: { (args: IEventArgs): void }): void; + /** Detach a previously set event handler */ + DetachEvent(eventType: JsGrid.EventType, fnOnEvent): void; + + /** Set a delegate. Delegates are way to replace default functionality with custom one. */ + SetDelegate(delegateKey: JsGrid.DelegateType, fn): void; + /** Get current delegate. */ + GetDelegate(delegateKey: JsGrid.DelegateType): any; + + /** Re-render the specified row in the view. */ + RefreshRow(recordKey: number): void; + /** Re-render all rows in the view. + It can be used e.g. if you have some custom display controls and they are rendered differently depending on some external settings. + In this case, if you update the external settings, obviously you have to then update the view for these settings to take effect. */ + RefreshAllRows(): void; + /** Clears undo queue, and also differencies tracker state and versions manager state. */ + ClearChanges(): void; + + GetGanttZoomLevel(): any; + SetGanttZoomLevel(level: any): void; + ScrollGanttToDate(date): void; + + /** Get top record view index. + You can then use GetRecordKeyByViewIndex to convert this value into the recordKey. */ + GetTopRecordIndex(): number; + /** Get number of rows displayed in the current view. */ + GetViewRecordCount(): number; + /** Get record key for a row that is specified by the viewIdx. + viewIdx - index of the row in the view, use GetTopRecordIndex to get the first one. + Returns recordKey, which is a unique numeric identifier of a row within a dataset. + Main difference between viewIdx and recordKey is that viewIdx is only unique within a view, + e.g. if you do paging, it can be same for different records. + */ + GetRecordKeyByViewIndex(viewIdx: number): number; + /** Opposite to GetRecordKeyByViewIndex, resolves the view index of the record based on record key. + recordKey - unique numeric identifier of a row in the current dataset. + Returns viewIdx - index of the row in the current view */ + GetViewIndexOfRecord(recordKey: number): number; + /** Get top row index. Usually returns 0. + You can then use GetRecordKeyByViewIndex to convert this value into the recordKey. */ + GetTopRowIndex(): number; + + GetOutlineLevel(record): any; + GetSplitterPosition(): any; + SetSplitterPosition(pos): void; + GetLeftColumnIndex(optPaneId?): any; + EnsurePaneWidth(): void; + + /** Show a previously hidden column at a specified position. + If atIdx is not defined, column will be shown at it's previous position. */ + ShowColumn(columnKey: string, atIdx?: number): void; + /** Hide the specified column from grid */ + HideColumn(columnKey: string): void; + /** Update column descriptions */ + UpdateColumns(columnInfoCollection: ColumnInfoCollection): void; + GetColumns(optPaneId?): ColumnInfo[]; + /** Get ColumnInfo object by fieldKey + @fieldKey when working with SharePoint data sources, fieldKey corresponds to field internal name */ + GetColumnByFieldKey(fieldKey: string, optPaneId?): ColumnInfo; + /** Adds a column, based on the specified grid field */ + AddColumn(columnInfo: ColumnInfo, gridField: GridField): void; + + /** Switches column header in rename mode, showing textbox and thus giving the user possibility to rename this column. */ + RenameColumn(columnKey: string): void; + /** Shows a dialog where user can reorder columns and change their widths. */ + ShowColumnConfigurationDialog(): void; + + + /** Returns true, if there are any errors in the JsGrid */ + AnyErrors(): boolean; + /** Returns true, if there are any errors in a specified row */ + AnyErrorsInRecord(recordKey: number): boolean; + /** Set error for the specified by recordKey and fieldKey cell. + Returns id of the error, so that later you can clear the error using this id. */ + SetCellError(recordKey: number, fieldKey: string, errorMessage: string): number; + /** Set error for the specified by recordKey row. + In the leftmost column of this row, exclamation mark error indicator will appear. + Clicking on this indicator will cause the specified error message appear in form of a reddish tooltip. + Returns id of the error, so that later you can clear the error using this id. */ + SetRowError(recordKey: number, errorMessage: string): number; + /** Clear specified by id error that was previously set on the specified by recordKey and fieldKey cell. */ + ClearCellError(recordKey: number, fieldKey: string, id: number): void; + /** Clear all errors in the specified cell. */ + ClearAllErrorsOnCell(recordKey: number, fieldKey: string): void; + /** Clear specified by id error that was previously set on the specified by recordKey row. */ + ClearRowError(recordKey: number, id: number): void; + /** Clear all errors in the specified row. */ + ClearAllErrorsOnRow(recordKey: number): void; + /** Get error message for the specified cell. + If many errors are set on the cell, only first is returned. + If there are no errors in the cell, returns null. */ + GetCellErrorMessage(recordKey: number, fieldKey: string): string; + /** Get error message for the specified row. + If many errors are set on the row, only first is returned. + If there are no errors in the row, returns null. */ + GetRowErrorMessage(recordKey: number): string; + /** This method is used mostly when you have a rather tall JSGrid and you want to ensure that user sees + that some error has occured. + You can specify the minId or/and filter function. + If minId is specified, method searches for an error with first id which is greater than minId. + Scrolls to the Returns the id of the found record. + If there aren't any errors, that satisfy the conditions, method does nothing and returns null. */ + ScrollToAndExpandNextError(minId?: number, fnFilter?: { (recordKey: number, fieldKey: string, id: number): boolean }): any; + /** Same as ScrollToAndExpandNextError, but searches within the specified record. + recordKey should be not null, otherwise you'll get an exception. + bDontExpand controls whether the error tooltip will be shown (if bDontExpand=true, tooltip will not be shown). */ + ScrollToAndExpandNextErrorOnRecord(minId?: number, recordKey?: number, fnFilter?: { (recordKey: number, fieldKey: string, id: number): boolean }, bDontExpand?: boolean): any; + + GetFocusedItem(): any; + SendKeyDownEvent(eventInfo:Sys.UI.DomEvent): any; + /** Moves cursor to entry record (the row that is used to add new records) */ + JumpToEntryRecord(): void; + + SelectRowRange(rowIdx1, rowIdx2, bAppend, optPaneId?): void; + SelectColumnRange(colIdx1, colIdx2, bAppend, optPaneId?): void; + SelectCellRange(rowIdx1, rowIdx2, colIdx1, colIdx2, bAppend, optPaneId): void; + SelectRowRangeByKey(rowKey1, rowKey2, bAppend, optPaneId?): void; + SelectColumnRangeByKey(colKey1, colKey2, bAppend, optPaneId?): void; + SelectCellRangeByKey(recordKey1: string, recordKey2: string, colKey1, colKey2, bAppend, optPaneId?): void; + + ChangeKeys(oldKey, newKey): void; + GetSelectedRowRanges(optPaneId?): any; + GetSelectedColumnRanges(optPaneId?): any; + GetSelectedRanges(optPaneId?): any; + MarkPropUpdateInvalid(recordKey: number, fieldKey, changeKey, optErrorMsg?): any; + GetCurrentChangeKey(): any; + CreateAndSynchronizeToNewChangeKey(): any; + CreateDataUpdateCmd(bUseCustomInitialUpdate: boolean): any; + IsChangeKeyApplied(changeKey): any; + GetChangeKeyForVersion(version): any; + TryReadPropForChangeKey(recordKey: number, fieldKey, changeKey): any; + GetUnfilteredHierarchyMap(): any; + GetHierarchyState(bDecompressGuidKeys: boolean): any; + IsGroupingRecordKey(recordKey: number): boolean; + IsGroupingColumnKey(recordKey: number): boolean; + GetSelectedRecordKeys(bDuplicatesAllowed: boolean): any; + /** Cut data from currently selected cells into the clipboard. + Will not work if current selection contains entry row or readonly cells. */ + CutToClipboard(): void; + /** Copy data from currently selected cells into the clipboard. */ + CopyToClipboard(): void; + /** Paste data from clipboard into currently selected cells. */ + PasteFromClipboard(): void; + TryRestoreFocusAfterInsertOrDeleteColumns(origFocus): void; + /** Get undo manager for performing undo/redo operations programmatically. */ + GetUndoManager(): SP.JsGrid.CommandManager; + /** Gets number of records visible in the current view, including the entry row. */ + GetVisibleRecordCount(): number; + /** Returns index of the system RecordIndicatorCheckBoxColumn. If not present in the view, returns null. */ + GetRecordIndicatorCheckBoxColumnIndex(): number; + /** Determines if the specified record is visible in the current view. */ + IsRecordVisibleInView(recordKey: number): boolean; + GetHierarchyQueryObject(): any; + GetSpCsrRenderCtx(): any; + } + + export interface IChangeKey { + Reserve(): void; + Release(): void; + GetVersionNumber(): number; + CompareTo(changeKey: IChangeKey): number; + } + + export enum EventType { + OnCellFocusChanged, + OnRowFocusChanged, + OnCellEditBegin, + OnCellEditCompleted, + OnRightClick, + OnPropertyChanged, + OnRecordInserted, + OnRecordDeleted, + OnRecordChecked, + OnCellErrorStateChanged, + OnEntryRecordAdded, + OnEntryRecordCommitted, + OnEntryRecordPropertyChanged, + OnRowErrorStateChanged, + OnDoubleClick, + OnBeforeGridDispose, + OnSingleCellClick, + OnInitialChangesForChangeKeyComplete, + OnVacateChange, + OnGridErrorStateChanged, + OnSingleCellKeyDown, + OnRecordsReordered, + OnBeforePropertyChanged, + OnRowEscape, + OnBeginRenameColumn, + OnEndRenameColumn, + OnPasteBegin, + OnPasteEnd, + OnBeginRedoDataUpdateChange, + OnBeginUndoDataUpdateChange + } + + export enum DelegateType { + ExpandColumnMenu, + AddColumnMenuItems, + Sort, + Filter, + InsertRecord, + DeleteRecords, + IndentRecords, + OutdentRecords, + IsRecordInsertInView, + ExpandDelayLoadedHierarchyNode, + AutoFilter, + ExpandConflictResolution, + GetAutoFilterEntries, + LaunchFilterDialog, + ShowColumnConfigurationDialog, + GetRecordEditMode, + GetGridRowStyleId, + CreateEntryRecord, + TryInsertEntryRecord, + WillAddColumnMenuItems, + NextPage, + AddNewColumn, + RemoveColumnFromView, + ReorderColumnPositionInView, + TryCreateProvisionalRecord, + CanReorderRecords, + AddNewColumnMenuItems, + TryBeginPaste, + AllowSelectionChange, + GetFieldEditMode, + GetFieldReadOnlyActiveState, + OnBeforeRecordReordered + } + + export enum ClickContext { + SelectAllSquare, + RowHeader, + ColumnHeader, + Cell, + Gantt, + Other + } + + export class RowHeaderState { + constructor(id: string, img: SP.JsGrid.Image, priority: SP.JsGrid.RowHeaderStatePriorities, tooltip: string, fnOnClick: { (eventInfo:Sys.UI.DomEvent, recordKey: number): void }); + GetId(): string; + GetImg(): SP.JsGrid.Image; + GetPriority(): SP.JsGrid.RowHeaderStatePriorities; + GetOnClick(): { (eventInfo:Sys.UI.DomEvent, recordKey: number): void }; + GetTooltip(): string; + toString(): string; + } + + export class Image { + /** optOuterCssNames and optImgCssNames are strings that contain css class names separated by spaces. + optImgCssNames are applied to the img tag. + if bIsClustered, image is rendered inside div, and optOuterCssNames are applied to the div. */ + constructor(imgSrc: string, bIsClustered: boolean, optOuterCssNames: string, optImgCssNames: string, bIsAnimated: boolean); + imgSrc: string; + bIsClustered: boolean; + optOuterCssNames: string; + imgCssNames: string; + bIsAnimated: boolean; + /** Renders the image with specified alternative text and on-click handler. + If bHideTooltip == false, then alternative text is also shown as the tooltip (title attribute). */ + Render(altText: string, clickFn: { (eventInfo:Sys.UI.DomEvent): void }, bHideTooltip: boolean): HTMLElement; + } + + export interface IEventArgs { } + export module EventArgs { + export class OnEntryRecordAdded implements IEventArgs { + constructor(recordKey: number); + recordKey: number; + } + + export class CellFocusChanged implements IEventArgs { + constructor(newRecordKey: number, newFieldKey: string, oldRecordKey: number, oldFieldKey: string); + newRecordKey: number; + newFieldKey: string; + oldRecordKey: number; + oldFieldKey: string; + } + export class RowFocusChanged implements IEventArgs { + constructor(newRecordKey: number, oldRecordKey: number); + newRecordKey: number; + oldRecordKey: number; + } + export class CellEditBegin implements IEventArgs { + constructor(recordKey: number, fieldKey: string); + recordKey: number; + fieldKey: string; + } + export class CellEditCompleted implements IEventArgs { + constructor(recordKey: number, fieldKey: string, changeKey: JsGrid.IChangeKey, bCancelled: boolean); + recordKey: number; + fieldKey: string; + changeKey: JsGrid.IChangeKey; + bCancelled: boolean; + } + export class Click implements IEventArgs { + constructor(eventInfo:Sys.UI.DomEvent, context: JsGrid.ClickContext, recordKey: number, fieldKey: string); + eventInfo:Sys.UI.DomEvent; + context: JsGrid.ClickContext; + recordKey: number; + fieldKey: string; + } + export class PropertyChanged implements IEventArgs { + constructor(recordKey: number, fieldKey: string, oldProp: SP.JsGrid.Internal.PropertyUpdate, newProp: SP.JsGrid.Internal.PropertyUpdate, propType: SP.JsGrid.IPropertyType, changeKey: SP.JsGrid.IChangeKey, validationState: SP.JsGrid.ValidationState); + recordKey: number; + fieldKey: string; + oldProp: SP.JsGrid.Internal.PropertyUpdate; + newProp: SP.JsGrid.Internal.PropertyUpdate; + propType: SP.JsGrid.IPropertyType; + changeKey: SP.JsGrid.IChangeKey; + validationState: SP.JsGrid.ValidationState; + } + export class RecordInserted implements IEventArgs { + constructor(recordKey, recordIdx, afterRecordKey, changeKey); + recordKey: number; + recordIdx: number; + afterRecordKey: number; + changeKey: JsGrid.IChangeKey; + } + export class RecordDeleted implements IEventArgs { + constructor(recordKey, recordIdx, changeKey); + recordKey: number; + recordIdx: number; + changeKey: JsGrid.IChangeKey; + } + export class RecordChecked implements IEventArgs { + constructor(recordKeySet: SP.Utilities.Set, bChecked: boolean); + recordKeySet: SP.Utilities.Set; + bChecked: boolean; + } + export class OnCellErrorStateChanged implements IEventArgs { + constructor(recordKey, fieldKey, bAddingError, bCellCurrentlyHasError, bCellHadError, errorId); + recordKey: number; + fieldKey: string; + bAddingError: boolean; + bCellCurrentlyHasError: boolean; + bCellHadError: boolean; + errorId: number; + } + export class OnRowErrorStateChanged implements IEventArgs { + constructor(recordKey, bAddingError, bErrorCurrentlyInRow, bRowHadError, errorId, message); + recordKey: number; + bAddingError: boolean; + bErrorCurrentlyInRow: boolean; + bRowHadError: boolean; + errorId: number; + message: string; + } + export class OnEntryRecordCommitted implements IEventArgs { + constructor(origRecKey: string, recordKey: number, changeKey: JsGrid.IChangeKey); + originalRecordKey: number; + recordKey: number; + changeKey: JsGrid.IChangeKey + } + export class SingleCellClick implements IEventArgs { + constructor(eventInfo:Sys.UI.DomEvent, recordKey: number, fieldKey: string); + eventInfo:Sys.UI.DomEvent; + recordKey: number; + fieldKey: string; + } + export class PendingChangeKeyInitiallyComplete implements IEventArgs { + constructor(changeKey: JsGrid.IChangeKey); + changeKey: JsGrid.IChangeKey + } + export class VacateChange implements IEventArgs { + constructor(changeKey: JsGrid.IChangeKey); + changeKey: JsGrid.IChangeKey + } + export class GridErrorStateChanged implements IEventArgs { + constructor(bAnyErrors: boolean); + bAnyErrors: boolean; + } + export class SingleCellKeyDown implements IEventArgs { + constructor(eventInfo:Sys.UI.DomEvent, recordKey: number, fieldKey: string); + eventInfo:Sys.UI.DomEvent; + recordKey: number; + fieldKey: string; + } + export class OnRecordsReordered implements IEventArgs { + constructor(recordKeys: string[], changeKey: JsGrid.IChangeKey); + reorderedKeys: string[]; + changeKey: JsGrid.IChangeKey; + } + export class OnRowEscape implements IEventArgs { + constructor(recordKey: number); + recordKey: number; + } + export class OnEndRenameColumn implements IEventArgs { + constructor(columnKey: string, originalColumnTitle: string, newColumnTitle: string); + columnKey: string; + originalColumnTitle: string; + newColumnTitle: string; + } + export class OnBeginRedoDataUpdateChange implements IEventArgs { + constructor(changeKey: JsGrid.IChangeKey); + changeKey: JsGrid.IChangeKey + } + export class OnBeginUndoDataUpdateChange implements IEventArgs { + constructor(changeKey: JsGrid.IChangeKey); + changeKey: JsGrid.IChangeKey + } + + } + + export module JsGridControl { + export class Parameters { + tableCache: SP.JsGrid.TableCache; + name: any; // TODO + bNotificationsEnabled: boolean; + styleManager: IStyleManager; + minHeaderHeight: number; + minRowHeight: number; + commandMgr: SP.JsGrid.CommandManager; + enabledRowHeaderAutoStates: SP.Utilities.Set; + } + } + + export class CommandManager { + // todo + } + + export class TableCache { + // todo + } + + export interface IStyleManager { + gridPaneStyle: IStyleType.GridPane; + columnHeaderStyleCollection: { + normal: IStyleType.Header; + normalHover: IStyleType.Header; + partSelected: IStyleType.Header; + partSelectedHover: IStyleType.Header; + allSelected: IStyleType.Header; + allSelectedHover: IStyleType.Header; + }; + rowHeaderStyleCollection: { + normal: IStyleType.Header; + normalHover: IStyleType.Header; + partSelected: IStyleType.Header; + partSelectedHover: IStyleType.Header; + allSelected: IStyleType.Header; + allSelectedHover: IStyleType.Header; + }; + splitterStyleCollection: { + normal: IStyleType.Splitter; + normalHandle: IStyleType.SplitterHandle; + hover: IStyleType.Splitter; + hoverHandle: IStyleType.SplitterHandle; + dra: IStyleType.Splitter; + dragHandle: IStyleType.SplitterHandle; + }; + defaultCellStyle: IStyleType.Cell; + readOnlyCellStyle: IStyleType.Cell; + readOnlyFocusedCellStyle: IStyleType.Cell; + timescaleTierStyle: IStyleType.TimescaleTier; + groupingStyles: any[]; + widgetDockStyle: IStyleType.Widget; + widgetDockHoverStyle: IStyleType.Widget; + widgetDockPressedStyle: IStyleType.Widget; + RegisterCellStyle(styleId: string, cellStyle: IStyleType.Cell): void; + GetCellStyle(styleId: string): IStyleType.Cell; + UpdateSplitterStyleFromCss(styleObject: IStyleType.Splitter, splitterStyleNameCollection): void; + UpdateHeaderStyleFromCss(styleObject: IStyleType.Header, headerStyleNameCol): void; + UpdateGridPaneStyleFromCss(styleObject: IStyleType.GridPane, gridStyleNameCollection): void; + UpdateDefaultCellStyleFromCss(styleObject: IStyleType.Cell, cssClass): void; + UpdateGroupStylesFromCss(styleObject, prefix): void; + } + + export interface IStyleType { } + export module IStyleType { + export interface Splitter extends IStyleType { + outerBorderColor: any; + leftInnerBorderColor: any; + innerBorderColor: any; + backgroundColor: any; + } + export interface SplitterHandle extends IStyleType{ + outerBorderColor: any; + leftInnerBorderColor: any; + innerBorderColor: any; + backgroundColor: any; + gripUpperColor: any; + gripLowerColor: any; + } + export interface GridPane { + verticalBorderColor: any; + verticalBorderStyle: any; + horizontalBorderColor: any; + horizontalBorderStyle: any; + backgroundColor: any; + columnDropIndicatorColor: any; + rowDropIndicatorColor: any; + linkColor: any; + visitedLinkColor: any; + copyRectForeBorderColor: any; + copyRectBackBorderColor: any; + focusRectBorderColor: any; + selectionRectBorderColor: any; + selectedCellBgColor: any; + readonlySelectionRectBorderColor: any; + changeHighlightCellBgColor: any; + fillRectBorderColor: any; + errorRectBorderColor: any; + } + export interface Header { + font: any; + fontSize: any; + fontWeight: any; + textColor: any; + backgroundColor: any; + outerBorderColor: any; + innerBorderColor: any; + eyeBrowBorderColor: any; + eyeBrowColor: any; + menuColor: any; + menuBorderColor: any; + resizeColor: any; + resizeBorderColor: any; + menuHoverColor: any; + menuHoverBorderColor: any; + resizeHoverColor: any; + resizeHoverBorderColor: any; + eyeBrowHoverColor: any; + eyeBrowHoverBorderColor: any; + elementClickColor: any; + elementClickBorderColor: any; + } + export interface Cell extends IStyleType { + /** -> CSS font-family */ + font: any; + /** -> CSS font-size */ + fontSize: any; + /** -> CSS font-weight */ + fontWeight: any; + /** -> CSS font-style */ + fontStyle: any; + /** -> CSS color */ + textColor: any; + /** -> CSS background-color */ + backgroundColor: any; + /** -> CSS text-align */ + textAlign: any; + } + export interface Widget { + backgroundColor: any; + borderColor: any; + } + export interface RowHeaderStyle { + backgroundColor: any; + outerBorderColor: any; + innerBorderColor: any; + } + export interface TimescaleTier { + font: any; + fontSize: any; + fontWeight: any; + textColor: any; + backgroundColor: any; + verticalBorderColor: any; + verticalBorderStyle: any; + horizontalBorderColor: any; + horizontalBorderStyle: any; + outerBorderColor: any; + todayLineColor: any; + } + } + + export class Style { + + static Type: { + Splitter: IStyleType.Splitter; + SplitterHandle: IStyleType.SplitterHandle; + GridPane: IStyleType.GridPane; + Header: IStyleType.Header; + RowHeaderStyle: IStyleType.RowHeaderStyle; + TimescaleTier: IStyleType.TimescaleTier; + Cell: IStyleType.Cell; + Widget: IStyleType.Widget; + }; + + static SetRTL: { (rtlObject): void; }; + static MakeJsGridStyleManager: { (): IStyleManager }; + static CreateStyleFromCss: { (styleType: IStyleType, cssStyleName: string, optExistingStyle, optClassId): any; }; + static CreateStyle: { (styleType: IStyleType, styleProps: any): any; }; + static MergeCellStyles: { (majorStyle, minorStyle): any; }; + static ApplyCellStyle: { (td, style): void; }; + static ApplyRowHeaderStyle: { (domObj, style, fnGetHeaderSibling): void; }; + static ApplyCornerHeaderBorderStyle: { (domObj, colStyle, rowStyle): void; }; + static ApplyHeaderInnerBorderStyle: { (domObj, bIsRowHeader, headerObject): void }; + static ApplyColumnContextMenuStyle: { (domObj, style): void }; + static ApplySplitterStyle: { (domObj, style): void }; + static MakeBorderString: { (width: number, style: string, color: string): string }; + static GetCellStyleDefaultBackgroundColor: { (): string }; + + } + + export class ColumnInfoCollection { + constructor(colInfoArray: any[]); + GetColumnByKey(key: string): any; + GetColumnArray(bVisibleOnly?: boolean): any[]; + GetColumnMap(): { [key: string]: any; }; + AppendColumn(colInfo: any): void; + InsertColumnAt(idx: number, colInfo: any): void; + RemoveColumn(key: string): void; + /** Returns null if the specified column is not found or hidden. */ + GetColumnPosition(key: string): number; + } + + export class ColumnInfo { + constructor(name: string, imgSrc: string, key: string, width: number); + /** Column title */ + name: string; + /** Column image URL. + If not null, the column header cell will show the image instead of title text. + If the title is defined at the same time as the imgSrc, the title will be shown as a tooltip. */ + imgSrc: string; + /** Custom image HTML. + If you define this in addition to the imgSrc attribute, then instead of standard img tag + the custom HTML defined by this field will be used. */ + imgRawSrc: string; + /** Column identifier */ + columnKey: string; + /** Field keys of the fields, that are displayed in this column */ + fieldKeys: string[]; + /** Width of the column */ + width: number; + bOpenMenuOnContentClick: boolean; + /** always returns 'column' */ + ColumnType(): string; + /** true by default */ + isVisible: boolean; + /** true by default */ + isHidable: boolean; + /** true by default */ + isResizable: boolean; + /** true by default */ + isSortable: boolean; + /** true by default */ + isAutoFilterable: boolean; + /** false by default */ + isFooter: boolean; + /** determine whether the cells in this column should be clickable */ + fnShouldLinkSingleValue: { (record: IRecord, fieldKey: string, dataValue: any, localizedValue: any): boolean }; + /** if a particular cell is determined as clickable by fnShouldLinkSingleValue, this function will be called when the cell is clicked */ + fnSingleValueClicked: { (record: IRecord, fieldKey: string, dataValue: any, localizedValue: any): void }; + /** this is used when you need to make some of the cells in the column readonly, but at the same time keep others editable */ + fnGetCellEditMode: { (record: IRecord, fieldKey: string): JsGrid.EditMode }; + /** this function should return name of the display control for the given cell in the column + the name should be previously associated with the display control via SP.JsGrid.PropertyType.Utils.RegisterDisplayControl method */ + fnGetDisplayControlName: { (record: IRecord, fieldKey: string): string }; + /** this function should return name of the edit control for the given cell in the column + the name should be previously associated with the edit control via SP.JsGrid.PropertyType.Utils.RegisterEditControl method */ + fnGetEditControlName: { (record: IRecord, fieldKey: string): string }; + /** set widget control names for a particular cell + widgets are basically in-cell buttons with associated popup controls, e.g. date selector or address book button + standard widget ids are defined in the SP.JsGrid.WidgetControl.Type enumeration + it is also possible to create your own widgets + usually this function is not used, and instead, widget control names are determined via PropertyType + */ + fnGetWidgetControlNames: { (record: IRecord, fieldKey: string): string[] }; + /** this function should return id of the style for the given cell in the column + styles and their ids are registered for a JsGridControl via jsGridParams.styleManager.RegisterCellStyle method */ + fnGetCellStyleId: { (record: IRecord, fieldKey: string, dataValue: any): string }; + /** set custom tooltip for the given cell in the column. by default, localized value is displayed as the tooltip */ + fnGetSingleValueTooltip: { (record: IRecord, fieldKey: string, dataValue: any, localizedValue: any): string }; + } + + + export interface IRecord { + /** True if this is an entry row */ + bIsNewRow: boolean; + + /** Please use SetProp and GetProp */ + properties: { [fieldKey: string]: IPropertyBase }; + + /** returns recordKey */ + key(): number; + /** returns raw data value for the specified field */ + GetDataValue(fieldKey: string): any; + /** returns localized text value for the specified field */ + GetLocalizedValue(fieldKey: string): string; + /** returns true if data value for the specified field is available */ + HasDataValue(fieldKey: string): boolean; + /** returns true if localized text value for the specified field is available */ + HasLocalizedValue(fieldKey: string): boolean; + + GetProp(fieldKey: string): IPropertyBase; + SetProp(fieldKey: string, prop: IPropertyBase): void; + + /** Update the specified field with the specified value */ + AddFieldValue(fieldKey: string, value: any): void; + /** Removes value of the specified field. + Does not refresh the view. */ + RemoveFieldValue(fieldKey: string): void; + } + + + export class RecordFactory { + constructor(gridFieldMap: any, keyColumnName: string, fnGetPropType: any); + gridFieldMap: any; + /** Create a new record */ + MakeRecord(dataPropMap, localizedPropMap, bKeepRawData): IRecord; + } + + export interface IPropertyBase { + HasLocalizedValue(): boolean; + HasDataValue(): boolean; + Clone(): IPropertyBase; + /** dataValue actually is cloned */ + Update(dataValue: any, localizedValue: string): void; + GetLocalized(): string; + GetData(): any; + } + + export class Property { + static MakeProperty(dataValue: any, localizedValue: string, bHasDataValue: boolean, bHasLocalizedValue: boolean, propType): IPropertyBase; + static MakePropertyFromGridField(gridField: any, dataValue: any, localizedVal: string, optPropType?): IPropertyBase; + } + + export class GridField { + constructor(key: string, hasDataValue: boolean, hasLocalizedValue: boolean, textDirection, defaultCellStyleId, editMode, dateOnly, csrInfo); + key: string; + hasDataValue: boolean; + hasLocalizedValue: boolean; + textDirection: any; + dateOnly: boolean; + csrInfo: any; + GetEditMode(): any; + SetEditMode(mode: any): void; + GetDefaultCellStyleId(): any; + CompareSingleDataEqual(dataValue1, dataValue2): boolean; + GetPropType(): any; + GetSingleValuePropType(): any; + GetMultiValuePropType(): any; + SetSingleValuePropType(svPropType: any): void; + SetIsMultiValue(listSeparator: any): void; + GetIsMultiValue(): boolean; + } + + export interface IEditActorGridContext { + jsGridObj: JsGridControl; + parentNode: HTMLElement; + styleManager: IStyleManager; + RTL: any; + emptyValue: any; + bLightFocus: boolean; + OnKeyDown: { (domEvent: Sys.UI.DomEvent): void; }; + } + + export interface IEditControlGridContext extends IEditActorGridContext { + OnActivateActor(): void; + OnDeactivateActor():void; + } + + export interface IPropertyType { + ID: string; + BeginValidateNormalizeConvert(recordKey: number, fieldKey: string, newValue: any, bIsLocalized: boolean, fnCallback: { (args: { isValid: boolean; dataValue: any; normalizedLocValue: string }): void; }, fnError: any): void; + } + + export interface ILookupPropertyType extends IPropertyType { + GetItems(fnCallback: any): void; + DataToLocalized(dataValue: any): string; + LocalizedToData(localized: string): any; + GetImageSource(record: IRecord, dataValue: any): string; + GetStyleId(dataValue: any): string; + GetIsLimitedToList(): boolean; + GetSerializableLookupPropType(): { items: any[]; id: string; bLimitToList: boolean }; + } + + export interface IMultiValuePropertyType extends IPropertyType { + bMultiValue: boolean; + separator: string; + singleValuePropType: string; + GetSerializableMultiValuePropType(): { singleValuePropTypeID: string; separatorChar: string; bDelayInit: boolean; }; + InitSingleValuePropType(): void; + LocStrToLocStrArray(locStr: string): string[]; + LocStrArrayToLocStr(locStrArray: string[]): string; + } + + export class PropertyType { + /** Lookup property type factory, based on SP.JsGrid.PropertyType.LookupTable class. + displayCtrlName should be one of the following: SP.JsGrid.DisplayControl.Type.Image, SP.JsGrid.DisplayControl.Type.ImageText or SP.JsGrid.DisplayControl.Type.Text + */ + static RegisterNewLookupPropType(id: string, items: any[], displayCtrlName: string, bLimitToList: boolean): void; + + /** Register a custom property type. */ + static RegisterNewCustomPropType(propType: IPropertyType, displayCtrlName: string, editControlName: string, widgetControlNames: string[]): void; + + /** Register a custom property type, where display and edit controls, and also widgets, are derived from the specified parent property type. */ + static RegisterNewDerivedCustomPropType(propType: IPropertyType, baseTypeName: string): void; + } + + export module PropertyType { + export class String implements IPropertyType { + constructor(); + ID: string; + BeginValidateNormalizeConvert(recordKey: number, fieldKey: string, newValue: any, bIsLocalized: boolean, fnCallback: { (args: { isValid: boolean; dataValue: any; normalizedLocValue: string }): void; }, fnError: any): void; + toString(): string; + } + export class LookupTable implements ILookupPropertyType { + constructor(items: any[], id: string, bLimitToList: boolean); + ID: string; + BeginValidateNormalizeConvert(recordKey: number, fieldKey: string, newValue: any, bIsLocalized: boolean, fnCallback: { (args: { isValid: boolean; dataValue: any; normalizedLocValue: string }): void; }, fnError: any): void; + GetItems(fnCallback: any): void; + DataToLocalized(dataValue: any): string; + LocalizedToData(localized: string): any; + GetImageSource(record: IRecord, dataValue: any): string; + GetStyleId(dataValue: any): string; + GetIsLimitedToList(): boolean; + GetSerializableLookupPropType(): { items: any[]; id: string; bLimitToList: boolean }; + + } + export class CheckBoxBoolean implements IPropertyType { + constructor(); + ID: string; + BeginValidateNormalizeConvert(recordKey: number, fieldKey: string, newValue: any, bIsLocalized: boolean, fnCallback: { (args: { isValid: boolean; dataValue: any; normalizedLocValue: string }): void; }, fnError: any): void; + DataToLocalized(dataValue: any): string; + GetBool(dataValue: any): boolean; + toString(): string; + } + export class DropDownBoolean implements IPropertyType { + constructor(); + ID: string; + BeginValidateNormalizeConvert(recordKey: number, fieldKey: string, newValue: any, bIsLocalized: boolean, fnCallback: { (args: { isValid: boolean; dataValue: any; normalizedLocValue: string }): void; }, fnError: any): void; + DataToLocalized(dataValue: any): string; + GetBool(dataValue: any): boolean; + toString(): string; + } + export class MultiValuePropType implements IMultiValuePropertyType { + ID: string; + BeginValidateNormalizeConvert(recordKey: number, fieldKey: string, newValue: any, bIsLocalized: boolean, fnCallback: { (args: { isValid: boolean; dataValue: any; normalizedLocValue: string }): void; }, fnError: any): void; + bMultiValue: boolean; + separator: string; + singleValuePropType: string; + GetSerializableMultiValuePropType(): { singleValuePropTypeID: string; separatorChar: string; bDelayInit: boolean; }; + InitSingleValuePropType(): void; + LocStrToLocStrArray(locStr: string): string[]; + LocStrArrayToLocStr(locStrArray: string[]): string; + } + export class HyperLink implements IPropertyType { + ID: string; + BeginValidateNormalizeConvert(recordKey: number, fieldKey: string, newValue: any, bIsLocalized: boolean, fnCallback: { (args: { isValid: boolean; dataValue: any; normalizedLocValue: string }): void; }, fnError: any): void; + bHyperlink: boolean; + DataToLocalized(dataValue: any): string; + GetAddress(dataValue: any): string; + /** Returns string like this: '"http://site.com, Site title"' */ + GetCopyValue(record: IRecord, dataValue: any, locValue: string): string; + toString(): string; + } + + + export class Utils { + static RegisterDisplayControl(name: string, singleton, requiredFunctionNames: string[]); + static RegisterEditControl(name: string, factory: (gridContext: IEditControlGridContext, gridTextInputElement:HTMLElement) => IEditControl, requiredFunctionNames: string[]); + static RegisterWidgetControl(name: string, factory: { (ddContext): IPropertyType; }, requiredFunctionNames: string[]); + + static UpdateDisplayControlForPropType(propTypeName: string, displayControlType: string); + } + } + + export module WidgetControl { + export class Type { + static Demo: string; + static Date: string; + static AddressBook: string; + static Hyperlink: string; + } + } + + export module Internal { + export class DiffTracker { + constructor(objBag, fnGetChange); + ExternalAPI: { + AnyChanges(): boolean; + ChangeKeySliceInfo(): any; + ChangeQuery(): any; + EventSliceInfo(): any; + GetChanges(optStartEvent, optEndEvent, optRecordKeys, bFirstStartEvent: boolean, bStartInclusive: boolean, bEndInclusive: boolean, bIncludeInvalidPropUpdates: boolean, bLastEndEvent: boolean): any; + GetChangesAsJson(changeQuery, optfnPreProcessUpdateForSerialize?): string; + GetUniquePropertyChanges(changeQuery, optfnFilter): any; + RegisterEvent(changeKey: IChangeKey, eventObject): void; + UnregisterEvent(changeKey: IChangeKey, eventObject): void; + }; + Clear(): void; + NotifySynchronizeToChange(changeKey: IChangeKey): void; + NotifyRollbackChange(changeKey: IChangeKey): void; + NotifyVacateChange(changeKey: IChangeKey): void; + } + + export class PropertyUpdate implements IValue { + constructor(data: any, localized: string); + data: any; + localized: string; + } + } + + export interface IEditActorCellContext { + propType:IPropertyType; + originalValue:IValue; + record:IRecord; + column:ColumnInfo; + field:GridField; + fieldKey:string; + cellExpandSpace:{ left:number; top:number; fight:number; bottom:number; }; + SetCurrentValue(value): void; + } + + export interface IEditControlCellContext extends IEditActorCellContext{ + cellWidth: number; + cellHeight: number; + cellStyle: any; //TODO: Determine correct type + cellRect:any; + NotifyExpandControl(): void; + NotifyEditComplete(): void; + Show(element: HTMLElement): void; + Hide(element: HTMLElement): void; + } + + + export module EditControl { + + } + + export interface IEditControl { + SupportedWriteMode?: SP.JsGrid.EditActorWriteType; + SupportedReadMode?: SP.JsGrid.EditActorReadType; + GetCellContext? (): IEditControlCellContext; + GetOriginalValue?():IValue; + SetValue?(value:IValue):void; + Dispose():void; + GetInputElement?():HTMLElement; + Focus?(eventInfo:Sys.UI.DomEvent):void; + BindToCell (cellContext: IEditControlCellContext):void; + OnBeginEdit (eventInfo: Sys.UI.DomEvent):void; + Unbind():void; + OnEndEdit():void; + OnCellMove?():void; + OnValueChanged?(newValue: IValue):void; + IsCurrentlyUsingGridTextInputElement?(): boolean; + SetSize?(width:number, height:number):void; + } + + } + + export module Utilities { + export class Set { + constructor(items?: { [item: string]: number }); + constructor(items?: { [item: number]: number }); + /** Returns true if the set is empty */ + IsEmpty(): boolean; + /** Returns first item in the set */ + First(): any; + /** Returns the underlying collection of items as dictionary. + Items are the keys, and values are always 1. + So the return value may be either { [item: string]: number } or { [item: number]: number } */ + GetCollection(): any; + /** Returns all items from the set as an array */ + ToArray(): any[]; + /** Adds all items from array to the set, and returns the set */ + AddArray(array: any[]): SP.Utilities.Set; + /** Adds an item to the set */ + Add(item: any): any; + /** Removes the specified item from the set and returns the removed item */ + Remove(item: any): any; + /** Clears all the items from set */ + Clear(): SP.Utilities.Set; + /** Returns true if item exists in this set */ + Contains(item: any): boolean; + /** Returns a copy of this set */ + Clone(): SP.Utilities.Set; + /** Returns a set that contains all the items that exist only in one of the sets (this and other), but not in both */ + SymmetricDifference(otherSet: SP.Utilities.Set): SP.Utilities.Set; + /** Returns a set that contains all the items that are in this set but not in the otherSet */ + Difference(otherSet: SP.Utilities.Set): SP.Utilities.Set; + /** Returns a new set, that contains items from this set and otherSet */ + Union(otherSet: SP.Utilities.Set): SP.Utilities.Set; + /** Adds all items from otherSet to this set, and returns this set */ + UnionWith(otherSet: SP.Utilities.Set): SP.Utilities.Set; + /** Returns a new set, that contains only items that exist both in this set and the otherSet */ + Intersection(otherSet: SP.Utilities.Set): SP.Utilities.Set; + } + } +} + + + + + +declare module SP { + export class GanttControl { + static WaitForGanttCreation(callack: (control: GanttControl) => void): void; + static Instances: GanttControl[]; + static FnGanttCreationCallback: { (control: GanttControl): void }[]; + + get_Columns():SP.JsGrid.ColumnInfo[]; + } +} From e1210e53158790023ab52a15207762f2e7b2e917 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 20 May 2015 19:26:58 +0200 Subject: [PATCH 0033/1358] jasmine ajax defs --- jasmine-ajax/jasmine-ajax-tests.ts | 1818 ++++++++++++++++++ jasmine-ajax/jasmine-ajax-tests.ts.tscparams | 1 + jasmine-ajax/jasmine-ajax.d.ts | 77 + 3 files changed, 1896 insertions(+) create mode 100644 jasmine-ajax/jasmine-ajax-tests.ts create mode 100644 jasmine-ajax/jasmine-ajax-tests.ts.tscparams create mode 100644 jasmine-ajax/jasmine-ajax.d.ts diff --git a/jasmine-ajax/jasmine-ajax-tests.ts b/jasmine-ajax/jasmine-ajax-tests.ts new file mode 100644 index 0000000000..b5134d2cf7 --- /dev/null +++ b/jasmine-ajax/jasmine-ajax-tests.ts @@ -0,0 +1,1818 @@ +/** + * Tests adapted from: https://github.com/jasmine/jasmine-ajax + * By Louis Grignon + */ + +/// +/// + +describe('StubTracker', function() { + beforeEach(function() { + var Constructor = getJasmineRequireObj().AjaxStubTracker(); + this.tracker = new Constructor(); + }); + + it('finds nothing if no stubs are added', function() { + expect(this.tracker.findStub()).toBeUndefined(); + }); + + it('finds an added stub', function() { + var stub = { matches: function() { return true; } }; + this.tracker.addStub(stub); + + expect(this.tracker.findStub()).toBe(stub); + }); + + it('skips an added stub that does not match', function() { + var stub = { matches: function() { return false; } }; + this.tracker.addStub(stub); + + expect(this.tracker.findStub()).toBeUndefined(); + }); + + it('passes url, data, and method to the stub', function() { + var stub = { matches: jasmine.createSpy('matches') }; + this.tracker.addStub(stub); + + this.tracker.findStub('url', 'data', 'method'); + + expect(stub.matches).toHaveBeenCalledWith('url', 'data', 'method'); + }); + + it('can clear out all stubs', function() { + var stub = { matches: jasmine.createSpy('matches') }; + this.tracker.addStub(stub); + + this.tracker.findStub(); + + expect(stub.matches).toHaveBeenCalled(); + + this.tracker.reset(); + stub.matches.calls.reset(); + + this.tracker.findStub(); + + expect(stub.matches).not.toHaveBeenCalled(); + }); + + it('uses the most recently added stub that matches', function() { + var stub1 = { matches: function() { return true; } }; + var stub2 = { matches: function() { return true; } }; + var stub3 = { matches: function() { return false; } }; + + this.tracker.addStub(stub1); + this.tracker.addStub(stub2); + this.tracker.addStub(stub3); + + expect(this.tracker.findStub()).toBe(stub2); + }); +}); + +describe('FakeRequest', function() { + beforeEach(function() { + this.requestTracker = { track: jasmine.createSpy('trackRequest') }; + this.stubTracker = { findStub: function() {} }; + var parserInstance = this.parserInstance = jasmine.createSpy('parse'); + this.paramParser = { findParser: function() { return { parse: parserInstance }; } }; + var eventBus = this.fakeEventBus = { + addEventListener: jasmine.createSpy('addEventListener'), + trigger: jasmine.createSpy('trigger'), + removeEventListener: jasmine.createSpy('removeEventListener') + }; + this.eventBusFactory = function() { + return eventBus; + }; + this.fakeGlobal = { + XMLHttpRequest: function() { + this.extraAttribute = 'my cool attribute'; + }, + DOMParser: window['DOMParser'], + ActiveXObject: window['ActiveXObject'] + }; + this.FakeRequest = getJasmineRequireObj().AjaxFakeRequest(this.eventBusFactory)(this.fakeGlobal, this.requestTracker, this.stubTracker, this.paramParser); + }); + + it('extends from the global XMLHttpRequest', function() { + var request = new this.FakeRequest(); + + expect(request.extraAttribute).toEqual('my cool attribute'); + }); + + it('skips XMLHttpRequest attributes that IE does not want copied', function() { + // use real window here so it will correctly go red on IE if it breaks + var FakeRequest = getJasmineRequireObj().AjaxFakeRequest(this.eventBusFactory)(window, this.requestTracker, this.stubTracker, this.paramParser); + var request = new FakeRequest(); + + expect(request.responseBody).toBeUndefined(); + expect(request.responseXML).toBeUndefined(); + expect(request.statusText).toBeUndefined(); + }); + + it('tracks the request', function() { + var request = new this.FakeRequest(); + + expect(this.requestTracker.track).toHaveBeenCalledWith(request); + }); + + it('has default request headers and override mime type', function() { + var request = new this.FakeRequest(); + + expect(request.requestHeaders).toEqual({}); + expect(request.overriddenMimeType).toBeNull(); + }); + + it('saves request information when opened', function() { + var request = new this.FakeRequest(); + request.open('METHOD', 'URL', 'ignore_async', 'USERNAME', 'PASSWORD'); + + expect(request.method).toEqual('METHOD'); + expect(request.url).toEqual('URL'); + expect(request.username).toEqual('USERNAME'); + expect(request.password).toEqual('PASSWORD'); + }); + + it('saves an override mime type', function() { + var request = new this.FakeRequest(); + + request.overrideMimeType('application/text; charset: utf-8'); + + expect(request.overriddenMimeType).toBe('application/text; charset: utf-8'); + }); + + it('saves request headers', function() { + var request = new this.FakeRequest(); + + request.setRequestHeader('X-Header-1', 'value1'); + request.setRequestHeader('X-Header-2', 'value2'); + + expect(request.requestHeaders).toEqual({ + 'X-Header-1': 'value1', + 'X-Header-2': 'value2' + }); + }); + + it('combines request headers with the same header name', function() { + var request = new this.FakeRequest(); + + request.setRequestHeader('X-Header', 'value1'); + request.setRequestHeader('X-Header', 'value2'); + + expect(request.requestHeaders['X-Header']).toEqual('value1, value2'); + }); + + it('finds the content-type request header', function() { + var request = new this.FakeRequest(); + + request.setRequestHeader('ContEnt-tYPe', 'application/text+xml'); + + expect(request.contentType()).toEqual('application/text+xml'); + }); + + describe('managing readyState', function() { + beforeEach(function() { + this.request = new this.FakeRequest(); + }); + + it('has an initial ready state of 0 (uninitialized)', function() { + expect(this.request.readyState).toBe(0); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalled(); + }); + + it('has a ready state of 1 (open) when opened', function() { + this.request.open(); + + expect(this.request.readyState).toBe(1); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('readystatechange'); + }); + + it('has a ready state of 0 (uninitialized) when aborted', function() { + this.request.open(); + this.fakeEventBus.trigger.calls.reset(); + + this.request.abort(); + + expect(this.request.readyState).toBe(0); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('readystatechange'); + }); + + it('has a ready state of 1 (sent) when sent', function() { + this.request.open(); + this.fakeEventBus.trigger.calls.reset(); + + this.request.send(); + + expect(this.request.readyState).toBe(1); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('loadstart'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('readystatechange'); + }); + + it('has a ready state of 4 (loaded) when timed out', function() { + this.request.open(); + this.request.send(); + this.fakeEventBus.trigger.calls.reset(); + + jasmine.clock().install(); + this.request.responseTimeout(); + jasmine.clock().uninstall(); + + expect(this.request.readyState).toBe(4); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('readystatechange', 'timeout'); + }); + + it('has a ready state of 4 (loaded) when network erroring', function() { + this.request.open(); + this.request.send(); + this.fakeEventBus.trigger.calls.reset(); + + this.request.responseError(); + + expect(this.request.readyState).toBe(4); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('readystatechange'); + }); + + it('has a ready state of 4 (loaded) when responding', function() { + this.request.open(); + this.request.send(); + this.fakeEventBus.trigger.calls.reset(); + + this.request.respondWith({}); + + expect(this.request.readyState).toBe(4); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('readystatechange'); + }); + + it('has a ready state of 2, then 4 (loaded) when responding', function() { + this.request.open(); + this.request.send(); + this.fakeEventBus.trigger.calls.reset(); + + var request = this.request; + var events = []; + var headers = [ + { name: 'X-Header', value: 'foo' } + ]; + + this.fakeEventBus.trigger.and.callFake(function(event) { + if (event === 'readystatechange') { + events.push({ + readyState: request.readyState, + status: request.status, + statusText: request.statusText, + responseHeaders: request.responseHeaders + }); + } + }); + + this.request.respondWith({ + status: 200, + statusText: 'OK', + responseHeaders: headers + }); + + expect(this.request.readyState).toBe(4); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('readystatechange'); + expect(events.length).toBe(2); + expect(events).toEqual([ + { readyState: 2, status: 200, statusText: 'OK', responseHeaders: headers }, + { readyState: 4, status: 200, statusText: 'OK', responseHeaders: headers } + ]); + }); + + it('throws an error when timing out a request that has completed', function() { + this.request.open(); + this.request.send(); + this.request.respondWith({}); + var request = this.request; + + expect(function() { + request.responseTimeout(); + }).toThrowError('FakeXMLHttpRequest already completed'); + }); + + it('throws an error when responding to a request that has completed', function() { + this.request.open(); + this.request.send(); + this.request.respondWith({}); + var request = this.request; + + expect(function() { + request.respondWith({}); + }).toThrowError('FakeXMLHttpRequest already completed'); + }); + + it('throws an error when erroring a request that has completed', function() { + this.request.open(); + this.request.send(); + this.request.respondWith({}); + var request = this.request; + + expect(function() { + request.responseError({}); + }).toThrowError('FakeXMLHttpRequest already completed'); + }); + }); + + it('registers on-style callback with the event bus', function() { + this.request = new this.FakeRequest(); + + expect(this.fakeEventBus.addEventListener).toHaveBeenCalledWith('readystatechange', jasmine.any(Function)); + expect(this.fakeEventBus.addEventListener).toHaveBeenCalledWith('loadstart', jasmine.any(Function)); + expect(this.fakeEventBus.addEventListener).toHaveBeenCalledWith('progress', jasmine.any(Function)); + expect(this.fakeEventBus.addEventListener).toHaveBeenCalledWith('abort', jasmine.any(Function)); + expect(this.fakeEventBus.addEventListener).toHaveBeenCalledWith('error', jasmine.any(Function)); + expect(this.fakeEventBus.addEventListener).toHaveBeenCalledWith('load', jasmine.any(Function)); + expect(this.fakeEventBus.addEventListener).toHaveBeenCalledWith('timeout', jasmine.any(Function)); + expect(this.fakeEventBus.addEventListener).toHaveBeenCalledWith('loadend', jasmine.any(Function)); + + this.request.onreadystatechange = jasmine.createSpy('readystatechange'); + this.request.onloadstart = jasmine.createSpy('loadstart'); + this.request.onprogress = jasmine.createSpy('progress'); + this.request.onabort = jasmine.createSpy('abort'); + this.request.onerror = jasmine.createSpy('error'); + this.request.onload = jasmine.createSpy('load'); + this.request.ontimeout = jasmine.createSpy('timeout'); + this.request.onloadend = jasmine.createSpy('loadend'); + + var args = this.fakeEventBus.addEventListener.calls.allArgs(); + for (var i = 0; i < args.length; i++) { + var eventName = args[i][0], + busCallback = args[i][1]; + + busCallback(); + expect(this.request['on' + eventName]).toHaveBeenCalled(); + } + }); + + it('delegates addEventListener to the eventBus', function() { + this.request = new this.FakeRequest(); + + this.request.addEventListener('foo', 'bar'); + + expect(this.fakeEventBus.addEventListener).toHaveBeenCalledWith('foo', 'bar'); + }); + + it('delegates removeEventListener to the eventBus', function() { + this.request = new this.FakeRequest(); + + this.request.removeEventListener('foo', 'bar'); + + expect(this.fakeEventBus.removeEventListener).toHaveBeenCalledWith('foo', 'bar'); + }); + + describe('triggering progress events', function() { + beforeEach(function() { + this.request = new this.FakeRequest(); + }); + + it('should not trigger any events to start', function() { + this.request.open(); + + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('readystatechange'); + }); + + it('should trigger loadstart when sent', function() { + this.request.open(); + + this.fakeEventBus.trigger.calls.reset(); + + this.request.send(); + + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('loadstart'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('readystatechange'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('progress'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('abort'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('error'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('load'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('timeout'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('loadend'); + }); + + it('should trigger abort, progress, loadend when aborted', function() { + this.request.open(); + this.request.send(); + + this.fakeEventBus.trigger.calls.reset(); + + this.request.abort(); + + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('readystatechange'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('loadstart'); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('progress'); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('abort'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('error'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('load'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('timeout'); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('loadend'); + }); + + it('should trigger error, progress, loadend when network error', function() { + this.request.open(); + this.request.send(); + + this.fakeEventBus.trigger.calls.reset(); + + this.request.responseError(); + + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('loadstart'); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('readystatechange'); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('progress'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('abort'); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('error'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('load'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('timeout'); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('loadend'); + }); + + it('should trigger timeout, progress, loadend when timing out', function() { + this.request.open(); + this.request.send(); + + this.fakeEventBus.trigger.calls.reset(); + + jasmine.clock().install(); + this.request.responseTimeout(); + jasmine.clock().uninstall(); + + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('loadstart'); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('readystatechange', 'timeout'); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('progress'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('abort'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('error'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('load'); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('timeout'); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('loadend'); + }); + + it('should trigger load, progress, loadend when responding', function() { + this.request.open(); + this.request.send(); + + this.fakeEventBus.trigger.calls.reset(); + + this.request.respondWith({ status: 200 }); + + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('loadstart'); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('readystatechange'); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('progress'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('abort'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('error'); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('load'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('timeout'); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('loadend'); + }); + }); + + it('ticks the jasmine clock on timeout', function() { + var clock = { tick: jasmine.createSpy('tick') }; + spyOn(jasmine, 'clock').and.returnValue(clock); + + var request = new this.FakeRequest(); + request.open(); + request.send(); + + request.responseTimeout(); + + expect(clock.tick).toHaveBeenCalledWith(30000); + }); + + it('has an initial status of null', function() { + var request = new this.FakeRequest(); + + expect(request.status).toBeNull(); + }); + + it('has an aborted status', function() { + var request = new this.FakeRequest(); + + request.abort(); + + expect(request.status).toBe(0); + expect(request.statusText).toBe('abort'); + }); + + it('has a status from the response', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + request.respondWith({ status: 200 }); + + expect(request.status).toBe(200); + expect(request.statusText).toBe(''); + }); + + it('has a statusText from the response', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + request.respondWith({ status: 200, statusText: 'OK' }); + + expect(request.status).toBe(200); + expect(request.statusText).toBe('OK'); + }); + + it('saves off any data sent to the server', function() { + var request = new this.FakeRequest(); + request.open(); + request.send('foo=bar&baz=quux'); + + expect(request.params).toBe('foo=bar&baz=quux'); + }); + + it('parses data sent to the server', function() { + var request = new this.FakeRequest(); + request.open(); + request.send('foo=bar&baz=quux'); + + this.parserInstance.and.returnValue('parsed'); + + expect(request.data()).toBe('parsed'); + }); + + it('skips parsing if no data was sent', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + expect(request.data()).toEqual({}); + expect(this.parserInstance).not.toHaveBeenCalled(); + }); + + it('saves responseText', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + request.respondWith({ status: 200, responseText: 'foobar' }); + + expect(request.responseText).toBe('foobar'); + }); + + it('defaults responseText if none is given', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + request.respondWith({ status: 200 }); + + expect(request.responseText).toBe(''); + }); + + it('retrieves individual response headers', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + request.respondWith({ + status: 200, + responseHeaders: { + 'X-Header': 'foo' + } + }); + + expect(request.getResponseHeader('X-Header')).toBe('foo'); + }); + + it('retrieves individual response headers case-insensitively', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + request.respondWith({ + status: 200, + responseHeaders: { + 'X-Header': 'foo' + } + }); + + expect(request.getResponseHeader('x-header')).toBe('foo'); + }); + + it('retrieves a combined response header', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + request.respondWith({ + status: 200, + responseHeaders: [ + { name: 'X-Header', value: 'foo' }, + { name: 'X-Header', value: 'bar' } + ] + }); + + expect(request.getResponseHeader('x-header')).toBe('foo, bar'); + }); + + it("doesn't pollute the response headers of other XHRs", function() { + var request1 = new this.FakeRequest(); + request1.open(); + request1.send(); + + var request2 = new this.FakeRequest(); + request2.open(); + request2.send(); + + request1.respondWith({ status: 200, responseHeaders: { 'X-Foo': 'bar' } }); + request2.respondWith({ status: 200, responseHeaders: { 'X-Baz': 'quux' } }); + + expect(request1.getAllResponseHeaders()).toBe("X-Foo: bar\r\n"); + expect(request2.getAllResponseHeaders()).toBe("X-Baz: quux\r\n"); + }); + + it('retrieves all response headers', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + request.respondWith({ + status: 200, + responseHeaders: [ + { name: 'X-Header-1', value: 'foo' }, + { name: 'X-Header-2', value: 'bar' }, + { name: 'X-Header-1', value: 'baz' } + ] + }); + + expect(request.getAllResponseHeaders()).toBe("X-Header-1: foo\r\nX-Header-2: bar\r\nX-Header-1: baz\r\n"); + }); + + it('sets the content-type header to the specified contentType when no other headers are supplied', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + request.respondWith({ status: 200, contentType: 'text/plain' }); + + expect(request.getResponseHeader('content-type')).toBe('text/plain'); + expect(request.getAllResponseHeaders()).toBe("Content-Type: text/plain\r\n"); + }); + + it('sets a default content-type header if no contentType and headers are supplied', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + request.respondWith({ status: 200 }); + + expect(request.getResponseHeader('content-type')).toBe('application/json'); + expect(request.getAllResponseHeaders()).toBe("Content-Type: application/json\r\n"); + }); + + it('has no responseXML by default', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + request.respondWith({ status: 200 }); + + expect(request.responseXML).toBeNull(); + }); + + it('parses a text/xml document into responseXML', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + request.respondWith({ status: 200, contentType: 'text/xml', responseText: '' }); + + if (typeof window['Document'] !== 'undefined') { + expect(request.responseXML instanceof window['Document']).toBe(true); + expect(request.response instanceof window['Document']).toBe(true); + } else { + // IE 8 + expect(request.responseXML instanceof window['ActiveXObject']).toBe(true); + expect(request.response instanceof window['ActiveXObject']).toBe(true); + } + }); + + it('parses an application/xml document into responseXML', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + request.respondWith({ status: 200, contentType: 'application/xml', responseText: '' }); + + if (typeof window['Document'] !== 'undefined') { + expect(request.responseXML instanceof window['Document']).toBe(true); + expect(request.response instanceof window['Document']).toBe(true); + } else { + // IE 8 + expect(request.responseXML instanceof window['ActiveXObject']).toBe(true); + expect(request.response instanceof window['ActiveXObject']).toBe(true); + } + }); + + it('parses a custom blah+xml document into responseXML', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + request.respondWith({ status: 200, contentType: 'application/text+xml', responseText: '' }); + + if (typeof window['Document'] !== 'undefined') { + expect(request.responseXML instanceof window['Document']).toBe(true); + expect(request.response instanceof window['Document']).toBe(true); + } else { + // IE 8 + expect(request.responseXML instanceof window['ActiveXObject']).toBe(true); + expect(request.response instanceof window['ActiveXObject']).toBe(true); + } + }); + + it('defaults the response attribute to the responseText', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + request.respondWith({ status: 200, responseText: 'foo' }); + + expect(request.response).toEqual('foo'); + }); + + it('has a text response when the responseType is blank', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + request.respondWith({ status: 200, responseText: 'foo', responseType: '' }); + + expect(request.response).toEqual('foo'); + }); + + it('has a text response when the responseType is text', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + request.respondWith({ status: 200, responseText: 'foo', responseType: 'text' }); + + expect(request.response).toEqual('foo'); + }); +}); + + +describe("Jasmine Mock Ajax (for toplevel)", function() { + var request, anotherRequest, response; + var success, error, complete; + var client, onreadystatechange; + var sharedContext: any = {}; + var fakeGlobal, mockAjax; + + beforeEach(function() { + var fakeXMLHttpRequest = jasmine.createSpy('realFakeXMLHttpRequest'); + fakeGlobal = { + XMLHttpRequest: fakeXMLHttpRequest, + DOMParser: window['DOMParser'], + ActiveXObject: window['ActiveXObject'] + }; + mockAjax = new MockAjax(fakeGlobal); + mockAjax.install(); + + success = jasmine.createSpy("onSuccess"); + error = jasmine.createSpy("onFailure"); + complete = jasmine.createSpy("onComplete"); + + onreadystatechange = function() { + if (this.readyState === (this.DONE || 4)) { // IE 8 doesn't support DONE + if (this.status === 200) { + success(this.responseText, this.textStatus, this); + } else { + error(this, this.textStatus, ''); + } + + complete(this, this.textStatus); + } + }; + }); + + describe("when making a request", function () { + beforeEach(function() { + client = new fakeGlobal.XMLHttpRequest(); + client.onreadystatechange = onreadystatechange; + client.open("GET", "example.com/someApi"); + client.send(); + request = mockAjax.requests.mostRecent(); + }); + + it("should store URL and transport", function() { + expect(request.url).toEqual("example.com/someApi"); + }); + + it("should queue the request", function() { + expect(mockAjax.requests.count()).toEqual(1); + }); + + it("should allow access to the queued request", function() { + expect(mockAjax.requests.first()).toEqual(request); + }); + + it("should allow access to the queued request via index", function() { + expect(mockAjax.requests.at(0)).toEqual(request); + }); + + describe("and then another request", function () { + beforeEach(function() { + client = new fakeGlobal.XMLHttpRequest(); + client.onreadystatechange = onreadystatechange; + client.open("GET", "example.com/someApi"); + client.send(); + + anotherRequest = mockAjax.requests.mostRecent(); + }); + + it("should queue the next request", function() { + expect(mockAjax.requests.count()).toEqual(2); + }); + + it("should allow access to the other queued request", function() { + expect(mockAjax.requests.first()).toEqual(request); + expect(mockAjax.requests.mostRecent()).toEqual(anotherRequest); + }); + }); + + describe("mockAjax.requests.mostRecent()", function () { + + describe("when there is one request queued", function () { + it("should return the request", function() { + expect(mockAjax.requests.mostRecent()).toEqual(request); + }); + }); + + describe("when there is more than one request", function () { + beforeEach(function() { + client = new fakeGlobal.XMLHttpRequest(); + client.onreadystatechange = onreadystatechange; + client.open("GET", "example.com/someApi"); + client.send(); + anotherRequest = mockAjax.requests.mostRecent(); + }); + + it("should return the most recent request", function() { + expect(mockAjax.requests.mostRecent()).toEqual(anotherRequest); + }); + }); + + describe("when there are no requests", function () { + beforeEach(function() { + mockAjax.requests.reset(); + }); + + it("should return null", function() { + expect(mockAjax.requests.mostRecent()).toBeUndefined(); + }); + }); + }); + + describe("clearAjaxRequests()", function () { + beforeEach(function() { + mockAjax.requests.reset(); + }); + + it("should remove all requests", function() { + expect(mockAjax.requests.count()).toEqual(0); + expect(mockAjax.requests.mostRecent()).toBeUndefined(); + }); + }); + }); + + describe("when simulating a response with request.response", function () { + describe("and the response is Success", function () { + beforeEach(function() { + client = new fakeGlobal.XMLHttpRequest(); + client.onreadystatechange = onreadystatechange; + client.open("GET", "example.com/someApi"); + client.setRequestHeader("Content-Type", "text/plain"); + client.send(); + + request = mockAjax.requests.mostRecent(); + response = {status: 200, statusText: "OK", contentType: "text/html", responseText: "OK!"}; + request.respondWith(response); + + sharedContext.responseCallback = success; + sharedContext.status = response.status; + sharedContext.statusText = response.statusText; + sharedContext.contentType = response.contentType; + sharedContext.responseText = response.responseText; + sharedContext.responseType = response.responseType; + }); + + it("should call the success handler", function() { + expect(success).toHaveBeenCalled(); + }); + + it("should not call the failure handler", function() { + expect(error).not.toHaveBeenCalled(); + }); + + it("should call the complete handler", function() { + expect(complete).toHaveBeenCalled(); + }); + + sharedAjaxResponseBehaviorForZepto_Success(sharedContext); + }); + + describe("and the response is Success, but with JSON", function () { + beforeEach(function() { + client = new fakeGlobal.XMLHttpRequest(); + client.onreadystatechange = onreadystatechange; + client.open("GET", "example.com/someApi"); + client.setRequestHeader("Content-Type", "application/json"); + client.send(); + + request = mockAjax.requests.mostRecent(); + var responseObject = {status: 200, statusText: "OK", contentType: "application/json", responseText: '{"foo":"bar"}', responseType: "json"}; + + request.respondWith(responseObject); + + sharedContext.responseCallback = success; + sharedContext.status = responseObject.status; + sharedContext.statusText = responseObject.statusText; + sharedContext.contentType = responseObject.contentType; + sharedContext.responseText = responseObject.responseText; + sharedContext.responseType = responseObject.responseType; + + response = success.calls.mostRecent().args[2]; + }); + + it("should call the success handler", function() { + expect(success).toHaveBeenCalled(); + }); + + it("should not call the failure handler", function() { + expect(error).not.toHaveBeenCalled(); + }); + + it("should call the complete handler", function() { + expect(complete).toHaveBeenCalled(); + }); + + it("should return a JavaScript object for XHR2 response", function() { + var responseText = sharedContext.responseText; + expect(success.calls.mostRecent().args[0]).toEqual(responseText); + + expect(response.responseText).toEqual(responseText); + expect(response.response).toEqual({foo: "bar"}); + }); + + sharedAjaxResponseBehaviorForZepto_Success(sharedContext); + }); + + describe("and the response is Success, and response is overriden", function () { + beforeEach(function() { + client = new fakeGlobal.XMLHttpRequest(); + client.onreadystatechange = onreadystatechange; + client.open("GET", "example.com/someApi"); + client.setRequestHeader("Content-Type", "application/json"); + client.send(); + + request = mockAjax.requests.mostRecent(); + var responseObject = {status: 200, statusText: "OK", contentType: "application/json", responseText: '{"foo":"bar"}', responseType: 'json'}; + + request.respondWith(responseObject); + + sharedContext.responseCallback = success; + sharedContext.status = responseObject.status; + sharedContext.statusText = responseObject.statusText; + sharedContext.contentType = responseObject.contentType; + sharedContext.responseText = responseObject.responseText; + sharedContext.responseType = responseObject.responseType; + + response = success.calls.mostRecent().args[2]; + }); + + it("should return the provided override for the XHR2 response", function() { + var responseText = sharedContext.responseText; + + expect(response.responseText).toEqual(responseText); + expect(response.response).toEqual({foo: "bar"}); + }); + + sharedAjaxResponseBehaviorForZepto_Success(sharedContext); + }); + + describe("response with unique header names using an object", function () { + beforeEach(function () { + client = new fakeGlobal.XMLHttpRequest(); + client.onreadystatechange = onreadystatechange; + client.open("GET", "example.com"); + client.send(); + + request = mockAjax.requests.mostRecent(); + var responseObject = {status: 200, statusText: "OK", responseText: '["foo"]', responseHeaders: { + 'X-Header1': 'header 1 value', + 'X-Header2': 'header 2 value', + 'X-Header3': 'header 3 value' + }}; + request.respondWith(responseObject); + response = success.calls.mostRecent().args[2]; + }); + + it("getResponseHeader should return the each value", function () { + expect(response.getResponseHeader('X-Header1')).toBe('header 1 value'); + expect(response.getResponseHeader('X-Header2')).toBe('header 2 value'); + expect(response.getResponseHeader('X-Header3')).toBe('header 3 value'); + }); + + it("getAllResponseHeaders should return all values", function () { + expect(response.getAllResponseHeaders()).toBe([ + "X-Header1: header 1 value", + "X-Header2: header 2 value", + "X-Header3: header 3 value" + ].join("\r\n") + "\r\n"); + }); + }); + + describe("response with multiple headers of the same name using an array of objects", function () { + beforeEach(function () { + client = new fakeGlobal.XMLHttpRequest(); + client.onreadystatechange = onreadystatechange; + client.open("GET", "example.com"); + client.send(); + + request = mockAjax.requests.mostRecent(); + var responseObject = {status: 200, statusText: "OK", responseText: '["foo"]', responseHeaders: [ + { name: 'X-Header', value: 'header value 1' }, + { name: 'X-Header', value: 'header value 2' } + ]}; + request.respondWith(responseObject); + response = success.calls.mostRecent().args[2]; + }); + + it("getResponseHeader should return all values comma separated", function () { + expect(response.getResponseHeader('X-Header')).toBe('header value 1, header value 2'); + }); + + it("getAllResponseHeaders should return all values", function () { + expect(response.getAllResponseHeaders()).toBe([ + "X-Header: header value 1", + "X-Header: header value 2" + ].join("\r\n") + "\r\n"); + }); + }); + + describe("the content type defaults to application/json", function () { + beforeEach(function() { + client = new fakeGlobal.XMLHttpRequest(); + client.onreadystatechange = onreadystatechange; + client.open("GET", "example.com/someApi"); + client.setRequestHeader("Content-Type", "application/json"); + client.send(); + + request = mockAjax.requests.mostRecent(); + response = {status: 200, statusText: "OK", responseText: '{"foo": "valid JSON, dammit."}', responseType: 'json'}; + request.respondWith(response); + + sharedContext.responseCallback = success; + sharedContext.status = response.status; + sharedContext.statusText = response.statusText; + sharedContext.contentType = "application/json"; + sharedContext.responseType = response.responseType; + sharedContext.responseText = response.responseText; + }); + + it("should call the success handler", function() { + expect(success).toHaveBeenCalled(); + }); + + it("should not call the failure handler", function() { + expect(error).not.toHaveBeenCalled(); + }); + + it("should call the complete handler", function() { + expect(complete).toHaveBeenCalled(); + }); + + sharedAjaxResponseBehaviorForZepto_Success(sharedContext); + }); + + describe("and the status/response code is 0", function () { + beforeEach(function() { + client = new fakeGlobal.XMLHttpRequest(); + client.onreadystatechange = onreadystatechange; + client.open("GET", "example.com/someApi"); + client.setRequestHeader("Content-Type", "text/plain"); + client.send(); + + request = mockAjax.requests.mostRecent(); + response = {status: 0, statusText: "ABORT", responseText: '{"foo": "whoops!"}'}; + request.respondWith(response); + + sharedContext.responseCallback = error; + sharedContext.status = 0; + sharedContext.statusText = response.statusText; + sharedContext.contentType = 'application/json'; + sharedContext.responseText = response.responseText; + sharedContext.responseType = response.responseType; + }); + + it("should call the success handler", function() { + expect(success).not.toHaveBeenCalled(); + }); + + it("should not call the failure handler", function() { + expect(error).toHaveBeenCalled(); + }); + + it("should call the complete handler", function() { + expect(complete).toHaveBeenCalled(); + }); + + sharedAjaxResponseBehaviorForZepto_Failure(sharedContext); + }); + }); + + describe("and the response is error", function () { + beforeEach(function() { + client = new fakeGlobal.XMLHttpRequest(); + client.onreadystatechange = onreadystatechange; + client.open("GET", "example.com/someApi"); + client.setRequestHeader("Content-Type", "text/plain"); + client.send(); + + request = mockAjax.requests.mostRecent(); + response = {status: 500, statusText: "SERVER ERROR", contentType: "text/html", responseText: "(._){"}; + request.respondWith(response); + + sharedContext.responseCallback = error; + sharedContext.status = response.status; + sharedContext.statusText = response.statusText; + sharedContext.contentType = response.contentType; + sharedContext.responseText = response.responseText; + sharedContext.responseType = response.responseType; + }); + + it("should not call the success handler", function() { + expect(success).not.toHaveBeenCalled(); + }); + + it("should call the failure handler", function() { + expect(error).toHaveBeenCalled(); + }); + + it("should call the complete handler", function() { + expect(complete).toHaveBeenCalled(); + }); + + sharedAjaxResponseBehaviorForZepto_Failure(sharedContext); + }); + + describe('when simulating a response with request.responseTimeout', function() { + beforeEach(function() { + jasmine.clock().install(); + + client = new fakeGlobal.XMLHttpRequest(); + client.onreadystatechange = onreadystatechange; + client.open("GET", "example.com/someApi"); + client.setRequestHeader("Content-Type", "text/plain"); + client.send(); + + request = mockAjax.requests.mostRecent(); + response = {contentType: "text/html", response: "(._){response", responseText: "(._){", responseType: "text"}; + request.responseTimeout(response); + + sharedContext.responseCallback = error; + sharedContext.status = response.status; + sharedContext.statusText = response.statusText; + sharedContext.contentType = response.contentType; + sharedContext.responseText = response.responseText; + sharedContext.responseType = response.responseType; + }); + + afterEach(function() { + jasmine.clock().uninstall(); + }); + + it("should not call the success handler", function() { + expect(success).not.toHaveBeenCalled(); + }); + + it("should call the failure handler", function() { + expect(error).toHaveBeenCalled(); + }); + + it("should call the complete handler", function() { + expect(complete).toHaveBeenCalled(); + }); + }); +}); + + +function sharedAjaxResponseBehaviorForZepto_Success(context) { + describe("the success response", function () { + var xhr; + beforeEach(function() { + xhr = context.responseCallback.calls.mostRecent().args[2]; + }); + + it("should have the expected status code", function() { + expect(xhr.status).toEqual(context.status); + }); + + it("should have the expected content type", function() { + expect(xhr.getResponseHeader('Content-Type')).toEqual(context.contentType); + }); + + it("should have the expected xhr2 response", function() { + var expected = context.response || context.responseType === 'json' ? JSON.parse(context.responseText) : context.responseText; + expect(xhr.response).toEqual(expected); + }); + + it("should have the expected response text", function() { + expect(xhr.responseText).toEqual(context.responseText); + }); + + it("should have the expected status text", function() { + expect(xhr.statusText).toEqual(context.statusText); + }); + }); +} + +function sharedAjaxResponseBehaviorForZepto_Failure(context) { + describe("the failure response", function () { + var xhr; + beforeEach(function() { + xhr = context.responseCallback.calls.mostRecent().args[0]; + }); + + it("should have the expected status code", function() { + expect(xhr.status).toEqual(context.status); + }); + + it("should have the expected content type", function() { + expect(xhr.getResponseHeader('Content-Type')).toEqual(context.contentType); + }); + + it("should have the expected xhr2 response", function() { + var expected = context.response || xhr.responseType === 'json' ? JSON.parse(xhr.responseText) : xhr.responseText; + expect(xhr.response).toEqual(expected); + }); + + it("should have the expected response text", function() { + expect(xhr.responseText).toEqual(context.responseText); + }); + + it("should have the expected status text", function() { + expect(xhr.statusText).toEqual(context.statusText); + }); + }); +} + +describe('ParamParser', function() { + beforeEach(function() { + var Constructor = getJasmineRequireObj().AjaxParamParser(); + expect(Constructor).toEqual(jasmine.any(Function)); + this.parser = new Constructor(); + }); + + it('has a default parser', function() { + var parser = this.parser.findParser({ contentType: function() {} }), + parsed = parser.parse('3+stooges=shemp&3+stooges=larry%20%26%20moe%20%26%20curly&some%3Dthing=else+entirely'); + + expect(parsed).toEqual({ + '3 stooges': ['shemp', 'larry & moe & curly'], + 'some=thing': ['else entirely'] + }); + }); + + it('should detect and parse json', function() { + var data = { + foo: 'bar', + baz: ['q', 'u', 'u', 'x'], + nested: { + object: { + containing: 'stuff' + } + } + }, + parser = this.parser.findParser({ contentType: function() { return 'application/json'; } }), + parsed = parser.parse(JSON.stringify(data)); + + expect(parsed).toEqual(data); + }); + + it('should parse json with further qualifiers on content-type', function() { + var data = { + foo: 'bar', + baz: ['q', 'u', 'u', 'x'], + nested: { + object: { + containing: 'stuff' + } + } + }, + parser = this.parser.findParser({ contentType: function() { return 'application/json; charset=utf-8'; } }), + parsed = parser.parse(JSON.stringify(data)); + + expect(parsed).toEqual(data); + }); + + it('should have custom parsers take precedence', function() { + var custom = { + test: jasmine.createSpy('test').and.returnValue(true), + parse: jasmine.createSpy('parse').and.returnValue('parsedFormat') + }; + + this.parser.add(custom); + + var parser = this.parser.findParser({ contentType: function() {} }), + parsed = parser.parse('custom_format'); + + expect(parsed).toEqual('parsedFormat'); + expect(custom.test).toHaveBeenCalled(); + expect(custom.parse).toHaveBeenCalledWith('custom_format'); + }); + + it('should skip custom parsers that do not match', function() { + var custom = { + test: jasmine.createSpy('test').and.returnValue(false), + parse: jasmine.createSpy('parse').and.returnValue('parsedFormat') + }; + + this.parser.add(custom); + + var parser = this.parser.findParser({ contentType: function() {} }), + parsed = parser.parse('custom_format'); + + expect(parsed).toEqual({ custom_format: [ 'undefined' ] }); + expect(custom.test).toHaveBeenCalled(); + expect(custom.parse).not.toHaveBeenCalled(); + }); + + it('removes custom parsers when reset', function() { + var custom = { + test: jasmine.createSpy('test').and.returnValue(true), + parse: jasmine.createSpy('parse').and.returnValue('parsedFormat') + }; + + this.parser.add(custom); + + var parser = this.parser.findParser({ contentType: function() {} }), + parsed = parser.parse('custom_format'); + + expect(parsed).toEqual('parsedFormat'); + + custom.test['calls'].reset(); + custom.parse['calls'].reset(); + + this.parser.reset(); + + parser = this.parser.findParser({ contentType: function() {} }); + parsed = parser.parse('custom_format'); + + expect(parsed).toEqual({ custom_format: [ 'undefined' ] }); + expect(custom.test).not.toHaveBeenCalled(); + expect(custom.parse).not.toHaveBeenCalled(); + }); +}); + +describe('RequestStub', function() { + beforeEach(function() { + this.RequestStub = getJasmineRequireObj().AjaxRequestStub(); + + jasmine.addMatchers({ + toMatchRequest: function() { + return { + compare: function(actual) { + return { + pass: actual.matches.apply(actual, Array.prototype.slice.call(arguments, 1)) + }; + } + }; + } + }); + }); + + it('matches just by exact url', function() { + var stub = new this.RequestStub('www.example.com/foo'); + + expect(stub)['toMatchRequest']('www.example.com/foo'); + }); + + it('does not match if the url differs', function() { + var stub = new this.RequestStub('www.example.com/foo'); + + expect(stub).not['toMatchRequest']('www.example.com/bar'); + }); + + it('matches unordered query params', function() { + var stub = new this.RequestStub('www.example.com?foo=bar&baz=quux'); + + expect(stub)['toMatchRequest']('www.example.com?baz=quux&foo=bar'); + }); + + it('requires all specified query params to be there', function() { + var stub = new this.RequestStub('www.example.com?foo=bar&baz=quux'); + + expect(stub).not['toMatchRequest']('www.example.com?foo=bar'); + }); + + it('can match the url with a RegExp', function() { + var stub = new this.RequestStub(/ba[rz]/); + + expect(stub)['toMatchRequest']('bar'); + expect(stub)['toMatchRequest']('baz'); + expect(stub).not['toMatchRequest']('foo'); + }); + + it('requires the method to match if supplied', function() { + var stub = new this.RequestStub('www.example.com/foo', null, 'POST'); + + expect(stub).not['toMatchRequest']('www.example.com/foo'); + expect(stub).not['toMatchRequest']('www.example.com/foo', null, 'GET'); + expect(stub)['toMatchRequest']('www.example.com/foo', null, 'POST'); + }); + + it('requires the data submitted to match if supplied', function() { + var stub = new this.RequestStub('/foo', 'foo=bar&baz=quux'); + + expect(stub)['toMatchRequest']('/foo', 'baz=quux&foo=bar'); + expect(stub).not['toMatchRequest']('/foo', 'foo=bar'); + }); +}); + +describe('RequestTracker', function() { + beforeEach(function() { + var Constructor = getJasmineRequireObj().AjaxRequestTracker(); + this.tracker = new Constructor(); + }); + + it('tracks the number of times ajax requests are made', function() { + expect(this.tracker.count()).toBe(0); + + this.tracker.track(); + + expect(this.tracker.count()).toBe(1); + }); + + it('simplifies access to the last (most recent) request', function() { + this.tracker.track(); + this.tracker.track('request'); + + expect(this.tracker.mostRecent()).toEqual('request'); + }); + + it('returns a useful falsy value when there is no last (most recent) request', function() { + expect(this.tracker.mostRecent()).toBeFalsy(); + }); + + it('simplifies access to the first (oldest) request', function() { + this.tracker.track('request'); + this.tracker.track(); + + expect(this.tracker.first()).toEqual('request'); + }); + + it('returns a useful falsy value when there is no first (oldest) request', function() { + expect(this.tracker.first()).toBeFalsy(); + }); + + it('allows the requests list to be reset', function() { + this.tracker.track(); + this.tracker.track(); + + expect(this.tracker.count()).toBe(2); + + this.tracker.reset(); + + expect(this.tracker.count()).toBe(0); + }); + + it('allows retrieval of an arbitrary request by index', function() { + this.tracker.track('1'); + this.tracker.track('2'); + this.tracker.track('3'); + + expect(this.tracker.at(1)).toEqual('2'); + }); + + it('allows retrieval of all requests that are for a given url', function() { + this.tracker.track({ url: 'foo' }); + this.tracker.track({ url: 'bar' }); + + expect(this.tracker.filter('bar')).toEqual([{ url: 'bar' }]); + }); + + it('allows retrieval of all requests that match a given RegExp', function() { + this.tracker.track({ url: 'foo' }); + this.tracker.track({ url: 'bar' }); + this.tracker.track({ url: 'baz' }); + + expect(this.tracker.filter(/ba[rz]/)).toEqual([{ url: 'bar' }, { url: 'baz' }]); + }); + + it('allows retrieval of all requests that match based on a function', function() { + this.tracker.track({ url: 'foo' }); + this.tracker.track({ url: 'bar' }); + this.tracker.track({ url: 'baz' }); + + var func = function(request) { + return request.url === 'bar'; + }; + + expect(this.tracker.filter(func)).toEqual([{ url: 'bar' }]); + }); + + it('filters to nothing if no requests have been tracked', function() { + expect(this.tracker.filter('foo')).toEqual([]); + }); +}); + +describe('EventBus', function() { + beforeEach(function() { + this.bus = getJasmineRequireObj().AjaxEventBus()(); + }); + + it('calls an event listener', function() { + var callback = jasmine.createSpy('callback'); + + this.bus.addEventListener('foo', callback); + this.bus.trigger('foo'); + + expect(callback).toHaveBeenCalled(); + }); + + it('calls an event listener with additional arguments', function() { + var callback = jasmine.createSpy('callback'); + + this.bus.addEventListener('foo', callback); + this.bus.trigger('foo', 'bar'); + + expect(callback).toHaveBeenCalledWith('bar'); + }); + + it('only triggers callbacks for the specified event', function() { + var fooCallback = jasmine.createSpy('foo'), + barCallback = jasmine.createSpy('bar'); + + this.bus.addEventListener('foo', fooCallback); + this.bus.addEventListener('bar', barCallback); + + this.bus.trigger('foo'); + + expect(fooCallback).toHaveBeenCalled(); + expect(barCallback).not.toHaveBeenCalled(); + }); + + it('calls all the callbacks for the specified event', function() { + var callback1 = jasmine.createSpy('callback'); + var callback2 = jasmine.createSpy('otherCallback'); + + this.bus.addEventListener('foo', callback1); + this.bus.addEventListener('foo', callback2); + + this.bus.trigger('foo'); + + expect(callback1).toHaveBeenCalled(); + expect(callback2).toHaveBeenCalled(); + }); + + it('works if there are no callbacks for the event', function() { + var bus = this.bus; + expect(function() { + bus.trigger('notActuallyThere'); + }).not.toThrow(); + }); + + it('does not call listeners that have been removed', function() { + var callback = jasmine.createSpy('callback'); + + this.bus.addEventListener('foo', callback); + this.bus.removeEventListener('foo', callback); + this.bus.trigger('foo'); + + expect(callback).not.toHaveBeenCalled(); + }); + + it('only removes the specified callback', function() { + var callback1 = jasmine.createSpy('callback'); + var callback2 = jasmine.createSpy('otherCallback'); + + this.bus.addEventListener('foo', callback1); + this.bus.addEventListener('foo', callback2); + this.bus.removeEventListener('foo', callback2); + + this.bus.trigger('foo'); + + expect(callback1).toHaveBeenCalled(); + expect(callback2).not.toHaveBeenCalled(); + }); +}); + +describe("Webmock style mocking", function() { + var successSpy, errorSpy, response, fakeGlobal, mockAjax; + + var sendRequest = function(fakeGlobal, url?, method?) { + url = url || "http://example.com/someApi"; + method = method || 'GET'; + var xhr = new fakeGlobal.XMLHttpRequest(); + xhr.onreadystatechange = function(args) { + if (this.readyState === (this.DONE || 4)) { // IE 8 doesn't support DONE + response = this; + successSpy(); + } + }; + + xhr.open(method, url); + xhr.send(); + }; + + beforeEach(function() { + successSpy = jasmine.createSpy('success'); + fakeGlobal = {XMLHttpRequest: jasmine.createSpy('realXMLHttpRequest')}; + mockAjax = new MockAjax(fakeGlobal); + mockAjax.install(); + + mockAjax.stubRequest("http://example.com/someApi").andReturn({responseText: "hi!"}); + }); + + it("allows a url to be setup as a stub", function() { + sendRequest(fakeGlobal); + expect(successSpy).toHaveBeenCalled(); + }); + + it("should allow you to clear all the ajax stubs", function() { + mockAjax.stubs.reset(); + sendRequest(fakeGlobal); + expect(successSpy).not.toHaveBeenCalled(); + }); + + it("should set the contentType", function() { + sendRequest(fakeGlobal); + expect(response.getResponseHeader('Content-Type')).toEqual('application/json'); + }); + + it("should set the responseText", function() { + sendRequest(fakeGlobal); + expect(response.responseText).toEqual('hi!'); + }); + + it("should default the status to 200", function() { + sendRequest(fakeGlobal); + expect(response.status).toEqual(200); + }); + + it("should set the responseHeaders", function() { + mockAjax.stubRequest("http://example.com/someApi").andReturn({ + responseText: "hi!", + responseHeaders: [{name: "X-Custom", value: "header value"}] + }); + sendRequest(fakeGlobal); + expect(response.getResponseHeader('X-Custom')).toEqual('header value'); + }); + + describe("with another stub for the same url", function() { + beforeEach(function() { + mockAjax.stubRequest("http://example.com/someApi").andReturn({responseText: "no", status: 403}); + sendRequest(fakeGlobal); + }); + + it("should set the status", function() { + expect(response.status).toEqual(403); + }); + + it("should allow the latest stub to win", function() { + expect(response.responseText).toEqual('no'); + }); + }); +}); + +describe("withMock", function() { + var sendRequest = function(fakeGlobal) { + var xhr = new fakeGlobal.XMLHttpRequest(); + + xhr.open("GET", "http://example.com/someApi"); + xhr.send(); + }; + + it("installs the mock for passed in function, and uninstalls when complete", function() { + var xmlHttpRequest = jasmine.createSpyObj('XMLHttpRequest', ['open', 'send']), + xmlHttpRequestCtor = spyOn(window, 'XMLHttpRequest').and.returnValue(xmlHttpRequest), + fakeGlobal = {XMLHttpRequest: xmlHttpRequestCtor}, + mockAjax = new MockAjax(fakeGlobal); + + mockAjax.withMock(function() { + sendRequest(fakeGlobal); + expect(xmlHttpRequest.open).not.toHaveBeenCalled(); + }); + + sendRequest(fakeGlobal); + expect(xmlHttpRequest.open).toHaveBeenCalled(); + }); + + it("properly uninstalls when the passed in function throws", function() { + var xmlHttpRequest = jasmine.createSpyObj('XMLHttpRequest', ['open', 'send']), + xmlHttpRequestCtor = spyOn(window, 'XMLHttpRequest').and.returnValue(xmlHttpRequest), + fakeGlobal = {XMLHttpRequest: xmlHttpRequestCtor}, + mockAjax = new MockAjax(fakeGlobal); + + expect(function() { + mockAjax.withMock(function() { + throw "error"; + }); + }).toThrow("error"); + + sendRequest(fakeGlobal); + expect(xmlHttpRequest.open).toHaveBeenCalled(); + }); +}); + +describe("mockAjax", function() { + it("throws an error if installed multiple times", function() { + var fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'), + fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest }, + mockAjax = new MockAjax(fakeGlobal); + + function doubleInstall() { + mockAjax.install(); + mockAjax.install(); + } + + expect(doubleInstall).toThrow(); + }); + + it("does not throw an error if uninstalled between installs", function() { + var fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'), + fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest }, + mockAjax = new MockAjax(fakeGlobal); + + function sequentialInstalls() { + mockAjax.install(); + mockAjax.uninstall(); + mockAjax.install(); + } + + expect(sequentialInstalls).not.toThrow(); + }); + + it("does not replace XMLHttpRequest until it is installed", function() { + var fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'), + fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest }, + mockAjax = new MockAjax(fakeGlobal); + + fakeGlobal.XMLHttpRequest('foo'); + expect(fakeXmlHttpRequest).toHaveBeenCalledWith('foo'); + fakeXmlHttpRequest.calls.reset(); + + mockAjax.install(); + fakeGlobal.XMLHttpRequest('foo'); + expect(fakeXmlHttpRequest).not.toHaveBeenCalled(); + }); + + it("replaces the global XMLHttpRequest on uninstall", function() { + var fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'), + fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest }, + mockAjax = new MockAjax(fakeGlobal); + + mockAjax.install(); + mockAjax.uninstall(); + + fakeGlobal.XMLHttpRequest('foo'); + expect(fakeXmlHttpRequest).toHaveBeenCalledWith('foo'); + }); + + it("clears requests and stubs upon uninstall", function() { + var fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'), + fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest }, + mockAjax = new MockAjax(fakeGlobal); + + mockAjax.install(); + + mockAjax.requests.track({url: '/testurl'}); + mockAjax.stubRequest('/bobcat'); + + expect(mockAjax.requests.count()).toEqual(1); + expect(mockAjax.stubs.findStub('/bobcat')).toBeDefined(); + + mockAjax.uninstall(); + + expect(mockAjax.requests.count()).toEqual(0); + expect(mockAjax.stubs.findStub('/bobcat')).not.toBeDefined(); + }); + + it("allows the httpRequest to be retrieved", function() { + var fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'), + fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest }, + mockAjax = new MockAjax(fakeGlobal); + + mockAjax.install(); + var request = new (fakeGlobal.XMLHttpRequest)(); + + expect(mockAjax.requests.count()).toBe(1); + expect(mockAjax.requests.mostRecent()).toBe(request); + }); + + it("allows the httpRequests to be cleared", function() { + var fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'), + fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest }, + mockAjax = new MockAjax(fakeGlobal); + + mockAjax.install(); + var request = new (fakeGlobal.XMLHttpRequest)(); + + expect(mockAjax.requests.mostRecent()).toBe(request); + mockAjax.requests.reset(); + expect(mockAjax.requests.count()).toBe(0); + }); +}); diff --git a/jasmine-ajax/jasmine-ajax-tests.ts.tscparams b/jasmine-ajax/jasmine-ajax-tests.ts.tscparams new file mode 100644 index 0000000000..d3f5a12faa --- /dev/null +++ b/jasmine-ajax/jasmine-ajax-tests.ts.tscparams @@ -0,0 +1 @@ + diff --git a/jasmine-ajax/jasmine-ajax.d.ts b/jasmine-ajax/jasmine-ajax.d.ts new file mode 100644 index 0000000000..70ca2f57c1 --- /dev/null +++ b/jasmine-ajax/jasmine-ajax.d.ts @@ -0,0 +1,77 @@ +// Type definitions for jasmine-ajax 3.1.1 +// Project: https://github.com/jasmine/jasmine-ajax +// Definitions by: Louis Grignon +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +interface JasmineAjaxResponse { + status?: string; + statusText?: string; + responseText?: string; + response?: string; + responseType?: string; + contentType?: string; + responseHeaders?: { [key: string]: string }; +} + +interface JasmineAjaxRequest { + url: string; + respondWith(response: JasmineAjaxResponse): void; +} + +interface JasmineAjaxRequestTracker { + track(request: JasmineAjaxRequest): void; + first(): JasmineAjaxRequest; + count(): number; + reset(): void; + mostRecent(): JasmineAjaxRequest; + at(index: number): JasmineAjaxRequest; + filter(urlToMatch: RegExp): JasmineAjaxRequest[]; + filter(urlToMatch: Function): JasmineAjaxRequest[]; + filter(urlToMatch: string): JasmineAjaxRequest[]; +} + +interface JasmineAjaxRequestStubReturnOptions { + status?: number; + contentType?: string; + response?: string; + responseText?: string; + responseHeaders?: { [key: string]: string }; +} + +interface JasmineAjaxRequestStub { + data?: string; + method?: string; + andReturn(options: JasmineAjaxRequestStubReturnOptions): void; + matches(fullUrl: string, data: string, method: string): boolean; +} + +interface JasmineAjaxStubTracker { + addStub(stub: JasmineAjaxRequestStub): void; + reset(): void; + findStub(url: string, data?: string, method?: string): JasmineAjaxRequestStub; +} + +interface JasmineAjaxParamParser { + test(xhr: XMLHttpRequest): boolean; + parse(paramString: string): any; +} + +declare class MockAjax { + constructor(globals); + + install(): void; + uninstall(): void; + + withMock(closure: () => void): void; + addCustomParamParser(parser: JasmineAjaxParamParser): void; + + stubRequest(url: RegExp, data?: string, method?: string): JasmineAjaxRequestStub; + stubRequest(url: string, data?: string, method?: string): JasmineAjaxRequestStub; + + requests: JasmineAjaxRequestTracker; + stubs: JasmineAjaxStubTracker; +} + +declare module jasmine { + export var Ajax: MockAjax; +} From c0bb2b179811977f9a4d71285071989acf5a75b0 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 20 May 2015 21:15:47 +0200 Subject: [PATCH 0034/1358] fixed dependencies and errors --- jasmine-ajax/jasmine-ajax-tests.ts | 3197 ++++++++++++++-------------- jasmine-ajax/jasmine-ajax.d.ts | 11 +- 2 files changed, 1610 insertions(+), 1598 deletions(-) diff --git a/jasmine-ajax/jasmine-ajax-tests.ts b/jasmine-ajax/jasmine-ajax-tests.ts index b5134d2cf7..6b5c50b1b9 100644 --- a/jasmine-ajax/jasmine-ajax-tests.ts +++ b/jasmine-ajax/jasmine-ajax-tests.ts @@ -6,1813 +6,1820 @@ /// /// +declare function getJasmineRequireObj(); + describe('StubTracker', function() { - beforeEach(function() { - var Constructor = getJasmineRequireObj().AjaxStubTracker(); - this.tracker = new Constructor(); - }); + beforeEach(function() { + var Constructor = getJasmineRequireObj().AjaxStubTracker(); + this.tracker = new Constructor(); + }); - it('finds nothing if no stubs are added', function() { - expect(this.tracker.findStub()).toBeUndefined(); - }); + it('finds nothing if no stubs are added', function() { + expect(this.tracker.findStub()).toBeUndefined(); + }); - it('finds an added stub', function() { - var stub = { matches: function() { return true; } }; - this.tracker.addStub(stub); + it('finds an added stub', function() { + var stub = { matches: function() { return true; } }; + this.tracker.addStub(stub); - expect(this.tracker.findStub()).toBe(stub); - }); + expect(this.tracker.findStub()).toBe(stub); + }); - it('skips an added stub that does not match', function() { - var stub = { matches: function() { return false; } }; - this.tracker.addStub(stub); + it('skips an added stub that does not match', function() { + var stub = { matches: function() { return false; } }; + this.tracker.addStub(stub); - expect(this.tracker.findStub()).toBeUndefined(); - }); + expect(this.tracker.findStub()).toBeUndefined(); + }); - it('passes url, data, and method to the stub', function() { - var stub = { matches: jasmine.createSpy('matches') }; - this.tracker.addStub(stub); + it('passes url, data, and method to the stub', function() { + var stub = { matches: jasmine.createSpy('matches') }; + this.tracker.addStub(stub); - this.tracker.findStub('url', 'data', 'method'); + this.tracker.findStub('url', 'data', 'method'); - expect(stub.matches).toHaveBeenCalledWith('url', 'data', 'method'); - }); + expect(stub.matches).toHaveBeenCalledWith('url', 'data', 'method'); + }); - it('can clear out all stubs', function() { - var stub = { matches: jasmine.createSpy('matches') }; - this.tracker.addStub(stub); + it('can clear out all stubs', function() { + var stub = { matches: jasmine.createSpy('matches') }; + this.tracker.addStub(stub); - this.tracker.findStub(); + this.tracker.findStub(); - expect(stub.matches).toHaveBeenCalled(); + expect(stub.matches).toHaveBeenCalled(); - this.tracker.reset(); - stub.matches.calls.reset(); + this.tracker.reset(); + stub.matches.calls.reset(); - this.tracker.findStub(); + this.tracker.findStub(); - expect(stub.matches).not.toHaveBeenCalled(); - }); + expect(stub.matches).not.toHaveBeenCalled(); + }); - it('uses the most recently added stub that matches', function() { - var stub1 = { matches: function() { return true; } }; - var stub2 = { matches: function() { return true; } }; - var stub3 = { matches: function() { return false; } }; + it('uses the most recently added stub that matches', function() { + var stub1 = { matches: function() { return true; } }; + var stub2 = { matches: function() { return true; } }; + var stub3 = { matches: function() { return false; } }; - this.tracker.addStub(stub1); - this.tracker.addStub(stub2); - this.tracker.addStub(stub3); + this.tracker.addStub(stub1); + this.tracker.addStub(stub2); + this.tracker.addStub(stub3); - expect(this.tracker.findStub()).toBe(stub2); - }); + expect(this.tracker.findStub()).toBe(stub2); + }); }); describe('FakeRequest', function() { - beforeEach(function() { - this.requestTracker = { track: jasmine.createSpy('trackRequest') }; - this.stubTracker = { findStub: function() {} }; - var parserInstance = this.parserInstance = jasmine.createSpy('parse'); - this.paramParser = { findParser: function() { return { parse: parserInstance }; } }; - var eventBus = this.fakeEventBus = { - addEventListener: jasmine.createSpy('addEventListener'), - trigger: jasmine.createSpy('trigger'), - removeEventListener: jasmine.createSpy('removeEventListener') - }; - this.eventBusFactory = function() { - return eventBus; - }; - this.fakeGlobal = { - XMLHttpRequest: function() { - this.extraAttribute = 'my cool attribute'; - }, - DOMParser: window['DOMParser'], - ActiveXObject: window['ActiveXObject'] - }; - this.FakeRequest = getJasmineRequireObj().AjaxFakeRequest(this.eventBusFactory)(this.fakeGlobal, this.requestTracker, this.stubTracker, this.paramParser); - }); - - it('extends from the global XMLHttpRequest', function() { - var request = new this.FakeRequest(); - - expect(request.extraAttribute).toEqual('my cool attribute'); - }); - - it('skips XMLHttpRequest attributes that IE does not want copied', function() { - // use real window here so it will correctly go red on IE if it breaks - var FakeRequest = getJasmineRequireObj().AjaxFakeRequest(this.eventBusFactory)(window, this.requestTracker, this.stubTracker, this.paramParser); - var request = new FakeRequest(); - - expect(request.responseBody).toBeUndefined(); - expect(request.responseXML).toBeUndefined(); - expect(request.statusText).toBeUndefined(); - }); - - it('tracks the request', function() { - var request = new this.FakeRequest(); - - expect(this.requestTracker.track).toHaveBeenCalledWith(request); - }); - - it('has default request headers and override mime type', function() { - var request = new this.FakeRequest(); - - expect(request.requestHeaders).toEqual({}); - expect(request.overriddenMimeType).toBeNull(); - }); - - it('saves request information when opened', function() { - var request = new this.FakeRequest(); - request.open('METHOD', 'URL', 'ignore_async', 'USERNAME', 'PASSWORD'); - - expect(request.method).toEqual('METHOD'); - expect(request.url).toEqual('URL'); - expect(request.username).toEqual('USERNAME'); - expect(request.password).toEqual('PASSWORD'); - }); - - it('saves an override mime type', function() { - var request = new this.FakeRequest(); - - request.overrideMimeType('application/text; charset: utf-8'); - - expect(request.overriddenMimeType).toBe('application/text; charset: utf-8'); - }); - - it('saves request headers', function() { - var request = new this.FakeRequest(); - - request.setRequestHeader('X-Header-1', 'value1'); - request.setRequestHeader('X-Header-2', 'value2'); - - expect(request.requestHeaders).toEqual({ - 'X-Header-1': 'value1', - 'X-Header-2': 'value2' - }); - }); - - it('combines request headers with the same header name', function() { - var request = new this.FakeRequest(); - - request.setRequestHeader('X-Header', 'value1'); - request.setRequestHeader('X-Header', 'value2'); - - expect(request.requestHeaders['X-Header']).toEqual('value1, value2'); - }); - - it('finds the content-type request header', function() { - var request = new this.FakeRequest(); - - request.setRequestHeader('ContEnt-tYPe', 'application/text+xml'); - - expect(request.contentType()).toEqual('application/text+xml'); - }); - - describe('managing readyState', function() { - beforeEach(function() { - this.request = new this.FakeRequest(); - }); - - it('has an initial ready state of 0 (uninitialized)', function() { - expect(this.request.readyState).toBe(0); - expect(this.fakeEventBus.trigger).not.toHaveBeenCalled(); - }); - - it('has a ready state of 1 (open) when opened', function() { - this.request.open(); - - expect(this.request.readyState).toBe(1); - expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('readystatechange'); - }); - - it('has a ready state of 0 (uninitialized) when aborted', function() { - this.request.open(); - this.fakeEventBus.trigger.calls.reset(); - - this.request.abort(); - - expect(this.request.readyState).toBe(0); - expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('readystatechange'); - }); - - it('has a ready state of 1 (sent) when sent', function() { - this.request.open(); - this.fakeEventBus.trigger.calls.reset(); - - this.request.send(); - - expect(this.request.readyState).toBe(1); - expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('loadstart'); - expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('readystatechange'); - }); - - it('has a ready state of 4 (loaded) when timed out', function() { - this.request.open(); - this.request.send(); - this.fakeEventBus.trigger.calls.reset(); - - jasmine.clock().install(); - this.request.responseTimeout(); - jasmine.clock().uninstall(); - - expect(this.request.readyState).toBe(4); - expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('readystatechange', 'timeout'); - }); - - it('has a ready state of 4 (loaded) when network erroring', function() { - this.request.open(); - this.request.send(); - this.fakeEventBus.trigger.calls.reset(); - - this.request.responseError(); - - expect(this.request.readyState).toBe(4); - expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('readystatechange'); - }); - - it('has a ready state of 4 (loaded) when responding', function() { - this.request.open(); - this.request.send(); - this.fakeEventBus.trigger.calls.reset(); - - this.request.respondWith({}); - - expect(this.request.readyState).toBe(4); - expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('readystatechange'); - }); - - it('has a ready state of 2, then 4 (loaded) when responding', function() { - this.request.open(); - this.request.send(); - this.fakeEventBus.trigger.calls.reset(); - - var request = this.request; - var events = []; - var headers = [ - { name: 'X-Header', value: 'foo' } - ]; - - this.fakeEventBus.trigger.and.callFake(function(event) { - if (event === 'readystatechange') { - events.push({ - readyState: request.readyState, - status: request.status, - statusText: request.statusText, - responseHeaders: request.responseHeaders - }); - } - }); - - this.request.respondWith({ - status: 200, - statusText: 'OK', - responseHeaders: headers - }); - - expect(this.request.readyState).toBe(4); - expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('readystatechange'); - expect(events.length).toBe(2); - expect(events).toEqual([ - { readyState: 2, status: 200, statusText: 'OK', responseHeaders: headers }, - { readyState: 4, status: 200, statusText: 'OK', responseHeaders: headers } - ]); - }); - - it('throws an error when timing out a request that has completed', function() { - this.request.open(); - this.request.send(); - this.request.respondWith({}); - var request = this.request; - - expect(function() { - request.responseTimeout(); - }).toThrowError('FakeXMLHttpRequest already completed'); - }); - - it('throws an error when responding to a request that has completed', function() { - this.request.open(); - this.request.send(); - this.request.respondWith({}); - var request = this.request; - - expect(function() { - request.respondWith({}); - }).toThrowError('FakeXMLHttpRequest already completed'); - }); - - it('throws an error when erroring a request that has completed', function() { - this.request.open(); - this.request.send(); - this.request.respondWith({}); - var request = this.request; - - expect(function() { - request.responseError({}); - }).toThrowError('FakeXMLHttpRequest already completed'); - }); - }); - - it('registers on-style callback with the event bus', function() { - this.request = new this.FakeRequest(); - - expect(this.fakeEventBus.addEventListener).toHaveBeenCalledWith('readystatechange', jasmine.any(Function)); - expect(this.fakeEventBus.addEventListener).toHaveBeenCalledWith('loadstart', jasmine.any(Function)); - expect(this.fakeEventBus.addEventListener).toHaveBeenCalledWith('progress', jasmine.any(Function)); - expect(this.fakeEventBus.addEventListener).toHaveBeenCalledWith('abort', jasmine.any(Function)); - expect(this.fakeEventBus.addEventListener).toHaveBeenCalledWith('error', jasmine.any(Function)); - expect(this.fakeEventBus.addEventListener).toHaveBeenCalledWith('load', jasmine.any(Function)); - expect(this.fakeEventBus.addEventListener).toHaveBeenCalledWith('timeout', jasmine.any(Function)); - expect(this.fakeEventBus.addEventListener).toHaveBeenCalledWith('loadend', jasmine.any(Function)); - - this.request.onreadystatechange = jasmine.createSpy('readystatechange'); - this.request.onloadstart = jasmine.createSpy('loadstart'); - this.request.onprogress = jasmine.createSpy('progress'); - this.request.onabort = jasmine.createSpy('abort'); - this.request.onerror = jasmine.createSpy('error'); - this.request.onload = jasmine.createSpy('load'); - this.request.ontimeout = jasmine.createSpy('timeout'); - this.request.onloadend = jasmine.createSpy('loadend'); - - var args = this.fakeEventBus.addEventListener.calls.allArgs(); - for (var i = 0; i < args.length; i++) { - var eventName = args[i][0], - busCallback = args[i][1]; - - busCallback(); - expect(this.request['on' + eventName]).toHaveBeenCalled(); - } - }); - - it('delegates addEventListener to the eventBus', function() { - this.request = new this.FakeRequest(); - - this.request.addEventListener('foo', 'bar'); - - expect(this.fakeEventBus.addEventListener).toHaveBeenCalledWith('foo', 'bar'); - }); - - it('delegates removeEventListener to the eventBus', function() { - this.request = new this.FakeRequest(); - - this.request.removeEventListener('foo', 'bar'); - - expect(this.fakeEventBus.removeEventListener).toHaveBeenCalledWith('foo', 'bar'); - }); - - describe('triggering progress events', function() { - beforeEach(function() { - this.request = new this.FakeRequest(); - }); - - it('should not trigger any events to start', function() { - this.request.open(); - - expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('readystatechange'); - }); - - it('should trigger loadstart when sent', function() { - this.request.open(); - - this.fakeEventBus.trigger.calls.reset(); - - this.request.send(); - - expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('loadstart'); - expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('readystatechange'); - expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('progress'); - expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('abort'); - expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('error'); - expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('load'); - expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('timeout'); - expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('loadend'); - }); - - it('should trigger abort, progress, loadend when aborted', function() { - this.request.open(); - this.request.send(); - - this.fakeEventBus.trigger.calls.reset(); - - this.request.abort(); - - expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('readystatechange'); - expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('loadstart'); - expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('progress'); - expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('abort'); - expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('error'); - expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('load'); - expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('timeout'); - expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('loadend'); - }); - - it('should trigger error, progress, loadend when network error', function() { - this.request.open(); - this.request.send(); - - this.fakeEventBus.trigger.calls.reset(); - - this.request.responseError(); - - expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('loadstart'); - expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('readystatechange'); - expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('progress'); - expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('abort'); - expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('error'); - expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('load'); - expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('timeout'); - expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('loadend'); - }); + beforeEach(function() { + this.requestTracker = { track: jasmine.createSpy('trackRequest') }; + this.stubTracker = { findStub: function() { } }; + var parserInstance = this.parserInstance = jasmine.createSpy('parse'); + this.paramParser = { findParser: function() { return { parse: parserInstance }; } }; + var eventBus = this.fakeEventBus = { + addEventListener: jasmine.createSpy('addEventListener'), + trigger: jasmine.createSpy('trigger'), + removeEventListener: jasmine.createSpy('removeEventListener') + }; + this.eventBusFactory = function() { + return eventBus; + }; + this.fakeGlobal = { + XMLHttpRequest: function() { + this.extraAttribute = 'my cool attribute'; + }, + DOMParser: window['DOMParser'], + ActiveXObject: window['ActiveXObject'] + }; + this.FakeRequest = getJasmineRequireObj().AjaxFakeRequest(this.eventBusFactory)(this.fakeGlobal, this.requestTracker, this.stubTracker, this.paramParser); + }); + + it('extends from the global XMLHttpRequest', function() { + var request = new this.FakeRequest(); + + expect(request.extraAttribute).toEqual('my cool attribute'); + }); + + it('skips XMLHttpRequest attributes that IE does not want copied', function() { + // use real window here so it will correctly go red on IE if it breaks + var FakeRequest = getJasmineRequireObj().AjaxFakeRequest(this.eventBusFactory)(window, this.requestTracker, this.stubTracker, this.paramParser); + var request = new FakeRequest(); + + expect(request.responseBody).toBeUndefined(); + expect(request.responseXML).toBeUndefined(); + expect(request.statusText).toBeUndefined(); + }); + + it('tracks the request', function() { + var request = new this.FakeRequest(); + + expect(this.requestTracker.track).toHaveBeenCalledWith(request); + }); + + it('has default request headers and override mime type', function() { + var request = new this.FakeRequest(); + + expect(request.requestHeaders).toEqual({}); + expect(request.overriddenMimeType).toBeNull(); + }); + + it('saves request information when opened', function() { + var request = new this.FakeRequest(); + request.open('METHOD', 'URL', 'ignore_async', 'USERNAME', 'PASSWORD'); + + expect(request.method).toEqual('METHOD'); + expect(request.url).toEqual('URL'); + expect(request.username).toEqual('USERNAME'); + expect(request.password).toEqual('PASSWORD'); + }); + + it('saves an override mime type', function() { + var request = new this.FakeRequest(); + + request.overrideMimeType('application/text; charset: utf-8'); + + expect(request.overriddenMimeType).toBe('application/text; charset: utf-8'); + }); + + it('saves request headers', function() { + var request = new this.FakeRequest(); + + request.setRequestHeader('X-Header-1', 'value1'); + request.setRequestHeader('X-Header-2', 'value2'); + + expect(request.requestHeaders).toEqual({ + 'X-Header-1': 'value1', + 'X-Header-2': 'value2' + }); + }); + + it('combines request headers with the same header name', function() { + var request = new this.FakeRequest(); + + request.setRequestHeader('X-Header', 'value1'); + request.setRequestHeader('X-Header', 'value2'); + + expect(request.requestHeaders['X-Header']).toEqual('value1, value2'); + }); + + it('finds the content-type request header', function() { + var request = new this.FakeRequest(); + + request.setRequestHeader('ContEnt-tYPe', 'application/text+xml'); + + expect(request.contentType()).toEqual('application/text+xml'); + }); + + describe('managing readyState', function() { + beforeEach(function() { + this.request = new this.FakeRequest(); + }); + + it('has an initial ready state of 0 (uninitialized)', function() { + expect(this.request.readyState).toBe(0); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalled(); + }); + + it('has a ready state of 1 (open) when opened', function() { + this.request.open(); + + expect(this.request.readyState).toBe(1); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('readystatechange'); + }); + + it('has a ready state of 0 (uninitialized) when aborted', function() { + this.request.open(); + this.fakeEventBus.trigger.calls.reset(); + + this.request.abort(); + + expect(this.request.readyState).toBe(0); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('readystatechange'); + }); + + it('has a ready state of 1 (sent) when sent', function() { + this.request.open(); + this.fakeEventBus.trigger.calls.reset(); + + this.request.send(); + + expect(this.request.readyState).toBe(1); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('loadstart'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('readystatechange'); + }); + + it('has a ready state of 4 (loaded) when timed out', function() { + this.request.open(); + this.request.send(); + this.fakeEventBus.trigger.calls.reset(); + + jasmine.clock().install(); + this.request.responseTimeout(); + jasmine.clock().uninstall(); + + expect(this.request.readyState).toBe(4); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('readystatechange', 'timeout'); + }); + + it('has a ready state of 4 (loaded) when network erroring', function() { + this.request.open(); + this.request.send(); + this.fakeEventBus.trigger.calls.reset(); + + this.request.responseError(); + + expect(this.request.readyState).toBe(4); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('readystatechange'); + }); + + it('has a ready state of 4 (loaded) when responding', function() { + this.request.open(); + this.request.send(); + this.fakeEventBus.trigger.calls.reset(); + + this.request.respondWith({}); + + expect(this.request.readyState).toBe(4); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('readystatechange'); + }); + + it('has a ready state of 2, then 4 (loaded) when responding', function() { + this.request.open(); + this.request.send(); + this.fakeEventBus.trigger.calls.reset(); + + var request = this.request; + var events = []; + var headers = [ + { name: 'X-Header', value: 'foo' } + ]; + + this.fakeEventBus.trigger.and.callFake(function(event) { + if (event === 'readystatechange') { + events.push({ + readyState: request.readyState, + status: request.status, + statusText: request.statusText, + responseHeaders: request.responseHeaders + }); + } + }); + + this.request.respondWith({ + status: 200, + statusText: 'OK', + responseHeaders: headers + }); + + expect(this.request.readyState).toBe(4); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('readystatechange'); + expect(events.length).toBe(2); + expect(events).toEqual([ + { readyState: 2, status: 200, statusText: 'OK', responseHeaders: headers }, + { readyState: 4, status: 200, statusText: 'OK', responseHeaders: headers } + ]); + }); + + it('throws an error when timing out a request that has completed', function() { + this.request.open(); + this.request.send(); + this.request.respondWith({}); + var request = this.request; + + expect(function() { + request.responseTimeout(); + }).toThrowError('FakeXMLHttpRequest already completed'); + }); + + it('throws an error when responding to a request that has completed', function() { + this.request.open(); + this.request.send(); + this.request.respondWith({}); + var request = this.request; + + expect(function() { + request.respondWith({}); + }).toThrowError('FakeXMLHttpRequest already completed'); + }); + + it('throws an error when erroring a request that has completed', function() { + this.request.open(); + this.request.send(); + this.request.respondWith({}); + var request = this.request; + + expect(function() { + request.responseError({}); + }).toThrowError('FakeXMLHttpRequest already completed'); + }); + }); + + it('registers on-style callback with the event bus', function() { + this.request = new this.FakeRequest(); + + expect(this.fakeEventBus.addEventListener).toHaveBeenCalledWith('readystatechange', jasmine.any(Function)); + expect(this.fakeEventBus.addEventListener).toHaveBeenCalledWith('loadstart', jasmine.any(Function)); + expect(this.fakeEventBus.addEventListener).toHaveBeenCalledWith('progress', jasmine.any(Function)); + expect(this.fakeEventBus.addEventListener).toHaveBeenCalledWith('abort', jasmine.any(Function)); + expect(this.fakeEventBus.addEventListener).toHaveBeenCalledWith('error', jasmine.any(Function)); + expect(this.fakeEventBus.addEventListener).toHaveBeenCalledWith('load', jasmine.any(Function)); + expect(this.fakeEventBus.addEventListener).toHaveBeenCalledWith('timeout', jasmine.any(Function)); + expect(this.fakeEventBus.addEventListener).toHaveBeenCalledWith('loadend', jasmine.any(Function)); + + this.request.onreadystatechange = jasmine.createSpy('readystatechange'); + this.request.onloadstart = jasmine.createSpy('loadstart'); + this.request.onprogress = jasmine.createSpy('progress'); + this.request.onabort = jasmine.createSpy('abort'); + this.request.onerror = jasmine.createSpy('error'); + this.request.onload = jasmine.createSpy('load'); + this.request.ontimeout = jasmine.createSpy('timeout'); + this.request.onloadend = jasmine.createSpy('loadend'); + + var args = this.fakeEventBus.addEventListener.calls.allArgs(); + for (var i = 0; i < args.length; i++) { + var eventName = args[i][0], + busCallback = args[i][1]; + + busCallback(); + expect(this.request['on' + eventName]).toHaveBeenCalled(); + } + }); + + it('delegates addEventListener to the eventBus', function() { + this.request = new this.FakeRequest(); + + this.request.addEventListener('foo', 'bar'); + + expect(this.fakeEventBus.addEventListener).toHaveBeenCalledWith('foo', 'bar'); + }); + + it('delegates removeEventListener to the eventBus', function() { + this.request = new this.FakeRequest(); + + this.request.removeEventListener('foo', 'bar'); + + expect(this.fakeEventBus.removeEventListener).toHaveBeenCalledWith('foo', 'bar'); + }); + + describe('triggering progress events', function() { + beforeEach(function() { + this.request = new this.FakeRequest(); + }); + + it('should not trigger any events to start', function() { + this.request.open(); + + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('readystatechange'); + }); + + it('should trigger loadstart when sent', function() { + this.request.open(); + + this.fakeEventBus.trigger.calls.reset(); + + this.request.send(); + + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('loadstart'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('readystatechange'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('progress'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('abort'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('error'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('load'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('timeout'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('loadend'); + }); + + it('should trigger abort, progress, loadend when aborted', function() { + this.request.open(); + this.request.send(); + + this.fakeEventBus.trigger.calls.reset(); + + this.request.abort(); + + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('readystatechange'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('loadstart'); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('progress'); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('abort'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('error'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('load'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('timeout'); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('loadend'); + }); + + it('should trigger error, progress, loadend when network error', function() { + this.request.open(); + this.request.send(); + + this.fakeEventBus.trigger.calls.reset(); + + this.request.responseError(); + + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('loadstart'); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('readystatechange'); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('progress'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('abort'); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('error'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('load'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('timeout'); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('loadend'); + }); - it('should trigger timeout, progress, loadend when timing out', function() { - this.request.open(); - this.request.send(); + it('should trigger timeout, progress, loadend when timing out', function() { + this.request.open(); + this.request.send(); - this.fakeEventBus.trigger.calls.reset(); + this.fakeEventBus.trigger.calls.reset(); - jasmine.clock().install(); - this.request.responseTimeout(); - jasmine.clock().uninstall(); + jasmine.clock().install(); + this.request.responseTimeout(); + jasmine.clock().uninstall(); - expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('loadstart'); - expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('readystatechange', 'timeout'); - expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('progress'); - expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('abort'); - expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('error'); - expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('load'); - expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('timeout'); - expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('loadend'); - }); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('loadstart'); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('readystatechange', 'timeout'); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('progress'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('abort'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('error'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('load'); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('timeout'); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('loadend'); + }); - it('should trigger load, progress, loadend when responding', function() { - this.request.open(); - this.request.send(); + it('should trigger load, progress, loadend when responding', function() { + this.request.open(); + this.request.send(); - this.fakeEventBus.trigger.calls.reset(); + this.fakeEventBus.trigger.calls.reset(); - this.request.respondWith({ status: 200 }); + this.request.respondWith({ status: 200 }); - expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('loadstart'); - expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('readystatechange'); - expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('progress'); - expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('abort'); - expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('error'); - expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('load'); - expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('timeout'); - expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('loadend'); - }); - }); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('loadstart'); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('readystatechange'); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('progress'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('abort'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('error'); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('load'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('timeout'); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('loadend'); + }); + }); - it('ticks the jasmine clock on timeout', function() { - var clock = { tick: jasmine.createSpy('tick') }; - spyOn(jasmine, 'clock').and.returnValue(clock); + it('ticks the jasmine clock on timeout', function() { + var clock = { tick: jasmine.createSpy('tick') }; + spyOn(jasmine, 'clock').and.returnValue(clock); - var request = new this.FakeRequest(); - request.open(); - request.send(); + var request = new this.FakeRequest(); + request.open(); + request.send(); - request.responseTimeout(); + request.responseTimeout(); - expect(clock.tick).toHaveBeenCalledWith(30000); - }); + expect(clock.tick).toHaveBeenCalledWith(30000); + }); - it('has an initial status of null', function() { - var request = new this.FakeRequest(); - - expect(request.status).toBeNull(); - }); - - it('has an aborted status', function() { - var request = new this.FakeRequest(); - - request.abort(); + it('has an initial status of null', function() { + var request = new this.FakeRequest(); + + expect(request.status).toBeNull(); + }); + + it('has an aborted status', function() { + var request = new this.FakeRequest(); + + request.abort(); - expect(request.status).toBe(0); - expect(request.statusText).toBe('abort'); - }); + expect(request.status).toBe(0); + expect(request.statusText).toBe('abort'); + }); - it('has a status from the response', function() { - var request = new this.FakeRequest(); - request.open(); - request.send(); - - request.respondWith({ status: 200 }); - - expect(request.status).toBe(200); - expect(request.statusText).toBe(''); - }); - - it('has a statusText from the response', function() { - var request = new this.FakeRequest(); - request.open(); - request.send(); - - request.respondWith({ status: 200, statusText: 'OK' }); - - expect(request.status).toBe(200); - expect(request.statusText).toBe('OK'); - }); - - it('saves off any data sent to the server', function() { - var request = new this.FakeRequest(); - request.open(); - request.send('foo=bar&baz=quux'); - - expect(request.params).toBe('foo=bar&baz=quux'); - }); - - it('parses data sent to the server', function() { - var request = new this.FakeRequest(); - request.open(); - request.send('foo=bar&baz=quux'); - - this.parserInstance.and.returnValue('parsed'); + it('has a status from the response', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + request.respondWith({ status: 200 }); + + expect(request.status).toBe(200); + expect(request.statusText).toBe(''); + }); + + it('has a statusText from the response', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + request.respondWith({ status: 200, statusText: 'OK' }); + + expect(request.status).toBe(200); + expect(request.statusText).toBe('OK'); + }); + + it('saves off any data sent to the server', function() { + var request = new this.FakeRequest(); + request.open(); + request.send('foo=bar&baz=quux'); + + expect(request.params).toBe('foo=bar&baz=quux'); + }); + + it('parses data sent to the server', function() { + var request = new this.FakeRequest(); + request.open(); + request.send('foo=bar&baz=quux'); + + this.parserInstance.and.returnValue('parsed'); - expect(request.data()).toBe('parsed'); - }); - - it('skips parsing if no data was sent', function() { - var request = new this.FakeRequest(); - request.open(); - request.send(); - - expect(request.data()).toEqual({}); - expect(this.parserInstance).not.toHaveBeenCalled(); - }); - - it('saves responseText', function() { - var request = new this.FakeRequest(); - request.open(); - request.send(); - - request.respondWith({ status: 200, responseText: 'foobar' }); + expect(request.data()).toBe('parsed'); + }); + + it('skips parsing if no data was sent', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + expect(request.data()).toEqual({}); + expect(this.parserInstance).not.toHaveBeenCalled(); + }); + + it('saves responseText', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + request.respondWith({ status: 200, responseText: 'foobar' }); - expect(request.responseText).toBe('foobar'); - }); + expect(request.responseText).toBe('foobar'); + }); - it('defaults responseText if none is given', function() { - var request = new this.FakeRequest(); - request.open(); - request.send(); - - request.respondWith({ status: 200 }); + it('defaults responseText if none is given', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + request.respondWith({ status: 200 }); - expect(request.responseText).toBe(''); - }); + expect(request.responseText).toBe(''); + }); - it('retrieves individual response headers', function() { - var request = new this.FakeRequest(); - request.open(); - request.send(); + it('retrieves individual response headers', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); - request.respondWith({ - status: 200, - responseHeaders: { - 'X-Header': 'foo' - } - }); + request.respondWith({ + status: 200, + responseHeaders: { + 'X-Header': 'foo' + } + }); - expect(request.getResponseHeader('X-Header')).toBe('foo'); - }); + expect(request.getResponseHeader('X-Header')).toBe('foo'); + }); - it('retrieves individual response headers case-insensitively', function() { - var request = new this.FakeRequest(); - request.open(); - request.send(); + it('retrieves individual response headers case-insensitively', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); - request.respondWith({ - status: 200, - responseHeaders: { - 'X-Header': 'foo' - } - }); - - expect(request.getResponseHeader('x-header')).toBe('foo'); - }); - - it('retrieves a combined response header', function() { - var request = new this.FakeRequest(); - request.open(); - request.send(); - - request.respondWith({ - status: 200, - responseHeaders: [ - { name: 'X-Header', value: 'foo' }, - { name: 'X-Header', value: 'bar' } - ] - }); - - expect(request.getResponseHeader('x-header')).toBe('foo, bar'); - }); - - it("doesn't pollute the response headers of other XHRs", function() { - var request1 = new this.FakeRequest(); - request1.open(); - request1.send(); - - var request2 = new this.FakeRequest(); - request2.open(); - request2.send(); - - request1.respondWith({ status: 200, responseHeaders: { 'X-Foo': 'bar' } }); - request2.respondWith({ status: 200, responseHeaders: { 'X-Baz': 'quux' } }); - - expect(request1.getAllResponseHeaders()).toBe("X-Foo: bar\r\n"); - expect(request2.getAllResponseHeaders()).toBe("X-Baz: quux\r\n"); - }); - - it('retrieves all response headers', function() { - var request = new this.FakeRequest(); - request.open(); - request.send(); - - request.respondWith({ - status: 200, - responseHeaders: [ - { name: 'X-Header-1', value: 'foo' }, - { name: 'X-Header-2', value: 'bar' }, - { name: 'X-Header-1', value: 'baz' } - ] - }); - - expect(request.getAllResponseHeaders()).toBe("X-Header-1: foo\r\nX-Header-2: bar\r\nX-Header-1: baz\r\n"); - }); - - it('sets the content-type header to the specified contentType when no other headers are supplied', function() { - var request = new this.FakeRequest(); - request.open(); - request.send(); - - request.respondWith({ status: 200, contentType: 'text/plain' }); - - expect(request.getResponseHeader('content-type')).toBe('text/plain'); - expect(request.getAllResponseHeaders()).toBe("Content-Type: text/plain\r\n"); - }); - - it('sets a default content-type header if no contentType and headers are supplied', function() { - var request = new this.FakeRequest(); - request.open(); - request.send(); - - request.respondWith({ status: 200 }); - - expect(request.getResponseHeader('content-type')).toBe('application/json'); - expect(request.getAllResponseHeaders()).toBe("Content-Type: application/json\r\n"); - }); - - it('has no responseXML by default', function() { - var request = new this.FakeRequest(); - request.open(); - request.send(); - - request.respondWith({ status: 200 }); - - expect(request.responseXML).toBeNull(); - }); - - it('parses a text/xml document into responseXML', function() { - var request = new this.FakeRequest(); - request.open(); - request.send(); - - request.respondWith({ status: 200, contentType: 'text/xml', responseText: '' }); - - if (typeof window['Document'] !== 'undefined') { - expect(request.responseXML instanceof window['Document']).toBe(true); - expect(request.response instanceof window['Document']).toBe(true); - } else { - // IE 8 - expect(request.responseXML instanceof window['ActiveXObject']).toBe(true); - expect(request.response instanceof window['ActiveXObject']).toBe(true); - } - }); - - it('parses an application/xml document into responseXML', function() { - var request = new this.FakeRequest(); - request.open(); - request.send(); - - request.respondWith({ status: 200, contentType: 'application/xml', responseText: '' }); - - if (typeof window['Document'] !== 'undefined') { - expect(request.responseXML instanceof window['Document']).toBe(true); - expect(request.response instanceof window['Document']).toBe(true); - } else { - // IE 8 - expect(request.responseXML instanceof window['ActiveXObject']).toBe(true); - expect(request.response instanceof window['ActiveXObject']).toBe(true); - } - }); - - it('parses a custom blah+xml document into responseXML', function() { - var request = new this.FakeRequest(); - request.open(); - request.send(); - - request.respondWith({ status: 200, contentType: 'application/text+xml', responseText: '' }); - - if (typeof window['Document'] !== 'undefined') { - expect(request.responseXML instanceof window['Document']).toBe(true); - expect(request.response instanceof window['Document']).toBe(true); - } else { - // IE 8 - expect(request.responseXML instanceof window['ActiveXObject']).toBe(true); - expect(request.response instanceof window['ActiveXObject']).toBe(true); - } - }); - - it('defaults the response attribute to the responseText', function() { - var request = new this.FakeRequest(); - request.open(); - request.send(); - - request.respondWith({ status: 200, responseText: 'foo' }); - - expect(request.response).toEqual('foo'); - }); - - it('has a text response when the responseType is blank', function() { - var request = new this.FakeRequest(); - request.open(); - request.send(); - - request.respondWith({ status: 200, responseText: 'foo', responseType: '' }); - - expect(request.response).toEqual('foo'); - }); - - it('has a text response when the responseType is text', function() { - var request = new this.FakeRequest(); - request.open(); - request.send(); - - request.respondWith({ status: 200, responseText: 'foo', responseType: 'text' }); - - expect(request.response).toEqual('foo'); - }); + request.respondWith({ + status: 200, + responseHeaders: { + 'X-Header': 'foo' + } + }); + + expect(request.getResponseHeader('x-header')).toBe('foo'); + }); + + it('retrieves a combined response header', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + request.respondWith({ + status: 200, + responseHeaders: [ + { name: 'X-Header', value: 'foo' }, + { name: 'X-Header', value: 'bar' } + ] + }); + + expect(request.getResponseHeader('x-header')).toBe('foo, bar'); + }); + + it("doesn't pollute the response headers of other XHRs", function() { + var request1 = new this.FakeRequest(); + request1.open(); + request1.send(); + + var request2 = new this.FakeRequest(); + request2.open(); + request2.send(); + + request1.respondWith({ status: 200, responseHeaders: { 'X-Foo': 'bar' } }); + request2.respondWith({ status: 200, responseHeaders: { 'X-Baz': 'quux' } }); + + expect(request1.getAllResponseHeaders()).toBe("X-Foo: bar\r\n"); + expect(request2.getAllResponseHeaders()).toBe("X-Baz: quux\r\n"); + }); + + it('retrieves all response headers', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + request.respondWith({ + status: 200, + responseHeaders: [ + { name: 'X-Header-1', value: 'foo' }, + { name: 'X-Header-2', value: 'bar' }, + { name: 'X-Header-1', value: 'baz' } + ] + }); + + expect(request.getAllResponseHeaders()).toBe("X-Header-1: foo\r\nX-Header-2: bar\r\nX-Header-1: baz\r\n"); + }); + + it('sets the content-type header to the specified contentType when no other headers are supplied', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + request.respondWith({ status: 200, contentType: 'text/plain' }); + + expect(request.getResponseHeader('content-type')).toBe('text/plain'); + expect(request.getAllResponseHeaders()).toBe("Content-Type: text/plain\r\n"); + }); + + it('sets a default content-type header if no contentType and headers are supplied', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + request.respondWith({ status: 200 }); + + expect(request.getResponseHeader('content-type')).toBe('application/json'); + expect(request.getAllResponseHeaders()).toBe("Content-Type: application/json\r\n"); + }); + + it('has no responseXML by default', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + request.respondWith({ status: 200 }); + + expect(request.responseXML).toBeNull(); + }); + + it('parses a text/xml document into responseXML', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + request.respondWith({ status: 200, contentType: 'text/xml', responseText: '' }); + + if (typeof window['Document'] !== 'undefined') { + expect(request.responseXML instanceof window['Document']).toBe(true); + expect(request.response instanceof window['Document']).toBe(true); + } else { + // IE 8 + expect(request.responseXML instanceof window['ActiveXObject']).toBe(true); + expect(request.response instanceof window['ActiveXObject']).toBe(true); + } + }); + + it('parses an application/xml document into responseXML', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + request.respondWith({ status: 200, contentType: 'application/xml', responseText: '' }); + + if (typeof window['Document'] !== 'undefined') { + expect(request.responseXML instanceof window['Document']).toBe(true); + expect(request.response instanceof window['Document']).toBe(true); + } else { + // IE 8 + expect(request.responseXML instanceof window['ActiveXObject']).toBe(true); + expect(request.response instanceof window['ActiveXObject']).toBe(true); + } + }); + + it('parses a custom blah+xml document into responseXML', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + request.respondWith({ status: 200, contentType: 'application/text+xml', responseText: '' }); + + if (typeof window['Document'] !== 'undefined') { + expect(request.responseXML instanceof window['Document']).toBe(true); + expect(request.response instanceof window['Document']).toBe(true); + } else { + // IE 8 + expect(request.responseXML instanceof window['ActiveXObject']).toBe(true); + expect(request.response instanceof window['ActiveXObject']).toBe(true); + } + }); + + it('defaults the response attribute to the responseText', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + request.respondWith({ status: 200, responseText: 'foo' }); + + expect(request.response).toEqual('foo'); + }); + + it('has a text response when the responseType is blank', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + request.respondWith({ status: 200, responseText: 'foo', responseType: '' }); + + expect(request.response).toEqual('foo'); + }); + + it('has a text response when the responseType is text', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + request.respondWith({ status: 200, responseText: 'foo', responseType: 'text' }); + + expect(request.response).toEqual('foo'); + }); }); describe("Jasmine Mock Ajax (for toplevel)", function() { - var request, anotherRequest, response; - var success, error, complete; - var client, onreadystatechange; - var sharedContext: any = {}; - var fakeGlobal, mockAjax; - - beforeEach(function() { - var fakeXMLHttpRequest = jasmine.createSpy('realFakeXMLHttpRequest'); - fakeGlobal = { - XMLHttpRequest: fakeXMLHttpRequest, - DOMParser: window['DOMParser'], - ActiveXObject: window['ActiveXObject'] - }; - mockAjax = new MockAjax(fakeGlobal); - mockAjax.install(); - - success = jasmine.createSpy("onSuccess"); - error = jasmine.createSpy("onFailure"); - complete = jasmine.createSpy("onComplete"); - - onreadystatechange = function() { - if (this.readyState === (this.DONE || 4)) { // IE 8 doesn't support DONE - if (this.status === 200) { - success(this.responseText, this.textStatus, this); - } else { - error(this, this.textStatus, ''); - } - - complete(this, this.textStatus); - } - }; - }); - - describe("when making a request", function () { - beforeEach(function() { - client = new fakeGlobal.XMLHttpRequest(); - client.onreadystatechange = onreadystatechange; - client.open("GET", "example.com/someApi"); - client.send(); - request = mockAjax.requests.mostRecent(); - }); - - it("should store URL and transport", function() { - expect(request.url).toEqual("example.com/someApi"); - }); - - it("should queue the request", function() { - expect(mockAjax.requests.count()).toEqual(1); - }); - - it("should allow access to the queued request", function() { - expect(mockAjax.requests.first()).toEqual(request); - }); - - it("should allow access to the queued request via index", function() { - expect(mockAjax.requests.at(0)).toEqual(request); - }); - - describe("and then another request", function () { - beforeEach(function() { - client = new fakeGlobal.XMLHttpRequest(); - client.onreadystatechange = onreadystatechange; - client.open("GET", "example.com/someApi"); - client.send(); - - anotherRequest = mockAjax.requests.mostRecent(); - }); - - it("should queue the next request", function() { - expect(mockAjax.requests.count()).toEqual(2); - }); - - it("should allow access to the other queued request", function() { - expect(mockAjax.requests.first()).toEqual(request); - expect(mockAjax.requests.mostRecent()).toEqual(anotherRequest); - }); - }); - - describe("mockAjax.requests.mostRecent()", function () { - - describe("when there is one request queued", function () { - it("should return the request", function() { - expect(mockAjax.requests.mostRecent()).toEqual(request); - }); - }); - - describe("when there is more than one request", function () { - beforeEach(function() { - client = new fakeGlobal.XMLHttpRequest(); - client.onreadystatechange = onreadystatechange; - client.open("GET", "example.com/someApi"); - client.send(); - anotherRequest = mockAjax.requests.mostRecent(); - }); - - it("should return the most recent request", function() { - expect(mockAjax.requests.mostRecent()).toEqual(anotherRequest); - }); - }); - - describe("when there are no requests", function () { - beforeEach(function() { - mockAjax.requests.reset(); - }); - - it("should return null", function() { - expect(mockAjax.requests.mostRecent()).toBeUndefined(); - }); - }); - }); - - describe("clearAjaxRequests()", function () { - beforeEach(function() { - mockAjax.requests.reset(); - }); - - it("should remove all requests", function() { - expect(mockAjax.requests.count()).toEqual(0); - expect(mockAjax.requests.mostRecent()).toBeUndefined(); - }); - }); - }); - - describe("when simulating a response with request.response", function () { - describe("and the response is Success", function () { - beforeEach(function() { - client = new fakeGlobal.XMLHttpRequest(); - client.onreadystatechange = onreadystatechange; - client.open("GET", "example.com/someApi"); - client.setRequestHeader("Content-Type", "text/plain"); - client.send(); - - request = mockAjax.requests.mostRecent(); - response = {status: 200, statusText: "OK", contentType: "text/html", responseText: "OK!"}; - request.respondWith(response); - - sharedContext.responseCallback = success; - sharedContext.status = response.status; - sharedContext.statusText = response.statusText; - sharedContext.contentType = response.contentType; - sharedContext.responseText = response.responseText; - sharedContext.responseType = response.responseType; - }); - - it("should call the success handler", function() { - expect(success).toHaveBeenCalled(); - }); - - it("should not call the failure handler", function() { - expect(error).not.toHaveBeenCalled(); - }); - - it("should call the complete handler", function() { - expect(complete).toHaveBeenCalled(); - }); - - sharedAjaxResponseBehaviorForZepto_Success(sharedContext); - }); - - describe("and the response is Success, but with JSON", function () { - beforeEach(function() { - client = new fakeGlobal.XMLHttpRequest(); - client.onreadystatechange = onreadystatechange; - client.open("GET", "example.com/someApi"); - client.setRequestHeader("Content-Type", "application/json"); - client.send(); - - request = mockAjax.requests.mostRecent(); - var responseObject = {status: 200, statusText: "OK", contentType: "application/json", responseText: '{"foo":"bar"}', responseType: "json"}; - - request.respondWith(responseObject); - - sharedContext.responseCallback = success; - sharedContext.status = responseObject.status; - sharedContext.statusText = responseObject.statusText; - sharedContext.contentType = responseObject.contentType; - sharedContext.responseText = responseObject.responseText; - sharedContext.responseType = responseObject.responseType; - - response = success.calls.mostRecent().args[2]; - }); - - it("should call the success handler", function() { - expect(success).toHaveBeenCalled(); - }); - - it("should not call the failure handler", function() { - expect(error).not.toHaveBeenCalled(); - }); - - it("should call the complete handler", function() { - expect(complete).toHaveBeenCalled(); - }); - - it("should return a JavaScript object for XHR2 response", function() { - var responseText = sharedContext.responseText; - expect(success.calls.mostRecent().args[0]).toEqual(responseText); - - expect(response.responseText).toEqual(responseText); - expect(response.response).toEqual({foo: "bar"}); - }); - - sharedAjaxResponseBehaviorForZepto_Success(sharedContext); - }); - - describe("and the response is Success, and response is overriden", function () { - beforeEach(function() { - client = new fakeGlobal.XMLHttpRequest(); - client.onreadystatechange = onreadystatechange; - client.open("GET", "example.com/someApi"); - client.setRequestHeader("Content-Type", "application/json"); - client.send(); - - request = mockAjax.requests.mostRecent(); - var responseObject = {status: 200, statusText: "OK", contentType: "application/json", responseText: '{"foo":"bar"}', responseType: 'json'}; - - request.respondWith(responseObject); - - sharedContext.responseCallback = success; - sharedContext.status = responseObject.status; - sharedContext.statusText = responseObject.statusText; - sharedContext.contentType = responseObject.contentType; - sharedContext.responseText = responseObject.responseText; - sharedContext.responseType = responseObject.responseType; - - response = success.calls.mostRecent().args[2]; - }); - - it("should return the provided override for the XHR2 response", function() { - var responseText = sharedContext.responseText; - - expect(response.responseText).toEqual(responseText); - expect(response.response).toEqual({foo: "bar"}); - }); - - sharedAjaxResponseBehaviorForZepto_Success(sharedContext); - }); - - describe("response with unique header names using an object", function () { - beforeEach(function () { - client = new fakeGlobal.XMLHttpRequest(); - client.onreadystatechange = onreadystatechange; - client.open("GET", "example.com"); - client.send(); - - request = mockAjax.requests.mostRecent(); - var responseObject = {status: 200, statusText: "OK", responseText: '["foo"]', responseHeaders: { - 'X-Header1': 'header 1 value', - 'X-Header2': 'header 2 value', - 'X-Header3': 'header 3 value' - }}; - request.respondWith(responseObject); - response = success.calls.mostRecent().args[2]; - }); - - it("getResponseHeader should return the each value", function () { - expect(response.getResponseHeader('X-Header1')).toBe('header 1 value'); - expect(response.getResponseHeader('X-Header2')).toBe('header 2 value'); - expect(response.getResponseHeader('X-Header3')).toBe('header 3 value'); - }); - - it("getAllResponseHeaders should return all values", function () { - expect(response.getAllResponseHeaders()).toBe([ - "X-Header1: header 1 value", - "X-Header2: header 2 value", - "X-Header3: header 3 value" - ].join("\r\n") + "\r\n"); - }); - }); - - describe("response with multiple headers of the same name using an array of objects", function () { - beforeEach(function () { - client = new fakeGlobal.XMLHttpRequest(); - client.onreadystatechange = onreadystatechange; - client.open("GET", "example.com"); - client.send(); - - request = mockAjax.requests.mostRecent(); - var responseObject = {status: 200, statusText: "OK", responseText: '["foo"]', responseHeaders: [ - { name: 'X-Header', value: 'header value 1' }, - { name: 'X-Header', value: 'header value 2' } - ]}; - request.respondWith(responseObject); - response = success.calls.mostRecent().args[2]; - }); - - it("getResponseHeader should return all values comma separated", function () { - expect(response.getResponseHeader('X-Header')).toBe('header value 1, header value 2'); - }); - - it("getAllResponseHeaders should return all values", function () { - expect(response.getAllResponseHeaders()).toBe([ - "X-Header: header value 1", - "X-Header: header value 2" - ].join("\r\n") + "\r\n"); - }); - }); - - describe("the content type defaults to application/json", function () { - beforeEach(function() { - client = new fakeGlobal.XMLHttpRequest(); - client.onreadystatechange = onreadystatechange; - client.open("GET", "example.com/someApi"); - client.setRequestHeader("Content-Type", "application/json"); - client.send(); - - request = mockAjax.requests.mostRecent(); - response = {status: 200, statusText: "OK", responseText: '{"foo": "valid JSON, dammit."}', responseType: 'json'}; - request.respondWith(response); - - sharedContext.responseCallback = success; - sharedContext.status = response.status; - sharedContext.statusText = response.statusText; - sharedContext.contentType = "application/json"; - sharedContext.responseType = response.responseType; - sharedContext.responseText = response.responseText; - }); - - it("should call the success handler", function() { - expect(success).toHaveBeenCalled(); - }); - - it("should not call the failure handler", function() { - expect(error).not.toHaveBeenCalled(); - }); - - it("should call the complete handler", function() { - expect(complete).toHaveBeenCalled(); - }); - - sharedAjaxResponseBehaviorForZepto_Success(sharedContext); - }); - - describe("and the status/response code is 0", function () { - beforeEach(function() { - client = new fakeGlobal.XMLHttpRequest(); - client.onreadystatechange = onreadystatechange; - client.open("GET", "example.com/someApi"); - client.setRequestHeader("Content-Type", "text/plain"); - client.send(); - - request = mockAjax.requests.mostRecent(); - response = {status: 0, statusText: "ABORT", responseText: '{"foo": "whoops!"}'}; - request.respondWith(response); - - sharedContext.responseCallback = error; - sharedContext.status = 0; - sharedContext.statusText = response.statusText; - sharedContext.contentType = 'application/json'; - sharedContext.responseText = response.responseText; - sharedContext.responseType = response.responseType; - }); - - it("should call the success handler", function() { - expect(success).not.toHaveBeenCalled(); - }); - - it("should not call the failure handler", function() { - expect(error).toHaveBeenCalled(); - }); - - it("should call the complete handler", function() { - expect(complete).toHaveBeenCalled(); - }); - - sharedAjaxResponseBehaviorForZepto_Failure(sharedContext); - }); - }); - - describe("and the response is error", function () { - beforeEach(function() { - client = new fakeGlobal.XMLHttpRequest(); - client.onreadystatechange = onreadystatechange; - client.open("GET", "example.com/someApi"); - client.setRequestHeader("Content-Type", "text/plain"); - client.send(); - - request = mockAjax.requests.mostRecent(); - response = {status: 500, statusText: "SERVER ERROR", contentType: "text/html", responseText: "(._){"}; - request.respondWith(response); - - sharedContext.responseCallback = error; - sharedContext.status = response.status; - sharedContext.statusText = response.statusText; - sharedContext.contentType = response.contentType; - sharedContext.responseText = response.responseText; - sharedContext.responseType = response.responseType; - }); - - it("should not call the success handler", function() { - expect(success).not.toHaveBeenCalled(); - }); - - it("should call the failure handler", function() { - expect(error).toHaveBeenCalled(); - }); - - it("should call the complete handler", function() { - expect(complete).toHaveBeenCalled(); - }); - - sharedAjaxResponseBehaviorForZepto_Failure(sharedContext); - }); - - describe('when simulating a response with request.responseTimeout', function() { - beforeEach(function() { - jasmine.clock().install(); - - client = new fakeGlobal.XMLHttpRequest(); - client.onreadystatechange = onreadystatechange; - client.open("GET", "example.com/someApi"); - client.setRequestHeader("Content-Type", "text/plain"); - client.send(); - - request = mockAjax.requests.mostRecent(); - response = {contentType: "text/html", response: "(._){response", responseText: "(._){", responseType: "text"}; - request.responseTimeout(response); - - sharedContext.responseCallback = error; - sharedContext.status = response.status; - sharedContext.statusText = response.statusText; - sharedContext.contentType = response.contentType; - sharedContext.responseText = response.responseText; - sharedContext.responseType = response.responseType; - }); - - afterEach(function() { - jasmine.clock().uninstall(); - }); - - it("should not call the success handler", function() { - expect(success).not.toHaveBeenCalled(); - }); - - it("should call the failure handler", function() { - expect(error).toHaveBeenCalled(); - }); - - it("should call the complete handler", function() { - expect(complete).toHaveBeenCalled(); - }); - }); + var request, anotherRequest, response; + var success, error, complete; + var client, onreadystatechange; + var sharedContext: any = {}; + var fakeGlobal, mockAjax; + + beforeEach(function() { + var fakeXMLHttpRequest = jasmine.createSpy('realFakeXMLHttpRequest'); + fakeGlobal = { + XMLHttpRequest: fakeXMLHttpRequest, + DOMParser: window['DOMParser'], + ActiveXObject: window['ActiveXObject'] + }; + mockAjax = new MockAjax(fakeGlobal); + mockAjax.install(); + + success = jasmine.createSpy("onSuccess"); + error = jasmine.createSpy("onFailure"); + complete = jasmine.createSpy("onComplete"); + + onreadystatechange = function() { + if (this.readyState === (this.DONE || 4)) { // IE 8 doesn't support DONE + if (this.status === 200) { + success(this.responseText, this.textStatus, this); + } else { + error(this, this.textStatus, ''); + } + + complete(this, this.textStatus); + } + }; + }); + + describe("when making a request", function() { + beforeEach(function() { + client = new fakeGlobal.XMLHttpRequest(); + client.onreadystatechange = onreadystatechange; + client.open("GET", "example.com/someApi"); + client.send(); + request = mockAjax.requests.mostRecent(); + }); + + it("should store URL and transport", function() { + expect(request.url).toEqual("example.com/someApi"); + }); + + it("should queue the request", function() { + expect(mockAjax.requests.count()).toEqual(1); + }); + + it("should allow access to the queued request", function() { + expect(mockAjax.requests.first()).toEqual(request); + }); + + it("should allow access to the queued request via index", function() { + expect(mockAjax.requests.at(0)).toEqual(request); + }); + + describe("and then another request", function() { + beforeEach(function() { + client = new fakeGlobal.XMLHttpRequest(); + client.onreadystatechange = onreadystatechange; + client.open("GET", "example.com/someApi"); + client.send(); + + anotherRequest = mockAjax.requests.mostRecent(); + }); + + it("should queue the next request", function() { + expect(mockAjax.requests.count()).toEqual(2); + }); + + it("should allow access to the other queued request", function() { + expect(mockAjax.requests.first()).toEqual(request); + expect(mockAjax.requests.mostRecent()).toEqual(anotherRequest); + }); + }); + + describe("mockAjax.requests.mostRecent()", function() { + + describe("when there is one request queued", function() { + it("should return the request", function() { + expect(mockAjax.requests.mostRecent()).toEqual(request); + }); + }); + + describe("when there is more than one request", function() { + beforeEach(function() { + client = new fakeGlobal.XMLHttpRequest(); + client.onreadystatechange = onreadystatechange; + client.open("GET", "example.com/someApi"); + client.send(); + anotherRequest = mockAjax.requests.mostRecent(); + }); + + it("should return the most recent request", function() { + expect(mockAjax.requests.mostRecent()).toEqual(anotherRequest); + }); + }); + + describe("when there are no requests", function() { + beforeEach(function() { + mockAjax.requests.reset(); + }); + + it("should return null", function() { + expect(mockAjax.requests.mostRecent()).toBeUndefined(); + }); + }); + }); + + describe("clearAjaxRequests()", function() { + beforeEach(function() { + mockAjax.requests.reset(); + }); + + it("should remove all requests", function() { + expect(mockAjax.requests.count()).toEqual(0); + expect(mockAjax.requests.mostRecent()).toBeUndefined(); + }); + }); + }); + + describe("when simulating a response with request.response", function() { + describe("and the response is Success", function() { + beforeEach(function() { + client = new fakeGlobal.XMLHttpRequest(); + client.onreadystatechange = onreadystatechange; + client.open("GET", "example.com/someApi"); + client.setRequestHeader("Content-Type", "text/plain"); + client.send(); + + request = mockAjax.requests.mostRecent(); + response = { status: 200, statusText: "OK", contentType: "text/html", responseText: "OK!" }; + request.respondWith(response); + + sharedContext.responseCallback = success; + sharedContext.status = response.status; + sharedContext.statusText = response.statusText; + sharedContext.contentType = response.contentType; + sharedContext.responseText = response.responseText; + sharedContext.responseType = response.responseType; + }); + + it("should call the success handler", function() { + expect(success).toHaveBeenCalled(); + }); + + it("should not call the failure handler", function() { + expect(error).not.toHaveBeenCalled(); + }); + + it("should call the complete handler", function() { + expect(complete).toHaveBeenCalled(); + }); + + sharedAjaxResponseBehaviorForZepto_Success(sharedContext); + }); + + describe("and the response is Success, but with JSON", function() { + beforeEach(function() { + client = new fakeGlobal.XMLHttpRequest(); + client.onreadystatechange = onreadystatechange; + client.open("GET", "example.com/someApi"); + client.setRequestHeader("Content-Type", "application/json"); + client.send(); + + request = mockAjax.requests.mostRecent(); + var responseObject = { status: 200, statusText: "OK", contentType: "application/json", responseText: '{"foo":"bar"}', responseType: "json" }; + + request.respondWith(responseObject); + + sharedContext.responseCallback = success; + sharedContext.status = responseObject.status; + sharedContext.statusText = responseObject.statusText; + sharedContext.contentType = responseObject.contentType; + sharedContext.responseText = responseObject.responseText; + sharedContext.responseType = responseObject.responseType; + + response = success.calls.mostRecent().args[2]; + }); + + it("should call the success handler", function() { + expect(success).toHaveBeenCalled(); + }); + + it("should not call the failure handler", function() { + expect(error).not.toHaveBeenCalled(); + }); + + it("should call the complete handler", function() { + expect(complete).toHaveBeenCalled(); + }); + + it("should return a JavaScript object for XHR2 response", function() { + var responseText = sharedContext.responseText; + expect(success.calls.mostRecent().args[0]).toEqual(responseText); + + expect(response.responseText).toEqual(responseText); + expect(response.response).toEqual({ foo: "bar" }); + }); + + sharedAjaxResponseBehaviorForZepto_Success(sharedContext); + }); + + describe("and the response is Success, and response is overriden", function() { + beforeEach(function() { + client = new fakeGlobal.XMLHttpRequest(); + client.onreadystatechange = onreadystatechange; + client.open("GET", "example.com/someApi"); + client.setRequestHeader("Content-Type", "application/json"); + client.send(); + + request = mockAjax.requests.mostRecent(); + var responseObject = { status: 200, statusText: "OK", contentType: "application/json", responseText: '{"foo":"bar"}', responseType: 'json' }; + + request.respondWith(responseObject); + + sharedContext.responseCallback = success; + sharedContext.status = responseObject.status; + sharedContext.statusText = responseObject.statusText; + sharedContext.contentType = responseObject.contentType; + sharedContext.responseText = responseObject.responseText; + sharedContext.responseType = responseObject.responseType; + + response = success.calls.mostRecent().args[2]; + }); + + it("should return the provided override for the XHR2 response", function() { + var responseText = sharedContext.responseText; + + expect(response.responseText).toEqual(responseText); + expect(response.response).toEqual({ foo: "bar" }); + }); + + sharedAjaxResponseBehaviorForZepto_Success(sharedContext); + }); + + describe("response with unique header names using an object", function() { + beforeEach(function() { + client = new fakeGlobal.XMLHttpRequest(); + client.onreadystatechange = onreadystatechange; + client.open("GET", "example.com"); + client.send(); + + request = mockAjax.requests.mostRecent(); + var responseObject = { + status: 200, statusText: "OK", responseText: '["foo"]', responseHeaders: { + 'X-Header1': 'header 1 value', + 'X-Header2': 'header 2 value', + 'X-Header3': 'header 3 value' + } + }; + request.respondWith(responseObject); + response = success.calls.mostRecent().args[2]; + }); + + it("getResponseHeader should return the each value", function() { + expect(response.getResponseHeader('X-Header1')).toBe('header 1 value'); + expect(response.getResponseHeader('X-Header2')).toBe('header 2 value'); + expect(response.getResponseHeader('X-Header3')).toBe('header 3 value'); + }); + + it("getAllResponseHeaders should return all values", function() { + expect(response.getAllResponseHeaders()).toBe([ + "X-Header1: header 1 value", + "X-Header2: header 2 value", + "X-Header3: header 3 value" + ].join("\r\n") + "\r\n"); + }); + }); + + describe("response with multiple headers of the same name using an array of objects", function() { + beforeEach(function() { + client = new fakeGlobal.XMLHttpRequest(); + client.onreadystatechange = onreadystatechange; + client.open("GET", "example.com"); + client.send(); + + request = mockAjax.requests.mostRecent(); + var responseObject = { + status: 200, statusText: "OK", responseText: '["foo"]', responseHeaders: [ + { name: 'X-Header', value: 'header value 1' }, + { name: 'X-Header', value: 'header value 2' } + ] + }; + request.respondWith(responseObject); + response = success.calls.mostRecent().args[2]; + }); + + it("getResponseHeader should return all values comma separated", function() { + expect(response.getResponseHeader('X-Header')).toBe('header value 1, header value 2'); + }); + + it("getAllResponseHeaders should return all values", function() { + expect(response.getAllResponseHeaders()).toBe([ + "X-Header: header value 1", + "X-Header: header value 2" + ].join("\r\n") + "\r\n"); + }); + }); + + describe("the content type defaults to application/json", function() { + beforeEach(function() { + client = new fakeGlobal.XMLHttpRequest(); + client.onreadystatechange = onreadystatechange; + client.open("GET", "example.com/someApi"); + client.setRequestHeader("Content-Type", "application/json"); + client.send(); + + request = mockAjax.requests.mostRecent(); + response = { status: 200, statusText: "OK", responseText: '{"foo": "valid JSON, dammit."}', responseType: 'json' }; + request.respondWith(response); + + sharedContext.responseCallback = success; + sharedContext.status = response.status; + sharedContext.statusText = response.statusText; + sharedContext.contentType = "application/json"; + sharedContext.responseType = response.responseType; + sharedContext.responseText = response.responseText; + }); + + it("should call the success handler", function() { + expect(success).toHaveBeenCalled(); + }); + + it("should not call the failure handler", function() { + expect(error).not.toHaveBeenCalled(); + }); + + it("should call the complete handler", function() { + expect(complete).toHaveBeenCalled(); + }); + + sharedAjaxResponseBehaviorForZepto_Success(sharedContext); + }); + + describe("and the status/response code is 0", function() { + beforeEach(function() { + client = new fakeGlobal.XMLHttpRequest(); + client.onreadystatechange = onreadystatechange; + client.open("GET", "example.com/someApi"); + client.setRequestHeader("Content-Type", "text/plain"); + client.send(); + + request = mockAjax.requests.mostRecent(); + response = { status: 0, statusText: "ABORT", responseText: '{"foo": "whoops!"}' }; + request.respondWith(response); + + sharedContext.responseCallback = error; + sharedContext.status = 0; + sharedContext.statusText = response.statusText; + sharedContext.contentType = 'application/json'; + sharedContext.responseText = response.responseText; + sharedContext.responseType = response.responseType; + }); + + it("should call the success handler", function() { + expect(success).not.toHaveBeenCalled(); + }); + + it("should not call the failure handler", function() { + expect(error).toHaveBeenCalled(); + }); + + it("should call the complete handler", function() { + expect(complete).toHaveBeenCalled(); + }); + + sharedAjaxResponseBehaviorForZepto_Failure(sharedContext); + }); + }); + + describe("and the response is error", function() { + beforeEach(function() { + client = new fakeGlobal.XMLHttpRequest(); + client.onreadystatechange = onreadystatechange; + client.open("GET", "example.com/someApi"); + client.setRequestHeader("Content-Type", "text/plain"); + client.send(); + + request = mockAjax.requests.mostRecent(); + response = { status: 500, statusText: "SERVER ERROR", contentType: "text/html", responseText: "(._){" }; + request.respondWith(response); + + sharedContext.responseCallback = error; + sharedContext.status = response.status; + sharedContext.statusText = response.statusText; + sharedContext.contentType = response.contentType; + sharedContext.responseText = response.responseText; + sharedContext.responseType = response.responseType; + }); + + it("should not call the success handler", function() { + expect(success).not.toHaveBeenCalled(); + }); + + it("should call the failure handler", function() { + expect(error).toHaveBeenCalled(); + }); + + it("should call the complete handler", function() { + expect(complete).toHaveBeenCalled(); + }); + + sharedAjaxResponseBehaviorForZepto_Failure(sharedContext); + }); + + describe('when simulating a response with request.responseTimeout', function() { + beforeEach(function() { + jasmine.clock().install(); + + client = new fakeGlobal.XMLHttpRequest(); + client.onreadystatechange = onreadystatechange; + client.open("GET", "example.com/someApi"); + client.setRequestHeader("Content-Type", "text/plain"); + client.send(); + + request = mockAjax.requests.mostRecent(); + response = { contentType: "text/html", response: "(._){response", responseText: "(._){", responseType: "text" }; + request.responseTimeout(response); + + sharedContext.responseCallback = error; + sharedContext.status = response.status; + sharedContext.statusText = response.statusText; + sharedContext.contentType = response.contentType; + sharedContext.responseText = response.responseText; + sharedContext.responseType = response.responseType; + }); + + afterEach(function() { + jasmine.clock().uninstall(); + }); + + it("should not call the success handler", function() { + expect(success).not.toHaveBeenCalled(); + }); + + it("should call the failure handler", function() { + expect(error).toHaveBeenCalled(); + }); + + it("should call the complete handler", function() { + expect(complete).toHaveBeenCalled(); + }); + }); }); function sharedAjaxResponseBehaviorForZepto_Success(context) { - describe("the success response", function () { - var xhr; - beforeEach(function() { - xhr = context.responseCallback.calls.mostRecent().args[2]; - }); + describe("the success response", function() { + var xhr; + beforeEach(function() { + xhr = context.responseCallback.calls.mostRecent().args[2]; + }); - it("should have the expected status code", function() { - expect(xhr.status).toEqual(context.status); - }); + it("should have the expected status code", function() { + expect(xhr.status).toEqual(context.status); + }); - it("should have the expected content type", function() { - expect(xhr.getResponseHeader('Content-Type')).toEqual(context.contentType); - }); + it("should have the expected content type", function() { + expect(xhr.getResponseHeader('Content-Type')).toEqual(context.contentType); + }); - it("should have the expected xhr2 response", function() { - var expected = context.response || context.responseType === 'json' ? JSON.parse(context.responseText) : context.responseText; - expect(xhr.response).toEqual(expected); - }); + it("should have the expected xhr2 response", function() { + var expected = context.response || context.responseType === 'json' ? JSON.parse(context.responseText) : context.responseText; + expect(xhr.response).toEqual(expected); + }); - it("should have the expected response text", function() { - expect(xhr.responseText).toEqual(context.responseText); - }); + it("should have the expected response text", function() { + expect(xhr.responseText).toEqual(context.responseText); + }); - it("should have the expected status text", function() { - expect(xhr.statusText).toEqual(context.statusText); - }); - }); + it("should have the expected status text", function() { + expect(xhr.statusText).toEqual(context.statusText); + }); + }); } function sharedAjaxResponseBehaviorForZepto_Failure(context) { - describe("the failure response", function () { - var xhr; - beforeEach(function() { - xhr = context.responseCallback.calls.mostRecent().args[0]; - }); + describe("the failure response", function() { + var xhr; + beforeEach(function() { + xhr = context.responseCallback.calls.mostRecent().args[0]; + }); - it("should have the expected status code", function() { - expect(xhr.status).toEqual(context.status); - }); + it("should have the expected status code", function() { + expect(xhr.status).toEqual(context.status); + }); - it("should have the expected content type", function() { - expect(xhr.getResponseHeader('Content-Type')).toEqual(context.contentType); - }); + it("should have the expected content type", function() { + expect(xhr.getResponseHeader('Content-Type')).toEqual(context.contentType); + }); - it("should have the expected xhr2 response", function() { - var expected = context.response || xhr.responseType === 'json' ? JSON.parse(xhr.responseText) : xhr.responseText; - expect(xhr.response).toEqual(expected); - }); + it("should have the expected xhr2 response", function() { + var expected = context.response || xhr.responseType === 'json' ? JSON.parse(xhr.responseText) : xhr.responseText; + expect(xhr.response).toEqual(expected); + }); - it("should have the expected response text", function() { - expect(xhr.responseText).toEqual(context.responseText); - }); + it("should have the expected response text", function() { + expect(xhr.responseText).toEqual(context.responseText); + }); - it("should have the expected status text", function() { - expect(xhr.statusText).toEqual(context.statusText); - }); - }); + it("should have the expected status text", function() { + expect(xhr.statusText).toEqual(context.statusText); + }); + }); } describe('ParamParser', function() { - beforeEach(function() { - var Constructor = getJasmineRequireObj().AjaxParamParser(); - expect(Constructor).toEqual(jasmine.any(Function)); - this.parser = new Constructor(); - }); + beforeEach(function() { + var Constructor = getJasmineRequireObj().AjaxParamParser(); + expect(Constructor).toEqual(jasmine.any(Function)); + this.parser = new Constructor(); + }); - it('has a default parser', function() { - var parser = this.parser.findParser({ contentType: function() {} }), - parsed = parser.parse('3+stooges=shemp&3+stooges=larry%20%26%20moe%20%26%20curly&some%3Dthing=else+entirely'); + it('has a default parser', function() { + var parser = this.parser.findParser({ contentType: function() { } }), + parsed = parser.parse('3+stooges=shemp&3+stooges=larry%20%26%20moe%20%26%20curly&some%3Dthing=else+entirely'); - expect(parsed).toEqual({ - '3 stooges': ['shemp', 'larry & moe & curly'], - 'some=thing': ['else entirely'] - }); - }); + expect(parsed).toEqual({ + '3 stooges': ['shemp', 'larry & moe & curly'], + 'some=thing': ['else entirely'] + }); + }); - it('should detect and parse json', function() { - var data = { - foo: 'bar', - baz: ['q', 'u', 'u', 'x'], - nested: { - object: { - containing: 'stuff' - } - } + it('should detect and parse json', function() { + var data = { + foo: 'bar', + baz: ['q', 'u', 'u', 'x'], + nested: { + object: { + containing: 'stuff' + } + } }, - parser = this.parser.findParser({ contentType: function() { return 'application/json'; } }), - parsed = parser.parse(JSON.stringify(data)); + parser = this.parser.findParser({ contentType: function() { return 'application/json'; } }), + parsed = parser.parse(JSON.stringify(data)); - expect(parsed).toEqual(data); - }); + expect(parsed).toEqual(data); + }); - it('should parse json with further qualifiers on content-type', function() { - var data = { - foo: 'bar', - baz: ['q', 'u', 'u', 'x'], - nested: { - object: { - containing: 'stuff' - } - } + it('should parse json with further qualifiers on content-type', function() { + var data = { + foo: 'bar', + baz: ['q', 'u', 'u', 'x'], + nested: { + object: { + containing: 'stuff' + } + } }, - parser = this.parser.findParser({ contentType: function() { return 'application/json; charset=utf-8'; } }), - parsed = parser.parse(JSON.stringify(data)); + parser = this.parser.findParser({ contentType: function() { return 'application/json; charset=utf-8'; } }), + parsed = parser.parse(JSON.stringify(data)); - expect(parsed).toEqual(data); - }); + expect(parsed).toEqual(data); + }); - it('should have custom parsers take precedence', function() { - var custom = { - test: jasmine.createSpy('test').and.returnValue(true), - parse: jasmine.createSpy('parse').and.returnValue('parsedFormat') - }; + it('should have custom parsers take precedence', function() { + var custom = { + test: jasmine.createSpy('test').and.returnValue(true), + parse: jasmine.createSpy('parse').and.returnValue('parsedFormat') + }; - this.parser.add(custom); + this.parser.add(custom); - var parser = this.parser.findParser({ contentType: function() {} }), - parsed = parser.parse('custom_format'); + var parser = this.parser.findParser({ contentType: function() { } }), + parsed = parser.parse('custom_format'); - expect(parsed).toEqual('parsedFormat'); - expect(custom.test).toHaveBeenCalled(); - expect(custom.parse).toHaveBeenCalledWith('custom_format'); - }); + expect(parsed).toEqual('parsedFormat'); + expect(custom.test).toHaveBeenCalled(); + expect(custom.parse).toHaveBeenCalledWith('custom_format'); + }); - it('should skip custom parsers that do not match', function() { - var custom = { - test: jasmine.createSpy('test').and.returnValue(false), - parse: jasmine.createSpy('parse').and.returnValue('parsedFormat') - }; + it('should skip custom parsers that do not match', function() { + var custom = { + test: jasmine.createSpy('test').and.returnValue(false), + parse: jasmine.createSpy('parse').and.returnValue('parsedFormat') + }; - this.parser.add(custom); + this.parser.add(custom); - var parser = this.parser.findParser({ contentType: function() {} }), - parsed = parser.parse('custom_format'); + var parser = this.parser.findParser({ contentType: function() { } }), + parsed = parser.parse('custom_format'); - expect(parsed).toEqual({ custom_format: [ 'undefined' ] }); - expect(custom.test).toHaveBeenCalled(); - expect(custom.parse).not.toHaveBeenCalled(); - }); + expect(parsed).toEqual({ custom_format: ['undefined'] }); + expect(custom.test).toHaveBeenCalled(); + expect(custom.parse).not.toHaveBeenCalled(); + }); - it('removes custom parsers when reset', function() { - var custom = { - test: jasmine.createSpy('test').and.returnValue(true), - parse: jasmine.createSpy('parse').and.returnValue('parsedFormat') - }; + it('removes custom parsers when reset', function() { + var custom = { + test: jasmine.createSpy('test').and.returnValue(true), + parse: jasmine.createSpy('parse').and.returnValue('parsedFormat') + }; - this.parser.add(custom); + this.parser.add(custom); - var parser = this.parser.findParser({ contentType: function() {} }), - parsed = parser.parse('custom_format'); + var parser = this.parser.findParser({ contentType: function() { } }), + parsed = parser.parse('custom_format'); - expect(parsed).toEqual('parsedFormat'); + expect(parsed).toEqual('parsedFormat'); - custom.test['calls'].reset(); - custom.parse['calls'].reset(); + custom.test['calls'].reset(); + custom.parse['calls'].reset(); - this.parser.reset(); + this.parser.reset(); - parser = this.parser.findParser({ contentType: function() {} }); - parsed = parser.parse('custom_format'); + parser = this.parser.findParser({ contentType: function() { } }); + parsed = parser.parse('custom_format'); - expect(parsed).toEqual({ custom_format: [ 'undefined' ] }); - expect(custom.test).not.toHaveBeenCalled(); - expect(custom.parse).not.toHaveBeenCalled(); - }); + expect(parsed).toEqual({ custom_format: ['undefined'] }); + expect(custom.test).not.toHaveBeenCalled(); + expect(custom.parse).not.toHaveBeenCalled(); + }); }); describe('RequestStub', function() { - beforeEach(function() { - this.RequestStub = getJasmineRequireObj().AjaxRequestStub(); + beforeEach(function() { + this.RequestStub = getJasmineRequireObj().AjaxRequestStub(); - jasmine.addMatchers({ - toMatchRequest: function() { - return { - compare: function(actual) { - return { - pass: actual.matches.apply(actual, Array.prototype.slice.call(arguments, 1)) - }; - } - }; - } - }); - }); + jasmine.addMatchers({ + toMatchRequest: function(a, b) { + return { + compare: function(actual): jasmine.CustomMatcherResult { + return { + message: '', + pass: actual.matches.apply(actual, Array.prototype.slice.call(arguments, 1)) + }; + } + }; + } + }); + }); - it('matches just by exact url', function() { - var stub = new this.RequestStub('www.example.com/foo'); + it('matches just by exact url', function() { + var stub = new this.RequestStub('www.example.com/foo'); - expect(stub)['toMatchRequest']('www.example.com/foo'); - }); + expect(stub)['toMatchRequest']('www.example.com/foo'); + }); - it('does not match if the url differs', function() { - var stub = new this.RequestStub('www.example.com/foo'); + it('does not match if the url differs', function() { + var stub = new this.RequestStub('www.example.com/foo'); - expect(stub).not['toMatchRequest']('www.example.com/bar'); - }); + expect(stub).not['toMatchRequest']('www.example.com/bar'); + }); - it('matches unordered query params', function() { - var stub = new this.RequestStub('www.example.com?foo=bar&baz=quux'); + it('matches unordered query params', function() { + var stub = new this.RequestStub('www.example.com?foo=bar&baz=quux'); - expect(stub)['toMatchRequest']('www.example.com?baz=quux&foo=bar'); - }); + expect(stub)['toMatchRequest']('www.example.com?baz=quux&foo=bar'); + }); - it('requires all specified query params to be there', function() { - var stub = new this.RequestStub('www.example.com?foo=bar&baz=quux'); + it('requires all specified query params to be there', function() { + var stub = new this.RequestStub('www.example.com?foo=bar&baz=quux'); - expect(stub).not['toMatchRequest']('www.example.com?foo=bar'); - }); + expect(stub).not['toMatchRequest']('www.example.com?foo=bar'); + }); - it('can match the url with a RegExp', function() { - var stub = new this.RequestStub(/ba[rz]/); + it('can match the url with a RegExp', function() { + var stub = new this.RequestStub(/ba[rz]/); - expect(stub)['toMatchRequest']('bar'); - expect(stub)['toMatchRequest']('baz'); - expect(stub).not['toMatchRequest']('foo'); - }); + expect(stub)['toMatchRequest']('bar'); + expect(stub)['toMatchRequest']('baz'); + expect(stub).not['toMatchRequest']('foo'); + }); - it('requires the method to match if supplied', function() { - var stub = new this.RequestStub('www.example.com/foo', null, 'POST'); + it('requires the method to match if supplied', function() { + var stub = new this.RequestStub('www.example.com/foo', null, 'POST'); - expect(stub).not['toMatchRequest']('www.example.com/foo'); - expect(stub).not['toMatchRequest']('www.example.com/foo', null, 'GET'); - expect(stub)['toMatchRequest']('www.example.com/foo', null, 'POST'); - }); + expect(stub).not['toMatchRequest']('www.example.com/foo'); + expect(stub).not['toMatchRequest']('www.example.com/foo', null, 'GET'); + expect(stub)['toMatchRequest']('www.example.com/foo', null, 'POST'); + }); - it('requires the data submitted to match if supplied', function() { - var stub = new this.RequestStub('/foo', 'foo=bar&baz=quux'); + it('requires the data submitted to match if supplied', function() { + var stub = new this.RequestStub('/foo', 'foo=bar&baz=quux'); - expect(stub)['toMatchRequest']('/foo', 'baz=quux&foo=bar'); - expect(stub).not['toMatchRequest']('/foo', 'foo=bar'); - }); + expect(stub)['toMatchRequest']('/foo', 'baz=quux&foo=bar'); + expect(stub).not['toMatchRequest']('/foo', 'foo=bar'); + }); }); describe('RequestTracker', function() { - beforeEach(function() { - var Constructor = getJasmineRequireObj().AjaxRequestTracker(); - this.tracker = new Constructor(); - }); + beforeEach(function() { + var Constructor = getJasmineRequireObj().AjaxRequestTracker(); + this.tracker = new Constructor(); + }); - it('tracks the number of times ajax requests are made', function() { - expect(this.tracker.count()).toBe(0); + it('tracks the number of times ajax requests are made', function() { + expect(this.tracker.count()).toBe(0); - this.tracker.track(); + this.tracker.track(); - expect(this.tracker.count()).toBe(1); - }); + expect(this.tracker.count()).toBe(1); + }); - it('simplifies access to the last (most recent) request', function() { - this.tracker.track(); - this.tracker.track('request'); + it('simplifies access to the last (most recent) request', function() { + this.tracker.track(); + this.tracker.track('request'); - expect(this.tracker.mostRecent()).toEqual('request'); - }); + expect(this.tracker.mostRecent()).toEqual('request'); + }); - it('returns a useful falsy value when there is no last (most recent) request', function() { - expect(this.tracker.mostRecent()).toBeFalsy(); - }); + it('returns a useful falsy value when there is no last (most recent) request', function() { + expect(this.tracker.mostRecent()).toBeFalsy(); + }); - it('simplifies access to the first (oldest) request', function() { - this.tracker.track('request'); - this.tracker.track(); + it('simplifies access to the first (oldest) request', function() { + this.tracker.track('request'); + this.tracker.track(); - expect(this.tracker.first()).toEqual('request'); - }); + expect(this.tracker.first()).toEqual('request'); + }); - it('returns a useful falsy value when there is no first (oldest) request', function() { - expect(this.tracker.first()).toBeFalsy(); - }); + it('returns a useful falsy value when there is no first (oldest) request', function() { + expect(this.tracker.first()).toBeFalsy(); + }); - it('allows the requests list to be reset', function() { - this.tracker.track(); - this.tracker.track(); + it('allows the requests list to be reset', function() { + this.tracker.track(); + this.tracker.track(); - expect(this.tracker.count()).toBe(2); + expect(this.tracker.count()).toBe(2); - this.tracker.reset(); + this.tracker.reset(); - expect(this.tracker.count()).toBe(0); - }); + expect(this.tracker.count()).toBe(0); + }); - it('allows retrieval of an arbitrary request by index', function() { - this.tracker.track('1'); - this.tracker.track('2'); - this.tracker.track('3'); + it('allows retrieval of an arbitrary request by index', function() { + this.tracker.track('1'); + this.tracker.track('2'); + this.tracker.track('3'); - expect(this.tracker.at(1)).toEqual('2'); - }); + expect(this.tracker.at(1)).toEqual('2'); + }); - it('allows retrieval of all requests that are for a given url', function() { - this.tracker.track({ url: 'foo' }); - this.tracker.track({ url: 'bar' }); + it('allows retrieval of all requests that are for a given url', function() { + this.tracker.track({ url: 'foo' }); + this.tracker.track({ url: 'bar' }); - expect(this.tracker.filter('bar')).toEqual([{ url: 'bar' }]); - }); + expect(this.tracker.filter('bar')).toEqual([{ url: 'bar' }]); + }); - it('allows retrieval of all requests that match a given RegExp', function() { - this.tracker.track({ url: 'foo' }); - this.tracker.track({ url: 'bar' }); - this.tracker.track({ url: 'baz' }); + it('allows retrieval of all requests that match a given RegExp', function() { + this.tracker.track({ url: 'foo' }); + this.tracker.track({ url: 'bar' }); + this.tracker.track({ url: 'baz' }); - expect(this.tracker.filter(/ba[rz]/)).toEqual([{ url: 'bar' }, { url: 'baz' }]); - }); + expect(this.tracker.filter(/ba[rz]/)).toEqual([{ url: 'bar' }, { url: 'baz' }]); + }); - it('allows retrieval of all requests that match based on a function', function() { - this.tracker.track({ url: 'foo' }); - this.tracker.track({ url: 'bar' }); - this.tracker.track({ url: 'baz' }); + it('allows retrieval of all requests that match based on a function', function() { + this.tracker.track({ url: 'foo' }); + this.tracker.track({ url: 'bar' }); + this.tracker.track({ url: 'baz' }); - var func = function(request) { - return request.url === 'bar'; - }; + var func = function(request) { + return request.url === 'bar'; + }; - expect(this.tracker.filter(func)).toEqual([{ url: 'bar' }]); - }); + expect(this.tracker.filter(func)).toEqual([{ url: 'bar' }]); + }); - it('filters to nothing if no requests have been tracked', function() { - expect(this.tracker.filter('foo')).toEqual([]); - }); + it('filters to nothing if no requests have been tracked', function() { + expect(this.tracker.filter('foo')).toEqual([]); + }); }); describe('EventBus', function() { - beforeEach(function() { - this.bus = getJasmineRequireObj().AjaxEventBus()(); - }); + beforeEach(function() { + this.bus = getJasmineRequireObj().AjaxEventBus()(); + }); - it('calls an event listener', function() { - var callback = jasmine.createSpy('callback'); + it('calls an event listener', function() { + var callback = jasmine.createSpy('callback'); - this.bus.addEventListener('foo', callback); - this.bus.trigger('foo'); + this.bus.addEventListener('foo', callback); + this.bus.trigger('foo'); - expect(callback).toHaveBeenCalled(); - }); + expect(callback).toHaveBeenCalled(); + }); - it('calls an event listener with additional arguments', function() { - var callback = jasmine.createSpy('callback'); + it('calls an event listener with additional arguments', function() { + var callback = jasmine.createSpy('callback'); - this.bus.addEventListener('foo', callback); - this.bus.trigger('foo', 'bar'); + this.bus.addEventListener('foo', callback); + this.bus.trigger('foo', 'bar'); - expect(callback).toHaveBeenCalledWith('bar'); - }); + expect(callback).toHaveBeenCalledWith('bar'); + }); - it('only triggers callbacks for the specified event', function() { - var fooCallback = jasmine.createSpy('foo'), - barCallback = jasmine.createSpy('bar'); + it('only triggers callbacks for the specified event', function() { + var fooCallback = jasmine.createSpy('foo'), + barCallback = jasmine.createSpy('bar'); - this.bus.addEventListener('foo', fooCallback); - this.bus.addEventListener('bar', barCallback); + this.bus.addEventListener('foo', fooCallback); + this.bus.addEventListener('bar', barCallback); - this.bus.trigger('foo'); + this.bus.trigger('foo'); - expect(fooCallback).toHaveBeenCalled(); - expect(barCallback).not.toHaveBeenCalled(); - }); + expect(fooCallback).toHaveBeenCalled(); + expect(barCallback).not.toHaveBeenCalled(); + }); - it('calls all the callbacks for the specified event', function() { - var callback1 = jasmine.createSpy('callback'); - var callback2 = jasmine.createSpy('otherCallback'); + it('calls all the callbacks for the specified event', function() { + var callback1 = jasmine.createSpy('callback'); + var callback2 = jasmine.createSpy('otherCallback'); - this.bus.addEventListener('foo', callback1); - this.bus.addEventListener('foo', callback2); + this.bus.addEventListener('foo', callback1); + this.bus.addEventListener('foo', callback2); - this.bus.trigger('foo'); + this.bus.trigger('foo'); - expect(callback1).toHaveBeenCalled(); - expect(callback2).toHaveBeenCalled(); - }); + expect(callback1).toHaveBeenCalled(); + expect(callback2).toHaveBeenCalled(); + }); - it('works if there are no callbacks for the event', function() { - var bus = this.bus; - expect(function() { - bus.trigger('notActuallyThere'); - }).not.toThrow(); - }); + it('works if there are no callbacks for the event', function() { + var bus = this.bus; + expect(function() { + bus.trigger('notActuallyThere'); + }).not.toThrow(); + }); - it('does not call listeners that have been removed', function() { - var callback = jasmine.createSpy('callback'); + it('does not call listeners that have been removed', function() { + var callback = jasmine.createSpy('callback'); - this.bus.addEventListener('foo', callback); - this.bus.removeEventListener('foo', callback); - this.bus.trigger('foo'); + this.bus.addEventListener('foo', callback); + this.bus.removeEventListener('foo', callback); + this.bus.trigger('foo'); - expect(callback).not.toHaveBeenCalled(); - }); + expect(callback).not.toHaveBeenCalled(); + }); - it('only removes the specified callback', function() { - var callback1 = jasmine.createSpy('callback'); - var callback2 = jasmine.createSpy('otherCallback'); + it('only removes the specified callback', function() { + var callback1 = jasmine.createSpy('callback'); + var callback2 = jasmine.createSpy('otherCallback'); - this.bus.addEventListener('foo', callback1); - this.bus.addEventListener('foo', callback2); - this.bus.removeEventListener('foo', callback2); + this.bus.addEventListener('foo', callback1); + this.bus.addEventListener('foo', callback2); + this.bus.removeEventListener('foo', callback2); - this.bus.trigger('foo'); + this.bus.trigger('foo'); - expect(callback1).toHaveBeenCalled(); - expect(callback2).not.toHaveBeenCalled(); - }); + expect(callback1).toHaveBeenCalled(); + expect(callback2).not.toHaveBeenCalled(); + }); }); describe("Webmock style mocking", function() { - var successSpy, errorSpy, response, fakeGlobal, mockAjax; + var successSpy, errorSpy, response, fakeGlobal, mockAjax; - var sendRequest = function(fakeGlobal, url?, method?) { - url = url || "http://example.com/someApi"; - method = method || 'GET'; - var xhr = new fakeGlobal.XMLHttpRequest(); - xhr.onreadystatechange = function(args) { - if (this.readyState === (this.DONE || 4)) { // IE 8 doesn't support DONE - response = this; - successSpy(); - } - }; + var sendRequest = function(fakeGlobal, url?, method?) { + url = url || "http://example.com/someApi"; + method = method || 'GET'; + var xhr = new fakeGlobal.XMLHttpRequest(); + xhr.onreadystatechange = function(args) { + if (this.readyState === (this.DONE || 4)) { // IE 8 doesn't support DONE + response = this; + successSpy(); + } + }; - xhr.open(method, url); - xhr.send(); - }; + xhr.open(method, url); + xhr.send(); + }; - beforeEach(function() { - successSpy = jasmine.createSpy('success'); - fakeGlobal = {XMLHttpRequest: jasmine.createSpy('realXMLHttpRequest')}; - mockAjax = new MockAjax(fakeGlobal); - mockAjax.install(); + beforeEach(function() { + successSpy = jasmine.createSpy('success'); + fakeGlobal = { XMLHttpRequest: jasmine.createSpy('realXMLHttpRequest') }; + mockAjax = new MockAjax(fakeGlobal); + mockAjax.install(); - mockAjax.stubRequest("http://example.com/someApi").andReturn({responseText: "hi!"}); - }); + mockAjax.stubRequest("http://example.com/someApi").andReturn({ responseText: "hi!" }); + }); - it("allows a url to be setup as a stub", function() { - sendRequest(fakeGlobal); - expect(successSpy).toHaveBeenCalled(); - }); + it("allows a url to be setup as a stub", function() { + sendRequest(fakeGlobal); + expect(successSpy).toHaveBeenCalled(); + }); - it("should allow you to clear all the ajax stubs", function() { - mockAjax.stubs.reset(); - sendRequest(fakeGlobal); - expect(successSpy).not.toHaveBeenCalled(); - }); + it("should allow you to clear all the ajax stubs", function() { + mockAjax.stubs.reset(); + sendRequest(fakeGlobal); + expect(successSpy).not.toHaveBeenCalled(); + }); - it("should set the contentType", function() { - sendRequest(fakeGlobal); - expect(response.getResponseHeader('Content-Type')).toEqual('application/json'); - }); + it("should set the contentType", function() { + sendRequest(fakeGlobal); + expect(response.getResponseHeader('Content-Type')).toEqual('application/json'); + }); - it("should set the responseText", function() { - sendRequest(fakeGlobal); - expect(response.responseText).toEqual('hi!'); - }); + it("should set the responseText", function() { + sendRequest(fakeGlobal); + expect(response.responseText).toEqual('hi!'); + }); - it("should default the status to 200", function() { - sendRequest(fakeGlobal); - expect(response.status).toEqual(200); - }); + it("should default the status to 200", function() { + sendRequest(fakeGlobal); + expect(response.status).toEqual(200); + }); - it("should set the responseHeaders", function() { - mockAjax.stubRequest("http://example.com/someApi").andReturn({ - responseText: "hi!", - responseHeaders: [{name: "X-Custom", value: "header value"}] - }); - sendRequest(fakeGlobal); - expect(response.getResponseHeader('X-Custom')).toEqual('header value'); - }); + it("should set the responseHeaders", function() { + mockAjax.stubRequest("http://example.com/someApi").andReturn({ + responseText: "hi!", + responseHeaders: [{ name: "X-Custom", value: "header value" }] + }); + sendRequest(fakeGlobal); + expect(response.getResponseHeader('X-Custom')).toEqual('header value'); + }); - describe("with another stub for the same url", function() { - beforeEach(function() { - mockAjax.stubRequest("http://example.com/someApi").andReturn({responseText: "no", status: 403}); - sendRequest(fakeGlobal); - }); + describe("with another stub for the same url", function() { + beforeEach(function() { + mockAjax.stubRequest("http://example.com/someApi").andReturn({ responseText: "no", status: 403 }); + sendRequest(fakeGlobal); + }); - it("should set the status", function() { - expect(response.status).toEqual(403); - }); + it("should set the status", function() { + expect(response.status).toEqual(403); + }); - it("should allow the latest stub to win", function() { - expect(response.responseText).toEqual('no'); - }); - }); + it("should allow the latest stub to win", function() { + expect(response.responseText).toEqual('no'); + }); + }); }); describe("withMock", function() { - var sendRequest = function(fakeGlobal) { - var xhr = new fakeGlobal.XMLHttpRequest(); + var sendRequest = function(fakeGlobal) { + var xhr = new fakeGlobal.XMLHttpRequest(); - xhr.open("GET", "http://example.com/someApi"); - xhr.send(); - }; + xhr.open("GET", "http://example.com/someApi"); + xhr.send(); + }; - it("installs the mock for passed in function, and uninstalls when complete", function() { - var xmlHttpRequest = jasmine.createSpyObj('XMLHttpRequest', ['open', 'send']), - xmlHttpRequestCtor = spyOn(window, 'XMLHttpRequest').and.returnValue(xmlHttpRequest), - fakeGlobal = {XMLHttpRequest: xmlHttpRequestCtor}, - mockAjax = new MockAjax(fakeGlobal); + it("installs the mock for passed in function, and uninstalls when complete", function() { + var xmlHttpRequest = jasmine.createSpyObj('XMLHttpRequest', ['open', 'send']), + xmlHttpRequestCtor = spyOn(window, 'XMLHttpRequest').and.returnValue(xmlHttpRequest), + fakeGlobal = { XMLHttpRequest: xmlHttpRequestCtor }, + mockAjax = new MockAjax(fakeGlobal); - mockAjax.withMock(function() { - sendRequest(fakeGlobal); - expect(xmlHttpRequest.open).not.toHaveBeenCalled(); - }); + mockAjax.withMock(function() { + sendRequest(fakeGlobal); + expect(xmlHttpRequest.open).not.toHaveBeenCalled(); + }); - sendRequest(fakeGlobal); - expect(xmlHttpRequest.open).toHaveBeenCalled(); - }); + sendRequest(fakeGlobal); + expect(xmlHttpRequest.open).toHaveBeenCalled(); + }); - it("properly uninstalls when the passed in function throws", function() { - var xmlHttpRequest = jasmine.createSpyObj('XMLHttpRequest', ['open', 'send']), - xmlHttpRequestCtor = spyOn(window, 'XMLHttpRequest').and.returnValue(xmlHttpRequest), - fakeGlobal = {XMLHttpRequest: xmlHttpRequestCtor}, - mockAjax = new MockAjax(fakeGlobal); + it("properly uninstalls when the passed in function throws", function() { + var xmlHttpRequest = jasmine.createSpyObj('XMLHttpRequest', ['open', 'send']), + xmlHttpRequestCtor = spyOn(window, 'XMLHttpRequest').and.returnValue(xmlHttpRequest), + fakeGlobal = { XMLHttpRequest: xmlHttpRequestCtor }, + mockAjax = new MockAjax(fakeGlobal); - expect(function() { - mockAjax.withMock(function() { - throw "error"; - }); - }).toThrow("error"); + expect(function() { + mockAjax.withMock(function() { + throw "error"; + }); + }).toThrow("error"); - sendRequest(fakeGlobal); - expect(xmlHttpRequest.open).toHaveBeenCalled(); - }); + sendRequest(fakeGlobal); + expect(xmlHttpRequest.open).toHaveBeenCalled(); + }); }); describe("mockAjax", function() { - it("throws an error if installed multiple times", function() { - var fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'), - fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest }, - mockAjax = new MockAjax(fakeGlobal); + it("throws an error if installed multiple times", function() { + var fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'), + fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest }, + mockAjax = new MockAjax(fakeGlobal); - function doubleInstall() { - mockAjax.install(); - mockAjax.install(); - } + function doubleInstall() { + mockAjax.install(); + mockAjax.install(); + } - expect(doubleInstall).toThrow(); - }); + expect(doubleInstall).toThrow(); + }); - it("does not throw an error if uninstalled between installs", function() { - var fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'), - fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest }, - mockAjax = new MockAjax(fakeGlobal); + it("does not throw an error if uninstalled between installs", function() { + var fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'), + fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest }, + mockAjax = new MockAjax(fakeGlobal); - function sequentialInstalls() { - mockAjax.install(); - mockAjax.uninstall(); - mockAjax.install(); - } + function sequentialInstalls() { + mockAjax.install(); + mockAjax.uninstall(); + mockAjax.install(); + } - expect(sequentialInstalls).not.toThrow(); - }); + expect(sequentialInstalls).not.toThrow(); + }); - it("does not replace XMLHttpRequest until it is installed", function() { - var fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'), - fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest }, - mockAjax = new MockAjax(fakeGlobal); + it("does not replace XMLHttpRequest until it is installed", function() { + var fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'), + fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest }, + mockAjax = new MockAjax(fakeGlobal); - fakeGlobal.XMLHttpRequest('foo'); - expect(fakeXmlHttpRequest).toHaveBeenCalledWith('foo'); - fakeXmlHttpRequest.calls.reset(); + fakeGlobal.XMLHttpRequest('foo'); + expect(fakeXmlHttpRequest).toHaveBeenCalledWith('foo'); + fakeXmlHttpRequest.calls.reset(); - mockAjax.install(); - fakeGlobal.XMLHttpRequest('foo'); - expect(fakeXmlHttpRequest).not.toHaveBeenCalled(); - }); + mockAjax.install(); + fakeGlobal.XMLHttpRequest('foo'); + expect(fakeXmlHttpRequest).not.toHaveBeenCalled(); + }); - it("replaces the global XMLHttpRequest on uninstall", function() { - var fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'), - fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest }, - mockAjax = new MockAjax(fakeGlobal); + it("replaces the global XMLHttpRequest on uninstall", function() { + var fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'), + fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest }, + mockAjax = new MockAjax(fakeGlobal); - mockAjax.install(); - mockAjax.uninstall(); + mockAjax.install(); + mockAjax.uninstall(); - fakeGlobal.XMLHttpRequest('foo'); - expect(fakeXmlHttpRequest).toHaveBeenCalledWith('foo'); - }); + fakeGlobal.XMLHttpRequest('foo'); + expect(fakeXmlHttpRequest).toHaveBeenCalledWith('foo'); + }); - it("clears requests and stubs upon uninstall", function() { - var fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'), - fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest }, - mockAjax = new MockAjax(fakeGlobal); + it("clears requests and stubs upon uninstall", function() { + var fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'), + fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest }, + mockAjax = new MockAjax(fakeGlobal); - mockAjax.install(); + mockAjax.install(); - mockAjax.requests.track({url: '/testurl'}); - mockAjax.stubRequest('/bobcat'); + mockAjax.requests.track({ url: '/testurl' }); + mockAjax.stubRequest('/bobcat'); - expect(mockAjax.requests.count()).toEqual(1); - expect(mockAjax.stubs.findStub('/bobcat')).toBeDefined(); + expect(mockAjax.requests.count()).toEqual(1); + expect(mockAjax.stubs.findStub('/bobcat')).toBeDefined(); - mockAjax.uninstall(); + mockAjax.uninstall(); - expect(mockAjax.requests.count()).toEqual(0); - expect(mockAjax.stubs.findStub('/bobcat')).not.toBeDefined(); - }); + expect(mockAjax.requests.count()).toEqual(0); + expect(mockAjax.stubs.findStub('/bobcat')).not.toBeDefined(); + }); - it("allows the httpRequest to be retrieved", function() { - var fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'), - fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest }, - mockAjax = new MockAjax(fakeGlobal); + it("allows the httpRequest to be retrieved", function() { + var fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'), + fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest }, + mockAjax = new MockAjax(fakeGlobal); - mockAjax.install(); - var request = new (fakeGlobal.XMLHttpRequest)(); + mockAjax.install(); + var request = new (fakeGlobal.XMLHttpRequest)(); - expect(mockAjax.requests.count()).toBe(1); - expect(mockAjax.requests.mostRecent()).toBe(request); - }); + expect(mockAjax.requests.count()).toBe(1); + expect(mockAjax.requests.mostRecent()).toBe(request); + }); - it("allows the httpRequests to be cleared", function() { - var fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'), - fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest }, - mockAjax = new MockAjax(fakeGlobal); + it("allows the httpRequests to be cleared", function() { + var fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'), + fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest }, + mockAjax = new MockAjax(fakeGlobal); - mockAjax.install(); - var request = new (fakeGlobal.XMLHttpRequest)(); + mockAjax.install(); + var request = new (fakeGlobal.XMLHttpRequest)(); - expect(mockAjax.requests.mostRecent()).toBe(request); - mockAjax.requests.reset(); - expect(mockAjax.requests.count()).toBe(0); - }); + expect(mockAjax.requests.mostRecent()).toBe(request); + mockAjax.requests.reset(); + expect(mockAjax.requests.count()).toBe(0); + }); }); diff --git a/jasmine-ajax/jasmine-ajax.d.ts b/jasmine-ajax/jasmine-ajax.d.ts index 70ca2f57c1..657ec33747 100644 --- a/jasmine-ajax/jasmine-ajax.d.ts +++ b/jasmine-ajax/jasmine-ajax.d.ts @@ -4,17 +4,22 @@ // Definitions: https://github.com/borisyankov/DefinitelyTyped interface JasmineAjaxResponse { - status?: string; + status?: number; statusText?: string; responseText?: string; response?: string; - responseType?: string; contentType?: string; responseHeaders?: { [key: string]: string }; } -interface JasmineAjaxRequest { +interface JasmineAjaxRequest extends XMLHttpRequest { url: string; + method: string; + username: string; + password: string; + requestHeaders: { [key: string]: string }; + overriddenMimeType: string; + respondWith(response: JasmineAjaxResponse): void; } From 403894c47328ead23d90b576d564558fda447dd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Va=CC=81clav=20Ostroz=CC=8Cli=CC=81k?= Date: Wed, 20 May 2015 21:54:16 +0200 Subject: [PATCH 0035/1358] React-router 0.13 support --- react-router/react-router-test.ts | 86 ++--- react-router/react-router.d.ts | 559 +++++++++++++++--------------- 2 files changed, 324 insertions(+), 321 deletions(-) diff --git a/react-router/react-router-test.ts b/react-router/react-router-test.ts index 41b352af36..fa335e9346 100644 --- a/react-router/react-router-test.ts +++ b/react-router/react-router-test.ts @@ -7,7 +7,7 @@ import Router = require('react-router'); // Mixin class NavigationTest { v: T; - + makePath() { var v1: string = this.v.makePath('to'); var v2: string = this.v.makePath('to', {id: 1}); @@ -35,27 +35,27 @@ class NavigationTest { class StateTest { v: T; - + getPath() { var v1: string = this.v.getPath(); } - + getRoutes() { var v1: Router.Route[] = this.v.getRoutes(); } - + getPathname() { var v1: string = this.v.getPathname(); } - + getParams() { var v1: {} = this.v.getParams(); } - + getQuery() { var v1: {} = this.v.getQuery(); } - + isActive() { var v1: boolean = this.v.isActive('to'); var v2: boolean = this.v.isActive('to', {id: 1}); @@ -63,35 +63,23 @@ class StateTest { } } -class RouteHandlerMixinTest { - v: T; - - getRouteDepth() { - var v1: number = this.v.getRouteDepth(); - } - - createChildRouteHandler() { - var v1: Router.RouteHandler = this.v.createChildRouteHandler({ref: 'hoge'}); - } -} - // Location -class LocationTest { +class LocationTest { v: T; - + push() { var v1: void = this.v.push('path/to/hoge'); } - + replace() { var v1: void = this.v.replace('path/to/hoge'); } - + pop() { var v1: void = this.v.pop(); } - + getCurrentPath() { var v1: void = this.v.getCurrentPath(); } @@ -102,11 +90,11 @@ new LocationTest(); class LocationListenerTest { v: T; - + addChangeListener() { var v1: void = this.v.addChangeListener(() => console.log(1)); } - + removeChangeListener() { var v1: void = this.v.removeChangeListener(() => console.log(1)); } @@ -118,7 +106,7 @@ new LocationListenerTest(); // Behavior class ScrollBehaviorTest { v: T; - + updateScrollPosition() { var v1: void = this.v.updateScrollPosition({x: 33, y: 102}, 'scrollTop'); } @@ -130,12 +118,12 @@ new ScrollBehaviorTest(); // Component class DefaultRouteTest { v: Router.DefaultRoute; - + props() { var name: string = this.v.props.name; var handler: React.ComponentClass = this.v.props.handler; } - + createElement() { var Handler: React.ComponentClass; React.createElement(Router.DefaultRoute, null); @@ -145,12 +133,12 @@ class DefaultRouteTest { class LinkTest { v: Router.Link; - + constructor() { new NavigationTest(); new StateTest(); } - + props() { var activeClassName: string = this.v.props.activeClassName; var to: string = this.v.props.to; @@ -158,15 +146,15 @@ class LinkTest { var query: {} = this.v.props.query; var onClick: Function = this.v.props.onClick; } - + getHref() { var v1: string = this.v.getHref(); } - + getClassName() { var v1: string = this.v.getClassName(); } - + createElement() { React.createElement(Router.Link, null); React.createElement(Router.Link, {to: 'home'}); @@ -182,12 +170,12 @@ class LinkTest { class NotFoundRouteTest { v: Router.NotFoundRoute; - + props() { var name: string = this.v.props.name; var handler: React.ComponentClass = this.v.props.handler; } - + createElement() { var Handler: React.ComponentClass; React.createElement(Router.NotFoundRoute, null); @@ -198,13 +186,13 @@ class NotFoundRouteTest { class RedirectTest { v: Router.Redirect; - + props() { var path: string = this.v.props.path; var from: string = this.v.props.from; var to: string = this.v.props.to; } - + createElement() { React.createElement(Router.Redirect, null); React.createElement(Router.Redirect, {}); @@ -214,14 +202,14 @@ class RedirectTest { class RouteTest { v: Router.Route; - + props() { var name: string = this.v.props.name; var path: string = this.v.props.path; var handler: React.ComponentClass = this.v.props.handler; var ignoreScrollBehavior: boolean = this.v.props.ignoreScrollBehavior; } - + createElement() { var Handler: React.ComponentClass; React.createElement(Router.Route, null); @@ -232,11 +220,7 @@ class RouteTest { class RouteHandlerTest { v: Router.RouteHandler; - - constructor() { - new RouteHandlerMixinTest(); - } - + createElement() { React.createElement(Router.RouteHandler, null); React.createElement(Router.RouteHandler, {}); @@ -247,11 +231,11 @@ class RouteHandlerTest { // History class HistoryTest { v: Router.History; - + length() { var v1: number = this.v.length; } - + back() { var v1: void = this.v.back(); } @@ -261,7 +245,7 @@ class HistoryTest { // Router class CreateTest { v: Router.Router; - + constructor() { // React.createElement() version this.v = Router.create({ @@ -272,7 +256,7 @@ class CreateTest { location: Router.HistoryLocation, scrollBehavior: Router.ImitateBrowserBehavior }); - + // React.createFactory() version this.v = Router.create({ routes: React.createFactory(Router.Route)() @@ -283,7 +267,7 @@ class CreateTest { scrollBehavior: Router.ImitateBrowserBehavior }); } - + run() { this.v.run((Handler) => console.log(Handler)); this.v.run((Handler, state) => console.log(Handler, state)); @@ -299,7 +283,7 @@ class RunTest { var v2: Router.Router = Router.run(React.createElement(Router.Route, null), Router.HistoryLocation, (Handler, state) => { React.render(React.createElement(Handler, null), document.body); }); - + // React.createFactory() version var v3: Router.Router = Router.run(React.createFactory(Router.Route)(), (Handler) => { React.render(React.createElement(Handler, null), document.body); diff --git a/react-router/react-router.d.ts b/react-router/react-router.d.ts index 58ec9069a4..c02892ffe1 100644 --- a/react-router/react-router.d.ts +++ b/react-router/react-router.d.ts @@ -1,278 +1,297 @@ -// Type definitions for React Router 0.12.0 +// Type definitions for React Router 0.13.3 // Project: https://github.com/rackt/react-router -// Definitions by: Yuichi Murata +// Definitions by: Yuichi Murata , Václav Ostrožlík // Definitions: https://github.com/borisyankov/DefinitelyTyped -/// +/// -declare module ReactRouter { - // - // Mixin - // ---------------------------------------------------------------------- - interface Navigation { - makePath(to: string, params?: {}, query?: {}): string; - makeHref(to: string, params?: {}, query?: {}): string; - transitionTo(to: string, params?: {}, query?: {}): void; - replaceWith(to: string, params?: {}, query?: {}): void; - goBack(): void; - } - - interface RouteHandlerMixin { - getRouteDepth(): number; - createChildRouteHandler(props: {}): RouteHandler; - } - - interface State { - getPath(): string; - getRoutes(): Route[]; - getPathname(): string; - getParams(): {}; - getQuery(): {}; - isActive(to: string, params?: {}, query?: {}): boolean; - } - - var Navigation: Navigation; - var State: State; - var RouteHandlerMixin: RouteHandlerMixin; - - - // - // Component - // ---------------------------------------------------------------------- - // DefaultRoute - interface DefaultRouteProp { - name?: string; - handler: React.ComponentClass; - } - interface DefaultRoute extends React.ReactElement { - __react_router_default_route__: any; // dummy - } - interface DefaultRouteClass extends React.ComponentClass { - __react_router_default_route__: any; // dummy - } - - // Link - interface LinkProp { - activeClassName?: string; - to: string; - params?: {}; - query?: {}; - onClick?: Function; - } - interface Link extends React.ReactElement, Navigation, State { - __react_router_link__: any; // dummy - - getHref(): string; - getClassName(): string; - } - interface LinkClass extends React.ComponentClass { - __react_router_link__: any; // dummy - } - - // NotFoundRoute - interface NotFoundRouteProp { - name?: string; - handler: React.ComponentClass; - } - interface NotFoundRoute extends React.ReactElement { - __react_router_not_found_route__: any; // dummy - } - interface NotFoundRouteClass extends React.ComponentClass { - __react_router_not_found_route__: any; // dummy - } - - // Redirect - interface RedirectProp { - path?: string; - from?: string; - to?: string; - } - interface Redirect extends React.ReactElement { - __react_router_redirect__: any; // dummy - } - interface RedirectClass extends React.ComponentClass { - __react_router_redirect__: any; // dummy - } - - // Route - interface RouteProp { - name?: string; - path?: string; - handler?: React.ComponentClass; - ignoreScrollBehavior?: boolean; - } - interface Route extends React.ReactElement { - __react_router_route__: any; // dummy - } - interface RouteClass extends React.ComponentClass { - __react_router_route__: any; // dummy - } - - // RouteHandler - interface RouteHandlerProp {} - interface RouteHandler extends React.ReactElement, RouteHandlerMixin { - __react_router_route_handler__: any; // dummy - } - interface RouteHandlerClass extends React.ReactElement { - __react_router_route_handler__: any; // dummy - } - - var DefaultRoute: DefaultRouteClass; - var Link: LinkClass; - var NotFoundRoute: NotFoundRouteClass; - var Redirect: RedirectClass; - var Route: RouteClass; - var RouteHandler: RouteHandlerClass; - - - // - // Location - // ---------------------------------------------------------------------- - interface LocationBase { - push(path: string): void; - replace(path: string): void; - pop(): void; - getCurrentPath(): void; - } - - interface LocationListener { - addChangeListener(listener: Function): void; - removeChangeListener(listener: Function): void; - } - - interface HashLocation extends LocationBase, LocationListener {} - interface HistoryLocation extends LocationBase, LocationListener {} - interface RefreshLocation extends LocationBase {} - - var HashLocation: HashLocation; - var HistoryLocation: HistoryLocation; - var RefreshLocation: RefreshLocation; - - - // - // Behavior - // ---------------------------------------------------------------------- - interface ScrollBehaviorBase { - updateScrollPosition(position: {x: number; y: number;}, actionType: string): void; - } - interface ImitateBrowserBehavior extends ScrollBehaviorBase {} - interface ScrollToTopBehavior extends ScrollBehaviorBase {} - - var ImitateBrowserBehavior: ImitateBrowserBehavior; - var ScrollToTopBehavior: ScrollToTopBehavior; - - - // - // Router - // ---------------------------------------------------------------------- - interface Router extends React.ReactElement { - run(callback: RouterRunCallback): void; - } - - interface RouterState { - path: string; - action: string; - pathname: string; - params: {}; - query: {}; - routes : Route[]; - } - - interface RouterCreateOption { - routes: React.ReactElement; - location?: LocationBase; - scrollBehavior?: ScrollBehaviorBase; - } - - type RouterRunCallback = (Handler: Router, state: RouterState) => void; - - function create(options: RouterCreateOption): Router; - function run(routes: React.ReactElement, callback: RouterRunCallback): Router; - function run(routes: React.ReactElement, location: LocationBase, callback: RouterRunCallback): Router; - - - // - // History - // ---------------------------------------------------------------------- - interface History { - back(): void; - length: number; - } - var History: History; - - - // - // Transition - // ---------------------------------------------------------------------- - interface Transition { - abort(): void; - redirect(to: string, params?: {}, query?: {}): void; - retry(): void; - } - - interface TransitionStaticLifecycle { - willTransitionTo?( - transition: Transition, - params: {}, - query: {}, - callback: Function - ): void; - - willTransitionFrom?( - transition: Transition, - component: React.ReactElement, - callback: Function - ): void; - } +declare module "react-router" { + + import React = require("react"); + + // + // Transition + // ---------------------------------------------------------------------- + interface Transition { + path: string; + abortReason: any; + retry(): void; + abort(reason?: any): void; + redirect(to: string, params?: {}, query?: {}): void; + cancel(): void; + from: (transition: Transition, routes: Route[], components?: React.ReactElement[], callback?: (error?: any) => void) => void; + to: (transition: Transition, routes: Route[], params?: {}, query?: {}, callback?: (error?: any) => void) => void; + } + + interface TransitionStaticLifecycle { + willTransitionTo?( + transition: Transition, + params: {}, + query: {}, + callback: Function + ): void; + + willTransitionFrom?( + transition: Transition, + component: React.ReactElement, + callback: Function + ): void; + } + + // + // Route Configuration + // ---------------------------------------------------------------------- + // DefaultRoute + interface DefaultRouteProp { + name?: string; + handler: React.ComponentClass; + } + interface DefaultRoute extends React.ReactElement {} + interface DefaultRouteClass extends React.ComponentClass {} + + // NotFoundRoute + interface NotFoundRouteProp { + name?: string; + handler: React.ComponentClass; + } + interface NotFoundRoute extends React.ReactElement {} + interface NotFoundRouteClass extends React.ComponentClass {} + + // Redirect + interface RedirectProp { + path?: string; + from?: string; + to?: string; + } + interface Redirect extends React.ReactElement {} + interface RedirectClass extends React.ComponentClass {} + + // Route + interface RouteProp { + name?: string; + path?: string; + handler?: React.ComponentClass; + ignoreScrollBehavior?: boolean; + } + interface Route extends React.ReactElement {} + interface RouteClass extends React.ComponentClass {} + + var DefaultRoute: DefaultRouteClass; + var NotFoundRoute: NotFoundRouteClass; + var Redirect: RedirectClass; + var Route: RouteClass; + + interface CreateRouteOptions { + name?: string; + path?: string; + ignoreScrollBehavior?: boolean; + isDefault?: boolean; + isNotFound?: boolean; + onEnter?: (transition: Transition, params: {}, query: {}, callback: Function) => void; + onLeave?: (transition: Transition, wtf: any, callback: Function) => void; + handler?: Function; + parentRoute?: Route; + } + + type CreateRouteCallback = (route: Route) => void; + + function createRoute(callback: CreateRouteCallback): Route; + function createRoute(options: CreateRouteOptions | string, callback: CreateRouteCallback): Route; + function createDefaultRoute(options?: CreateRouteOptions | string): Route; + function createNotFoundRoute(options?: CreateRouteOptions | string): Route; + + interface CreateRedirectOptions extends CreateRouteOptions { + path?: string; + from?: string; + to: string; + params?: {}; + query?: {}; + } + function createRedirect(options: CreateRedirectOptions): Redirect; + function createRoutesFromReactChildren(children: Route): Route[]; + + // + // Components + // ---------------------------------------------------------------------- + // Link + interface LinkProp { + activeClassName?: string; + activeStyle?: {}; + to: string; + params?: {}; + query?: {}; + onClick?: Function; + } + interface Link extends React.ReactElement, Navigation, State { + handleClick(event: any): void; + getHref(): string; + getClassName(): string; + getActiveState(): boolean; + } + interface LinkClass extends React.ComponentClass {} + + // RouteHandler + interface RouteHandlerProp { } + interface RouteHandlerChildContext { + routeDepth: number; + } + interface RouteHandler extends React.ReactElement { + getChildContext(): RouteHandlerChildContext; + getRouteDepth(): number; + createChildRouteHandler(props: {}): RouteHandler; + } + interface RouteHandlerClass extends React.ReactElement {} + + var Link: LinkClass; + var RouteHandler: RouteHandlerClass; + + + // + // Top-Level + // ---------------------------------------------------------------------- + interface Router extends React.ReactElement { + run(callback: RouterRunCallback): void; + } + + interface RouterState { + path: string; + action: string; + pathname: string; + params: {}; + query: {}; + routes: Route[]; + } + + interface RouterCreateOption { + routes: Route; + location?: LocationBase; + scrollBehavior?: ScrollBehaviorBase; + onError?: (error: any) => void; + onAbort?: (error: any) => void; + } + + type RouterRunCallback = (Handler: RouteClass, state: RouterState) => void; + + function create(options: RouterCreateOption): Router; + function run(routes: Route, callback: RouterRunCallback): Router; + function run(routes: Route, location: LocationBase, callback: RouterRunCallback): Router; + + + // + // Location + // ---------------------------------------------------------------------- + interface LocationBase { + getCurrentPath(): void; + toString(): string; + } + interface Location extends LocationBase { + push(path: string): void; + replace(path: string): void; + pop(): void; + } + + interface LocationListener { + addChangeListener(listener: Function): void; + removeChangeListener(listener: Function): void; + } + + interface HashLocation extends Location, LocationListener { } + interface HistoryLocation extends Location, LocationListener { } + interface RefreshLocation extends Location { } + interface StaticLocation extends LocationBase { } + interface TestLocation extends Location, LocationListener { } + + var HashLocation: HashLocation; + var HistoryLocation: HistoryLocation; + var RefreshLocation: RefreshLocation; + var StaticLocation: StaticLocation; + var TestLocation: TestLocation; + + + // + // Behavior + // ---------------------------------------------------------------------- + interface ScrollBehaviorBase { + updateScrollPosition(position: { x: number; y: number; }, actionType: string): void; + } + interface ImitateBrowserBehavior extends ScrollBehaviorBase { } + interface ScrollToTopBehavior extends ScrollBehaviorBase { } + + var ImitateBrowserBehavior: ImitateBrowserBehavior; + var ScrollToTopBehavior: ScrollToTopBehavior; + + + // + // Mixin + // ---------------------------------------------------------------------- + interface Navigation { + makePath(to: string, params?: {}, query?: {}): string; + makeHref(to: string, params?: {}, query?: {}): string; + transitionTo(to: string, params?: {}, query?: {}): void; + replaceWith(to: string, params?: {}, query?: {}): void; + goBack(): void; + } + + interface State { + getPath(): string; + getRoutes(): Route[]; + getPathname(): string; + getParams(): {}; + getQuery(): {}; + isActive(to: string, params?: {}, query?: {}): boolean; + } + + var Navigation: Navigation; + var State: State; + + + // + // History + // ---------------------------------------------------------------------- + interface History { + back(): void; + length: number; + } + var History: History; } -declare module 'react-router' { - import Export = ReactRouter; - export = Export; -} -declare module React { - interface TopLevelAPI { - // for DefaultRoute - createElement( - type: ReactRouter.DefaultRouteClass, - props: ReactRouter.DefaultRouteProp, - ...children: ReactNode[] - ): ReactRouter.DefaultRoute; - - // for Link - createElement( - type: ReactRouter.LinkClass, - props: ReactRouter.LinkProp, - ...children: ReactNode[] - ): ReactRouter.Link; - - // for NotFoundRoute - createElement( - type: ReactRouter.NotFoundRouteClass, - props: ReactRouter.NotFoundRouteProp, - ...children: ReactNode[] - ): ReactRouter.NotFoundRoute; - - // for Redirect - createElement( - type: ReactRouter.RedirectClass, - props: ReactRouter.RedirectProp, - ...children: ReactNode[] - ): ReactRouter.Redirect; - - // for Route - createElement( - type: ReactRouter.RouteClass, - props: ReactRouter.RouteProp, - ...children: ReactNode[] - ): ReactRouter.Route; - - // for RouteHandler - createElement( - type: ReactRouter.RouteHandlerClass, - props: ReactRouter.RouteHandlerProp, - ...children: ReactNode[] - ): ReactRouter.RouteHandler; - } +declare module "react" { + import ReactRouter = require("react-router"); + + // for DefaultRoute + function createElement( + type: ReactRouter.DefaultRouteClass, + props: ReactRouter.DefaultRouteProp, + ...children: ReactNode[]): ReactRouter.DefaultRoute; + + // for Link + function createElement( + type: ReactRouter.LinkClass, + props: ReactRouter.LinkProp, + ...children: ReactNode[]): ReactRouter.Link; + + // for NotFoundRoute + function createElement( + type: ReactRouter.NotFoundRouteClass, + props: ReactRouter.NotFoundRouteProp, + ...children: ReactNode[]): ReactRouter.NotFoundRoute; + + // for Redirect + function createElement( + type: ReactRouter.RedirectClass, + props: ReactRouter.RedirectProp, + ...children: ReactNode[]): ReactRouter.Redirect; + + // for Route + function createElement( + type: ReactRouter.RouteClass, + props: ReactRouter.RouteProp, + ...children: ReactNode[]): ReactRouter.Route; + + // for RouteHandler + function createElement( + type: ReactRouter.RouteHandlerClass, + props: ReactRouter.RouteHandlerProp, + ...children: ReactNode[]): ReactRouter.RouteHandler; } From 16c5267ec4c4611949ce77e381a9b416cb5a3f36 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 21 May 2015 11:18:08 +0200 Subject: [PATCH 0036/1358] fixed implicit any --- jasmine-ajax/jasmine-ajax.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jasmine-ajax/jasmine-ajax.d.ts b/jasmine-ajax/jasmine-ajax.d.ts index 657ec33747..d10f67ad40 100644 --- a/jasmine-ajax/jasmine-ajax.d.ts +++ b/jasmine-ajax/jasmine-ajax.d.ts @@ -62,7 +62,7 @@ interface JasmineAjaxParamParser { } declare class MockAjax { - constructor(globals); + constructor(globals: any); install(): void; uninstall(): void; From 1ec7dac4f93c825f3a90372de6abfe2198343358 Mon Sep 17 00:00:00 2001 From: Sam Albert Date: Tue, 26 May 2015 16:01:50 -0400 Subject: [PATCH 0037/1358] Updated callback buffer with rest parameters. --- node_zeromq/zmq-tests.ts | 2 +- node_zeromq/zmq.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/node_zeromq/zmq-tests.ts b/node_zeromq/zmq-tests.ts index 696a98c13b..a62d97a6ca 100644 --- a/node_zeromq/zmq-tests.ts +++ b/node_zeromq/zmq-tests.ts @@ -19,7 +19,7 @@ function test3() { var sock = zmq.socket('push'); sock.bindSync('tcp://127.0.0.1:3000'); sock.send(['hello', 'world']); - sock.on('message', function (buffer: Buffer) { + sock.on('message', function (buffer1: Buffer, buffer2: Buffer) { // }); } diff --git a/node_zeromq/zmq.d.ts b/node_zeromq/zmq.d.ts index 8d29e05691..3ab2d1f255 100644 --- a/node_zeromq/zmq.d.ts +++ b/node_zeromq/zmq.d.ts @@ -182,7 +182,7 @@ declare module 'zmq' { * @param eventName {string} * @param callback {Function} */ - on(eventName: string, callback: (buffer: Buffer) => void): void; + on(eventName: string, callback: (...buffer: Buffer[]) => void): void; // Socket Options _fd: any; From 3e467db265658e0dbc80de8c1be71e4531a52530 Mon Sep 17 00:00:00 2001 From: Chris Wrench Date: Wed, 27 May 2015 17:24:46 +0100 Subject: [PATCH 0038/1358] Begin update of Google Maps definitions to v3.20 As part of #4364, update some of the Google Maps API to the latest version, v3.20. Changes include: - Addition of `LatLngLiteral` type; - Remove `MarkerImage` type; - Update `Marker` class. The following areas of the API have been updated and checked for consistency with the latest API reference: - Map; - Controls; - Data; - Overlays; - Services; - Save to Google Maps; - Base; - MVC. All other areas of the API still need to be updated. --- googlemaps/google.maps.d.ts | 328 ++++++++++++++++++++++-------------- 1 file changed, 202 insertions(+), 126 deletions(-) diff --git a/googlemaps/google.maps.d.ts b/googlemaps/google.maps.d.ts index fe4e7459cd..f5d197773f 100644 --- a/googlemaps/google.maps.d.ts +++ b/googlemaps/google.maps.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Google Maps JavaScript API 3.19 +// Type definitions for Google Maps JavaScript API 3.20 // Project: https://developers.google.com/maps/ // Definitions by: Folia A/S , Chris Wrench // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -29,34 +29,6 @@ THE SOFTWARE. declare module google.maps { - /***** MVC *****/ - export class MVCObject { - constructor (); - addListener(eventName: string, handler: (...args: any[]) => void): MapsEventListener; - bindTo(key: string, target: MVCObject, targetKey?: string, noNotify?: boolean): void; - changed(key: string): void; - get(key: string): any; - notify(key: string): void; - set(key: string, value: any): void; - setValues(values: any): void; - unbind(key: string): void; - unbindAll(): void; - } - - export class MVCArray extends MVCObject { - constructor (array?: any[]); - clear(): void; - forEach(callback: (elem: any, index: number) => void ): void; - getArray(): any[]; - getAt(i: number): any; - getLength(): number; - insertAt(i: number, elem: any): void; - pop(): void; - push(elem: any): number; - removeAt(i: number): any; - setAt(i: number, elem: any): void; - } - /***** Map *****/ export class Map extends MVCObject { constructor (mapDiv: Element, opts?: MapOptions); @@ -65,17 +37,17 @@ declare module google.maps { getCenter(): LatLng; getDiv(): Element; getHeading(): number; - getMapTypeId(): MapTypeId; + getMapTypeId(): MapTypeId|string; getProjection(): Projection; getStreetView(): StreetViewPanorama; getTilt(): number; getZoom(): number; panBy(x: number, y: number): void; - panTo(latLng: LatLng): void; + panTo(latLng: LatLng|LatLngLiteral): void; panToBounds(latLngBounds: LatLngBounds): void; - setCenter(latlng: LatLng): void; + setCenter(latlng: LatLng|LatLngLiteral): void; setHeading(heading: number): void; - setMapTypeId(mapTypeId: MapTypeId): void; + setMapTypeId(mapTypeId: MapTypeId|string): void; setOptions(options: MapOptions): void; setStreetView(panorama: StreetViewPanorama): void; setTilt(tilt: number): void; @@ -99,8 +71,6 @@ declare module google.maps { mapMaker?: boolean; mapTypeControl?: boolean; mapTypeControlOptions?: MapTypeControlOptions; - navigationControl?: boolean; - navigationControlOptions?: NavigationControlOptions; mapTypeId?: MapTypeId; maxZoom?: number; minZoom?: number; @@ -133,7 +103,7 @@ declare module google.maps { /***** Controls *****/ export interface MapTypeControlOptions { - mapTypeIds?: MapTypeId[]; + mapTypeIds?: MapTypeId[]|string[]; position?: ControlPosition; style?: MapTypeControlStyle; } @@ -157,7 +127,6 @@ declare module google.maps { } export interface ScaleControlOptions { - position?: ControlPosition; style?: ScaleControlStyle; } @@ -195,18 +164,6 @@ declare module google.maps { TOP_RIGHT } - export interface NavigationControlOptions { - position?: ControlPosition; - style?: NavigationControlStyle; - } - - export enum NavigationControlStyle { - DEFAULT, - SMALL, - ANDROID, - ZOOM_PAN - } - /***** Data *****/ export class Data extends MVCObject { constructor(options?: Data.DataOptions); @@ -214,6 +171,9 @@ declare module google.maps { addGeoJson(geoJson: Object, options?: Data.GeoJsonOptions): Data.Feature[]; contains(feature: Data.Feature): boolean; forEach(callback: (feature: Data.Feature) => void): void; + getControlPosition(): ControlPosition; + getControls(): string[]; + getDrawingMode(): string; getFeatureById(id: number|string): Data.Feature; getMap(): Map; getStyle(): Data.StylingFunction|Data.StyleOptions; @@ -221,6 +181,9 @@ declare module google.maps { overrideStyle(feature: Data.Feature, style: Data.StyleOptions): void; remove(feature: Data.Feature): void; revertStyle(feature?: Data.Feature): void; + setControlPosition(controlPosition: ControlPosition): void; + setControls(controls: string[]): void; + setDrawingMode(drawingMode: string): void; setMap(map: Map): void; setStyle(style: Data.StylingFunction|Data.StyleOptions): void; toGeoJson(callback: (feature: Object) => void): void; @@ -228,6 +191,10 @@ declare module google.maps { export module Data { export interface DataOptions { + controlPosition?: ControlPosition; + controls?: string[]; + drawingMode?: string; + featureFactory?: (geometry: Data.Geometry) => Data.Feature; map?: Map; style?: Data.StylingFunction|Data.StyleOptions; } @@ -239,9 +206,11 @@ declare module google.maps { export interface StyleOptions { clickable?: boolean; cursor?: string; + draggable?: boolean; + editable?: boolean; fillColor?: string; fillOpacity?: number; - icon?: any; // TODO string|Icon|Symbol; + icon?: string|Icon|Symbol; shape?: MarkerShape; strokeColor?: string; strokeOpacity?: number; @@ -260,13 +229,13 @@ declare module google.maps { getId(): number|string; getProperty(name: string): any; removeProperty(name: string): void; - setGeometry(newGeometry: Data.Geometry|LatLng): void; // TODO LatLngLiteral + setGeometry(newGeometry: Data.Geometry|LatLng|LatLngLiteral): void; setProperty(name: string, newValue: any): void toGeoJson(callback: (feature: Object) => void): void } export interface FeatureOptions { - geometry?: Data.Geometry|LatLng; // TODO LatLngLiteral + geometry?: Data.Geometry|LatLng|LatLngLiteral; id?: number|string; properties?: Object; } @@ -276,53 +245,54 @@ declare module google.maps { } export class Point extends Data.Geometry { - constructor(latLng: LatLng); // TODO LatLngLiteral + constructor(latLng: LatLng|LatLngLiteral); get(): LatLng; } export class MultiPoint extends Data.Geometry { - constructor(elements: LatLng[]); // TODO LatLngLiteral + constructor(elements: LatLng[]|LatLngLiteral[]); + getArray(): LatLng[]; getAt(n: number): LatLng; getLength(): number; } export class LineString extends Data.Geometry { - constructor(elements: LatLng[]); // TODO LatLngLiteral + constructor(elements: LatLng[]|LatLngLiteral[]); getArray(): LatLng[]; getAt(n: number): LatLng; getLength(): number; } export class MultiLineString extends Data.Geometry { - constructor(elements: Data.LineString[]|LatLng[]); // TODO LatLngLiteral + constructor(elements: Data.LineString[]|LatLng[]|LatLngLiteral[]); getArray(): Data.LineString[]; getAt(n: number): Data.LineString; getLength(): number; } export class LinearRing extends Data.Geometry { - constructor(elements: LatLng[]); // TODO LatLngLiteral + constructor(elements: LatLng[]|LatLngLiteral[]); getArray(): LatLng[]; getAt(n: number): LatLng; getLength(): number; } export class Polygon extends Data.Geometry { - constructor(elements: LinearRing[]|LatLng[][]); // TODO LatLngLiteral - getArray(): LinearRing[]; - getAt(n: number): LinearRing; + constructor(elements: Data.LinearRing[]|LatLng[][]|LatLngLiteral[][]); + getArray(): Data.LinearRing[]; + getAt(n: number): Data.LinearRing; getLength(): number; } export class MultiPolygon extends Data.Geometry { - constructor(elements: Data.Polygon[]|LinearRing[][]|LatLng[][][]); // TODO LatLngLiteral + constructor(elements: Data.Polygon[]|LinearRing[][]|LatLng[][][]|LatLngLiteral[][][]); getArray(): Data.Polygon[]; getAt(n: number): Data.Polygon; getLength(): number; } export class GeometryCollection extends Data.Geometry { - constructor(elements: Data.Geometry[]|LatLng[]); // TODO LatLngLiteral + constructor(elements: Data.Geometry[]|LatLng[]|LatLngLiteral[]); getArray(): Data.Geometry[]; getAt(n: number): Data.Geometry; getLength(): number; @@ -365,31 +335,30 @@ declare module google.maps { static MAX_ZINDEX: number; constructor (opts?: MarkerOptions); getAnimation(): Animation; + getAttribution(): Attribution; getClickable(): boolean; getCursor(): string; getDraggable(): boolean; - getFlat(): boolean; - getIcon(): MarkerImage; - getMap(): any; // Map or StreetViewPanorama + getIcon(): string|Icon|Symbol; + getMap(): Map|StreetViewPanorama; + getOpacity(): number; + getPlace(): Place; getPosition(): LatLng; - getShadow(): MarkerImage; getShape(): MarkerShape; getTitle(): string; getVisible(): boolean; getZIndex(): number; setAnimation(animation: Animation): void; + setAttribution(attribution: Attribution): void; setClickable(flag: boolean): void; setCursor(cursor: string): void; setDraggable(flag: boolean): void; - setFlat(flag: boolean): void; - setIcon(icon: MarkerImage): void; - setIcon(icon: string): void; - setMap(map: Map): void; - setMap(map: StreetViewPanorama): void; + setIcon(icon: string|Icon|Symbol): void; + setMap(map: Map|StreetViewPanorama): void; + getOpacity(opacity: number): void; setOptions(options: MarkerOptions): void; - setPosition(latlng: LatLng): void; - setShadow(shadow: MarkerImage): void; - setShadow(shadow: string): void; + setPlace(place: Place): void; + setPosition(latlng: LatLng|LatLngLiteral): void; setShape(shape: MarkerShape): void; setTitle(title: string): void; setVisible(visible: boolean): void; @@ -397,30 +366,31 @@ declare module google.maps { } export interface MarkerOptions { + anchorPoint?:Point; animation?: Animation; + attribution?: Attribution; clickable?: boolean; + crossOnDrag?: boolean; cursor?: string; draggable?: boolean; - flat?: boolean; - icon?: any; - map?: any; + icon?: string|Icon|Symbol; + map?: Map|StreetViewPanorama; + opacity?: number; optimized?: boolean; + place?: Place; position?: LatLng; - raiseOnDrag?: boolean; - shadow?: any; shape?: MarkerShape; title?: string; visible?: boolean; zIndex?: number; } - export class MarkerImage { - constructor (url: string, size?: Size, origin?: Point, anchor?: Point, scaledSize?: Size); - anchor: Point; - origin: Point; - scaledSize: Size; - size: Size; - url: string; + export interface Icon { + anchor?: Point; + origin?: Point; + scaledSize?: Size; + size?: Size; + url?: string; } export interface MarkerShape { @@ -432,7 +402,7 @@ declare module google.maps { anchor?: Point; fillColor?: string; fillOpacity?: number; - path?: any; + path?: SymbolPath|string; rotation?: number; scale?: number; strokeColor?: string; @@ -456,24 +426,22 @@ declare module google.maps { export class InfoWindow extends MVCObject { constructor (opts?: InfoWindowOptions); close(): void; - getContent(): any; // string or Element + getContent(): string|Element; getPosition(): LatLng; getZIndex(): number; - open(map?: Map, anchor?: MVCObject): void; - open(map?: StreetViewPanorama, anchor?: MVCObject): void; - setContent(content: Node): void; - setContent(content: string): void; + open(map?: Map|StreetViewPanorama, anchor?: MVCObject): void; + setContent(content: string|Node): void; setOptions(options: InfoWindowOptions): void; setPosition(position: LatLng): void; setZIndex(zIndex: number): void; } export interface InfoWindowOptions { - content?: any; + content?: string|Node; disableAutoPan?: boolean; maxWidth?: number; pixelOffset?: Size; - position?: LatLng; + position?: LatLng|LatLngLiteral; zIndex?: number; } @@ -482,14 +450,13 @@ declare module google.maps { getDraggable(): boolean; getEditable(): boolean; getMap(): Map; - getPath(): MVCArray; + getPath(): MVCArray; // MVCArray getVisible(): boolean; setDraggable(draggable: boolean): void; setEditable(editable: boolean): void; setMap(map: Map): void; setOptions(options: PolylineOptions): void; - setPath(path: MVCArray): void; - setPath(path: LatLng[]): void; + setPath(path: MVCArray|LatLng[]|LatLngLiteral[]): void; // MVCArray|Array setVisible(visible: boolean): void; } @@ -500,7 +467,7 @@ declare module google.maps { geodesic?: boolean; icons?: IconSequence[]; map?: Map; - path?: any[]; + path?: MVCArray|LatLng[]|LatLngLiteral[]; // MVCArray|Array strokeColor?: string; strokeOpacity?: number; strokeWeight?: number; @@ -520,19 +487,20 @@ declare module google.maps { getDraggable(): boolean; getEditable(): boolean; getMap(): Map; - getPath(): MVCArray; - getPaths(): MVCArray; + getPath(): MVCArray; // MVCArray + getPaths(): MVCArray; // MVCArray> getVisible(): boolean; setDraggable(draggable: boolean): void; setEditable(editable: boolean): void; setMap(map: Map): void; setOptions(options: PolygonOptions): void; - setPath(path: MVCArray): void; - setPath(path: LatLng[]): void; + setPath(path: MVCArray|LatLng[]|LatLngLiteral[]): void; setPaths(paths: MVCArray): void; setPaths(paths: MVCArray[]): void; setPaths(path: LatLng[]): void; setPaths(path: LatLng[][]): void; + setPaths(path: LatLngLiteral[]): void; + setPaths(path: LatLngLiteral[][]): void; setVisible(visible: boolean): void; } @@ -544,7 +512,7 @@ declare module google.maps { fillOpacity?: number; geodesic?: boolean; map?: Map; - paths?: any[]; + paths?: any[]; // MVCArray>|MVCArray|Array>|Array strokeColor?: string; strokeOpacity?: number; strokePosition?: StrokePosition; @@ -599,7 +567,7 @@ declare module google.maps { getMap(): Map; getRadius(): number; getVisible(): boolean; - setCenter(center: LatLng): void; + setCenter(center: LatLng|LatLngLiteral): void; setDraggable(draggable: boolean): void; setEditable(editable: boolean): void; setMap(map: Map): void; @@ -649,23 +617,20 @@ declare module google.maps { export class OverlayView extends MVCObject { draw(): void; - getMap(): Map; + getMap(): Map|StreetViewPanorama; getPanes(): MapPanes; getProjection(): MapCanvasProjection; onAdd(): void; onRemove(): void; - setMap(map: Map): void; - setMap(map: StreetViewPanorama): void; + setMap(map: Map|StreetViewPanorama): void; } export interface MapPanes { floatPane: Element; - floatShadow: Element; mapPane: Element; - overlayImage: Element; + markerLayer: Element; overlayLayer: Element; overlayMouseTarget: Element; - overlayShadow: Element; } export class MapCanvasProjection extends MVCObject { @@ -678,17 +643,25 @@ declare module google.maps { /***** Services *****/ export class Geocoder { - constructor (); geocode(request: GeocoderRequest, callback: (results: GeocoderResult[], status: GeocoderStatus) => void ): void; } export interface GeocoderRequest { address?: string; bounds?: LatLngBounds; - location?: LatLng; + componentRestrictions: GeocoderComponentRestrictions; + location?: LatLng|LatLngLiteral; region?: string; } + export interface GeocoderComponentRestrictions { + administrativeArea: string; + country: string; + locality: string; + postalCode: string; + route: string; + } + export enum GeocoderStatus { ERROR, INVALID_REQUEST, @@ -703,6 +676,8 @@ declare module google.maps { address_components: GeocoderAddressComponent[]; formatted_address: string; geometry: GeocoderGeometry; + partial_match: boolean; + postcode_localities: string[] types: string[]; } @@ -757,16 +732,17 @@ declare module google.maps { } export class DirectionsService { - constructor (); route(request: DirectionsRequest, callback: (result: DirectionsResult, status: DirectionsStatus) => void ): void; } export interface DirectionsRequest { + avoidFerries?: boolean; avoidHighways?: boolean; avoidTolls?: boolean; - destination?: any; + destination?: LatLng|string; + durationInTraffic?: boolean; optimizeWaypoints?: boolean; - origin?: any; + origin?: LatLng|string; provideRouteAlternatives?: boolean; region?: string; transitOptions?: TransitOptions; @@ -790,10 +766,28 @@ declare module google.maps { export interface TransitOptions { arrivalTime?: Date; departureTime?: Date; + modes: TransitMode[]; + routingPreference: TransitRoutePreference; } + export enum TransitMode { + BUS, + RAIL, + SUBWAY, + TRAIN, + TRAM + } + + export enum TransitRoutePreference + { + FEWER_TRANSFERS, + LESS_WALKING + } + + export interface TransitFare { } + export interface DirectionsWaypoint { - location: any; + location: LatLng|string; stopover: boolean; } @@ -815,17 +809,20 @@ declare module google.maps { export interface DirectionsRoute { bounds: LatLngBounds; copyrights: string; + fare: TransitFare; legs: DirectionsLeg[]; overview_path: LatLng[]; + overview_polyline: string; warnings: string[]; waypoint_order: number[]; } export interface DirectionsLeg { - arrival_time: Distance; - departure_time: Duration; + arrival_time: Time; + departure_time: Time; distance: Distance; duration: Duration; + duration_in_traffic: Duration; end_address: string; end_location: LatLng; start_address: string; @@ -899,11 +896,31 @@ declare module google.maps { icon: string; local_icon: string; name: string; - type: string; + type: VehicleType; + } + + export enum VehicleType + { + BUS, + CABLE_CAR, + COMMUTER_TRAIN, + FERRY, + FUNICULAR, + GONDOLA_LIFT, + HEAVY_RAIL, + HIGH_SPEED_TRAIN, + INTERCITY_BUS, + METRO_RAIL, + MONORAIL, + OTHER, + RAIL, + SHARE_TAXI, + SUBWAY, + TRAM, + TROLLEYBUS } export class ElevationService { - constructor (); getElevationAlongPath(request: PathElevationRequest, callback: (results: ElevationResult[], status: ElevationStatus) => void ): void; getElevationForLocations(request: LocationElevationRequest, callback: (results: ElevationResult[], status: ElevationStatus) => void ): void; } @@ -932,8 +949,7 @@ declare module google.maps { } export class MaxZoomService { - constructor (); - getMaxZoomAtLatLng(latlng: LatLng, callback: (result: MaxZoomResult) => void ): void; + getMaxZoomAtLatLng(latlng: LatLng|LatLngLiteral, callback: (result: MaxZoomResult) => void ): void; } export interface MaxZoomResult { @@ -947,16 +963,18 @@ declare module google.maps { } export class DistanceMatrixService { - constructor (); getDistanceMatrix(request: DistanceMatrixRequest, callback: (response: DistanceMatrixResponse, status: DistanceMatrixStatus) => void ): void; } export interface DistanceMatrixRequest { + avoidFerries?: boolean; avoidHighways?: boolean; avoidTolls?: boolean; - destinations?: any[]; - origins?: any[]; + destinations?: LatLng[]|string[]; + durationInTraffic?: boolean; + origins?: LatLng[]|string[]; region?: string; + transitOptions?: TransitOptions; travelMode?: TravelMode; unitSystem?: UnitSystem; } @@ -974,6 +992,7 @@ declare module google.maps { export interface DistanceMatrixResponseElement { distance: Distance; duration: Duration; + fare: TransitFare; status: DistanceMatrixElementStatus; } @@ -992,6 +1011,33 @@ declare module google.maps { OK, ZERO_RESULTS } + + /***** Save to Google Maps *****/ + export interface Attribution { + iosDeepLinkId?: string; + source?: string; + webUrl?: string; + } + + export interface Place { + location?: LatLng|LatLngLiteral; + placeId?: string; + query?: string; + } + + export class SaveWidget { + constructor(container: Node, opts?: SaveWidgetOptions); + getAttribution(): Attribution; + getPlace(): Place; + setAttribution(attribution: Attribution): void; + setOptions(opts: SaveWidgetOptions): void; + setPlace(place: Place): void; + } + + export interface SaveWidgetOptions{ + attribution?: Attribution; + place?: Place; + } /***** Map Types *****/ export interface MapType { @@ -1333,7 +1379,7 @@ declare module google.maps { ZERO_RESULTS } - /***** Event *****/ + /***** Events *****/ export interface MapsEventListener { } export class event { @@ -1367,6 +1413,8 @@ declare module google.maps { } + export type LatLngLiteral = { lat: number; lng: number } + export class LatLngBounds { constructor (sw?: LatLng, ne?: LatLng); contains(latLng: LatLng): boolean; @@ -1399,6 +1447,34 @@ declare module google.maps { toString(): string; } + /***** MVC *****/ + export class MVCObject { + constructor (); + addListener(eventName: string, handler: (...args: any[]) => void): MapsEventListener; + bindTo(key: string, target: MVCObject, targetKey?: string, noNotify?: boolean): void; + changed(key: string): void; + get(key: string): any; + notify(key: string): void; + set(key: string, value: any): void; + setValues(values: any): void; + unbind(key: string): void; + unbindAll(): void; + } + + export class MVCArray extends MVCObject { + constructor (array?: any[]); + clear(): void; + forEach(callback: (elem: any, i: number) => void): void; + getArray(): any[]; + getAt(i: number): any; + getLength(): number; + insertAt(i: number, elem: any): void; + pop(): any; + push(elem: any): number; + removeAt(i: number): any; + setAt(i: number, elem: any): void; + } + /***** Geometry Library *****/ export module geometry { export class encoding { From ab71290650b4077c498503315396bece131ae488 Mon Sep 17 00:00:00 2001 From: Rodney Lorrimar Date: Thu, 28 May 2015 10:50:54 +0800 Subject: [PATCH 0039/1358] moment: Include some methods which were added in 2.9.0 --- moment/moment-node.d.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/moment/moment-node.d.ts b/moment/moment-node.d.ts index 13f1b9362e..0a89b7066c 100644 --- a/moment/moment-node.d.ts +++ b/moment/moment-node.d.ts @@ -69,6 +69,7 @@ declare module moment { subtract(d: Duration): Duration; toISOString(): string; + toJSON(): string; } @@ -276,6 +277,12 @@ declare module moment { isSame(b: Date, granularity: string): boolean; isSame(b: number[], granularity: string): boolean; + isBetween(a: Moment, b: Moment, granularity?: string): boolean; + isBetween(a: string, b: string, granularity?: string): boolean; + isBetween(a: number, b: number, granularity?: string): boolean; + isBetween(a: Date, b: Date, granularity?: string): boolean; + isBetween(a: number[], b: number[], granularity?: string): boolean; + // Deprecated as of 2.8.0. lang(language: string): Moment; lang(reset: boolean): Moment; @@ -412,6 +419,7 @@ declare module moment { invalid(parsingFlags?: Object): Moment; isMoment(): boolean; isMoment(m: any): boolean; + isDate(m: any): boolean; isDuration(): boolean; isDuration(d: any): boolean; From dbbc90296b72294f8099c19e724c37447dca43f3 Mon Sep 17 00:00:00 2001 From: Rodney Lorrimar Date: Thu, 28 May 2015 10:51:22 +0800 Subject: [PATCH 0040/1358] moment: Tests for 2.9.0 methods --- moment/moment-external-tests.ts | 7 +++++++ moment/moment-tests.ts | 9 +++++++++ 2 files changed, 16 insertions(+) diff --git a/moment/moment-external-tests.ts b/moment/moment-external-tests.ts index c5855c12c7..b76752b118 100644 --- a/moment/moment-external-tests.ts +++ b/moment/moment-external-tests.ts @@ -196,10 +196,17 @@ moment.isMoment(); moment.isMoment(new Date()); moment.isMoment(moment()); +moment.isDate(new Date()); +moment.isDate(/regexp/); + moment.isDuration(); moment.isDuration(new Date()); moment.isDuration(moment.duration()); +moment().isBetween(moment(), moment()); +moment().isBetween(new Date(), new Date()); +moment().isBetween([1,1,2000], [1,1,2001], "year"); + moment.localeData('fr'); moment(1316116057189).fromNow(); diff --git a/moment/moment-tests.ts b/moment/moment-tests.ts index 16490d2e19..04c0753529 100644 --- a/moment/moment-tests.ts +++ b/moment/moment-tests.ts @@ -196,10 +196,17 @@ moment.isMoment(); moment.isMoment(new Date()); moment.isMoment(moment()); +moment.isDate(new Date()); +moment.isDate(/regexp/); + moment.isDuration(); moment.isDuration(new Date()); moment.isDuration(moment.duration()); +moment().isBetween(moment(), moment()); +moment().isBetween(new Date(), new Date()); +moment().isBetween([1,1,2000], [1,1,2001], "year"); + moment.localeData('fr'); moment(1316116057189).fromNow(); @@ -228,6 +235,8 @@ moment.duration(500).seconds(); moment.duration(500).asSeconds(); moment.duration().minutes(); moment.duration().asMinutes(); +moment.duration().toISOString(); +moment.duration().toJSON(); var adur = moment.duration(3, 'd'); var bdur = moment.duration(2, 'd'); From 8064aa89b0ccf592a507ccd8f5e0389818abb64b Mon Sep 17 00:00:00 2001 From: Rodney Lorrimar Date: Tue, 2 Jun 2015 11:30:14 +0800 Subject: [PATCH 0041/1358] moment: Use type union for methods with moment-like parameters --- moment/moment-node.d.ts | 59 ++++++----------------------------------- 1 file changed, 8 insertions(+), 51 deletions(-) diff --git a/moment/moment-node.d.ts b/moment/moment-node.d.ts index 0a89b7066c..eaacb8855f 100644 --- a/moment/moment-node.d.ts +++ b/moment/moment-node.d.ts @@ -216,11 +216,8 @@ declare module moment { dayOfYear(): number; dayOfYear(d: number): Moment; - from(f: Moment): string; - from(f: Moment, suffix: boolean): string; - from(d: Date): string; - from(s: string): string; - from(date: number[]): string; + from(f: Moment|string|number|Date|number[], suffix?: boolean): string; + to(f: Moment|string|number|Date|number[], suffix?: boolean): string; diff(b: Moment): number; diff(b: Moment, unitOfTime: string): number; @@ -243,45 +240,13 @@ declare module moment { isDST(): boolean; isBefore(): boolean; - isBefore(b: Moment): boolean; - isBefore(b: string): boolean; - isBefore(b: Number): boolean; - isBefore(b: Date): boolean; - isBefore(b: number[]): boolean; - isBefore(b: Moment, granularity: string): boolean; - isBefore(b: String, granularity: string): boolean; - isBefore(b: Number, granularity: string): boolean; - isBefore(b: Date, granularity: string): boolean; - isBefore(b: number[], granularity: string): boolean; + isBefore(b: Moment|string|number|Date|number[], granularity?: string): boolean; isAfter(): boolean; - isAfter(b: Moment): boolean; - isAfter(b: string): boolean; - isAfter(b: Number): boolean; - isAfter(b: Date): boolean; - isAfter(b: number[]): boolean; - isAfter(b: Moment, granularity: string): boolean; - isAfter(b: String, granularity: string): boolean; - isAfter(b: Number, granularity: string): boolean; - isAfter(b: Date, granularity: string): boolean; - isAfter(b: number[], granularity: string): boolean; + isAfter(b: Moment|string|number|Date|number[], granularity?: string): boolean; - isSame(b: Moment): boolean; - isSame(b: string): boolean; - isSame(b: Number): boolean; - isSame(b: Date): boolean; - isSame(b: number[]): boolean; - isSame(b: Moment, granularity: string): boolean; - isSame(b: String, granularity: string): boolean; - isSame(b: Number, granularity: string): boolean; - isSame(b: Date, granularity: string): boolean; - isSame(b: number[], granularity: string): boolean; - - isBetween(a: Moment, b: Moment, granularity?: string): boolean; - isBetween(a: string, b: string, granularity?: string): boolean; - isBetween(a: number, b: number, granularity?: string): boolean; - isBetween(a: Date, b: Date, granularity?: string): boolean; - isBetween(a: number[], b: number[], granularity?: string): boolean; + isSame(b: Moment|string|number|Date|number[], granularity?: string): boolean; + isBetween(a: Moment|string|number|Date|number[], b: Moment|string|number|Date|number[], granularity?: string): boolean; // Deprecated as of 2.8.0. lang(language: string): Moment; @@ -297,20 +262,12 @@ declare module moment { localeData(): MomentLanguage; // Deprecated as of 2.7.0. - max(date: Date): Moment; - max(date: number): Moment; - max(date: any[]): Moment; - max(date: string): Moment; + max(date: Moment|string|number|Date|any[]): Moment; max(date: string, format: string): Moment; - max(clone: Moment): Moment; // Deprecated as of 2.7.0. - min(date: Date): Moment; - min(date: number): Moment; - min(date: any[]): Moment; - min(date: string): Moment; + min(date: Moment|string|number|Date|any[]): Moment; min(date: string, format: string): Moment; - min(clone: Moment): Moment; get(unit: string): number; set(unit: string, value: number): Moment; From 2f1df1f63590f9b97134414eab0ea53eea206c94 Mon Sep 17 00:00:00 2001 From: Nick Lee Date: Tue, 2 Jun 2015 12:21:16 -0400 Subject: [PATCH 0042/1358] Added IP and Hostname validators to Joi.d.ts --- joi/joi.d.ts | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/joi/joi.d.ts b/joi/joi.d.ts index 5e4bfc37bf..3df8ada9e0 100644 --- a/joi/joi.d.ts +++ b/joi/joi.d.ts @@ -47,11 +47,16 @@ declare module 'joi' { contextPrefix?: string; } + export interface IPOptions { + version?: Array; + cidr?: string + } + export interface ValidationError { message: string; details: ValidationErrorItem[]; - simple (): string; - annotated (): string; + simple(): string; + annotated(): string; } export interface ValidationErrorItem { @@ -82,19 +87,19 @@ declare module 'joi' { /** * Whitelists a value */ - allow(value: any, ...values : any[]): T; + allow(value: any, ...values: any[]): T; allow(values: any[]): T; /** * Adds the provided values into the allowed whitelist and marks them as the only valid values allowed. */ - valid(value: any, ...values : any[]): T; + valid(value: any, ...values: any[]): T; valid(values: any[]): T; /** * Blacklists a value */ - invalid(value: any, ...values : any[]): T; + invalid(value: any, ...values: any[]): T; invalid(values: any[]): T; /** @@ -257,6 +262,16 @@ declare module 'joi' { * Requires the string value to contain no whitespace before or after. If the validation convert option is on (enabled by default), the string will be trimmed. */ trim(): StringSchema; + + /** + * Requires the string value be a valid hostname. + */ + hostname(): StringSchema; + + /** + * Requires the string value to be a valid IP address. + */ + ip(options: IPOptions): StringSchema; /** * Requires the string value to be a valid uri with the passed scheme. @@ -364,7 +379,7 @@ declare module 'joi' { /** * Overrides the handling of unknown keys for the scope of the current object only (does not apply to children). */ - unknown(allow?:boolean): ObjectSchema; + unknown(allow?: boolean): ObjectSchema; } export interface BinarySchema extends AnySchema { @@ -486,5 +501,5 @@ declare module 'joi' { /** * Generates a reference to the value of the named key. */ - export function ref(key:string, options?: ReferenceOptions): Reference; + export function ref(key: string, options?: ReferenceOptions): Reference; } From cde81f5458364ef1dc43a85e1be6a9e132c94e11 Mon Sep 17 00:00:00 2001 From: Nick Lee Date: Wed, 3 Jun 2015 11:18:34 -0400 Subject: [PATCH 0043/1358] exported BoomError interface on Boom.d.ts --- boom/boom.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/boom/boom.d.ts b/boom/boom.d.ts index d0f05065cf..e1539d21b3 100644 --- a/boom/boom.d.ts +++ b/boom/boom.d.ts @@ -6,7 +6,8 @@ /// declare module Boom { - interface BoomError { + + export interface BoomError { data: any; reformat: () => void; isBoom: boolean; From 60d204c382a6a5126f9708b3848cf783cd535717 Mon Sep 17 00:00:00 2001 From: Vadim Macagon Date: Thu, 4 Jun 2015 16:49:28 +0700 Subject: [PATCH 0044/1358] Extend Mocha typings to allow writing of custom reporters --- mocha/mocha-tests.ts | 34 +++++++ mocha/mocha.d.ts | 230 ++++++++++++++++++++++++++----------------- 2 files changed, 173 insertions(+), 91 deletions(-) diff --git a/mocha/mocha-tests.ts b/mocha/mocha-tests.ts index f90fefaf96..a2e2b07961 100644 --- a/mocha/mocha-tests.ts +++ b/mocha/mocha-tests.ts @@ -249,3 +249,37 @@ function test_run_withOnComplete() { console.log(failures); }); } + +class CustomSpecReporter extends MochaDef.reporters.Spec { + constructor(runner: Mocha.IRunner) { + super(runner); + + runner.on('test', (test: Mocha.ITest) => { + console.log(test.parent.title + '/' + test.title); + }); + } +} + +class MyReporter extends MochaDef.reporters.Base { + passes: number = 0; + failures: number = 0; + + constructor(runner: Mocha.IRunner) { + super(runner); + + runner.on('pass', (test: Mocha.ITest) => { + this.passes++; + console.log('pass: %s', test.fullTitle()); + }); + + runner.on('fail', (test: Mocha.ITest, err: Error) => { + this.failures++; + console.log('fail: %s -- error: %s', test.fullTitle(), err.message); + }); + + runner.on('end', () => { + console.log('end: %d/%d', this.passes, this.passes + this.failures); + process.exit(this.failures); + }); + } +} diff --git a/mocha/mocha.d.ts b/mocha/mocha.d.ts index 63ad66014a..fefd919466 100644 --- a/mocha/mocha.d.ts +++ b/mocha/mocha.d.ts @@ -1,24 +1,9 @@ -// Type definitions for mocha 2.0.1 +// Type definitions for mocha 2.2.5 // Project: http://mochajs.org/ -// Definitions by: Kazi Manzur Rashid , otiai10 , jt000 +// Definitions by: Kazi Manzur Rashid , otiai10 , jt000 , Vadim Macagon // Definitions: https://github.com/borisyankov/DefinitelyTyped -interface Mocha { - // Setup mocha with the given setting options. - setup(options: MochaSetupOptions): Mocha; - - //Run tests and invoke `fn()` when complete. - run(callback?: () => void): void; - - // Set reporter as function - reporter(reporter: () => void): Mocha; - - // Set reporter, defaults to "dot" - reporter(reporter: string): Mocha; - - // Enable growl support. - growl(): Mocha -} +/// interface MochaSetupOptions { //milliseconds to wait before considering a test slow @@ -33,7 +18,7 @@ interface MochaSetupOptions { //array of accepted globals globals?: any[]; - // reporter instance (function or string), defaults to `mocha.reporters.Dot` + // reporter instance (function or string), defaults to `mocha.reporters.Spec` reporter?: any; // bail on the first test failure @@ -45,56 +30,20 @@ interface MochaSetupOptions { // grep string or regexp to filter tests with grep?: any; } - + interface MochaDone { (error?: Error): void; } declare var mocha: Mocha; - -declare var describe: { - (description: string, spec: () => void): void; - only(description: string, spec: () => void): void; - skip(description: string, spec: () => void): void; - timeout(ms: number): void; -} - +declare var describe: Mocha.IContextDefinition; // alias for `describe` -declare var context: { - (contextTitle: string, spec: () => void): void; - only(contextTitle: string, spec: () => void): void; - skip(contextTitle: string, spec: () => void): void; - timeout(ms: number): void; -}; - +declare var context: Mocha.IContextDefinition; // alias for `describe` -declare var suite: { - (suiteTitle: string, spec: () => void): void; - only(suiteTitle: string, spec: () => void): void; - skip(suiteTitle: string, spec: () => void): void; - timeout(ms: number): void; -}; - -declare var it: { - (expectation: string, assertion?: () => void): void; - (expectation: string, assertion?: (done: MochaDone) => void): void; - only(expectation: string, assertion?: () => void): void; - only(expectation: string, assertion?: (done: MochaDone) => void): void; - skip(expectation: string, assertion?: () => void): void; - skip(expectation: string, assertion?: (done: MochaDone) => void): void; - timeout(ms: number): void; -}; - +declare var suite: Mocha.IContextDefinition; +declare var it: Mocha.ITestDefinition; // alias for `it` -declare var test: { - (expectation: string, assertion?: () => void): void; - (expectation: string, assertion?: (done: MochaDone) => void): void; - only(expectation: string, assertion?: () => void): void; - only(expectation: string, assertion?: (done: MochaDone) => void): void; - skip(expectation: string, assertion?: () => void): void; - skip(expectation: string, assertion?: (done: MochaDone) => void): void; - timeout(ms: number): void; -}; +declare var test: Mocha.ITestDefinition; declare function before(action: () => void): void; @@ -128,39 +77,138 @@ declare function suiteTeardown(action: () => void): void; declare function suiteTeardown(action: (done: MochaDone) => void): void; -declare module "mocha" { +declare class Mocha { + constructor(options?: { + grep?: RegExp; + ui?: string; + reporter?: string; + timeout?: number; + bail?: boolean; + }); - class Mocha { - constructor(options?: { - grep?: RegExp; - ui?: string; - reporter?: string; - timeout?: number; - bail?: boolean; - }); + /** Setup mocha with the given options. */ + setup(options: MochaSetupOptions): Mocha; + bail(value?: boolean): Mocha; + addFile(file: string): Mocha; + /** Sets reporter by name, defaults to "spec". */ + reporter(name: string): Mocha; + /** Sets reporter constructor, defaults to mocha.reporters.Spec. */ + reporter(reporter: (runner: Mocha.IRunner, options: any) => any): Mocha; + ui(value: string): Mocha; + grep(value: string): Mocha; + grep(value: RegExp): Mocha; + invert(): Mocha; + ignoreLeaks(value: boolean): Mocha; + checkLeaks(): Mocha; + /** Enables growl support. */ + growl(): Mocha; + globals(value: string): Mocha; + globals(values: string[]): Mocha; + useColors(value: boolean): Mocha; + useInlineDiffs(value: boolean): Mocha; + timeout(value: number): Mocha; + slow(value: number): Mocha; + enableTimeouts(value: boolean): Mocha; + asyncOnly(value: boolean): Mocha; + noHighlighting(value: boolean): Mocha; + /** Runs tests and invokes `onComplete()` when finished. */ + run(onComplete?: (failures: number) => void): Mocha.IRunner; +} - bail(value?: boolean): Mocha; - addFile(file: string): Mocha; - reporter(value: string): Mocha; - ui(value: string): Mocha; - grep(value: string): Mocha; - grep(value: RegExp): Mocha; - invert(): Mocha; - ignoreLeaks(value: boolean): Mocha; - checkLeaks(): Mocha; - growl(): Mocha; - globals(value: string): Mocha; - globals(values: string[]): Mocha; - useColors(value: boolean): Mocha; - useInlineDiffs(value: boolean): Mocha; - timeout(value: number): Mocha; - slow(value: number): Mocha; - enableTimeouts(value: boolean): Mocha; - asyncOnly(value: boolean): Mocha; - noHighlighting(value: boolean): Mocha; - - run(onComplete?: (failures: number) => void): void; +// merge the Mocha class declaration with a module +declare module Mocha { + /** Partial interface for Mocha's `Runnable` class. */ + interface IRunnable extends NodeJS.EventEmitter { + title: string; + fn: Function; + async: boolean; + sync: boolean; + timedOut: boolean; } + /** Partial interface for Mocha's `Suite` class. */ + interface ISuite extends NodeJS.EventEmitter { + parent: ISuite; + title: string; + + fullTitle(): string; + } + + /** Partial interface for Mocha's `Test` class. */ + interface ITest extends IRunnable { + parent: ISuite; + pending: boolean; + + fullTitle(): string; + } + + /** Partial interface for Mocha's `Runner` class. */ + interface IRunner extends NodeJS.EventEmitter {} + + interface IContextDefinition { + (description: string, spec: () => void): ISuite; + only(description: string, spec: () => void): ISuite; + skip(description: string, spec: () => void): void; + timeout(ms: number): void; + } + + interface ITestDefinition { + (expectation: string, assertion?: () => void): ITest; + (expectation: string, assertion?: (done: MochaDone) => void): ITest; + only(expectation: string, assertion?: () => void): ITest; + only(expectation: string, assertion?: (done: MochaDone) => void): ITest; + skip(expectation: string, assertion?: () => void): void; + skip(expectation: string, assertion?: (done: MochaDone) => void): void; + timeout(ms: number): void; + } + + export module reporters { + export class Base { + stats: { + suites: number; + tests: number; + passes: number; + pending: number; + failures: number; + }; + + constructor(runner: IRunner); + } + + export class Doc extends Base {} + export class Dot extends Base {} + export class HTML extends Base {} + export class HTMLCov extends Base {} + export class JSON extends Base {} + export class JSONCov extends Base {} + export class JSONStream extends Base {} + export class Landing extends Base {} + export class List extends Base {} + export class Markdown extends Base {} + export class Min extends Base {} + export class Nyan extends Base {} + export class Progress extends Base { + /** + * @param options.open String used to indicate the start of the progress bar. + * @param options.complete String used to indicate a complete test on the progress bar. + * @param options.incomplete String used to indicate an incomplete test on the progress bar. + * @param options.close String used to indicate the end of the progress bar. + */ + constructor(runner: IRunner, options?: { + open?: string; + complete?: string; + incomplete?: string; + close?: string; + }); + } + export class Spec extends Base {} + export class TAP extends Base {} + export class XUnit extends Base { + constructor(runner: IRunner, options?: any); + } + } +} + +declare module "mocha" { export = Mocha; } From 8f9ff607f0a79e5a976682d00ce156781f9efd19 Mon Sep 17 00:00:00 2001 From: Rodney Lorrimar Date: Sat, 6 Jun 2015 16:26:00 +0800 Subject: [PATCH 0045/1358] moment: Use type alias for moment-like parameters --- moment/moment-node.d.ts | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/moment/moment-node.d.ts b/moment/moment-node.d.ts index eaacb8855f..f491833f9d 100644 --- a/moment/moment-node.d.ts +++ b/moment/moment-node.d.ts @@ -216,8 +216,8 @@ declare module moment { dayOfYear(): number; dayOfYear(d: number): Moment; - from(f: Moment|string|number|Date|number[], suffix?: boolean): string; - to(f: Moment|string|number|Date|number[], suffix?: boolean): string; + from(f: MomentLike, suffix?: boolean): string; + to(f: MomentLike, suffix?: boolean): string; diff(b: Moment): number; diff(b: Moment, unitOfTime: string): number; @@ -240,13 +240,13 @@ declare module moment { isDST(): boolean; isBefore(): boolean; - isBefore(b: Moment|string|number|Date|number[], granularity?: string): boolean; + isBefore(b: MomentLike, granularity?: string): boolean; isAfter(): boolean; - isAfter(b: Moment|string|number|Date|number[], granularity?: string): boolean; + isAfter(b: MomentLike, granularity?: string): boolean; - isSame(b: Moment|string|number|Date|number[], granularity?: string): boolean; - isBetween(a: Moment|string|number|Date|number[], b: Moment|string|number|Date|number[], granularity?: string): boolean; + isSame(b: MomentLike, granularity?: string): boolean; + isBetween(a: MomentLike, b: MomentLike, granularity?: string): boolean; // Deprecated as of 2.8.0. lang(language: string): Moment; @@ -262,11 +262,11 @@ declare module moment { localeData(): MomentLanguage; // Deprecated as of 2.7.0. - max(date: Moment|string|number|Date|any[]): Moment; + max(date: MomentLike|any[]): Moment; max(date: string, format: string): Moment; // Deprecated as of 2.7.0. - min(date: Moment|string|number|Date|any[]): Moment; + min(date: MomentLike|any[]): Moment; min(date: string, format: string): Moment; get(unit: string): number; @@ -439,6 +439,9 @@ declare module moment { } + // Moment.js automatically converts datetime parameters from a number of types + type MomentLike = Moment | string | number | Date | number[]; + } declare module 'moment' { From eb5f7c2d2a1ee0de72fe9d8b40c9d33ec2612e63 Mon Sep 17 00:00:00 2001 From: Michael Nahkies Date: Wed, 10 Jun 2015 16:38:16 +1200 Subject: [PATCH 0046/1358] Add definition with test for when.settle, add a test for when.all --- when/when-tests.ts | 10 ++++++++++ when/when.d.ts | 26 ++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/when/when-tests.ts b/when/when-tests.ts index 61b688a035..7f365b4cc1 100644 --- a/when/when-tests.ts +++ b/when/when-tests.ts @@ -91,6 +91,16 @@ promise = liftedFunc5(when(1), when('2'), when(true), when(4), when('5')); var joinedPromise: when.Promise = when.join(when(1), when(2), when(3)); +/* when.all(arr) */ +when.all([when(1), when(2), when(3)]).then(results => { + return results.reduce((r, x) => r + x, 0); +}); + +/* when.settle(arr) */ +when.settle([when(1), when(2), when.reject(new Error("Foo"))]).then(descriptors => { + return descriptors.filter(d => d.state === 'rejected').reduce((r, d) => r + d.value, 0); +}); + /* when.promise(resolver) */ promise = when.promise(resolve => resolve(5)); diff --git a/when/when.d.ts b/when/when.d.ts index be5e25f154..ab44901de6 100644 --- a/when/when.d.ts +++ b/when/when.d.ts @@ -101,6 +101,32 @@ declare module When { */ function all(promisesOrValues: any[]): Promise; + /** + * Describes the status of a promise. + * state may be one of: + * "fulfilled" - the promise has resolved + * "pending" - the promise is still pending to resolve/reject + * "rejected" - the promise has rejected + */ + interface Descriptor { + state: string; + value?: T; + reason?: any; + } + + /** + * Returns a promise for an array containing the same number of elements as the input array. + * Each element is a descriptor object describing of the outcome of the corresponding element in the input. + * The returned promise will only reject if array itself is a rejected promise. Otherwise, + * it will always fulfill with an array of descriptors. This is in contrast to when.all, + * which will reject if any element of array rejects. + * @memberOf when + * + * @param promisesOrValues array of anything, may contain a mix + * of {@link Promise}s and values + */ + function settle(promisesOrValues: any[]): Promise[]>; + /** * Creates a {promise, resolver} pair, either or both of which * may be given out safely to consumers. From 097dc2e2ba1f05755500a722c209715e56b40621 Mon Sep 17 00:00:00 2001 From: Michael Nahkies Date: Wed, 10 Jun 2015 17:01:55 +1200 Subject: [PATCH 0047/1358] Add definition with tests for spread --- when/when-tests.ts | 8 +++++--- when/when.d.ts | 7 +++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/when/when-tests.ts b/when/when-tests.ts index 61b688a035..602a2867ed 100644 --- a/when/when-tests.ts +++ b/when/when-tests.ts @@ -132,9 +132,11 @@ promise = when(1).then((val: number) => when(val + val), (err: any) => 2); /* promise.spread(onFulfilledArray) */ -// TODO: Work out how to do this... -// promise = when([1, '2', true]).spread((a: number, b: string, c: boolean) => a); -// promise = when([1, '2', true]).spread((a: number, b: string, c: boolean) => when(a)); +promise = when([]).spread(() => 2); +promise = when([1]).spread((a: number) => a); +promise = when([1, '2']).spread((a: number, b: string) => a); +promise = when([1, '2', true]).spread((a: number, b: string, c: boolean) => a); +promise = when([1, '2', true]).spread((a: number, b: string, c: boolean) => when(a)); /* promise.fold(combine, promise2) */ diff --git a/when/when.d.ts b/when/when.d.ts index be5e25f154..cd99d2a9a0 100644 --- a/when/when.d.ts +++ b/when/when.d.ts @@ -180,6 +180,13 @@ declare module When { then(onFulfilled: (value: T) => U | Promise, onRejected?: (reason: any) => U | Promise, onProgress?: (update: any) => void): Promise; + spread(onFulfilled: _.Fn0 | T>): Promise; + spread(onFulfilled: _.Fn1 | T>): Promise; + spread(onFulfilled: _.Fn2 | T>): Promise; + spread(onFulfilled: _.Fn3 | T>): Promise; + spread(onFulfilled: _.Fn4 | T>): Promise; + spread(onFulfilled: _.Fn5 | T>): Promise; + done(onFulfilled: (value: T) => void, onRejected?: (reason: any) => void): void; fold(combine: (value1: T, value2: V) => U | Promise, value2: V | Promise): Promise; From dc8494fbc793686888120bd23bc4c385ce37cdde Mon Sep 17 00:00:00 2001 From: Tsvetomir Tsonev Date: Wed, 10 Jun 2015 14:45:48 +0300 Subject: [PATCH 0048/1358] Update Kendo UI headers and definitions Closes #3976 for real --- kendo-ui/kendo-ui-tests.ts | 3 +- kendo-ui/kendo-ui.d.ts | 905 +++++++++++++++++++------------------ 2 files changed, 458 insertions(+), 450 deletions(-) diff --git a/kendo-ui/kendo-ui-tests.ts b/kendo-ui/kendo-ui-tests.ts index a9944b6afe..3c8a9bc042 100644 --- a/kendo-ui/kendo-ui-tests.ts +++ b/kendo-ui/kendo-ui-tests.ts @@ -1 +1,2 @@ -/// \ No newline at end of file +/// +/// diff --git a/kendo-ui/kendo-ui.d.ts b/kendo-ui/kendo-ui.d.ts index 3f5cb5d4fa..0683ab238b 100644 --- a/kendo-ui/kendo-ui.d.ts +++ b/kendo-ui/kendo-ui.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Kendo UI +// Type definitions for Kendo UI Professional v2015.1.609 // Project: http://www.telerik.com/kendo-ui -// Definitions by: Stefan Rahnev +// Definitions by: Telerik // Definitions: https://github.com/borisyankov/DefinitelyTyped declare module kendo { @@ -1364,6 +1364,7 @@ declare module kendo.mobile { options: ApplicationOptions; hideLoading(): void; navigate(url: string, transition?: string): void; + replace(url: string, transition?: string): void; scroller(): kendo.mobile.ui.Scroller; showLoading(): void; view(): kendo.mobile.ui.View; @@ -1428,9 +1429,225 @@ declare module kendo.dataviz.map.layer { } } +declare module kendo.geometry { + class Arc extends Observable { + options: ArcOptions; + bbox(matrix: kendo.geometry.Matrix): kendo.geometry.Rect; + getAnticlockwise(): boolean; + getCenter(): kendo.geometry.Point; + getEndAngle(): number; + getRadiusX(): number; + getRadiusY(): number; + getStartAngle(): number; + pointAt(angle: number): kendo.geometry.Point; + setAnticlockwise(value: boolean): kendo.geometry.Arc; + setCenter(value: kendo.geometry.Point): kendo.geometry.Arc; + setEndAngle(value: number): kendo.geometry.Arc; + setRadiusX(value: number): kendo.geometry.Arc; + setRadiusY(value: number): kendo.geometry.Arc; + setStartAngle(value: number): kendo.geometry.Arc; + anticlockwise: boolean; + center: kendo.geometry.Point; + endAngle: number; + radiusX: number; + radiusY: number; + startAngle: number; + } + + interface ArcOptions { + name?: string; + } + interface ArcEvent { + sender: Arc; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Circle extends Observable { + options: CircleOptions; + bbox(matrix: kendo.geometry.Matrix): kendo.geometry.Rect; + clone(): kendo.geometry.Circle; + equals(other: kendo.geometry.Circle): boolean; + getCenter(): kendo.geometry.Point; + getRadius(): number; + pointAt(angle: number): kendo.geometry.Point; + setCenter(value: kendo.geometry.Point): kendo.geometry.Point; + setCenter(value: any): kendo.geometry.Point; + setRadius(value: number): kendo.geometry.Circle; + center: kendo.geometry.Point; + radius: number; + } + + interface CircleOptions { + name?: string; + } + interface CircleEvent { + sender: Circle; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Matrix extends Observable { + options: MatrixOptions; + clone(): kendo.geometry.Matrix; + equals(other: kendo.geometry.Matrix): boolean; + round(digits: number): kendo.geometry.Matrix; + multiplyCopy(matrix: kendo.geometry.Matrix): kendo.geometry.Matrix; + toArray(digits: number): any; + toString(digits: number, separator: string): string; + static rotate(angle: number, x: number, y: number): kendo.geometry.Matrix; + static scale(scaleX: number, scaleY: number): kendo.geometry.Matrix; + static translate(x: number, y: number): kendo.geometry.Matrix; + static unit(): kendo.geometry.Matrix; + a: number; + b: number; + c: number; + d: number; + e: number; + f: number; + } + + interface MatrixOptions { + name?: string; + } + interface MatrixEvent { + sender: Matrix; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Point extends Observable { + options: PointOptions; + clone(): kendo.geometry.Point; + distanceTo(point: kendo.geometry.Point): number; + equals(other: kendo.geometry.Point): boolean; + getX(): number; + getY(): number; + move(x: number, y: number): kendo.geometry.Point; + rotate(angle: number, center: kendo.geometry.Point): kendo.geometry.Point; + rotate(angle: number, center: any): kendo.geometry.Point; + round(digits: number): kendo.geometry.Point; + scale(scaleX: number, scaleY: number): kendo.geometry.Point; + scaleCopy(scaleX: number, scaleY: number): kendo.geometry.Point; + setX(value: number): kendo.geometry.Point; + setY(value: number): kendo.geometry.Point; + toArray(digits: number): any; + toString(digits: number, separator: string): string; + transform(tansformation: kendo.geometry.Transformation): kendo.geometry.Point; + transformCopy(tansformation: kendo.geometry.Transformation): kendo.geometry.Point; + translate(dx: number, dy: number): kendo.geometry.Point; + translateWith(vector: kendo.geometry.Point): kendo.geometry.Point; + translateWith(vector: any): kendo.geometry.Point; + static create(x: number, y: number): kendo.geometry.Point; + static create(x: any, y: number): kendo.geometry.Point; + static create(x: kendo.geometry.Point, y: number): kendo.geometry.Point; + static min(): kendo.geometry.Point; + static max(): kendo.geometry.Point; + static minPoint(): kendo.geometry.Point; + static maxPoint(): kendo.geometry.Point; + x: number; + y: number; + } + + interface PointOptions { + name?: string; + } + interface PointEvent { + sender: Point; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Rect extends Observable { + constructor(origin: kendo.geometry.Point, size: kendo.geometry.Size); + options: RectOptions; + bbox(matrix: kendo.geometry.Matrix): kendo.geometry.Rect; + bottomLeft(): kendo.geometry.Point; + bottomRight(): kendo.geometry.Point; + center(): kendo.geometry.Point; + clone(): kendo.geometry.Rect; + equals(other: kendo.geometry.Rect): boolean; + getOrigin(): kendo.geometry.Point; + getSize(): kendo.geometry.Size; + height(): number; + setOrigin(value: kendo.geometry.Point): kendo.geometry.Rect; + setOrigin(value: any): kendo.geometry.Rect; + setSize(value: kendo.geometry.Size): kendo.geometry.Rect; + setSize(value: any): kendo.geometry.Rect; + topLeft(): kendo.geometry.Point; + topRight(): kendo.geometry.Point; + width(): number; + static fromPoints(pointA: kendo.geometry.Point, pointB: kendo.geometry.Point): kendo.geometry.Rect; + static union(rectA: kendo.geometry.Rect, rectB: kendo.geometry.Rect): kendo.geometry.Rect; + origin: kendo.geometry.Point; + size: kendo.geometry.Size; + } + + interface RectOptions { + name?: string; + } + interface RectEvent { + sender: Rect; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Size extends Observable { + options: SizeOptions; + clone(): kendo.geometry.Size; + equals(other: kendo.geometry.Size): boolean; + getWidth(): number; + getHeight(): number; + setWidth(value: number): kendo.geometry.Size; + setHeight(value: number): kendo.geometry.Size; + static create(width: number, height: number): kendo.geometry.Size; + static create(width: any, height: number): kendo.geometry.Size; + static create(width: kendo.geometry.Size, height: number): kendo.geometry.Size; + width: number; + height: number; + } + + interface SizeOptions { + name?: string; + } + interface SizeEvent { + sender: Size; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Transformation extends Observable { + options: TransformationOptions; + clone(): kendo.geometry.Transformation; + equals(other: kendo.geometry.Transformation): boolean; + matrix(): kendo.geometry.Matrix; + multiply(transformation: kendo.geometry.Transformation): kendo.geometry.Transformation; + rotate(angle: number, center: any): kendo.geometry.Transformation; + rotate(angle: number, center: kendo.geometry.Point): kendo.geometry.Transformation; + scale(scaleX: number, scaleY: number): kendo.geometry.Transformation; + translate(x: number, y: number): kendo.geometry.Transformation; + } + + interface TransformationOptions { + name?: string; + } + interface TransformationEvent { + sender: Transformation; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + +} declare module kendo.drawing { class Arc extends kendo.drawing.Element { - constructor(options?: ArcOptions); + constructor(geometry: kendo.geometry.Arc, options?: ArcOptions); options: ArcOptions; bbox(): kendo.geometry.Rect; clip(): kendo.drawing.Path; @@ -1465,7 +1682,7 @@ declare module kendo.drawing { class Circle extends kendo.drawing.Element { - constructor(options?: CircleOptions); + constructor(geometry: kendo.geometry.Circle, options?: CircleOptions); options: CircleOptions; bbox(): kendo.geometry.Rect; clip(): kendo.drawing.Path; @@ -1605,7 +1822,7 @@ declare module kendo.drawing { class Image extends kendo.drawing.Element { - constructor(options?: ImageOptions); + constructor(src: string, rect: kendo.geometry.Rect); options: ImageOptions; bbox(): kendo.geometry.Rect; clip(): kendo.drawing.Path; @@ -1638,7 +1855,7 @@ declare module kendo.drawing { class Layout extends kendo.drawing.Group { - constructor(options?: LayoutOptions); + constructor(rect: kendo.geometry.Rect, options?: LayoutOptions); options: LayoutOptions; rect(): kendo.geometry.Rect; rect(rect: kendo.geometry.Rect): void; @@ -1733,6 +1950,7 @@ declare module kendo.drawing { class OptionsStore extends kendo.Class { + constructor(options?: OptionsStoreOptions); options: OptionsStoreOptions; get(field: string): any; set(field: string, value: any): void; @@ -1837,6 +2055,7 @@ declare module kendo.drawing { class Segment extends kendo.Class { + constructor(anchor: kendo.geometry.Point, controlIn: kendo.geometry.Point, controlOut: kendo.geometry.Point); options: SegmentOptions; anchor(): kendo.geometry.Point; anchor(value: kendo.geometry.Point): void; @@ -1910,7 +2129,7 @@ declare module kendo.drawing { class Text extends kendo.drawing.Element { - constructor(options?: TextOptions); + constructor(content: string, position: kendo.geometry.Point, options?: TextOptions); options: TextOptions; bbox(): kendo.geometry.Rect; clip(): kendo.drawing.Path; @@ -1947,221 +2166,6 @@ declare module kendo.drawing { } -} -declare module kendo.geometry { - class Arc extends Observable { - options: ArcOptions; - bbox(matrix: kendo.geometry.Matrix): kendo.geometry.Rect; - getAnticlockwise(): boolean; - getCenter(): kendo.geometry.Point; - getEndAngle(): number; - getRadiusX(): number; - getRadiusY(): number; - getStartAngle(): number; - pointAt(angle: number): kendo.geometry.Point; - setAnticlockwise(value: boolean): kendo.geometry.Arc; - setCenter(value: kendo.geometry.Point): kendo.geometry.Arc; - setEndAngle(value: number): kendo.geometry.Arc; - setRadiusX(value: number): kendo.geometry.Arc; - setRadiusY(value: number): kendo.geometry.Arc; - setStartAngle(value: number): kendo.geometry.Arc; - anticlockwise: boolean; - center: kendo.geometry.Point; - endAngle: number; - radiusX: number; - radiusY: number; - startAngle: number; - } - - interface ArcOptions { - name?: string; - } - interface ArcEvent { - sender: Arc; - isDefaultPrevented(): boolean; - preventDefault: Function; - } - - - class Circle extends Observable { - options: CircleOptions; - bbox(matrix: kendo.geometry.Matrix): kendo.geometry.Rect; - clone(): kendo.geometry.Circle; - equals(other: kendo.geometry.Circle): boolean; - getCenter(): kendo.geometry.Point; - getRadius(): number; - pointAt(angle: number): kendo.geometry.Point; - setCenter(value: kendo.geometry.Point): kendo.geometry.Point; - setCenter(value: any): kendo.geometry.Point; - setRadius(value: number): kendo.geometry.Circle; - center: kendo.geometry.Point; - radius: number; - } - - interface CircleOptions { - name?: string; - } - interface CircleEvent { - sender: Circle; - isDefaultPrevented(): boolean; - preventDefault: Function; - } - - - class Matrix extends Observable { - options: MatrixOptions; - clone(): kendo.geometry.Matrix; - equals(other: kendo.geometry.Matrix): boolean; - round(digits: number): kendo.geometry.Matrix; - multiplyCopy(matrix: kendo.geometry.Matrix): kendo.geometry.Matrix; - toArray(digits: number): any; - toString(digits: number, separator: string): string; - static rotate(angle: number, x: number, y: number): kendo.geometry.Matrix; - static scale(scaleX: number, scaleY: number): kendo.geometry.Matrix; - static translate(x: number, y: number): kendo.geometry.Matrix; - static unit(): kendo.geometry.Matrix; - a: number; - b: number; - c: number; - d: number; - e: number; - f: number; - } - - interface MatrixOptions { - name?: string; - } - interface MatrixEvent { - sender: Matrix; - isDefaultPrevented(): boolean; - preventDefault: Function; - } - - - class Point extends Observable { - options: PointOptions; - clone(): kendo.geometry.Point; - distanceTo(point: kendo.geometry.Point): number; - equals(other: kendo.geometry.Point): boolean; - getX(): number; - getY(): number; - move(x: number, y: number): kendo.geometry.Point; - rotate(angle: number, center: kendo.geometry.Point): kendo.geometry.Point; - rotate(angle: number, center: any): kendo.geometry.Point; - round(digits: number): kendo.geometry.Point; - scale(scaleX: number, scaleY: number): kendo.geometry.Point; - scaleCopy(scaleX: number, scaleY: number): kendo.geometry.Point; - setX(value: number): kendo.geometry.Point; - setY(value: number): kendo.geometry.Point; - toArray(digits: number): any; - toString(digits: number, separator: string): string; - transform(tansformation: kendo.geometry.Transformation): kendo.geometry.Point; - transformCopy(tansformation: kendo.geometry.Transformation): kendo.geometry.Point; - translate(dx: number, dy: number): kendo.geometry.Point; - translateWith(vector: kendo.geometry.Point): kendo.geometry.Point; - translateWith(vector: any): kendo.geometry.Point; - static create(x: number, y: number): kendo.geometry.Point; - static create(x: any, y: number): kendo.geometry.Point; - static create(x: kendo.geometry.Point, y: number): kendo.geometry.Point; - static min(): kendo.geometry.Point; - static max(): kendo.geometry.Point; - static minPoint(): kendo.geometry.Point; - static maxPoint(): kendo.geometry.Point; - x: number; - y: number; - } - - interface PointOptions { - name?: string; - } - interface PointEvent { - sender: Point; - isDefaultPrevented(): boolean; - preventDefault: Function; - } - - - class Rect extends Observable { - options: RectOptions; - bbox(matrix: kendo.geometry.Matrix): kendo.geometry.Rect; - bottomLeft(): kendo.geometry.Point; - bottomRight(): kendo.geometry.Point; - center(): kendo.geometry.Point; - clone(): kendo.geometry.Rect; - equals(other: kendo.geometry.Rect): boolean; - getOrigin(): kendo.geometry.Point; - getSize(): kendo.geometry.Size; - height(): number; - setOrigin(value: kendo.geometry.Point): kendo.geometry.Rect; - setOrigin(value: any): kendo.geometry.Rect; - setSize(value: kendo.geometry.Size): kendo.geometry.Rect; - setSize(value: any): kendo.geometry.Rect; - topLeft(): kendo.geometry.Point; - topRight(): kendo.geometry.Point; - width(): number; - static fromPoints(pointA: kendo.geometry.Point, pointB: kendo.geometry.Point): kendo.geometry.Rect; - static union(rectA: kendo.geometry.Rect, rectB: kendo.geometry.Rect): kendo.geometry.Rect; - origin: kendo.geometry.Point; - size: kendo.geometry.Size; - } - - interface RectOptions { - name?: string; - } - interface RectEvent { - sender: Rect; - isDefaultPrevented(): boolean; - preventDefault: Function; - } - - - class Size extends Observable { - options: SizeOptions; - clone(): kendo.geometry.Size; - equals(other: kendo.geometry.Size): boolean; - getWidth(): number; - getHeight(): number; - setWidth(value: number): kendo.geometry.Size; - setHeight(value: number): kendo.geometry.Size; - static create(width: number, height: number): kendo.geometry.Size; - static create(width: any, height: number): kendo.geometry.Size; - static create(width: kendo.geometry.Size, height: number): kendo.geometry.Size; - width: number; - height: number; - } - - interface SizeOptions { - name?: string; - } - interface SizeEvent { - sender: Size; - isDefaultPrevented(): boolean; - preventDefault: Function; - } - - - class Transformation extends Observable { - options: TransformationOptions; - clone(): kendo.geometry.Transformation; - equals(other: kendo.geometry.Transformation): boolean; - matrix(): kendo.geometry.Matrix; - multiply(transformation: kendo.geometry.Transformation): kendo.geometry.Transformation; - rotate(angle: number, center: any): kendo.geometry.Transformation; - rotate(angle: number, center: kendo.geometry.Point): kendo.geometry.Transformation; - scale(scaleX: number, scaleY: number): kendo.geometry.Transformation; - translate(x: number, y: number): kendo.geometry.Transformation; - } - - interface TransformationOptions { - name?: string; - } - interface TransformationEvent { - sender: Transformation; - isDefaultPrevented(): boolean; - preventDefault: Function; - } - - } declare module kendo.ui { class AutoComplete extends kendo.ui.Widget { @@ -5569,7 +5573,7 @@ declare module kendo.ui { name?: string; axis?: string; container?: any; - connectWith?: any; + connectWith?: string; cursor?: string; cursorOffset?: SortableCursorOffset; disabled?: string; @@ -9601,7 +9605,7 @@ declare module kendo.dataviz.ui { interface DiagramShapeDefaultsConnector { name?: string; - position?: any; + position?: Function; } interface DiagramShapeDefaultsContent { @@ -9671,7 +9675,7 @@ declare module kendo.dataviz.ui { interface DiagramShapeConnector { description?: string; name?: string; - position?: any; + position?: Function; } interface DiagramShapeContent { @@ -13331,7 +13335,6 @@ declare module kendo.dataviz.diagram { constructor(options?: ConnectorOptions); options: ConnectorOptions; position(): kendo.dataviz.diagram.Point; - position(position: kendo.dataviz.diagram.Point): void; } interface ConnectorFill { @@ -13617,7 +13620,7 @@ declare module kendo { module drawing { function align(elements: any, rect: kendo.geometry.Rect, alignment: string): void; - function drawDOM(element: HTMLElement): JQueryPromise; + function drawDOM(element: JQuery): JQueryPromise; function exportImage(group: kendo.drawing.Group, options: any): JQueryPromise; function exportPDF(group: kendo.drawing.Group, options: kendo.drawing.PDFOptions): JQueryPromise; function exportSVG(group: kendo.drawing.Group, options: any): JQueryPromise; @@ -13671,6 +13674,7 @@ declare module kendo { } declare module kendo.dataviz.map { class Extent extends kendo.Class { + constructor(nw: kendo.dataviz.map.Location, se: kendo.dataviz.map.Location); options: ExtentOptions; contains(location: kendo.dataviz.map.Location): boolean; containsAny(locations: any): boolean; @@ -13699,6 +13703,7 @@ declare module kendo.dataviz.map { class Layer extends kendo.Class { + constructor(map: kendo.dataviz.ui.Map, options?: LayerOptions); options: LayerOptions; show(): void; hide(): void; @@ -13716,6 +13721,7 @@ declare module kendo.dataviz.map { class Location extends kendo.Class { + constructor(lat: number, lng: number); options: LocationOptions; clone(): kendo.dataviz.map.Location; destination(destination: kendo.dataviz.map.Location): number; @@ -14631,9 +14637,225 @@ declare module kendo.ooxml { } +declare module kendo.dataviz.geometry { + class Arc extends Observable { + options: ArcOptions; + bbox(matrix: kendo.geometry.Matrix): kendo.geometry.Rect; + getAnticlockwise(): boolean; + getCenter(): kendo.geometry.Point; + getEndAngle(): number; + getRadiusX(): number; + getRadiusY(): number; + getStartAngle(): number; + pointAt(angle: number): kendo.geometry.Point; + setAnticlockwise(value: boolean): kendo.geometry.Arc; + setCenter(value: kendo.geometry.Point): kendo.geometry.Arc; + setEndAngle(value: number): kendo.geometry.Arc; + setRadiusX(value: number): kendo.geometry.Arc; + setRadiusY(value: number): kendo.geometry.Arc; + setStartAngle(value: number): kendo.geometry.Arc; + anticlockwise: boolean; + center: kendo.geometry.Point; + endAngle: number; + radiusX: number; + radiusY: number; + startAngle: number; + } + + interface ArcOptions { + name?: string; + } + interface ArcEvent { + sender: Arc; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Circle extends Observable { + options: CircleOptions; + bbox(matrix: kendo.geometry.Matrix): kendo.geometry.Rect; + clone(): kendo.geometry.Circle; + equals(other: kendo.geometry.Circle): boolean; + getCenter(): kendo.geometry.Point; + getRadius(): number; + pointAt(angle: number): kendo.geometry.Point; + setCenter(value: kendo.geometry.Point): kendo.geometry.Point; + setCenter(value: any): kendo.geometry.Point; + setRadius(value: number): kendo.geometry.Circle; + center: kendo.geometry.Point; + radius: number; + } + + interface CircleOptions { + name?: string; + } + interface CircleEvent { + sender: Circle; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Matrix extends Observable { + options: MatrixOptions; + clone(): kendo.geometry.Matrix; + equals(other: kendo.geometry.Matrix): boolean; + round(digits: number): kendo.geometry.Matrix; + multiplyCopy(matrix: kendo.geometry.Matrix): kendo.geometry.Matrix; + toArray(digits: number): any; + toString(digits: number, separator: string): string; + static rotate(angle: number, x: number, y: number): kendo.geometry.Matrix; + static scale(scaleX: number, scaleY: number): kendo.geometry.Matrix; + static translate(x: number, y: number): kendo.geometry.Matrix; + static unit(): kendo.geometry.Matrix; + a: number; + b: number; + c: number; + d: number; + e: number; + f: number; + } + + interface MatrixOptions { + name?: string; + } + interface MatrixEvent { + sender: Matrix; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Point extends Observable { + options: PointOptions; + clone(): kendo.geometry.Point; + distanceTo(point: kendo.geometry.Point): number; + equals(other: kendo.geometry.Point): boolean; + getX(): number; + getY(): number; + move(x: number, y: number): kendo.geometry.Point; + rotate(angle: number, center: kendo.geometry.Point): kendo.geometry.Point; + rotate(angle: number, center: any): kendo.geometry.Point; + round(digits: number): kendo.geometry.Point; + scale(scaleX: number, scaleY: number): kendo.geometry.Point; + scaleCopy(scaleX: number, scaleY: number): kendo.geometry.Point; + setX(value: number): kendo.geometry.Point; + setY(value: number): kendo.geometry.Point; + toArray(digits: number): any; + toString(digits: number, separator: string): string; + transform(tansformation: kendo.geometry.Transformation): kendo.geometry.Point; + transformCopy(tansformation: kendo.geometry.Transformation): kendo.geometry.Point; + translate(dx: number, dy: number): kendo.geometry.Point; + translateWith(vector: kendo.geometry.Point): kendo.geometry.Point; + translateWith(vector: any): kendo.geometry.Point; + static create(x: number, y: number): kendo.geometry.Point; + static create(x: any, y: number): kendo.geometry.Point; + static create(x: kendo.geometry.Point, y: number): kendo.geometry.Point; + static min(): kendo.geometry.Point; + static max(): kendo.geometry.Point; + static minPoint(): kendo.geometry.Point; + static maxPoint(): kendo.geometry.Point; + x: number; + y: number; + } + + interface PointOptions { + name?: string; + } + interface PointEvent { + sender: Point; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Rect extends Observable { + constructor(origin: kendo.geometry.Point, size: kendo.geometry.Size); + options: RectOptions; + bbox(matrix: kendo.geometry.Matrix): kendo.geometry.Rect; + bottomLeft(): kendo.geometry.Point; + bottomRight(): kendo.geometry.Point; + center(): kendo.geometry.Point; + clone(): kendo.geometry.Rect; + equals(other: kendo.geometry.Rect): boolean; + getOrigin(): kendo.geometry.Point; + getSize(): kendo.geometry.Size; + height(): number; + setOrigin(value: kendo.geometry.Point): kendo.geometry.Rect; + setOrigin(value: any): kendo.geometry.Rect; + setSize(value: kendo.geometry.Size): kendo.geometry.Rect; + setSize(value: any): kendo.geometry.Rect; + topLeft(): kendo.geometry.Point; + topRight(): kendo.geometry.Point; + width(): number; + static fromPoints(pointA: kendo.geometry.Point, pointB: kendo.geometry.Point): kendo.geometry.Rect; + static union(rectA: kendo.geometry.Rect, rectB: kendo.geometry.Rect): kendo.geometry.Rect; + origin: kendo.geometry.Point; + size: kendo.geometry.Size; + } + + interface RectOptions { + name?: string; + } + interface RectEvent { + sender: Rect; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Size extends Observable { + options: SizeOptions; + clone(): kendo.geometry.Size; + equals(other: kendo.geometry.Size): boolean; + getWidth(): number; + getHeight(): number; + setWidth(value: number): kendo.geometry.Size; + setHeight(value: number): kendo.geometry.Size; + static create(width: number, height: number): kendo.geometry.Size; + static create(width: any, height: number): kendo.geometry.Size; + static create(width: kendo.geometry.Size, height: number): kendo.geometry.Size; + width: number; + height: number; + } + + interface SizeOptions { + name?: string; + } + interface SizeEvent { + sender: Size; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Transformation extends Observable { + options: TransformationOptions; + clone(): kendo.geometry.Transformation; + equals(other: kendo.geometry.Transformation): boolean; + matrix(): kendo.geometry.Matrix; + multiply(transformation: kendo.geometry.Transformation): kendo.geometry.Transformation; + rotate(angle: number, center: any): kendo.geometry.Transformation; + rotate(angle: number, center: kendo.geometry.Point): kendo.geometry.Transformation; + scale(scaleX: number, scaleY: number): kendo.geometry.Transformation; + translate(x: number, y: number): kendo.geometry.Transformation; + } + + interface TransformationOptions { + name?: string; + } + interface TransformationEvent { + sender: Transformation; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + +} declare module kendo.dataviz.drawing { class Arc extends kendo.drawing.Element { - constructor(options?: ArcOptions); + constructor(geometry: kendo.geometry.Arc, options?: ArcOptions); options: ArcOptions; bbox(): kendo.geometry.Rect; clip(): kendo.drawing.Path; @@ -14668,7 +14890,7 @@ declare module kendo.dataviz.drawing { class Circle extends kendo.drawing.Element { - constructor(options?: CircleOptions); + constructor(geometry: kendo.geometry.Circle, options?: CircleOptions); options: CircleOptions; bbox(): kendo.geometry.Rect; clip(): kendo.drawing.Path; @@ -14808,7 +15030,7 @@ declare module kendo.dataviz.drawing { class Image extends kendo.drawing.Element { - constructor(options?: ImageOptions); + constructor(src: string, rect: kendo.geometry.Rect); options: ImageOptions; bbox(): kendo.geometry.Rect; clip(): kendo.drawing.Path; @@ -14841,7 +15063,7 @@ declare module kendo.dataviz.drawing { class Layout extends kendo.drawing.Group { - constructor(options?: LayoutOptions); + constructor(rect: kendo.geometry.Rect, options?: LayoutOptions); options: LayoutOptions; rect(): kendo.geometry.Rect; rect(rect: kendo.geometry.Rect): void; @@ -14936,6 +15158,7 @@ declare module kendo.dataviz.drawing { class OptionsStore extends kendo.Class { + constructor(options?: OptionsStoreOptions); options: OptionsStoreOptions; get(field: string): any; set(field: string, value: any): void; @@ -15040,6 +15263,7 @@ declare module kendo.dataviz.drawing { class Segment extends kendo.Class { + constructor(anchor: kendo.geometry.Point, controlIn: kendo.geometry.Point, controlOut: kendo.geometry.Point); options: SegmentOptions; anchor(): kendo.geometry.Point; anchor(value: kendo.geometry.Point): void; @@ -15113,7 +15337,7 @@ declare module kendo.dataviz.drawing { class Text extends kendo.drawing.Element { - constructor(options?: TextOptions); + constructor(content: string, position: kendo.geometry.Point, options?: TextOptions); options: TextOptions; bbox(): kendo.geometry.Rect; clip(): kendo.drawing.Path; @@ -15150,221 +15374,6 @@ declare module kendo.dataviz.drawing { } -} -declare module kendo.dataviz.geometry { - class Arc extends Observable { - options: ArcOptions; - bbox(matrix: kendo.geometry.Matrix): kendo.geometry.Rect; - getAnticlockwise(): boolean; - getCenter(): kendo.geometry.Point; - getEndAngle(): number; - getRadiusX(): number; - getRadiusY(): number; - getStartAngle(): number; - pointAt(angle: number): kendo.geometry.Point; - setAnticlockwise(value: boolean): kendo.geometry.Arc; - setCenter(value: kendo.geometry.Point): kendo.geometry.Arc; - setEndAngle(value: number): kendo.geometry.Arc; - setRadiusX(value: number): kendo.geometry.Arc; - setRadiusY(value: number): kendo.geometry.Arc; - setStartAngle(value: number): kendo.geometry.Arc; - anticlockwise: boolean; - center: kendo.geometry.Point; - endAngle: number; - radiusX: number; - radiusY: number; - startAngle: number; - } - - interface ArcOptions { - name?: string; - } - interface ArcEvent { - sender: Arc; - isDefaultPrevented(): boolean; - preventDefault: Function; - } - - - class Circle extends Observable { - options: CircleOptions; - bbox(matrix: kendo.geometry.Matrix): kendo.geometry.Rect; - clone(): kendo.geometry.Circle; - equals(other: kendo.geometry.Circle): boolean; - getCenter(): kendo.geometry.Point; - getRadius(): number; - pointAt(angle: number): kendo.geometry.Point; - setCenter(value: kendo.geometry.Point): kendo.geometry.Point; - setCenter(value: any): kendo.geometry.Point; - setRadius(value: number): kendo.geometry.Circle; - center: kendo.geometry.Point; - radius: number; - } - - interface CircleOptions { - name?: string; - } - interface CircleEvent { - sender: Circle; - isDefaultPrevented(): boolean; - preventDefault: Function; - } - - - class Matrix extends Observable { - options: MatrixOptions; - clone(): kendo.geometry.Matrix; - equals(other: kendo.geometry.Matrix): boolean; - round(digits: number): kendo.geometry.Matrix; - multiplyCopy(matrix: kendo.geometry.Matrix): kendo.geometry.Matrix; - toArray(digits: number): any; - toString(digits: number, separator: string): string; - static rotate(angle: number, x: number, y: number): kendo.geometry.Matrix; - static scale(scaleX: number, scaleY: number): kendo.geometry.Matrix; - static translate(x: number, y: number): kendo.geometry.Matrix; - static unit(): kendo.geometry.Matrix; - a: number; - b: number; - c: number; - d: number; - e: number; - f: number; - } - - interface MatrixOptions { - name?: string; - } - interface MatrixEvent { - sender: Matrix; - isDefaultPrevented(): boolean; - preventDefault: Function; - } - - - class Point extends Observable { - options: PointOptions; - clone(): kendo.geometry.Point; - distanceTo(point: kendo.geometry.Point): number; - equals(other: kendo.geometry.Point): boolean; - getX(): number; - getY(): number; - move(x: number, y: number): kendo.geometry.Point; - rotate(angle: number, center: kendo.geometry.Point): kendo.geometry.Point; - rotate(angle: number, center: any): kendo.geometry.Point; - round(digits: number): kendo.geometry.Point; - scale(scaleX: number, scaleY: number): kendo.geometry.Point; - scaleCopy(scaleX: number, scaleY: number): kendo.geometry.Point; - setX(value: number): kendo.geometry.Point; - setY(value: number): kendo.geometry.Point; - toArray(digits: number): any; - toString(digits: number, separator: string): string; - transform(tansformation: kendo.geometry.Transformation): kendo.geometry.Point; - transformCopy(tansformation: kendo.geometry.Transformation): kendo.geometry.Point; - translate(dx: number, dy: number): kendo.geometry.Point; - translateWith(vector: kendo.geometry.Point): kendo.geometry.Point; - translateWith(vector: any): kendo.geometry.Point; - static create(x: number, y: number): kendo.geometry.Point; - static create(x: any, y: number): kendo.geometry.Point; - static create(x: kendo.geometry.Point, y: number): kendo.geometry.Point; - static min(): kendo.geometry.Point; - static max(): kendo.geometry.Point; - static minPoint(): kendo.geometry.Point; - static maxPoint(): kendo.geometry.Point; - x: number; - y: number; - } - - interface PointOptions { - name?: string; - } - interface PointEvent { - sender: Point; - isDefaultPrevented(): boolean; - preventDefault: Function; - } - - - class Rect extends Observable { - options: RectOptions; - bbox(matrix: kendo.geometry.Matrix): kendo.geometry.Rect; - bottomLeft(): kendo.geometry.Point; - bottomRight(): kendo.geometry.Point; - center(): kendo.geometry.Point; - clone(): kendo.geometry.Rect; - equals(other: kendo.geometry.Rect): boolean; - getOrigin(): kendo.geometry.Point; - getSize(): kendo.geometry.Size; - height(): number; - setOrigin(value: kendo.geometry.Point): kendo.geometry.Rect; - setOrigin(value: any): kendo.geometry.Rect; - setSize(value: kendo.geometry.Size): kendo.geometry.Rect; - setSize(value: any): kendo.geometry.Rect; - topLeft(): kendo.geometry.Point; - topRight(): kendo.geometry.Point; - width(): number; - static fromPoints(pointA: kendo.geometry.Point, pointB: kendo.geometry.Point): kendo.geometry.Rect; - static union(rectA: kendo.geometry.Rect, rectB: kendo.geometry.Rect): kendo.geometry.Rect; - origin: kendo.geometry.Point; - size: kendo.geometry.Size; - } - - interface RectOptions { - name?: string; - } - interface RectEvent { - sender: Rect; - isDefaultPrevented(): boolean; - preventDefault: Function; - } - - - class Size extends Observable { - options: SizeOptions; - clone(): kendo.geometry.Size; - equals(other: kendo.geometry.Size): boolean; - getWidth(): number; - getHeight(): number; - setWidth(value: number): kendo.geometry.Size; - setHeight(value: number): kendo.geometry.Size; - static create(width: number, height: number): kendo.geometry.Size; - static create(width: any, height: number): kendo.geometry.Size; - static create(width: kendo.geometry.Size, height: number): kendo.geometry.Size; - width: number; - height: number; - } - - interface SizeOptions { - name?: string; - } - interface SizeEvent { - sender: Size; - isDefaultPrevented(): boolean; - preventDefault: Function; - } - - - class Transformation extends Observable { - options: TransformationOptions; - clone(): kendo.geometry.Transformation; - equals(other: kendo.geometry.Transformation): boolean; - matrix(): kendo.geometry.Matrix; - multiply(transformation: kendo.geometry.Transformation): kendo.geometry.Transformation; - rotate(angle: number, center: any): kendo.geometry.Transformation; - rotate(angle: number, center: kendo.geometry.Point): kendo.geometry.Transformation; - scale(scaleX: number, scaleY: number): kendo.geometry.Transformation; - translate(x: number, y: number): kendo.geometry.Transformation; - } - - interface TransformationOptions { - name?: string; - } - interface TransformationEvent { - sender: Transformation; - isDefaultPrevented(): boolean; - preventDefault: Function; - } - - } interface HTMLElement { @@ -15378,8 +15387,6 @@ interface JQueryEventObject { } interface JQueryPromise { - pipe(doneFilter?: (x: any) => any, failFilter?: (x: any) => any, progressFilter?: (x: any) => any): JQueryPromise; - then(doneCallbacks: any, failCallbacks: any, progressCallbacks?: any): JQueryPromise; } interface JQuery { From b3a3a0746c9fde9e6119e8a777e9857a6b2e1df2 Mon Sep 17 00:00:00 2001 From: Tobias Lundin Date: Wed, 10 Jun 2015 15:14:12 +0200 Subject: [PATCH 0049/1358] chrome: Add queue-interface for cast --- chrome/{chrome-cast.ts => chrome-cast.d.ts} | 253 ++++++++++++++++++-- 1 file changed, 238 insertions(+), 15 deletions(-) rename chrome/{chrome-cast.ts => chrome-cast.d.ts} (79%) diff --git a/chrome/chrome-cast.ts b/chrome/chrome-cast.d.ts similarity index 79% rename from chrome/chrome-cast.ts rename to chrome/chrome-cast.d.ts index 71a5305428..a314fb0631 100644 --- a/chrome/chrome-cast.ts +++ b/chrome/chrome-cast.d.ts @@ -206,7 +206,7 @@ declare module chrome.cast { sessionListener: (session: chrome.cast.Session) => void, receiverListener: (receiverAvailability: chrome.cast.ReceiverAvailability) => void, autoJoinPolicy?: chrome.cast.AutoJoinPolicy, - defaultActionPolicy: chrome.cast.DefaultActionPolicy + defaultActionPolicy?: chrome.cast.DefaultActionPolicy ); sessionRequest: chrome.cast.SessionRequest; @@ -419,6 +419,17 @@ declare module chrome.cast { successCallback: (media: chrome.cast.media.Media) => void, errorCallback: (error: chrome.cast.Error) => void ) + + /** + * @param {!chrome.cast.media.QueueLoadRequest} queueLoadRequest + * @param {function(!chrome.cast.media.Media)} successCallback + * @param {function(!chrome.cast.Error)} errorCallback + */ + queueLoad( + queueLoadRequest: chrome.cast.media.QueueLoadRequest, + successCallback: (media: chrome.cast.media.Media) => void, + errorCallback: (error: chrome.cast.Error) => void + ) } interface Receiver { @@ -479,6 +490,9 @@ declare module chrome.cast { } declare module chrome.cast.media { + + const DEFAULT_MEDIA_RECEIVER_APP_ID: string; + /** * @enum {string} * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.MediaCommand @@ -542,7 +556,98 @@ declare module chrome.cast.media { FINISHED: string; ERROR: string; } - + + /** + * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.QueueLoadRequest + */ + interface RepeatMode { + OFF:string; + ALL:string; + SINGLE:string; + ALL_AND_SHUFFLE:string; + } + + /** + * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.QueueItem + */ + interface QueueItem { + new( + mediaInfo: chrome.cast.media.MediaInfo + ); + + activeTrackIds: Array; + autoplay: boolean; + customData: Object; + itemId: number; + media: chrome.cast.media.MediaInfo; + preloadTime: number; + startTime: number; + } + + /** + * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.QueueLoadRequest + */ + interface QueueLoadRequest { + new( + items: Array + ); + + customData: Object; + items: Array; + repeatMode: chrome.cast.media.RepeatMode; + startIndex: number; + } + + /** + * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.QueueInsertItemsRequest + */ + interface QueueInsertItemsRequest { + new( + itemsToInsert: Array + ); + + customData: Object; + insertBefore:number; + items: Array; + } + + /** + * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.QueueRemoveItemsRequest + */ + interface QueueRemoveItemsRequest { + new( + itemIdsToRemove: Array + ); + + customData: Object; + itemIds: Array; + } + + /** + * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.QueueReorderItemsRequest + */ + interface QueueReorderItemsRequest { + new( + itemIdsToReorder: Array + ); + + customData: Object; + insertBefore: number; + itemIds: Array; + } + + /** + * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.QueueUpdateItemsRequest + */ + interface QueueUpdateItemsRequest { + new( + itemsToUpdate: Array + ); + + customData: Object; + item: Array; + } + /** * @enum {string} * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.TrackType @@ -724,7 +829,7 @@ declare module chrome.cast.media { images: Array; releaseDate: string; - // Deprecated + /** Deprecated. Use metadataType instead. */ type: chrome.cast.media.MetadataType; releaseYear: number; } @@ -743,7 +848,7 @@ declare module chrome.cast.media { images: Array; releaseDate: string; - // Deprecated + /** Deprecated. Use metadataType instead. */ type: chrome.cast.media.MetadataType; releaseYear: number; } @@ -763,7 +868,7 @@ declare module chrome.cast.media { images: Array; originalAirdate: string; - // Deprecated + /** Deprecated. Use metadataType instead. */ type: chrome.cast.media.MetadataType; episodeTitle: string; seasonNumber: number; @@ -790,7 +895,7 @@ declare module chrome.cast.media { images: Array; releaseDate: string; - // Deprecated + /** Deprecated. Use metadataType instead. */ type: chrome.cast.media.MetadataType; artistName: string; releaseYear: number; @@ -814,7 +919,7 @@ declare module chrome.cast.media { height: number; creationDateTime: string; - // Deprecated + /** Deprecated. Use metadataType instead. */ type: chrome.cast.media.MetadataType; } @@ -852,18 +957,23 @@ declare module chrome.cast.media { mediaSessionId: number ); - sessionId: string; - mediaSessionId: number; + activeTrackIds: Array; + currentItemId: number; + customData: Object; + idleReason: chrome.cast.media.IdleReason; + items: Array; + loadingItemId: number; media: chrome.cast.media.MediaInfo; + mediaSessionId: number; playbackRate: number; playerState: chrome.cast.media.PlayerState; + preloadedItemId: number; + repeatMode: chrome.cast.media.RepeatMode; + sessionId: string; supportedMediaCommands: Array; volume: chrome.cast.Volume; - idleReason: chrome.cast.media.IdleReason; - activeTrackIds: Array; - customData: Object; - - // Deprecated + + /** Deprecated. Use getEstimatedTime instead */ currentTime: number; /** @@ -965,12 +1075,120 @@ declare module chrome.cast.media { listener: (boolean) => void ) - // Deprecated /** * @return {number} * @suppress {deprecated} Uses currentTime member to compute estimated time. */ getEstimatedTime(): number + + /** + * @param {!chrome.cast.media.QueueItem} item + * @param {function()} successCallback + * @param {function(!chrome.cast.Error)} errorCallback + */ + queueAppendItem ( + item: chrome.cast.media.QueueItem, + successCallback: Function, + errorCallback: (error: chrome.cast.Error) => void + ) + + /** + * @param {!chrome.cast.media.QueueInsertItemsRequest} queueInsertItemsRequest + * @param {function()} successCallback + * @param {function(!chrome.cast.Error)} errorCallback + */ + queueInsertItems ( + queueInsertItemsRequest: chrome.cast.media.QueueInsertItemsRequest, + successCallback: Function, + errorCallback: (error: chrome.cast.Error) => void + ) + + /** + * @param {!number} itemId + * @param {function()} successCallback + * @param {function(!chrome.cast.Error)} errorCallback + */ + queueJumpToItem ( + itemId: number, + successCallback: Function, + errorCallback: (error: chrome.cast.Error) => void + ) + + /** + * @param {!number} itemId + * @param {!number} newIndex + * @param {function()} successCallback + * @param {function(!chrome.cast.Error)} errorCallback + */ + queueMoveItemToNewIndex ( + itemId: number, + newIndex: number, + successCallback: Function, + errorCallback: (error: chrome.cast.Error) => void + ) + + /** + * @param {function()} successCallback + * @param {function(!chrome.cast.Error)} errorCallback + */ + queueNext ( + successCallback: Function, + errorCallback: (error: chrome.cast.Error) => void + ) + + /** + * @param {function()} successCallback + * @param {function(!chrome.cast.Error)} errorCallback + */ + queuePrev ( + successCallback: Function, + errorCallback: (error: chrome.cast.Error) => void + ) + + /** + * @param {!number} itemId + * @param {function()} successCallback + * @param {function(!chrome.cast.Error)} errorCallback + */ + queueRemoveItem ( + itemId: number, + successCallback: Function, + errorCallback: (error: chrome.cast.Error) => void + ) + + /** + * @param {!chrome.cast.media.QueueReorderItemsRequest} queueReorderItemsRequest + * @param {function()} successCallback + * @param {function(!chrome.cast.Error)} errorCallback + */ + queueReorderItems ( + queueReorderItemsRequest: chrome.cast.media.QueueReorderItemsRequest, + successCallback: Function, + errorCallback: (error: chrome.cast.Error) => void + ) + + /** + * @param {!chrome.cast.media.RepeatMode} repeatMode + * @param {function()} successCallback + * @param {function(!chrome.cast.Error)} errorCallback + */ + queueSetRepeatMode ( + repeatMode: chrome.cast.media.RepeatMode, + successCallback: Function, + errorCallback: (error: chrome.cast.Error) => void + ) + + /** + * @param {!chrome.cast.media.QueueUpdateItemsRequest} queueUpdateItemsRequest + * @param {function()} successCallback + * @param {function(!chrome.cast.Error)} errorCallback + */ + queueUpdateItems ( + queueUpdateItemsRequest: chrome.cast.media.QueueUpdateItemsRequest, + successCallback: Function, + errorCallback: (error: chrome.cast.Error) => void + ) + } interface Track { @@ -1030,4 +1248,9 @@ declare module chrome.cast.media.timeout { var stop: number; var setVolume: number; var editTracksInfo: number; + var queueInsert: number; + var queueLoad: number; + var queueRemove: number; + var queueReorder: number; + var queueUpdate: number; } \ No newline at end of file From 2a714679f74a80b935ed3d968815506fa08fba7e Mon Sep 17 00:00:00 2001 From: Tobias Lundin Date: Thu, 11 Jun 2015 09:45:01 +0200 Subject: [PATCH 0050/1358] chrome: fix failing tests for cast syntax --- chrome/chrome-cast.d.ts | 150 ++++++++++++++++++++-------------------- 1 file changed, 75 insertions(+), 75 deletions(-) diff --git a/chrome/chrome-cast.d.ts b/chrome/chrome-cast.d.ts index a314fb0631..53945029f6 100644 --- a/chrome/chrome-cast.d.ts +++ b/chrome/chrome-cast.d.ts @@ -188,7 +188,7 @@ declare module chrome.cast { receiver: chrome.cast.Receiver, successCallback: Function, errorCallback: (error: chrome.cast.Error) => void - ) + ): void interface ApiConfig { /** @@ -207,7 +207,7 @@ declare module chrome.cast { receiverListener: (receiverAvailability: chrome.cast.ReceiverAvailability) => void, autoJoinPolicy?: chrome.cast.AutoJoinPolicy, defaultActionPolicy?: chrome.cast.DefaultActionPolicy - ); + ):ApiConfig; sessionRequest: chrome.cast.SessionRequest; sessionListener: (session: chrome.cast.Session) => void; @@ -228,7 +228,7 @@ declare module chrome.cast { code: chrome.cast.ErrorCode, description?: string, details?: Object - ); + ):Error; code: chrome.cast.ErrorCode; description?: string; @@ -244,7 +244,7 @@ declare module chrome.cast { */ new( url: string - ); + ):Image; url: string; height?: number; @@ -255,7 +255,7 @@ declare module chrome.cast { new( platform: chrome.cast.SenderPlatform - ); + ):SenderApplication; platform: chrome.cast.SenderPlatform; url?: string; @@ -274,7 +274,7 @@ declare module chrome.cast { appId: string, capabilities?: Array, timeout?: number - ); + ):SessionRequest; appId: string; capabilities: Array; @@ -298,7 +298,7 @@ declare module chrome.cast { displayName: string, appImages: Array, receiver: chrome.cast.Receiver - ); + ):Session; sessionId: string; appId: string; @@ -319,7 +319,7 @@ declare module chrome.cast { newLevel: number, successCallback: Function, errorCallback: (error: chrome.cast.Error) => void - ) + ):void /** * @param {boolean} muted @@ -330,7 +330,7 @@ declare module chrome.cast { muted: boolean, successCallback: Function, errorCallback: (error: chrome.cast.Error) => void - ) + ):void /** * @param {function()} successCallback @@ -339,7 +339,7 @@ declare module chrome.cast { leave( successCallback: Function, errorCallback: (error: chrome.cast.Error) => void - ) + ):void /** * @param {function()} successCallback @@ -348,7 +348,7 @@ declare module chrome.cast { stop( successCallback: Function, errorCallback: (error: chrome.cast.Error) => void - ) + ):void /** * @param {string} namespace @@ -361,21 +361,21 @@ declare module chrome.cast { message: string, successCallback: Function, errorCallback: (error: chrome.cast.Error) => void - ) + ):void /** * @param {function(boolean)} listener */ addUpdateListener( - listener: (boolean) => void - ) + listener: (isAlive:boolean) => void + ):void /** * @param {function(boolean)} listener */ removeUpdateListener( - listener: (boolean) => void - ) + listener: (isAlive:boolean) => void + ):void /** * @param {string} namespace @@ -383,8 +383,8 @@ declare module chrome.cast { */ addMessageListener( namespace: string, - listener: (string, string) => void - ) + listener: (namespace: string, message: string) => void + ):void /** * @param {string} namespace @@ -392,22 +392,22 @@ declare module chrome.cast { */ removeMessageListener( namespace: string, - listener: (string, string) => void - ) + listener: (namespace:string, message:string) => void + ):void /** * @param {function(!chrome.cast.media.Media)} listener */ addMediaListener( listener: (media: chrome.cast.media.Media) => void - ) + ):void /** * @param {function(!chrome.cast.media.Media)} listener */ removeMediaListener( listener: (media: chrome.cast.media.Media) => void - ) + ):void /** * @param {!chrome.cast.media.LoadRequest} loadRequest @@ -418,7 +418,7 @@ declare module chrome.cast { loadRequest: chrome.cast.media.LoadRequest, successCallback: (media: chrome.cast.media.Media) => void, errorCallback: (error: chrome.cast.Error) => void - ) + ):void /** * @param {!chrome.cast.media.QueueLoadRequest} queueLoadRequest @@ -429,7 +429,7 @@ declare module chrome.cast { queueLoadRequest: chrome.cast.media.QueueLoadRequest, successCallback: (media: chrome.cast.media.Media) => void, errorCallback: (error: chrome.cast.Error) => void - ) + ):void } interface Receiver { @@ -446,7 +446,7 @@ declare module chrome.cast { friendlyName: string, capabilities?: Array, volume?: chrome.cast.Volume - ); + ):Receiver; label: string; friendlyName: string; @@ -466,7 +466,7 @@ declare module chrome.cast { new( statusText: string, appImages: Array - ); + ):ReceiverDisplayStatus; statusText: string; appImages: Array; @@ -482,7 +482,7 @@ declare module chrome.cast { new( level?: number, muted?: boolean - ); + ):Volume; level?: number; muted?: boolean; @@ -491,7 +491,7 @@ declare module chrome.cast { declare module chrome.cast.media { - const DEFAULT_MEDIA_RECEIVER_APP_ID: string; + var DEFAULT_MEDIA_RECEIVER_APP_ID: string; /** * @enum {string} @@ -573,7 +573,7 @@ declare module chrome.cast.media { interface QueueItem { new( mediaInfo: chrome.cast.media.MediaInfo - ); + ):QueueItem; activeTrackIds: Array; autoplay: boolean; @@ -590,7 +590,7 @@ declare module chrome.cast.media { interface QueueLoadRequest { new( items: Array - ); + ):QueueLoadRequest; customData: Object; items: Array; @@ -604,7 +604,7 @@ declare module chrome.cast.media { interface QueueInsertItemsRequest { new( itemsToInsert: Array - ); + ):QueueInsertItemsRequest; customData: Object; insertBefore:number; @@ -617,7 +617,7 @@ declare module chrome.cast.media { interface QueueRemoveItemsRequest { new( itemIdsToRemove: Array - ); + ):QueueRemoveItemsRequest; customData: Object; itemIds: Array; @@ -629,7 +629,7 @@ declare module chrome.cast.media { interface QueueReorderItemsRequest { new( itemIdsToReorder: Array - ); + ):QueueReorderItemsRequest; customData: Object; insertBefore: number; @@ -642,7 +642,7 @@ declare module chrome.cast.media { interface QueueUpdateItemsRequest { new( itemsToUpdate: Array - ); + ):QueueUpdateItemsRequest; customData: Object; item: Array; @@ -722,7 +722,7 @@ declare module chrome.cast.media { * @constructor * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.GetStatusRequest */ - new(); + new():GetStatusRequest; customData: Object; } @@ -732,7 +732,7 @@ declare module chrome.cast.media { * @constructor * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.PauseRequest */ - new(); + new():PauseRequest; customData: Object; } @@ -742,7 +742,7 @@ declare module chrome.cast.media { * @constructor * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.PlayRequest */ - new(); + new():PlayRequest; customData: Object; } @@ -752,7 +752,7 @@ declare module chrome.cast.media { * @constructor * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.SeekRequest */ - new(); + new():SeekRequest; currentTime: number; resumeState: chrome.cast.media.ResumeState; @@ -764,7 +764,7 @@ declare module chrome.cast.media { * @constructor * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.StopRequest */ - new(); + new():StopRequest; customData: Object; } @@ -777,7 +777,7 @@ declare module chrome.cast.media { */ new( volume: chrome.cast.Volume - ); + ):VolumeRequest; volume: chrome.cast.Volume; customData: Object; @@ -791,7 +791,7 @@ declare module chrome.cast.media { */ new( mediaInfo: chrome.cast.media.MediaInfo - ); + ):LoadRequest; activeTrackIds: Array; autoplay: boolean; @@ -810,7 +810,7 @@ declare module chrome.cast.media { new( activeTrackIds?: Array, textTrackStyle?: chrome.cast.media.TextTrackStyle - ); + ):EditTracksInfoRequest; activeTrackIds: Array; textTrackStyle: chrome.cast.media.TextTrackStyle; @@ -821,17 +821,17 @@ declare module chrome.cast.media { * @constructor * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.GenericMediaMetadata */ - new(); + new():GenericMediaMetadata; - metadataType: chrome.cast.media.MetadataType; - title: string; - subtitle: string; images: Array; + metadataType: chrome.cast.media.MetadataType; releaseDate: string; + releaseYear: number; + subtitle: string; + title: string; /** Deprecated. Use metadataType instead. */ type: chrome.cast.media.MetadataType; - releaseYear: number; } interface MovieMediaMetadata { @@ -839,18 +839,18 @@ declare module chrome.cast.media { * @constructor * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.MovieMediaMetadata */ - new(); - + new():MovieMediaMetadata; + + images: Array; metadataType: chrome.cast.media.MetadataType; + releaseDate: string; + releaseYear: number; + subtitle: string; title: string; studio: string; - subtitle: string; - images: Array; - releaseDate: string; - + /** Deprecated. Use metadataType instead. */ type: chrome.cast.media.MetadataType; - releaseYear: number; } interface TvShowMediaMetadata { @@ -858,7 +858,7 @@ declare module chrome.cast.media { * @constructor * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.TvShowMediaMetadata */ - new(); + new(): TvShowMediaMetadata; metadataType: chrome.cast.media.MetadataType; seriesTitle: string; @@ -881,7 +881,7 @@ declare module chrome.cast.media { * @constructor * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.MusicTrackMediaMetadata */ - new(); + new(): MusicTrackMediaMetadata; metadataType: chrome.cast.media.MetadataType; albumName: string; @@ -906,7 +906,7 @@ declare module chrome.cast.media { * @constructor * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.PhotoMediaMetadata */ - new(); + new(): PhotoMediaMetadata; metadataType: chrome.cast.media.MetadataType; title: string; @@ -933,7 +933,7 @@ declare module chrome.cast.media { new( contentId: string, contentType: string - ); + ): MediaInfo; contentId: string; streamType: chrome.cast.media.StreamType; @@ -955,7 +955,7 @@ declare module chrome.cast.media { new( sessionId: string, mediaSessionId: number - ); + ): Media; activeTrackIds: Array; currentItemId: number; @@ -1065,15 +1065,15 @@ declare module chrome.cast.media { * @param {function(boolean)} listener */ addUpdateListener( - listener: (boolean) => void - ) + listener: (isAlive:boolean) => void + ): void /** * @param {function(boolean)} listener */ removeUpdateListener( - listener: (boolean) => void - ) + listener: (isAlive:boolean) => void + ): void /** * @return {number} @@ -1090,7 +1090,7 @@ declare module chrome.cast.media { item: chrome.cast.media.QueueItem, successCallback: Function, errorCallback: (error: chrome.cast.Error) => void - ) + ): void /** * @param {!chrome.cast.media.QueueInsertItemsRequest} queueInsertItemsRequest @@ -1101,7 +1101,7 @@ declare module chrome.cast.media { queueInsertItemsRequest: chrome.cast.media.QueueInsertItemsRequest, successCallback: Function, errorCallback: (error: chrome.cast.Error) => void - ) + ): void /** * @param {!number} itemId @@ -1112,7 +1112,7 @@ declare module chrome.cast.media { itemId: number, successCallback: Function, errorCallback: (error: chrome.cast.Error) => void - ) + ): void /** * @param {!number} itemId @@ -1125,7 +1125,7 @@ declare module chrome.cast.media { newIndex: number, successCallback: Function, errorCallback: (error: chrome.cast.Error) => void - ) + ): void /** * @param {function()} successCallback @@ -1134,7 +1134,7 @@ declare module chrome.cast.media { queueNext ( successCallback: Function, errorCallback: (error: chrome.cast.Error) => void - ) + ): void /** * @param {function()} successCallback @@ -1143,7 +1143,7 @@ declare module chrome.cast.media { queuePrev ( successCallback: Function, errorCallback: (error: chrome.cast.Error) => void - ) + ): void /** * @param {!number} itemId @@ -1154,7 +1154,7 @@ declare module chrome.cast.media { itemId: number, successCallback: Function, errorCallback: (error: chrome.cast.Error) => void - ) + ): void /** * @param {!chrome.cast.media.QueueReorderItemsRequest} queueReorderItemsRequest @@ -1165,7 +1165,7 @@ declare module chrome.cast.media { queueReorderItemsRequest: chrome.cast.media.QueueReorderItemsRequest, successCallback: Function, errorCallback: (error: chrome.cast.Error) => void - ) + ): void /** * @param {!chrome.cast.media.RepeatMode} repeatMode @@ -1176,7 +1176,7 @@ declare module chrome.cast.media { repeatMode: chrome.cast.media.RepeatMode, successCallback: Function, errorCallback: (error: chrome.cast.Error) => void - ) + ): void /** * @param {!chrome.cast.media.QueueUpdateItemsRequest} queueUpdateItemsRequest @@ -1187,7 +1187,7 @@ declare module chrome.cast.media { queueUpdateItemsRequest: chrome.cast.media.QueueUpdateItemsRequest, successCallback: Function, errorCallback: (error: chrome.cast.Error) => void - ) + ): void } @@ -1201,7 +1201,7 @@ declare module chrome.cast.media { new( trackId: number, trackType: chrome.cast.media.TrackType - ); + ): Track; trackId: number; trackContentId: string; @@ -1218,7 +1218,7 @@ declare module chrome.cast.media { * @constructor * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.TextTrackStyle */ - new(); + new(): TextTrackStyle; foregroundColor: string; backgroundColor: string; From ce644f3dd330e22fa0e5b7eb43a728618d3fd41b Mon Sep 17 00:00:00 2001 From: vilicvane Date: Thu, 11 Jun 2015 18:00:48 +0800 Subject: [PATCH 0051/1358] complete multer declaration. --- multer/multer.d.ts | 87 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 84 insertions(+), 3 deletions(-) diff --git a/multer/multer.d.ts b/multer/multer.d.ts index b188c22ae4..7e152894f6 100644 --- a/multer/multer.d.ts +++ b/multer/multer.d.ts @@ -1,14 +1,95 @@ // Type definitions for multer // Project: https://github.com/expressjs/multer -// Definitions by: jt000 +// Definitions by: jt000 vilicvane // Definitions: https://github.com/borisyankov/DefinitelyTyped /// +declare module Express { + export interface Request { + files: { + [fieldname: string]: { + /** Field name specified in the form */ + fieldname: string; + /** Name of the file on the user's computer */ + originalname: string; + /** Renamed file name */ + name: string; + /** Encoding type of the file */ + encoding: string; + /** Mime type of the file */ + mimetype: string; + /** Location of the uploaded file */ + path: string; + /** Extension of the file */ + extension: string; + /** Size of the file in bytes */ + size: number; + /** If the file was truncated due to size limitation */ + truncated: boolean; + /** Raw data (is null unless the inMemory option is true) */ + buffer: Buffer; + } + } + } +} + declare module "multer" { import express = require('express'); - function multer(options?: any): express.RequestHandler; + function multer(options?: multer.Options): express.RequestHandler; + + module multer { + type Options = { + /** The destination directory for the uploaded files. */ + dest?: string; + /** An object specifying the size limits of the following optional properties. This object is passed to busboy directly, and the details of properties can be found on https://github.com/mscdex/busboy#busboy-methods */ + limits?: { + /** Max field name size (Default: 100 bytes) */ + fieldNameSize?: number; + /** Max field value size (Default: 1MB) */ + fieldSize?: number; + /** Max number of non- file fields (Default: Infinity) */ + fields?: number; + /** For multipart forms, the max file size (in bytes)(Default: Infinity) */ + fileSize?: number; + /** For multipart forms, the max number of file fields (Default: Infinity) */ + files?: number; + /** For multipart forms, the max number of parts (fields + files)(Default: Infinity) */ + parts?: number; + /** For multipart forms, the max number of header key=> value pairs to parse Default: 2000(same as node's http). */ + headerPairs?: number; + }; + /** A Boolean value to specify whether empty submitted values should be processed and applied to req.body; defaults to false; */ + includeEmptyFields?: boolean; + /** If this Boolean value is true, the file.buffer property holds the data in-memory that Multer would have written to disk. The dest option is still populated and the path property contains the proposed path to save the file. Defaults to false. */ + inMemory?: boolean; + /** Function to rename the uploaded files. Whatever the function returns will become the new name of the uploaded file (extension is not included). The fieldname and filename of the file will be available in this function, use them if you need to. */ + rename?: (fieldname: string, filename: string, req: Express.Request, res: Express.Response) => string; + /** Function to rename the directory in which to place uploaded files. The dest parameter is the default value originally assigned or passed into multer. The req and res parameters are also passed into the function because they may contain information (eg session data) needed to create the path (eg get userid from the session). */ + changeDest?: (dest: string, req: Express.Request, res: Express.Response) => string; + /** Event handler triggered when a file starts to be uploaded. A file object, with the following properties, is available to this function: fieldname, originalname, name, encoding, mimetype, path, and extension. */ + onFileUploadStart?: (file: string, req: Express.Request, res: Express.Response) => void; + /** Event handler triggered when a chunk of buffer is received. A buffer object along with a file object is available to the function. */ + onFileUploadData?: (file: string, data: Buffer, req: Express.Request, res: Express.Response) => void; + /** Event handler trigger when a file is completely uploaded. A file object is available to the function. */ + onFileUploadComplete?: (file: string, req: Express.Request, res: Express.Response) => void; + /** Event handler triggered when the form parsing starts. */ + onParseStart?: () => void; + /** Event handler triggered when the form parsing completes. The request object and the next objects are are passed to the function. */ + onParseEnd?: (req: Express.Request, next: () => void) => void; + /** Event handler for any errors encountering while processing the form. The error object and the next object is available to the function. If you are handling errors yourself, make sure to terminate the request or call the next() function, else the request will be left hanging. */ + onError?: () => void; + /** Event handler triggered when a file size exceeds the specification in the limit object. No more files will be parsed after the limit is reached. */ + onFileSizeLimit?: (file: string) => void; + /** Event handler triggered when the number of files exceed the specification in the limit object. No more files will be parsed after the limit is reached. */ + onFilesLimit?: () => void; + /** Event handler triggered when the number of fields exceed the specification in the limit object. No more fields will be parsed after the limit is reached. */ + onFieldsLimit?: () => void; + /** Event handler triggered when the number of parts exceed the specification in the limit object. No more files or fields will be parsed after the limit is reached. */ + onPartsLimit?: () => void; + }; + } export = multer; -} \ No newline at end of file +} From 376aa3d4ba6651c5c22a2a66fe67a2b32fc1d98a Mon Sep 17 00:00:00 2001 From: vilicvane Date: Thu, 11 Jun 2015 18:06:03 +0800 Subject: [PATCH 0052/1358] now multer extended `files` property --- express/express.d.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/express/express.d.ts b/express/express.d.ts index 0bd42b82f6..c5c623c9ba 100644 --- a/express/express.d.ts +++ b/express/express.d.ts @@ -389,8 +389,6 @@ declare module "express" { authenticatedUser: any; - files: any; - /** * Clear cookie `name`. * From a94992717c1800017483dc7de8aafdcfa0d87cd7 Mon Sep 17 00:00:00 2001 From: vilicvane Date: Thu, 11 Jun 2015 18:10:41 +0800 Subject: [PATCH 0053/1358] add missing comma --- multer/multer.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/multer/multer.d.ts b/multer/multer.d.ts index 7e152894f6..fdde44b54f 100644 --- a/multer/multer.d.ts +++ b/multer/multer.d.ts @@ -1,6 +1,6 @@ // Type definitions for multer // Project: https://github.com/expressjs/multer -// Definitions by: jt000 vilicvane +// Definitions by: jt000 , vilicvane // Definitions: https://github.com/borisyankov/DefinitelyTyped /// From 813035a67ff6e52846da23f58fe4739cecc60161 Mon Sep 17 00:00:00 2001 From: Ole Rehmsen Date: Thu, 11 Jun 2015 21:35:17 +0200 Subject: [PATCH 0054/1358] Add type definition for the mime property exposed on serve-static. JS source of serve-static exposes npm module mime, see: https://github.com/expressjs/serve-static/blob/master/index.js#L122 --- serve-static/serve-static-tests.ts | 6 ++++++ serve-static/serve-static.d.ts | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/serve-static/serve-static-tests.ts b/serve-static/serve-static-tests.ts index 6b16e842b2..36d2761cdd 100644 --- a/serve-static/serve-static-tests.ts +++ b/serve-static/serve-static-tests.ts @@ -18,3 +18,9 @@ app.use(serveStatic('/3', { res.setHeader('Server', 'server-static middleware'); } })); + +serveStatic.mime.define({ + 'application/babylon': ['babylon'], + 'application/babylonmeshdata': ['babylonmeshdata'], + 'application/fx': ['fx'] +}); \ No newline at end of file diff --git a/serve-static/serve-static.d.ts b/serve-static/serve-static.d.ts index b116d43848..f7d7e502f1 100644 --- a/serve-static/serve-static.d.ts +++ b/serve-static/serve-static.d.ts @@ -11,6 +11,7 @@ =============================================== */ /// +/// declare module "serve-static" { import express = require('express'); @@ -75,5 +76,11 @@ declare module "serve-static" { setHeaders?: (res: express.Response, path: string, stat: any) => any; }): express.Handler; + import m = require('mime'); + + module serveStatic { + var mime: typeof m; + } + export = serveStatic; } From 52038eca8702b6d3b1c1a75dd08c1a6d784b7b89 Mon Sep 17 00:00:00 2001 From: Bence Eros Date: Fri, 12 Jun 2015 19:00:56 +0200 Subject: [PATCH 0055/1358] adding Stream class with static factory methods --- streamjs/streamjs-tests.ts | 11 +++++++++++ streamjs/streamjs.d.ts | 12 ++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 streamjs/streamjs-tests.ts create mode 100644 streamjs/streamjs.d.ts diff --git a/streamjs/streamjs-tests.ts b/streamjs/streamjs-tests.ts new file mode 100644 index 0000000000..e5d9338515 --- /dev/null +++ b/streamjs/streamjs-tests.ts @@ -0,0 +1,11 @@ +// + +var numStream = Stream.make(10, 20); +numStream = Stream.make([10, 20]); +numStream = Stream.range(1, 5); +numStream = Stream.rangeClosed(1, 5); + +Stream.generate(function() { + return 1; +}); +Stream.generate(() => 1); diff --git a/streamjs/streamjs.d.ts b/streamjs/streamjs.d.ts new file mode 100644 index 0000000000..e1fe425366 --- /dev/null +++ b/streamjs/streamjs.d.ts @@ -0,0 +1,12 @@ +// Type definitions for streamjs 1.4.0 +// Project: http://streamjs.org/ +// Definitions by: Bence Eros +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare class Stream { + static make (...elems: T[]): Stream; + static make(elems: T[]): Stream; + static range(startInclusive: number, endExclusive: number): Stream; + static rangeClosed(startInclusive: number, endInclusive: number): Stream; + static generate(supplier: () => T): Stream; +} From a90baa3446ca61e406957a6bbde40d438c462231 Mon Sep 17 00:00:00 2001 From: Bence Eros Date: Fri, 12 Jun 2015 22:36:12 +0200 Subject: [PATCH 0056/1358] streamjs nonterminal operation definitions --- streamjs/streamjs-tests.ts | 36 +++++++++++++++++++++++++++++++++++- streamjs/streamjs.d.ts | 30 +++++++++++++++++++++++++----- 2 files changed, 60 insertions(+), 6 deletions(-) diff --git a/streamjs/streamjs-tests.ts b/streamjs/streamjs-tests.ts index e5d9338515..55bad2bd5f 100644 --- a/streamjs/streamjs-tests.ts +++ b/streamjs/streamjs-tests.ts @@ -1,6 +1,7 @@ // -var numStream = Stream.make(10, 20); +var numStream: Stream; +// numStream = Stream.make(10, 20); numStream = Stream.make([10, 20]); numStream = Stream.range(1, 5); numStream = Stream.rangeClosed(1, 5); @@ -9,3 +10,36 @@ Stream.generate(function() { return 1; }); Stream.generate(() => 1); + +var comparator = (s1, s2) => 0; + +numStream = numStream.filter(n => n % 2 == 0); +var strStream = numStream + .dropWhile((n) => n % 2 == 0) + .map(n => "number " + n) + .dropWhile(/^$/) + .limit(100) + .sorted() + .sort() + .sorted(comparator) + .sort(comparator) + .shuffle() + .reverse() + .distinct() + .skip(5) + .peek(s => console.log(s)) + .takeWhile(s => s.length < 5) + .takeWhile(/^aa.*$/) + .slice(5, 2) + ; + +var strArray = strStream.toArray(); + +class MyList { + elems: any[]; +} + +var elems: any[]; +elems = Stream.make([new MyList, new MyList]) + .flatMap(list => list.elems) + .toArray(); diff --git a/streamjs/streamjs.d.ts b/streamjs/streamjs.d.ts index e1fe425366..1ac6c534c8 100644 --- a/streamjs/streamjs.d.ts +++ b/streamjs/streamjs.d.ts @@ -4,9 +4,29 @@ // Definitions: https://github.com/borisyankov/DefinitelyTyped declare class Stream { - static make (...elems: T[]): Stream; - static make(elems: T[]): Stream; - static range(startInclusive: number, endExclusive: number): Stream; - static rangeClosed(startInclusive: number, endInclusive: number): Stream; - static generate(supplier: () => T): Stream; + // static make (...elems: T[]): Stream; + static make (elems: T[]): Stream; + static range (startInclusive: number, endExclusive: number): Stream; + static rangeClosed (startInclusive: number, endInclusive: number): Stream; + static generate (supplier: () => T): Stream; + + distinct(): Stream; + dropWhile(predicate: (elem: T) => boolean): Stream; + dropWhile(regexp: RegExp): Stream; + filter(predicate: (T) => boolean): Stream; + map (mapper: (T) => U): Stream; + flatMap (mapper: (T) => U[]): Stream; + limit(limit: number): Stream; + peek(consumer: (elem: T) => void ): Stream; + reverse(): Stream; + sorted(): Stream; + sorted(comparator: (e1: T, e2: T) => number): Stream; + sort(): Stream; + sort(comparator: (e1: T, e2: T) => number): Stream; + shuffle(): Stream; + skip(n: number): Stream; + slice(begin, end): Stream; + takeWhile(predicate: (elem: T) => boolean): Stream; + takeWhile(regexp: RegExp): Stream; + toArray(): T[]; } From 57e6fd59b6e022b7ead2acc5811dc27363971a03 Mon Sep 17 00:00:00 2001 From: Bence Eros Date: Fri, 12 Jun 2015 23:19:26 +0200 Subject: [PATCH 0057/1358] streamjs nonterminal operation definitions --- streamjs/streamjs-tests.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/streamjs/streamjs-tests.ts b/streamjs/streamjs-tests.ts index 55bad2bd5f..b1fba365cd 100644 --- a/streamjs/streamjs-tests.ts +++ b/streamjs/streamjs-tests.ts @@ -31,6 +31,7 @@ var strStream = numStream .takeWhile(s => s.length < 5) .takeWhile(/^aa.*$/) .slice(5, 2) + .forEach(s => console.log(s)) ; var strArray = strStream.toArray(); From b68684ddb562dbda02a4c10608e2f32e0b95f636 Mon Sep 17 00:00:00 2001 From: Bence Eros Date: Sat, 13 Jun 2015 01:55:29 +0200 Subject: [PATCH 0058/1358] adding most is the terminal operations - partitioning, joining, and iterator ops are missing yet --- streamjs/streamjs-tests.ts | 50 ++++++++++++++++++++++++++++++++++++-- streamjs/streamjs.d.ts | 42 ++++++++++++++++++++++++++++++++ 2 files changed, 90 insertions(+), 2 deletions(-) diff --git a/streamjs/streamjs-tests.ts b/streamjs/streamjs-tests.ts index b1fba365cd..50a398418d 100644 --- a/streamjs/streamjs-tests.ts +++ b/streamjs/streamjs-tests.ts @@ -31,16 +31,62 @@ var strStream = numStream .takeWhile(s => s.length < 5) .takeWhile(/^aa.*$/) .slice(5, 2) - .forEach(s => console.log(s)) ; var strArray = strStream.toArray(); +strStream.forEach(s => console.log(s)); +var opt: Stream.Optional = strStream.findFirst(); +opt = strStream.findAny(); +opt = strStream.max(); +opt = strStream.max((s1, s2) => 0); +opt = strStream.min(); +opt = strStream.min((s1, s2) => 0); + +var sum = numStream.sum(); +var avg = numStream.average(); +avg = numStream.avg(); + +var count = numStream.count(); +count = numStream.size(); + +var allMatch: boolean = numStream.allMatch(n => true); +allMatch = strStream.allMatch(/^$/); + +var anyMatch: boolean = numStream.anyMatch(n => false); +anyMatch = strStream.anyMatch(/^$/); + +var noneMatch: boolean = numStream.noneMatch(n => false); +noneMatch = strStream.noneMatch(/^$/); + +sum = numStream.reduce(0, (n1, n2) => n1 + n2); +opt = strStream.reduce((s1, s2) => s1 + s2); + class MyList { elems: any[]; + name: string } var elems: any[]; -elems = Stream.make([new MyList, new MyList]) + +var myStream = Stream.make([new MyList, new MyList]); +elems = myStream .flatMap(list => list.elems) .toArray(); + //.forEach(s => console.log(s)); + + +numStream.collect({ + supplier: () => 0, + accumulator: (n1, n2) => n1 + n2, + finisher: n => n +}); + +var groupingResult = myStream.groupBy(lst => lst.name); +var elems = groupingResult["hello"].elems; +groupingResult = myStream.groupingBy(lst => lst.name); + +var mappingResult = myStream.toMap(lst => lst.name, (e1, e2) => e2); +console.log(mappingResult["a"]); + +myStream.toMap(lst => lst.name); diff --git a/streamjs/streamjs.d.ts b/streamjs/streamjs.d.ts index 1ac6c534c8..1478d7a68d 100644 --- a/streamjs/streamjs.d.ts +++ b/streamjs/streamjs.d.ts @@ -10,15 +10,40 @@ declare class Stream { static rangeClosed (startInclusive: number, endInclusive: number): Stream; static generate (supplier: () => T): Stream; + anyMatch(predicate: (elem: T) => boolean): boolean; + anyMatch(regexp: RegExp): boolean; + allMatch(predicate: (elem: T) => boolean): boolean; + allMatch(regexp: RegExp): boolean; + average(): number; + avg(): number; + collect(collector: Stream.Collector): T; + count(): number; distinct(): Stream; dropWhile(predicate: (elem: T) => boolean): Stream; dropWhile(regexp: RegExp): Stream; filter(predicate: (T) => boolean): Stream; + findAny(): Stream.Optional; + findFirst(): Stream.Optional; + forEach(consumer: (elem: T) => void): void; + + groupBy(mapper: (elem: T) => string): Stream.GroupingResult; + groupingBy(mapper: (elem: T) => string): Stream.GroupingResult; + toMap(keyMapper: (elem: T) => string, mergeFunction?: (elem1: T, elem2: T) => T): T[]; + map (mapper: (T) => U): Stream; + max(): Stream.Optional; + max(comparator: (e1: T, e2: T) => number): Stream.Optional; + min(): Stream.Optional; + min(comparator: (elem1: T, elem2: T) => number): Stream.Optional; + noneMatch(predicate: (elem: T) => boolean): boolean; + noneMatch(regexp: RegExp): boolean; flatMap (mapper: (T) => U[]): Stream; limit(limit: number): Stream; peek(consumer: (elem: T) => void ): Stream; + reduce(identity: T, accumulator: (e1: T, e2: T) => T): T; + reduce(accumulator: (e1: T, e2: T) => T): Stream.Optional; reverse(): Stream; + size(): number; sorted(): Stream; sorted(comparator: (e1: T, e2: T) => number): Stream; sort(): Stream; @@ -26,7 +51,24 @@ declare class Stream { shuffle(): Stream; skip(n: number): Stream; slice(begin, end): Stream; + sum(): T; takeWhile(predicate: (elem: T) => boolean): Stream; takeWhile(regexp: RegExp): Stream; toArray(): T[]; } + +declare module Stream { + export interface GroupingResult { + [index: string]: T + } + + export interface Collector { + supplier(): T; + accumulator(e1: T, e2: T): T; + finisher(result: T): T + } + + export class Optional { + + } +} From b1192f0e1571397a03137b0df39652047d03c1db Mon Sep 17 00:00:00 2001 From: Kristof Mattei Date: Sat, 13 Jun 2015 16:21:22 +0200 Subject: [PATCH 0059/1358] Set the correct namespace --- angular-local-storage/angular-local-storage.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/angular-local-storage/angular-local-storage.d.ts b/angular-local-storage/angular-local-storage.d.ts index f0500a96f6..940874d23b 100644 --- a/angular-local-storage/angular-local-storage.d.ts +++ b/angular-local-storage/angular-local-storage.d.ts @@ -6,7 +6,7 @@ /// declare module angular.local.storage { - interface ILocalStorageServiceProvider extends IServiceProvider { + interface ILocalStorageServiceProvider extends ng.IServiceProvider { /** * Setter for the prefix * You should set a prefix to avoid overwriting any local storage variables from the rest of your app @@ -129,7 +129,7 @@ declare module angular.local.storage { * @param value optional * @param key The corresponding key used in local storage */ - bind(scope: angular.IScope, property: string, value?: any, key?: string): Function; + bind(scope: ng.IScope, property: string, value?: any, key?: string): Function; /** * Return the derive key * Returns String From bcbadfe78abb6c0ed3979cafd9994c04e48648e0 Mon Sep 17 00:00:00 2001 From: Bence Eros Date: Sun, 14 Jun 2015 00:05:19 +0200 Subject: [PATCH 0060/1358] adding partitioning and joining operators to Stream, and the nonterminals of Optional --- streamjs/streamjs-tests.ts | 32 ++++++++++++++++++++++++++++++++ streamjs/streamjs.d.ts | 38 +++++++++++++++++++++++++++++++++++--- 2 files changed, 67 insertions(+), 3 deletions(-) diff --git a/streamjs/streamjs-tests.ts b/streamjs/streamjs-tests.ts index 50a398418d..e59af31ae1 100644 --- a/streamjs/streamjs-tests.ts +++ b/streamjs/streamjs-tests.ts @@ -5,6 +5,7 @@ var numStream: Stream; numStream = Stream.make([10, 20]); numStream = Stream.range(1, 5); numStream = Stream.rangeClosed(1, 5); +// numStream = Stream.empty(); Stream.generate(function() { return 1; @@ -90,3 +91,34 @@ var mappingResult = myStream.toMap(lst => lst.name, (e1, e2) => e2); console.log(mappingResult["a"]); myStream.toMap(lst => lst.name); + +mappingResult = myStream.indexBy(lst => lst.name, (e1, e2) => e2); + +var partitionedNums: number[][] = numStream.partitioningBy(n => n % 2 == 0); +partitionedNums = numStream.partitionBy(n => n % 2 == 0); + +var partitionedStrings : string[][] = strStream.partitionBy(/^a$/); +partitionedStrings = strStream.partitioningBy(/^a$/); +partitionedStrings = strStream.partitioningBy(5); +partitionedStrings = strStream.partitionBy(5); + +var s: string = numStream.joining(); +s = numStream.join(); +s = numStream.joining(", "); +s = numStream.join(", "); +s = numStream.joining({prefix: "{", delimiter: ", ", suffix: "}"}); +s = numStream.join({prefix: "{", delimiter: ", ", suffix: "}"}); + + +var iter = numStream.iterator(); +var n: number = iter.next(); +var done: boolean = iter.done; + +var optNum: Stream.Optional = Stream.Optional.of(2); +optNum = Stream.Optional.ofNullable(null); +optNum = Stream.Optional.empty(); + +var optStr: Stream.Optional = optNum.filter(n => n % 2 == 0) + .map(n => "number" + n) + .flatMap(n => Stream.Optional.of(n + 2)) + ; diff --git a/streamjs/streamjs.d.ts b/streamjs/streamjs.d.ts index 1478d7a68d..6d13346a98 100644 --- a/streamjs/streamjs.d.ts +++ b/streamjs/streamjs.d.ts @@ -9,6 +9,7 @@ declare class Stream { static range (startInclusive: number, endExclusive: number): Stream; static rangeClosed (startInclusive: number, endInclusive: number): Stream; static generate (supplier: () => T): Stream; + // static empty(): Stream; anyMatch(predicate: (elem: T) => boolean): boolean; anyMatch(regexp: RegExp): boolean; @@ -28,8 +29,7 @@ declare class Stream { groupBy(mapper: (elem: T) => string): Stream.GroupingResult; groupingBy(mapper: (elem: T) => string): Stream.GroupingResult; - toMap(keyMapper: (elem: T) => string, mergeFunction?: (elem1: T, elem2: T) => T): T[]; - + indexBy(keyMapper: (elem: T) => string, mergeFunction?: (elem1: T, elem2: T) => T): T[]; map (mapper: (T) => U): Stream; max(): Stream.Optional; max(comparator: (e1: T, e2: T) => number): Stream.Optional; @@ -38,7 +38,20 @@ declare class Stream { noneMatch(predicate: (elem: T) => boolean): boolean; noneMatch(regexp: RegExp): boolean; flatMap (mapper: (T) => U[]): Stream; + iterator(): Stream.Iterator; + joining(): string; + joining(delimiter: string): string; + joining(options: Stream.JoinOptions): string; + join(): string; + join(delimiter: string): string; + join(options: Stream.JoinOptions): string; limit(limit: number): Stream; + partitioningBy(predicate: (elem: T) => boolean): T[][]; + partitionBy(predicate: (elem: T) => boolean): T[][]; + partitioningBy(regexp: RegExp): T[][]; + partitionBy(regexp: RegExp): T[][]; + partitioningBy(size: number): T[][]; + partitionBy(size: number): T[][]; peek(consumer: (elem: T) => void ): Stream; reduce(identity: T, accumulator: (e1: T, e2: T) => T): T; reduce(accumulator: (e1: T, e2: T) => T): Stream.Optional; @@ -55,9 +68,22 @@ declare class Stream { takeWhile(predicate: (elem: T) => boolean): Stream; takeWhile(regexp: RegExp): Stream; toArray(): T[]; + toMap(keyMapper: (elem: T) => string, mergeFunction?: (elem1: T, elem2: T) => T): T[]; } declare module Stream { + + export interface Iterator { + next(): T; + done: boolean; + } + + export interface JoinOptions { + prefix: string; + delimiter: string; + suffix: string; + } + export interface GroupingResult { [index: string]: T } @@ -69,6 +95,12 @@ declare module Stream { } export class Optional { - + static of(elem: T): Optional; + static ofNullable(elem: T): Optional; + static empty(): Optional; + + filter(predicate: (elem: T) => boolean): Optional; + map(mapper: (elem: T) => U): Optional; + flatMap(mapper: (elem: T) => Stream.Optional): Optional; } } From 09899c1ffa639cb80a835dcde5afc93d1f987af7 Mon Sep 17 00:00:00 2001 From: Bence Eros Date: Sun, 14 Jun 2015 00:38:59 +0200 Subject: [PATCH 0061/1358] added termial operations of Optional --- streamjs/streamjs-tests.ts | 9 ++++++++- streamjs/streamjs.d.ts | 6 ++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/streamjs/streamjs-tests.ts b/streamjs/streamjs-tests.ts index e59af31ae1..3d836b56f1 100644 --- a/streamjs/streamjs-tests.ts +++ b/streamjs/streamjs-tests.ts @@ -116,9 +116,16 @@ var done: boolean = iter.done; var optNum: Stream.Optional = Stream.Optional.of(2); optNum = Stream.Optional.ofNullable(null); -optNum = Stream.Optional.empty(); +//optNum = Stream.Optional.empty(); var optStr: Stream.Optional = optNum.filter(n => n % 2 == 0) .map(n => "number" + n) .flatMap(n => Stream.Optional.of(n + 2)) ; + +var isPresent: boolean = optNum.isPresent(); +var num: number = optNum.get(); +optNum.ifPresent(n => console.log(n)); +var def: number = optNum.orElse(2); +def = optNum.orElseGet(() => 3); +def = optNum.orElseThrow("something went wrong"); diff --git a/streamjs/streamjs.d.ts b/streamjs/streamjs.d.ts index 6d13346a98..5a0ea94a4d 100644 --- a/streamjs/streamjs.d.ts +++ b/streamjs/streamjs.d.ts @@ -102,5 +102,11 @@ declare module Stream { filter(predicate: (elem: T) => boolean): Optional; map(mapper: (elem: T) => U): Optional; flatMap(mapper: (elem: T) => Stream.Optional): Optional; + isPresent(): boolean; + get(): T; + ifPresent(consumer: (elem: T) => void): void; + orElse(other: T): T; + orElseGet(supplier: () => T): T; + orElseThrow(error: any): T; } } From aad6b603afa58007377fdc65649d9fdcdad4fc1e Mon Sep 17 00:00:00 2001 From: Bence Eros Date: Sun, 14 Jun 2015 00:39:46 +0200 Subject: [PATCH 0062/1358] added termial operations of Optional --- streamjs/streamjs.d.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/streamjs/streamjs.d.ts b/streamjs/streamjs.d.ts index 5a0ea94a4d..8ac67d583c 100644 --- a/streamjs/streamjs.d.ts +++ b/streamjs/streamjs.d.ts @@ -11,7 +11,7 @@ declare class Stream { static generate (supplier: () => T): Stream; // static empty(): Stream; - anyMatch(predicate: (elem: T) => boolean): boolean; + anyMatch(predicate: Stream.Predicate): boolean; anyMatch(regexp: RegExp): boolean; allMatch(predicate: (elem: T) => boolean): boolean; allMatch(regexp: RegExp): boolean; @@ -73,6 +73,10 @@ declare class Stream { declare module Stream { + export interface Predicate { + (elem: T): boolean; + } + export interface Iterator { next(): T; done: boolean; From c5432f4533707047327ee32618e0dbde55621c40 Mon Sep 17 00:00:00 2001 From: Bence Eros Date: Sun, 14 Jun 2015 00:57:48 +0200 Subject: [PATCH 0063/1358] added some functional interfaces to reduce the number of inline anonymous types --- streamjs/streamjs.d.ts | 86 ++++++++++++++++++++++++++---------------- 1 file changed, 53 insertions(+), 33 deletions(-) diff --git a/streamjs/streamjs.d.ts b/streamjs/streamjs.d.ts index 8ac67d583c..464a449ca4 100644 --- a/streamjs/streamjs.d.ts +++ b/streamjs/streamjs.d.ts @@ -8,36 +8,36 @@ declare class Stream { static make (elems: T[]): Stream; static range (startInclusive: number, endExclusive: number): Stream; static rangeClosed (startInclusive: number, endInclusive: number): Stream; - static generate (supplier: () => T): Stream; + static generate (supplier: Stream.Supplier): Stream; // static empty(): Stream; - anyMatch(predicate: Stream.Predicate): boolean; + anyMatch(predicate: Stream.Predicate): boolean; anyMatch(regexp: RegExp): boolean; - allMatch(predicate: (elem: T) => boolean): boolean; + allMatch(predicate: Stream.Predicate): boolean; allMatch(regexp: RegExp): boolean; average(): number; avg(): number; collect(collector: Stream.Collector): T; count(): number; distinct(): Stream; - dropWhile(predicate: (elem: T) => boolean): Stream; + dropWhile(predicate: Stream.Predicate): Stream; dropWhile(regexp: RegExp): Stream; - filter(predicate: (T) => boolean): Stream; + filter(predicate: Stream.Predicate): Stream; findAny(): Stream.Optional; findFirst(): Stream.Optional; - forEach(consumer: (elem: T) => void): void; + forEach(consumer: Stream.Consumer): void; - groupBy(mapper: (elem: T) => string): Stream.GroupingResult; - groupingBy(mapper: (elem: T) => string): Stream.GroupingResult; - indexBy(keyMapper: (elem: T) => string, mergeFunction?: (elem1: T, elem2: T) => T): T[]; - map (mapper: (T) => U): Stream; + groupBy(mapper: Stream.Function): Stream.GroupingResult; + groupingBy(mapper: Stream.Function): Stream.GroupingResult; + indexBy(keyMapper: Stream.Function, mergeFunction?: Stream.Accumulator): T[]; + map (mapper: Stream.Function): Stream; max(): Stream.Optional; - max(comparator: (e1: T, e2: T) => number): Stream.Optional; + max(comparator: Stream.Comparator): Stream.Optional; min(): Stream.Optional; - min(comparator: (elem1: T, elem2: T) => number): Stream.Optional; + min(comparator: Stream.Comparator): Stream.Optional; noneMatch(predicate: (elem: T) => boolean): boolean; noneMatch(regexp: RegExp): boolean; - flatMap (mapper: (T) => U[]): Stream; + flatMap (mapper: Stream.Function): Stream; iterator(): Stream.Iterator; joining(): string; joining(delimiter: string): string; @@ -46,56 +46,76 @@ declare class Stream { join(delimiter: string): string; join(options: Stream.JoinOptions): string; limit(limit: number): Stream; - partitioningBy(predicate: (elem: T) => boolean): T[][]; - partitionBy(predicate: (elem: T) => boolean): T[][]; + partitioningBy(predicate: Stream.Predicate): T[][]; + partitionBy(predicate: Stream.Predicate): T[][]; partitioningBy(regexp: RegExp): T[][]; partitionBy(regexp: RegExp): T[][]; partitioningBy(size: number): T[][]; partitionBy(size: number): T[][]; - peek(consumer: (elem: T) => void ): Stream; - reduce(identity: T, accumulator: (e1: T, e2: T) => T): T; - reduce(accumulator: (e1: T, e2: T) => T): Stream.Optional; + peek(consumer: Stream.Consumer): Stream; + reduce(identity: T, accumulator: Stream.Accumulator): T; + reduce(accumulator: Stream.Accumulator): Stream.Optional; reverse(): Stream; size(): number; sorted(): Stream; - sorted(comparator: (e1: T, e2: T) => number): Stream; + sorted(comparator: Stream.Comparator): Stream; sort(): Stream; - sort(comparator: (e1: T, e2: T) => number): Stream; + sort(comparator: Stream.Comparator): Stream; shuffle(): Stream; skip(n: number): Stream; slice(begin, end): Stream; sum(): T; - takeWhile(predicate: (elem: T) => boolean): Stream; + takeWhile(predicate: Stream.Predicate): Stream; takeWhile(regexp: RegExp): Stream; toArray(): T[]; - toMap(keyMapper: (elem: T) => string, mergeFunction?: (elem1: T, elem2: T) => T): T[]; + toMap(keyMapper: Stream.Function, mergeFunction?: Stream.Accumulator): T[]; } declare module Stream { - export interface Predicate { - (elem: T): boolean; + export interface Accumulator { + (e1: T, e2: T): T; + } + + export interface Collector { + supplier: Supplier; + accumulator: Stream.Accumulator; + finisher: Function; } + export interface Comparator { + (e1: T, e2: T): number + } + + export interface Consumer { + (elem: T): void; + } + + export interface Function { + (elem: T): U; + } + + export interface GroupingResult { + [index: string]: T + } + export interface Iterator { next(): T; done: boolean; } - + export interface JoinOptions { prefix: string; delimiter: string; suffix: string; } - export interface GroupingResult { - [index: string]: T + export interface Predicate { + (elem: T): boolean; } - - export interface Collector { - supplier(): T; - accumulator(e1: T, e2: T): T; - finisher(result: T): T + + export interface Supplier { + (): T } export class Optional { @@ -110,7 +130,7 @@ declare module Stream { get(): T; ifPresent(consumer: (elem: T) => void): void; orElse(other: T): T; - orElseGet(supplier: () => T): T; + orElseGet(supplier: Stream.Supplier): T; orElseThrow(error: any): T; } } From a8871c9dfaccaed9df047617c5a7bcee8d6f92cf Mon Sep 17 00:00:00 2001 From: Bence Eros Date: Sun, 14 Jun 2015 01:17:49 +0200 Subject: [PATCH 0064/1358] adding Stream.iterate() constructor --- streamjs/streamjs-tests.ts | 2 ++ streamjs/streamjs.d.ts | 1 + 2 files changed, 3 insertions(+) diff --git a/streamjs/streamjs-tests.ts b/streamjs/streamjs-tests.ts index 3d836b56f1..083940311d 100644 --- a/streamjs/streamjs-tests.ts +++ b/streamjs/streamjs-tests.ts @@ -12,6 +12,8 @@ Stream.generate(function() { }); Stream.generate(() => 1); +numStream = Stream.iterate(1, (n) => n * 2); + var comparator = (s1, s2) => 0; numStream = numStream.filter(n => n % 2 == 0); diff --git a/streamjs/streamjs.d.ts b/streamjs/streamjs.d.ts index 464a449ca4..3b82680dfd 100644 --- a/streamjs/streamjs.d.ts +++ b/streamjs/streamjs.d.ts @@ -9,6 +9,7 @@ declare class Stream { static range (startInclusive: number, endExclusive: number): Stream; static rangeClosed (startInclusive: number, endInclusive: number): Stream; static generate (supplier: Stream.Supplier): Stream; + static iterate(seed: T, fn: Stream.Function): Stream; // static empty(): Stream; anyMatch(predicate: Stream.Predicate): boolean; From b9dab01b68ad9b959cb3e057bed6b861e9de33f6 Mon Sep 17 00:00:00 2001 From: Bence Eros Date: Sun, 14 Jun 2015 02:05:27 +0200 Subject: [PATCH 0065/1358] adding some missing methods, adding README with unsupported method list --- streamjs/README.md | 22 ++++++++++++++++++++++ streamjs/streamjs-tests.ts | 8 ++++---- streamjs/streamjs.d.ts | 4 ++++ 3 files changed, 30 insertions(+), 4 deletions(-) create mode 100644 streamjs/README.md diff --git a/streamjs/README.md b/streamjs/README.md new file mode 100644 index 0000000000..ae3fcfc97a --- /dev/null +++ b/streamjs/README.md @@ -0,0 +1,22 @@ +# StreamJS Type Definitions + +Unsupported StreamJS function / method signatures: + * Stream(collection) + * Stream(string) + * Stream.empty() + * filter(sample) + * map(path) + * flatMap(path) + * sorted(path) + * takeWhile(sample) + * dropWhile(sample) + * min(path) + * max(path) + * sum(path) + * average(path) + * allMatch(sample) + * anyMatch(sample) + * groupingBy(path) + * toMap(path, mergeFunction) + * partitioningBy(sample); + * Optional.empty() diff --git a/streamjs/streamjs-tests.ts b/streamjs/streamjs-tests.ts index 083940311d..c5f1ea8624 100644 --- a/streamjs/streamjs-tests.ts +++ b/streamjs/streamjs-tests.ts @@ -1,11 +1,9 @@ // var numStream: Stream; -// numStream = Stream.make(10, 20); -numStream = Stream.make([10, 20]); +numStream = Stream.of(1, 2, 3); numStream = Stream.range(1, 5); numStream = Stream.rangeClosed(1, 5); -// numStream = Stream.empty(); Stream.generate(function() { return 1; @@ -37,7 +35,9 @@ var strStream = numStream ; var strArray = strStream.toArray(); - +strArray = strStream.toList(); +strStream.each(s => console.log(s)); +strStream.filter(/^$/); strStream.forEach(s => console.log(s)); var opt: Stream.Optional = strStream.findFirst(); opt = strStream.findAny(); diff --git a/streamjs/streamjs.d.ts b/streamjs/streamjs.d.ts index 3b82680dfd..17889ff2fc 100644 --- a/streamjs/streamjs.d.ts +++ b/streamjs/streamjs.d.ts @@ -6,6 +6,7 @@ declare class Stream { // static make (...elems: T[]): Stream; static make (elems: T[]): Stream; + static of(...elems: T[]): Stream; static range (startInclusive: number, endExclusive: number): Stream; static rangeClosed (startInclusive: number, endInclusive: number): Stream; static generate (supplier: Stream.Supplier): Stream; @@ -23,7 +24,9 @@ declare class Stream { distinct(): Stream; dropWhile(predicate: Stream.Predicate): Stream; dropWhile(regexp: RegExp): Stream; + each(consumer: Stream.Consumer): void; filter(predicate: Stream.Predicate): Stream; + filter(regexp: RegExp): Stream; findAny(): Stream.Optional; findFirst(): Stream.Optional; forEach(consumer: Stream.Consumer): void; @@ -69,6 +72,7 @@ declare class Stream { takeWhile(predicate: Stream.Predicate): Stream; takeWhile(regexp: RegExp): Stream; toArray(): T[]; + toList(): T[]; toMap(keyMapper: Stream.Function, mergeFunction?: Stream.Accumulator): T[]; } From f4fd84bb109efaf4c1e62dc65b543180ea90fd70 Mon Sep 17 00:00:00 2001 From: Bence Eros Date: Sun, 14 Jun 2015 02:13:48 +0200 Subject: [PATCH 0066/1358] commenting out Optional.empty() since it does not work as expected --- streamjs/streamjs.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/streamjs/streamjs.d.ts b/streamjs/streamjs.d.ts index 17889ff2fc..aa2a82e61f 100644 --- a/streamjs/streamjs.d.ts +++ b/streamjs/streamjs.d.ts @@ -126,7 +126,7 @@ declare module Stream { export class Optional { static of(elem: T): Optional; static ofNullable(elem: T): Optional; - static empty(): Optional; + // static empty(): Optional; filter(predicate: (elem: T) => boolean): Optional; map(mapper: (elem: T) => U): Optional; From bd123fb8824cc1a554ed1fa4abc2f4331ceaff17 Mon Sep 17 00:00:00 2001 From: Bence Eros Date: Sun, 14 Jun 2015 13:57:39 +0200 Subject: [PATCH 0067/1358] adding support for most of the methods receiving sample or path as parameter --- streamjs/README.md | 13 ------------- streamjs/streamjs-tests.ts | 23 ++++++++++++++++++++++- streamjs/streamjs.d.ts | 25 +++++++++++++++++++++++-- 3 files changed, 45 insertions(+), 16 deletions(-) diff --git a/streamjs/README.md b/streamjs/README.md index ae3fcfc97a..9428177672 100644 --- a/streamjs/README.md +++ b/streamjs/README.md @@ -4,19 +4,6 @@ Unsupported StreamJS function / method signatures: * Stream(collection) * Stream(string) * Stream.empty() - * filter(sample) * map(path) * flatMap(path) - * sorted(path) - * takeWhile(sample) - * dropWhile(sample) - * min(path) - * max(path) - * sum(path) - * average(path) - * allMatch(sample) - * anyMatch(sample) - * groupingBy(path) - * toMap(path, mergeFunction) - * partitioningBy(sample); * Optional.empty() diff --git a/streamjs/streamjs-tests.ts b/streamjs/streamjs-tests.ts index c5f1ea8624..f83ec69e82 100644 --- a/streamjs/streamjs-tests.ts +++ b/streamjs/streamjs-tests.ts @@ -22,8 +22,10 @@ var strStream = numStream .limit(100) .sorted() .sort() + .sort("propName") .sorted(comparator) .sort(comparator) + .sorted("propName") .shuffle() .reverse() .distinct() @@ -47,8 +49,11 @@ opt = strStream.min(); opt = strStream.min((s1, s2) => 0); var sum = numStream.sum(); +sum = numStream.sum("foo"); var avg = numStream.average(); +avg = numStream.average("foo"); avg = numStream.avg(); +avg = numStream.avg("foo"); var count = numStream.count(); count = numStream.size(); @@ -78,6 +83,13 @@ elems = myStream .toArray(); //.forEach(s => console.log(s)); +myStream = myStream.takeWhile({name: "foo"}); +myStream = myStream.dropWhile({name: "foo"}); +myStream = myStream.filter({name: "foo"}); +var myResult = myStream.min("name"); +myResult = myStream.max("name"); +var match: boolean = myStream.allMatch({name: "foo"}); +match = myStream.anyMatch({name: "foo"}); numStream.collect({ supplier: () => 0, @@ -88,9 +100,13 @@ numStream.collect({ var groupingResult = myStream.groupBy(lst => lst.name); var elems = groupingResult["hello"].elems; groupingResult = myStream.groupingBy(lst => lst.name); +groupingResult = myStream.groupBy("name"); +groupingResult = myStream.groupingBy("name"); var mappingResult = myStream.toMap(lst => lst.name, (e1, e2) => e2); -console.log(mappingResult["a"]); +var aMappingResult: MyList = mappingResult["a"]; + +mappingResult = myStream.toMap("a"); myStream.toMap(lst => lst.name); @@ -104,6 +120,9 @@ partitionedStrings = strStream.partitioningBy(/^a$/); partitionedStrings = strStream.partitioningBy(5); partitionedStrings = strStream.partitionBy(5); +var partitionedList: MyList[][] = myStream.partitionBy({name : "foo"}); +partitionedList = myStream.partitioningBy({name : "foo"}); + var s: string = numStream.joining(); s = numStream.join(); s = numStream.joining(", "); @@ -131,3 +150,5 @@ optNum.ifPresent(n => console.log(n)); var def: number = optNum.orElse(2); def = optNum.orElseGet(() => 3); def = optNum.orElseThrow("something went wrong"); + + diff --git a/streamjs/streamjs.d.ts b/streamjs/streamjs.d.ts index aa2a82e61f..81ed58a82f 100644 --- a/streamjs/streamjs.d.ts +++ b/streamjs/streamjs.d.ts @@ -1,5 +1,5 @@ // Type definitions for streamjs 1.4.0 -// Project: http://streamjs.org/ +// Project: https://github.com/winterbe/streamjs // Definitions by: Bence Eros // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -15,30 +15,40 @@ declare class Stream { anyMatch(predicate: Stream.Predicate): boolean; anyMatch(regexp: RegExp): boolean; + anyMatch(sample: Stream.Sample): boolean; allMatch(predicate: Stream.Predicate): boolean; allMatch(regexp: RegExp): boolean; + allMatch(sample: Stream.Sample): boolean; average(): number; + average(path: string): number; avg(): number; + avg(path: string): number; collect(collector: Stream.Collector): T; count(): number; distinct(): Stream; dropWhile(predicate: Stream.Predicate): Stream; dropWhile(regexp: RegExp): Stream; + dropWhile(sample: Stream.Sample): Stream; each(consumer: Stream.Consumer): void; filter(predicate: Stream.Predicate): Stream; filter(regexp: RegExp): Stream; + filter(sample: Stream.Sample): Stream; findAny(): Stream.Optional; findFirst(): Stream.Optional; forEach(consumer: Stream.Consumer): void; groupBy(mapper: Stream.Function): Stream.GroupingResult; + groupBy(path: string): Stream.GroupingResult; groupingBy(mapper: Stream.Function): Stream.GroupingResult; + groupingBy(path: string): Stream.GroupingResult; indexBy(keyMapper: Stream.Function, mergeFunction?: Stream.Accumulator): T[]; map (mapper: Stream.Function): Stream; max(): Stream.Optional; max(comparator: Stream.Comparator): Stream.Optional; + max(path: string): Stream.Optional; min(): Stream.Optional; min(comparator: Stream.Comparator): Stream.Optional; + min(path: string): Stream.Optional; noneMatch(predicate: (elem: T) => boolean): boolean; noneMatch(regexp: RegExp): boolean; flatMap (mapper: Stream.Function): Stream; @@ -52,10 +62,12 @@ declare class Stream { limit(limit: number): Stream; partitioningBy(predicate: Stream.Predicate): T[][]; partitionBy(predicate: Stream.Predicate): T[][]; + partitionBy(sample: Stream.Sample): T[][]; partitioningBy(regexp: RegExp): T[][]; partitionBy(regexp: RegExp): T[][]; partitioningBy(size: number): T[][]; partitionBy(size: number): T[][]; + partitioningBy(sample: Stream.Sample): T[][]; peek(consumer: Stream.Consumer): Stream; reduce(identity: T, accumulator: Stream.Accumulator): T; reduce(accumulator: Stream.Accumulator): Stream.Optional; @@ -63,21 +75,30 @@ declare class Stream { size(): number; sorted(): Stream; sorted(comparator: Stream.Comparator): Stream; + sorted(path: string): Stream; sort(): Stream; sort(comparator: Stream.Comparator): Stream; + sort(path: string): Stream; shuffle(): Stream; skip(n: number): Stream; slice(begin, end): Stream; - sum(): T; + sum(): number; + sum(path: string): number; takeWhile(predicate: Stream.Predicate): Stream; takeWhile(regexp: RegExp): Stream; + takeWhile(sample: Stream.Sample): Stream; toArray(): T[]; toList(): T[]; toMap(keyMapper: Stream.Function, mergeFunction?: Stream.Accumulator): T[]; + toMap(path: string, mergeFunction?: Stream.Accumulator): T[]; } declare module Stream { + export interface Sample { + [index: string]: any + } + export interface Accumulator { (e1: T, e2: T): T; } From 7da2851ffc22ac4b875d0d91584232e03a79c25b Mon Sep 17 00:00:00 2001 From: nfantone Date: Sun, 14 Jun 2015 17:38:54 -0300 Subject: [PATCH 0068/1358] Add sample() to LoDashArrayWrapper interface --- lodash/lodash-tests.ts | 2 ++ lodash/lodash.d.ts | 14 +++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 633c4ed0d4..e0f2b82269 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -605,6 +605,8 @@ result = _(foodsCombined).reject({ 'type': 'fruit' }).value(); result = _.sample([1, 2, 3, 4]); result = _.sample([1, 2, 3, 4], 2); +result = <_.LoDashArrayWrapper>_([1, 2, 3, 4]).sample(); +result = <_.LoDashArrayWrapper>_([1, 2, 3, 4]).sample(2); result = _.shuffle([1, 2, 3, 4, 5, 6]); result = <_.LoDashArrayWrapper>_([1, 2, 3]).shuffle(); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 9cb55485d9..a906b907f3 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -22,7 +22,7 @@ declare module _ { * forEach, forEachRight, forIn, forInRight, forOwn, forOwnRight, functions, groupBy, * indexBy, initial, intersection, invert, invoke, keys, map, max, memoize, merge, min, * object, omit, once, pairs, partial, partialRight, pick, pluck, pull, push, range, reject, - * remove, rest, reverse, shuffle, slice, sort, sortBy, splice, tap, throttle, times, + * remove, rest, reverse, sample, shuffle, slice, sort, sortBy, splice, tap, throttle, times, * toArray, transform, union, uniq, unshift, unzip, values, where, without, wrap, and zip * * The non-chainable wrapper functions are: @@ -4559,6 +4559,18 @@ declare module _ { sample(collection: Dictionary, n: number): T[]; } + interface LoDashArrayWrapper { + /** + * @see _.sample + **/ + sample(n: number): LoDashArrayWrapper; + + /** + * @see _.sample + **/ + sample(): LoDashArrayWrapper; + } + //_.shuffle interface LoDashStatic { /** From f9c3edf6c6c32726e7e424fc3690da5ff1b0eef6 Mon Sep 17 00:00:00 2001 From: Haskell Camargo Date: Sun, 14 Jun 2015 23:21:47 -0300 Subject: [PATCH 0069/1358] Each is not void, it returns a parameter of type A[] --- prelude-ls/prelude-ls-tests.ts | 16 ++++++++++------ prelude-ls/prelude-ls.d.ts | 6 ++++-- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/prelude-ls/prelude-ls-tests.ts b/prelude-ls/prelude-ls-tests.ts index b6e50e2256..8c37a1e717 100644 --- a/prelude-ls/prelude-ls-tests.ts +++ b/prelude-ls/prelude-ls-tests.ts @@ -1,23 +1,27 @@ +/// + import prelude = require("prelude-ls"); -prelude.id(5); //=> 5 -prelude.id({}); //=> {} +var five: number = prelude.id(5); //=> 5 +var emptyObj: Object = prelude.id({}); //=> {} -prelude.isType("Undefined", void 8); //=> true +var expectBool: boolean = prelude.isType("Undefined", void 8); //=> true prelude.isType("Boolean", true); //=> true prelude.isType("Number", 1); //=> true prelude.isType("String", "hi"); //=> true prelude.isType("Object", {}); //=> true prelude.isType("Array", []); //=> true -prelude.replicate(4, 3); //=> [3, 3, 3, 3] -prelude.replicate(4, "a"); //=> ["a", "a", "a", "a"] +var numberArray: Array = prelude.replicate(4, 3); //=> [3, 3, 3, 3] +var strArray: Array = + prelude.replicate(4, "a"); //=> ["a", "a", "a", "a"] prelude.replicate(0, "a"); //=> [] // List -prelude.each(x => x.push("boom"), [["a"], ["b"], ["c"]]); +var dblStrArray: Array> = + prelude.each(x => x.push("boom"), [["a"], ["b"], ["c"]]); //=> [["a", "boom"], ["b", "boom"], ["c", "boom"]] prelude.map(x => x * 2, [1, 2, 3, 4, 5]); //=> [2, 4, 6, 8, 10] diff --git a/prelude-ls/prelude-ls.d.ts b/prelude-ls/prelude-ls.d.ts index 848077c822..0de28f63a8 100644 --- a/prelude-ls/prelude-ls.d.ts +++ b/prelude-ls/prelude-ls.d.ts @@ -3,6 +3,8 @@ // Definitions by: Aya Morisawa // Definitions: https://github.com/borisyankov/DefinitelyTyped +// Change [0]: 2015/06/14 - Marcelo Camargo + declare module "prelude-ls" { module PreludeLS { export function id(x: A): A; @@ -14,8 +16,8 @@ declare module "prelude-ls" { // List - export function each(f: (x: A) => void): (xs: A[]) => void; - export function each(f: (x: A) => void, xs: A[]): void; + export function each(f: (x: A) => void): (xs: A[]) => A[]; + export function each(f: (x: A) => void, xs: A[]): A[]; export function map(f: (x: A) => B): (xs: A[]) => B[]; export function map(f: (x: A) => B, xs: A[]): B[]; export function compact(xs: A[]): A[]; From 19795463b32a83f4f68b55e8c8068f3956a4b7d3 Mon Sep 17 00:00:00 2001 From: Haskell Camargo Date: Sun, 14 Jun 2015 23:31:32 -0300 Subject: [PATCH 0070/1358] Correction on return types for find, head and last --- prelude-ls/prelude-ls-tests.ts | 30 +++++++++++++++++++----------- prelude-ls/prelude-ls.d.ts | 8 ++++---- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/prelude-ls/prelude-ls-tests.ts b/prelude-ls/prelude-ls-tests.ts index 8c37a1e717..080f40afbd 100644 --- a/prelude-ls/prelude-ls-tests.ts +++ b/prelude-ls/prelude-ls-tests.ts @@ -20,32 +20,40 @@ prelude.replicate(0, "a"); //=> [] // List -var dblStrArray: Array> = +var eachRes: Array> = prelude.each(x => x.push("boom"), [["a"], ["b"], ["c"]]); //=> [["a", "boom"], ["b", "boom"], ["c", "boom"]] -prelude.map(x => x * 2, [1, 2, 3, 4, 5]); //=> [2, 4, 6, 8, 10] +var mapRes: Array = + prelude.map(x => x.toString(), [1, 2, 3, 4, 5]) //=> ["1", "2", "3", "4", "5"] + prelude.map(x => x.toUpperCase(), ["ha", "ma"]); //=> ["HA", "MA"] prelude.map(x => x.num, [{num: 3}, {num: 1}]); //=> [3, 1] -prelude.compact([0, 1, false, true, "", "ha"]) //=> [1, true, "ha"] +var compactRes: Array = + prelude.compact([0, 1, false, true, "", "ha"]) //=> [1, true, "ha"] -prelude.filter(x => x < 3, [1, 2, 3, 4, 5]); //=> [1, 2] +var filterRes: Array = + prelude.filter(x => x < 3, [1, 2, 3, 4, 5]); //=> [1, 2] prelude.filter(prelude.even, [3, 4, 0]); //=> [4, 0] -prelude.reject(prelude.odd, [1, 2, 3, 4, 5]); //=> [2, 4] +var rejectRes: Array = + prelude.reject(prelude.odd, [1, 2, 3, 4, 5]); //=> [2, 4] -prelude.partition(x => x > 60, [49, 58, 76, 43, 88, 77, 90]); //=> [[76, 88, 77, 90], [49, 58, 43]] +var partitionRes: Array> = + prelude.partition(x => x > 60, [49, 58, 76, 43, 88, 77, 90]); + //=> [[76, 88, 77, 90], [49, 58, 43]] -prelude.find(prelude.odd, [2, 4, 6, 7, 8, 9, 10]); //=> 7 +var findRes: number = prelude.find(prelude.odd, [2, 4, 6, 7, 8, 9, 10]); //=> 7 -prelude.head([1, 2, 3, 4, 5]); //=> 1 +var headRes: number = prelude.head([1, 2, 3, 4, 5]); //=> 1 -prelude.tail([1, 2, 3, 4, 5]); //=> [2, 3, 4, 5] +var tailRes: Array = prelude.tail([1, 2, 3, 4, 5]); //=> [2, 3, 4, 5] -prelude.last([1, 2, 3, 4, 5]); //=> 5 +var lastRes: number = prelude.last([1, 2, 3, 4, 5]); //=> 5 -prelude.initial([1, 2, 3, 4, 5]); //=> [1, 2, 3, 4] +var initialRes: Array = + prelude.initial([1, 2, 3, 4, 5]); //=> [1, 2, 3, 4] prelude.empty([]); //=> true diff --git a/prelude-ls/prelude-ls.d.ts b/prelude-ls/prelude-ls.d.ts index 0de28f63a8..f72db01800 100644 --- a/prelude-ls/prelude-ls.d.ts +++ b/prelude-ls/prelude-ls.d.ts @@ -27,11 +27,11 @@ declare module "prelude-ls" { export function reject(f: (x: A) => boolean, xs: A[]): A[]; export function partition(f: (x: A) => Boolean): (xs: A[]) => [A[], A[]]; export function partition(f: (x: A) => Boolean, xs: A[]): [A[], A[]]; - export function find(f: (x: A) => Boolean): (xs: A[]) => (A | void); - export function find(f: (x: A) => Boolean, xs: A[]): (A | void); - export function head(xs: A[]): (A | void); + export function find(f: (x: A) => Boolean): (xs: A[]) => A; + export function find(f: (x: A) => Boolean, xs: A[]): A; + export function head(xs: A[]): A; export function tail(xs: A[]): A[]; - export function last(xs: A[]): (A | void); + export function last(xs: A[]): A; export function initial(xs: A[]): A[]; export function empty(xs: A[]): boolean; export function reverse(xs: A[]): A[]; From c5eee1bdc66ce227a58140a8ae166de4485bd883 Mon Sep 17 00:00:00 2001 From: Haskell Camargo Date: Sun, 14 Jun 2015 23:40:03 -0300 Subject: [PATCH 0071/1358] Correction on argument types for intersection and union --- prelude-ls/prelude-ls-tests.ts | 56 ++++++++++++++++++++++------------ prelude-ls/prelude-ls.d.ts | 4 +-- 2 files changed, 38 insertions(+), 22 deletions(-) diff --git a/prelude-ls/prelude-ls-tests.ts b/prelude-ls/prelude-ls-tests.ts index 080f40afbd..d3d5fcd4dd 100644 --- a/prelude-ls/prelude-ls-tests.ts +++ b/prelude-ls/prelude-ls-tests.ts @@ -55,41 +55,57 @@ var lastRes: number = prelude.last([1, 2, 3, 4, 5]); //=> 5 var initialRes: Array = prelude.initial([1, 2, 3, 4, 5]); //=> [1, 2, 3, 4] -prelude.empty([]); //=> true +var emptyRes: boolean = prelude.empty([]); //=> true -prelude.reverse([1, 2, 3]); //=> [3, 2, 1] +var reverseRes: Array = prelude.reverse([1, 2, 3]); //=> [3, 2, 1] -prelude.unique([1, 1, 1, 3, 3, 6, 7, 8]); //=> [1, 3, 6, 7, 8] +var uniqueRes: Array = + prelude.unique([1, 1, 1, 3, 3, 6, 7, 8]); //=> [1, 3, 6, 7, 8] -prelude.uniqueBy(x => x.length, ["and", "here", "are", "some", "words"]); //=> ["and", "here", "words"] +var uniqueByRes: Array = + prelude.uniqueBy(x => x.length, ["and", "here", "are", "some", "words"]); //=> ["and", "here", "words"] -prelude.fold(x => y => x + y, 0, [1, 2, 3, 4, 5]); //=> 15 -var product = prelude.fold(x => y => x * y, 1); +var foldRes: number = + prelude.fold(x => y => x + y, 0, [1, 2, 3, 4, 5]); //=> 15 -prelude.fold1(x => y => x + y, [1, 2, 3]); //=> 6 +var fold1Res: number = + prelude.fold1(x => y => x + y, [1, 2, 3]); //=> 6 -prelude.foldr(x => y => x - y, 9, [1, 2, 3, 4]); //=> 7 -prelude.foldr(x => y => x + y, "e", ["a", "b", "c", "d"]); //=> "abcde" +var foldrRes: number = + prelude.foldr(x => y => x - y, 9, [1, 2, 3, 4]); //=> 7 -prelude.foldr1(x => y => x - y, [1, 2, 3, 4, 9]); //=> 7 +var foldrStrRes: string = + prelude.foldr(x => y => x + y, "e", ["a", "b", "c", "d"]); //=> "abcde" -prelude.unfoldr(x => x === 0 ? null : [x, x - 1], 10); -//=> [10, 9, 8, 7, 6, 5, 4, 3, 2, 1] +var foldr1Res: number = + prelude.foldr1(x => y => x - y, [1, 2, 3, 4, 9]); //=> 7 -prelude.concat([[1], [2, 3], [4]]); //=> [1, 2, 3, 4] +var unfoldrRes: Array = + prelude.unfoldr(x => x === 0 ? null : [x, x - 1], 10); + //=> [10, 9, 8, 7, 6, 5, 4, 3, 2, 1] -prelude.concatMap(x => ["hoge", x, x + 2], [1, 2, 3]); //=> ["hoge", 1, 3, "hoge", 2, 4, "hoge", 3, 5] +var concatRes: Array = + prelude.concat([[1], [2, 3], [4]]); //=> [1, 2, 3, 4] -prelude.flatten([1, [[2], 3], [4, [[5]]]]); //=> [1, 2, 3, 4, 5] +var concatMapRes: Array = + prelude.concatMap(x => ["hoge", x, x + 2], [1, 2, 3]); + //=> ["hoge", 1, 3, "hoge", 2, 4, "hoge", 3, 5] -prelude.difference([1, 2, 3], [1]); //=> [2, 3] +var flattenRes: Array = + prelude.flatten([1, [[2], 3], [4, [[5]]]]); //=> [1, 2, 3, 4, 5] + +var differenceRes: Array = + prelude.difference([1, 2, 3], [1]); //=> [2, 3] prelude.difference([1, 2, 3, 4, 5], [5, 2, 10], [9]); //=> [1, 3, 4] -prelude.intersection([2, 3], [9, 8], [12, 1], [99]); //=> [] -prelude.intersection([1, 2, 3], [101, 2, 1, 10], [2, 1], [-1, 0, 1, 2]); //=> [1, 2] -prelude.intersection([1, 2, 3], [2, 1, 3], [3, 1, 2]); //=> [1, 2, 3] +prelude.intersection([2, 3], [9, 8], [12, 1], [99]); //=> [] +var intersectionRes: Array = + prelude.intersection([1, 2, 3], [101, 2, 1, 10], [2, 1], [-1, 0, 1, 2]); +//=> [1, 2] +prelude.intersection([1, 2, 3], [2, 1, 3], [3, 1, 2]); //=> [1, 2, 3] -prelude.union([1, 5, 7], [3, 5], []); //=> [1, 5, 7, 3] +var unionRes: Array = + prelude.union([1, 5, 7], [3, 5], []); //=> [1, 5, 7, 3] prelude.countBy(prelude.floor, [4.2, 6.1, 6.4]); //=> {4: 1, 6: 2} prelude.countBy(x => x.length, ["one", "two", "three"]); //=> {3: 2, 5: 1} diff --git a/prelude-ls/prelude-ls.d.ts b/prelude-ls/prelude-ls.d.ts index f72db01800..fde6ed1578 100644 --- a/prelude-ls/prelude-ls.d.ts +++ b/prelude-ls/prelude-ls.d.ts @@ -60,8 +60,8 @@ declare module "prelude-ls" { export function concatMap(f: (x: A) => B[], xs: A[]): B[]; export function flatten(xs: any[]): any[]; export function difference(...xss: A[][]): A[]; - export function intersection(...xss: A[]): A[]; - export function union(...xss: A[]): A[]; + export function intersection(...xss: A[][]): A[]; + export function union(...xss: A[][]): A[]; export function countBy(f: (x: A) => B): (xs: A[]) => any; export function countBy(f: (x: A) => B, xs: A[]): any; export function groupBy(f: (x: A) => B): (xs: A[]) => any; From b64f70ca142cb7932abfd2c2db501c182362ab25 Mon Sep 17 00:00:00 2001 From: Haskell Camargo Date: Sun, 14 Jun 2015 23:50:43 -0300 Subject: [PATCH 0072/1358] Added tests for numbers and strings, with assignment --- prelude-ls/prelude-ls-tests.ts | 80 +++++++++++++++++++--------------- 1 file changed, 44 insertions(+), 36 deletions(-) diff --git a/prelude-ls/prelude-ls-tests.ts b/prelude-ls/prelude-ls-tests.ts index d3d5fcd4dd..5bc034bc48 100644 --- a/prelude-ls/prelude-ls-tests.ts +++ b/prelude-ls/prelude-ls-tests.ts @@ -107,6 +107,8 @@ prelude.intersection([1, 2, 3], [2, 1, 3], [3, 1, 2]); //=> [1, 2, 3] var unionRes: Array = prelude.union([1, 5, 7], [3, 5], []); //=> [1, 5, 7, 3] +// --- UNION --- + prelude.countBy(prelude.floor, [4.2, 6.1, 6.4]); //=> {4: 1, 6: 2} prelude.countBy(x => x.length, ["one", "two", "three"]); //=> {3: 2, 5: 1} @@ -300,94 +302,100 @@ prelude.Str.breakStr(x => x === "h", "mmmmmhmm"); //=> ["mmmmm", "hmm"] // Func -prelude.apply((x, y) => x + y, [2, 3]); //=> 5 +var applyRes: number = prelude.apply((x, y) => x + y, [2, 3]); //=> 5 var add = (x: number, y: number) => x + y; var addCurried = prelude.curry(add); var addFour = addCurried(4); addFour(2); //=> 6 -var invertedPower = prelude.flip(x => y => Math.pow(x, y)); -invertedPower(2)(3); //=> 9 +var flipRes: (x: number) => (y: number) => number + = prelude.flip(x => y => Math.pow(x, y)); -prelude.fix((fib: (n: number) => number) => (n: number) => n <= 1 ? 1 : fib(n - 1) + fib(n - 2))(9); //=> 55 +var fixRes: number = prelude.fix( + (fib: (n: number) => number) => (n: number) => + n <= 1 + ? 1 + : fib(n - 1) + fib(n - 2) +)(9); //=> 55 -var sameLength = prelude.over((x, y) => x == y, x => x.length); +var sameLength: (x: string, y: string) => boolean + = prelude.over((x, y) => x == y, x => x.length); sameLength('hi', 'me'); //=> true sameLength('one', 'boom'); //=> false // Num prelude.max(3, 1); //=> 3 -prelude.max("a", "c"); //=> "c" +var maxRes: string = prelude.max("a", "c"); //=> "c" -prelude.min(3, 1); //=> 1 +var minRes: number = prelude.min(3, 1); //=> 1 prelude.min("a", "c"); //=> "a" -prelude.negate(3); //=> -3 +var negateRes: number = prelude.negate(3); //=> -3 prelude.negate(-2); //=> 2 -prelude.abs(-2); //=> 2 +var absRes: number = prelude.abs(-2); //=> 2 prelude.abs(2); //=> 2 -prelude.signum(-5); //=> -1 +var signumRes: number = prelude.signum(-5); //=> -1 prelude.signum(0); //=> 0 prelude.signum(9); //=> 1 -prelude.quot(-20, 3); //=> -6 +var quotRes: number = prelude.quot(-20, 3); //=> -6 -prelude.rem(-20, 3); //=> -2 +var remRes: number = prelude.rem(-20, 3); //=> -2 -prelude.div(-20, 3); //=> -7 +var divRes: number = prelude.div(-20, 3); //=> -7 -prelude.mod(-20, 3); //=> 1 +var modRes: number = prelude.mod(-20, 3); //=> 1 -prelude.recip(4); //=> 0.25 +var recipRes: number = prelude.recip(4); //=> 0.25 -prelude.pi; //=> 3.141592653589793 +var piRes: number = prelude.pi; //=> 3.141592653589793 -prelude.tau; //=> 6.283185307179586 +var tauRes: number = prelude.tau; //=> 6.283185307179586 -prelude.exp(1); //=> 2.718281828459045 +var expRes: number = prelude.exp(1); //=> 2.718281828459045 -prelude.sqrt(4); //=> 2 +var sqrtRes: number = prelude.sqrt(4); //=> 2 -prelude.ln(10); //=> 2.302585092994046 +var lnRes: number = prelude.ln(10); //=> 2.302585092994046 -prelude.pow(-2, 2); //=> 4 +var powRes: number = prelude.pow(-2, 2); //=> 4 -prelude.sin(prelude.pi / 2); //=> 1 +var sinRes: number = prelude.sin(prelude.pi / 2); //=> 1 -prelude.cos(prelude.pi); //=> -1 +var cosRes: number = prelude.cos(prelude.pi); //=> -1 -prelude.tan(prelude.pi / 4); //=> 1 +var aTanRes: number = prelude.tan(prelude.pi / 4); //=> 1 -prelude.asin(0); //=> 0 +var asinRes: number = prelude.asin(0); //=> 0 -prelude.acos(1); //=> 0 +var acosRes: number = prelude.acos(1); //=> 0 prelude.atan(0); //=> 0 -prelude.atan2(1, 0); //=> 1.5707963267948966 +var atanRes: number = prelude.atan2(1, 0); //=> 1.5707963267948966 -prelude.truncate(-1.5); //=> -1 +var truncateRes: number = prelude.truncate(-1.5); //=> -1 prelude.truncate(1.5); //=> 1 -prelude.round(0.6); //=> 1 +var roundRes: number = prelude.round(0.6); //=> 1 prelude.round(0.5); //=> 1 prelude.round(0.4); //=> 0 -prelude.ceiling(0.1); //=> 1 +var ceilingRes: number = prelude.ceiling(0.1); //=> 1 -prelude.floor(0.9); //=> 0 +var floorRes: number = prelude.floor(0.9); //=> 0 -prelude.isItNaN(prelude.sqrt(-1)); //=> true +var isItNanRes: boolean = prelude.isItNaN(prelude.sqrt(-1)); //=> true -prelude.even(4); //=> true +var evenRes: boolean = prelude.even(4); //=> true prelude.even(0); //=> true -prelude.odd(3); //=> true +var oddRes: boolean = prelude.odd(3); //=> true -prelude.gcd(12, 18); //=> 6 +var gcdRes: number = prelude.gcd(12, 18); //=> 6 -prelude.lcm(12, 18); //=> 36 \ No newline at end of file +var lcmRes: number = prelude.lcm(12, 18); //=> 36 \ No newline at end of file From 827ec75fbbf3d125a680b0b74e10f0c5e6beb567 Mon Sep 17 00:00:00 2001 From: Haskell Camargo Date: Sun, 14 Jun 2015 23:56:22 -0300 Subject: [PATCH 0073/1358] sortBy should return A[] instead of A --- prelude-ls/prelude-ls-tests.ts | 36 ++++++++++++++++++++++------------ prelude-ls/prelude-ls.d.ts | 4 ++-- 2 files changed, 25 insertions(+), 15 deletions(-) diff --git a/prelude-ls/prelude-ls-tests.ts b/prelude-ls/prelude-ls-tests.ts index 5bc034bc48..c04fb2277e 100644 --- a/prelude-ls/prelude-ls-tests.ts +++ b/prelude-ls/prelude-ls-tests.ts @@ -107,28 +107,31 @@ prelude.intersection([1, 2, 3], [2, 1, 3], [3, 1, 2]); //=> [1, 2, 3] var unionRes: Array = prelude.union([1, 5, 7], [3, 5], []); //=> [1, 5, 7, 3] -// --- UNION --- - -prelude.countBy(prelude.floor, [4.2, 6.1, 6.4]); //=> {4: 1, 6: 2} +var countByRes: Object = prelude.countBy(prelude.floor, [4.2, 6.1, 6.4]); +//=> {4: 1, 6: 2} prelude.countBy(x => x.length, ["one", "two", "three"]); //=> {3: 2, 5: 1} -prelude.groupBy(prelude.floor, [4.2, 6.1, 6.4]); //=> {4: [4.2], 6: [6.1, 6.4]} -prelude.groupBy(x => x.length, ["one", "two", "three"]); //=> {3: ["one", "two"], 5: ["three"]} +var groupByRes: Object = prelude.groupBy(prelude.floor, [4.2, 6.1, 6.4]); +//=> {4: [4.2], 6: [6.1, 6.4]} +prelude.groupBy(x => x.length, ["one", "two", "three"]); +//=> {3: ["one", "two"], 5: ["three"]} -prelude.andList([true, 2 + 2 == 4]); //=> true +var andListRes: boolean = prelude.andList([true, 2 + 2 == 4]); //=> true prelude.andList([true, true, false]); //=> false prelude.andList([]); //=> true -prelude.orList([false, false, true, false]); //=> true +var orListRes: boolean = prelude.orList([false, false, true, false]); //=> true prelude.orList([]); //=> false -prelude.any(prelude.even, [3, 5, 7, 8, 9]); //=> true +var anyRes: boolean = prelude.any(prelude.even, [3, 5, 7, 8, 9]); //=> true prelude.any(prelude.even, []); //=> false -prelude.all(prelude.isType("String"), ["ha", "ma", "la"]); //=> true +var allRes: boolean = prelude.all(prelude.isType("String"), ["ha", "ma", "la"]); +//=> true prelude.all(prelude.isType("String"), []); //=> true -prelude.sort([3, 1, 5, 2, 4, 6]); //=> [1, 2, 3, 4, 5, 6] +var sortRes: Array = prelude.sort([3, 1, 5, 2, 4, 6]); +//=> [1, 2, 3, 4, 5, 6] var f = (x: string) => (y: string) => x.length > y.length ? @@ -137,11 +140,18 @@ var f = (x: string) => (y: string) => -1 : 0; -prelude.sortWith(f, ["three", "one", "two"]); //=> ["one", "two", "three"] -prelude.sortBy(x => x.length, ["there", "hey", "a", "ha"]); //=> ["a", "ha", "hey", "there"] +var sortWithRes: Array = prelude.sortWith(f, ["three", "one", "two"]); +//=> ["one", "two", "three"] -var table = [{ +var sortByRes: Array = + prelude.sortBy(x => x.length, ["there", "hey", "a", "ha"]); + //=> ["a", "ha", "hey", "there"] + +var table: Array<{ + id: number, + name: string +}> = [{ id: 1, name: "george" }, { diff --git a/prelude-ls/prelude-ls.d.ts b/prelude-ls/prelude-ls.d.ts index fde6ed1578..26c1890d4f 100644 --- a/prelude-ls/prelude-ls.d.ts +++ b/prelude-ls/prelude-ls.d.ts @@ -75,8 +75,8 @@ declare module "prelude-ls" { export function sort(xs: A[]): A[]; export function sortWith(f: (x: A) => (y: A) => number): (xs: A[]) => A[]; export function sortWith(f: (x: A) => (y: A) => number, xs: A[]): A[]; - export function sortBy(f: (x: A) => B): (xs: A[]) => A; - export function sortBy(f: (x: A) => B, xs: A[]): A; + export function sortBy(f: (x: A) => B): (xs: A[]) => A[]; + export function sortBy(f: (x: A) => B, xs: A[]): A[]; export function sum(xs: number[]): number[]; export function product(xs: number[]): number[]; export function mean(xs: number[]): number[]; From d8822b4a8c471de06715e6bb23a494e62a643c68 Mon Sep 17 00:00:00 2001 From: Haskell Camargo Date: Mon, 15 Jun 2015 00:00:47 -0300 Subject: [PATCH 0074/1358] Return type for sum, product and mean are number, not number[] --- prelude-ls/prelude-ls-tests.ts | 20 +++++++++++--------- prelude-ls/prelude-ls.d.ts | 6 +++--- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/prelude-ls/prelude-ls-tests.ts b/prelude-ls/prelude-ls-tests.ts index c04fb2277e..a92c3c4243 100644 --- a/prelude-ls/prelude-ls-tests.ts +++ b/prelude-ls/prelude-ls-tests.ts @@ -162,23 +162,25 @@ var table: Array<{ name: "donald" }]; prelude.sortBy(x => x.name, table); -//=> [{"id": 3, "name": "donald"}, {"id": 1, "name": "george"}, {"id": 2, "name": "mike"}] +//=> [{"id": 3, "name": "donald"}, +// {"id": 1, "name": "george"}, +// {"id": 2, "name": "mike"}] -prelude.sum([1, 2, 3, 4, 5]); //=> 15 +var sumRes: number = prelude.sum([1, 2, 3, 4, 5]); //=> 15 prelude.sum([]); //=> 0 -prelude.product([1, 2, 3]); //=> 6 +var productRes: number = prelude.product([1, 2, 3]); //=> 6 prelude.product([]); //=> 1 -prelude.mean([1, 2, 3, 4, 5]); //=> 3 +var meanRes: number = prelude.mean([1, 2, 3, 4, 5]); //=> 3 -prelude.maximum([4, 1, 9, 3]); //=> 9 +var maximumRes: number = prelude.maximum([4, 1, 9, 3]); //=> 9 -prelude.minimum(["c", "e", "a", "d", "b"]); //=> "a" +var minimumRes: string = prelude.minimum(["c", "e", "a", "d", "b"]); //=> "a" -prelude.maximumBy(x => x.length, ["hi", "there", "I", "am", "looooong"]); //=> "looooong" - -prelude.maximumBy(x => x.length, ["hi", "there", "I", "am", "looooong"]); //=> "looooong" +var maximumByRes: string = + prelude.maximumBy(x => x.length, ["hi", "there", "I", "am", "looooong"]); + //=> "looooong" prelude.scan(x => y => x + y, 0, [1, 2, 3]); //=> [0, 1, 3, 6] diff --git a/prelude-ls/prelude-ls.d.ts b/prelude-ls/prelude-ls.d.ts index 26c1890d4f..053ed53a4a 100644 --- a/prelude-ls/prelude-ls.d.ts +++ b/prelude-ls/prelude-ls.d.ts @@ -77,9 +77,9 @@ declare module "prelude-ls" { export function sortWith(f: (x: A) => (y: A) => number, xs: A[]): A[]; export function sortBy(f: (x: A) => B): (xs: A[]) => A[]; export function sortBy(f: (x: A) => B, xs: A[]): A[]; - export function sum(xs: number[]): number[]; - export function product(xs: number[]): number[]; - export function mean(xs: number[]): number[]; + export function sum(xs: number[]): number; + export function product(xs: number[]): number; + export function mean(xs: number[]): number; export function maximum(xs: A[]): A; export function minimum(xs: A[]): A; export function maximumBy(f: (x: A) => B): (xs: A[]) => A; From e7c93592608108364fcbb09771c4a3222d9ac9dc Mon Sep 17 00:00:00 2001 From: Haskell Camargo Date: Mon, 15 Jun 2015 00:07:00 -0300 Subject: [PATCH 0075/1358] Passed tests for Prelude.List --- prelude-ls/prelude-ls-tests.ts | 51 ++++++++++++++++++++++------------ 1 file changed, 33 insertions(+), 18 deletions(-) diff --git a/prelude-ls/prelude-ls-tests.ts b/prelude-ls/prelude-ls-tests.ts index a92c3c4243..e21893e525 100644 --- a/prelude-ls/prelude-ls-tests.ts +++ b/prelude-ls/prelude-ls-tests.ts @@ -182,48 +182,63 @@ var maximumByRes: string = prelude.maximumBy(x => x.length, ["hi", "there", "I", "am", "looooong"]); //=> "looooong" -prelude.scan(x => y => x + y, 0, [1, 2, 3]); //=> [0, 1, 3, 6] +var scanRes: Array = prelude.scan(x => y => x + y, 0, [1, 2, 3]); +//=> [0, 1, 3, 6] -prelude.scan1(x => y => x + y, [1, 2, 3]); //=> [1, 3, 6] +var scan1Res: Array = prelude.scan1(x => y => x + y, [1, 2, 3]); +//=> [1, 3, 6] -prelude.scanr(x => y => x + y, 0, [1, 2, 3]); //=> [6, 5, 3, 0] +var scanrRes: Array = prelude.scanr(x => y => x + y, 0, [1, 2, 3]); +//=> [6, 5, 3, 0] -prelude.scanr1(x => y => x + y, [1, 2, 3]); //=> [6, 5, 3] +var scanr1Res: Array = prelude.scanr1(x => y => x + y, [1, 2, 3]); +//=> [6, 5, 3] -prelude.slice(2, 4, [1, 2, 3, 4, 5]); //=> [3, 4] +var sliceRes: Array = prelude.slice(2, 4, [1, 2, 3, 4, 5]); //=> [3, 4] -prelude.take(2, [1, 2, 3, 4, 5]); //=> [1, 2] +var takeRes: Array = prelude.take(2, [1, 2, 3, 4, 5]); //=> [1, 2] -prelude.drop(2, [1, 2, 3, 4, 5]); //=> [3, 4, 5] +var dropRes: Array = prelude.drop(2, [1, 2, 3, 4, 5]); //=> [3, 4, 5] -prelude.splitAt(2, [1, 2, 3, 4, 5]); //=> [[1, 2], [3, 4, 5]] +var splitAtRes: Array> = + prelude.splitAt(2, [1, 2, 3, 4, 5]); //=> [[1, 2], [3, 4, 5]] -prelude.takeWhile(prelude.odd, [1, 3, 5, 4, 8, 7, 9]); //=> [1, 3, 5] +var takeWhileRes: Array = + prelude.takeWhile(prelude.odd, [1, 3, 5, 4, 8, 7, 9]); //=> [1, 3, 5] -prelude.dropWhile(prelude.even, [2, 4, 5, 6]); //=> [5, 6] +var dropWhileRes: Array = + prelude.dropWhile(prelude.even, [2, 4, 5, 6]); //=> [5, 6] +var spanRes: Array> = prelude.span(prelude.even, [2, 4, 5, 6]); //=> [[2, 4], [5, 6]] -prelude.breakList(x => x == 3, [1, 2, 3, 4, 5]); //=> [[1, 2], [3, 4, 5]] +var breakListRes: Array> = + prelude.breakList(x => x == 3, [1, 2, 3, 4, 5]); //=> [[1, 2], [3, 4, 5]] -prelude.zip([1, 2, 3], [4, 5, 6]); //=> [[1, 4], [2, 5], [3, 6]] +var zipRes: Array> = prelude.zip([1, 2, 3], [4, 5, 6]); +//=> [[1, 4], [2, 5], [3, 6]] -prelude.zipWith(x => y => x + y, [1, 2, 3], [4, 5, 6]); //=> [5, 7, 9] +var zipWithRes: Array = + prelude.zipWith(x => y => x + y, [1, 2, 3], [4, 5, 6]); //=> [5, 7, 9] +var zipAllRes: Array> = prelude.zipAll([1, 2, 3], [4, 5, 6], [7, 8, 9]); //=> [[1, 4, 7], [2, 5, 8], [3, 6, 9]] +var zipAllWithRes: Array = prelude.zipAllWith((a, b, c) => a + b + c, [1, 2, 3], [3, 2, 1], [1, 1, 1]); //=> [5, 5, 5] -prelude.at(2, [1, 2, 3, 4]); //=> 3 +var atRes: number = prelude.at(2, [1, 2, 3, 4]); //=> 3 prelude.at(-3, [1, 2, 3, 4]); //=> 2 -prelude.elemIndex("a", ["c", "a", "b", "a"]); //=> 1 +var elemIndexRes: number = prelude.elemIndex("a", ["c", "a", "b", "a"]); //=> 1 -prelude.elemIndices("a", ["c", "a", "b", "a"]); //=> [1, 3] +var elemIndicesRes: Array = + prelude.elemIndices("a", ["c", "a", "b", "a"]); //=> [1, 3] -prelude.findIndex(prelude.even, [1, 2, 3, 4]); //=> 1 +var findIndexRes: number = prelude.findIndex(prelude.even, [1, 2, 3, 4]); //=> 1 -prelude.findIndices(prelude.even, [1, 2, 3, 4]); //=> [1, 3] +var findIndicesRes: Array = + prelude.findIndices(prelude.even, [1, 2, 3, 4]); //=> [1, 3] // Obj From 835b936c5a3080da4f960631f23dadd0ccd69fe4 Mon Sep 17 00:00:00 2001 From: Haskell Camargo Date: Mon, 15 Jun 2015 00:16:37 -0300 Subject: [PATCH 0076/1358] Final tests --- prelude-ls/prelude-ls-tests.ts | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/prelude-ls/prelude-ls-tests.ts b/prelude-ls/prelude-ls-tests.ts index e21893e525..bea29403b2 100644 --- a/prelude-ls/prelude-ls-tests.ts +++ b/prelude-ls/prelude-ls-tests.ts @@ -242,19 +242,27 @@ var findIndicesRes: Array = // Obj -prelude.keys({a: 2, b: 3, c: 9}); //=> ["a", "b", "c"] +var keysRes: Array = prelude.keys({a: 2, b: 3, c: 9}); +//=> ["a", "b", "c"] -prelude.values({a: 2, b: 3, c: 9}); //=> [2, 3, 9] +var valuesRes: Array = prelude.values({a: 2, b: 3, c: 9}); +//=> [2, 3, 9] -prelude.pairsToObj([["a", "b"], ["c", "d"], ["e", 1]]); //=> {a: "b", c: "d", e: 1} +var pairsToObjRes: Object = + prelude.pairsToObj([["a", "b"], ["c", "d"], ["e", 1]]); //=> {a: "b", c: "d", e: 1} -prelude.objToPairs({a: "b", c: "d", e: 1}); //=> [["a", "b"], ["c", "d"], ["e", 1]] +var objToPairsRes: Array> = + prelude.objToPairs({a: "b", c: "d", e: 1}); + //=> [["a", "b"], ["c", "d"], ["e", 1]] -prelude.listsToObj(["a", "b", "c"], [1, 2, 3]); //=> {a: 1, b: 2, c: 3} +var listsToObjRes: Object = + prelude.listsToObj(["a", "b", "c"], [1, 2, 3]); //=> {a: 1, b: 2, c: 3} -prelude.objToLists({a: 1, b: 2, c: 3}); //=> [["a", "b", "c"], [1, 2, 3]] +var objToListsRes = + prelude.objToLists({a: 1, b: 2, c: 3}); + //=> [["a", "b", "c"], [1, 2, 3]] -prelude.Obj.empty({}); //=> true +var objEmptyRes: boolean = prelude.Obj.empty({}); //=> true var count = 4; prelude.Obj.each(x => count += x, {a: 1, b: 2, c: 3}); From 87ed92fda4291cbb83e58241ad7956ada6895662 Mon Sep 17 00:00:00 2001 From: Haskell Camargo Date: Mon, 15 Jun 2015 00:25:15 -0300 Subject: [PATCH 0077/1358] (;) for Travis --- prelude-ls/prelude-ls-tests.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/prelude-ls/prelude-ls-tests.ts b/prelude-ls/prelude-ls-tests.ts index bea29403b2..dc36e9913b 100644 --- a/prelude-ls/prelude-ls-tests.ts +++ b/prelude-ls/prelude-ls-tests.ts @@ -149,8 +149,8 @@ var sortByRes: Array = //=> ["a", "ha", "hey", "there"] var table: Array<{ - id: number, - name: string + id: number; + name: string; }> = [{ id: 1, name: "george" From 503a60a6d656b20950157c201c0787ed157e6b12 Mon Sep 17 00:00:00 2001 From: Kristof Mattei Date: Mon, 15 Jun 2015 08:09:02 +0200 Subject: [PATCH 0078/1358] Changed namespace to angular as per comment --- angular-local-storage/angular-local-storage.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/angular-local-storage/angular-local-storage.d.ts b/angular-local-storage/angular-local-storage.d.ts index 940874d23b..ae027527a4 100644 --- a/angular-local-storage/angular-local-storage.d.ts +++ b/angular-local-storage/angular-local-storage.d.ts @@ -6,7 +6,7 @@ /// declare module angular.local.storage { - interface ILocalStorageServiceProvider extends ng.IServiceProvider { + interface ILocalStorageServiceProvider extends angular.IServiceProvider { /** * Setter for the prefix * You should set a prefix to avoid overwriting any local storage variables from the rest of your app @@ -129,7 +129,7 @@ declare module angular.local.storage { * @param value optional * @param key The corresponding key used in local storage */ - bind(scope: ng.IScope, property: string, value?: any, key?: string): Function; + bind(scope: angular.IScope, property: string, value?: any, key?: string): Function; /** * Return the derive key * Returns String From b116936ea52a2f437a44098718f7e64f4d60746d Mon Sep 17 00:00:00 2001 From: Bence Eros Date: Mon, 15 Jun 2015 12:32:10 +0200 Subject: [PATCH 0079/1358] updates for streamjs 1.5.0 --- streamjs/README.md | 3 +++ streamjs/streamjs-tests.ts | 6 +++--- streamjs/streamjs.d.ts | 7 ++++--- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/streamjs/README.md b/streamjs/README.md index 9428177672..36f8ec46c9 100644 --- a/streamjs/README.md +++ b/streamjs/README.md @@ -1,5 +1,8 @@ # StreamJS Type Definitions +Note: this definition file is not for the StreamJS library available at http://streamjs.org but the one at +http://winterbe.github.io/streamjs/ . + Unsupported StreamJS function / method signatures: * Stream(collection) * Stream(string) diff --git a/streamjs/streamjs-tests.ts b/streamjs/streamjs-tests.ts index f83ec69e82..ca9d65183c 100644 --- a/streamjs/streamjs-tests.ts +++ b/streamjs/streamjs-tests.ts @@ -4,7 +4,7 @@ var numStream: Stream; numStream = Stream.of(1, 2, 3); numStream = Stream.range(1, 5); numStream = Stream.rangeClosed(1, 5); - +numStream = Stream.from([1, 2, 3]); Stream.generate(function() { return 1; }); @@ -35,7 +35,7 @@ var strStream = numStream .takeWhile(/^aa.*$/) .slice(5, 2) ; - +strStream = Stream.from("foobar"); var strArray = strStream.toArray(); strArray = strStream.toList(); strStream.each(s => console.log(s)); @@ -77,7 +77,7 @@ class MyList { var elems: any[]; -var myStream = Stream.make([new MyList, new MyList]); +var myStream = Stream.from([new MyList, new MyList]); elems = myStream .flatMap(list => list.elems) .toArray(); diff --git a/streamjs/streamjs.d.ts b/streamjs/streamjs.d.ts index 81ed58a82f..0db7cff727 100644 --- a/streamjs/streamjs.d.ts +++ b/streamjs/streamjs.d.ts @@ -1,11 +1,12 @@ -// Type definitions for streamjs 1.4.0 -// Project: https://github.com/winterbe/streamjs +// Type definitions for streamjs 1.5.0 +// Project: http://winterbe.github.io/streamjs/ // Definitions by: Bence Eros // Definitions: https://github.com/borisyankov/DefinitelyTyped declare class Stream { // static make (...elems: T[]): Stream; - static make (elems: T[]): Stream; + static from (elems: T[]): Stream; + static from(str: string): Stream; static of(...elems: T[]): Stream; static range (startInclusive: number, endExclusive: number): Stream; static rangeClosed (startInclusive: number, endInclusive: number): Stream; From a29d577f810ea05786bb9b9eaa9f06c58e4d4003 Mon Sep 17 00:00:00 2001 From: Bence Eros Date: Mon, 15 Jun 2015 12:33:38 +0200 Subject: [PATCH 0080/1358] removing some comments --- streamjs/streamjs-tests.ts | 2 -- streamjs/streamjs.d.ts | 3 --- 2 files changed, 5 deletions(-) diff --git a/streamjs/streamjs-tests.ts b/streamjs/streamjs-tests.ts index ca9d65183c..ba989f4474 100644 --- a/streamjs/streamjs-tests.ts +++ b/streamjs/streamjs-tests.ts @@ -81,7 +81,6 @@ var myStream = Stream.from([new MyList, new MyList]); elems = myStream .flatMap(list => list.elems) .toArray(); - //.forEach(s => console.log(s)); myStream = myStream.takeWhile({name: "foo"}); myStream = myStream.dropWhile({name: "foo"}); @@ -137,7 +136,6 @@ var done: boolean = iter.done; var optNum: Stream.Optional = Stream.Optional.of(2); optNum = Stream.Optional.ofNullable(null); -//optNum = Stream.Optional.empty(); var optStr: Stream.Optional = optNum.filter(n => n % 2 == 0) .map(n => "number" + n) diff --git a/streamjs/streamjs.d.ts b/streamjs/streamjs.d.ts index 0db7cff727..e36dcca239 100644 --- a/streamjs/streamjs.d.ts +++ b/streamjs/streamjs.d.ts @@ -4,7 +4,6 @@ // Definitions: https://github.com/borisyankov/DefinitelyTyped declare class Stream { - // static make (...elems: T[]): Stream; static from (elems: T[]): Stream; static from(str: string): Stream; static of(...elems: T[]): Stream; @@ -12,7 +11,6 @@ declare class Stream { static rangeClosed (startInclusive: number, endInclusive: number): Stream; static generate (supplier: Stream.Supplier): Stream; static iterate(seed: T, fn: Stream.Function): Stream; - // static empty(): Stream; anyMatch(predicate: Stream.Predicate): boolean; anyMatch(regexp: RegExp): boolean; @@ -148,7 +146,6 @@ declare module Stream { export class Optional { static of(elem: T): Optional; static ofNullable(elem: T): Optional; - // static empty(): Optional; filter(predicate: (elem: T) => boolean): Optional; map(mapper: (elem: T) => U): Optional; From f20634f5fc012b94acdc5624955dc8fa460ea4a1 Mon Sep 17 00:00:00 2001 From: Bence Eros Date: Mon, 15 Jun 2015 12:35:47 +0200 Subject: [PATCH 0081/1358] readme cleanup --- streamjs/README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/streamjs/README.md b/streamjs/README.md index 36f8ec46c9..ba28f14426 100644 --- a/streamjs/README.md +++ b/streamjs/README.md @@ -4,9 +4,9 @@ Note: this definition file is not for the StreamJS library available at http://s http://winterbe.github.io/streamjs/ . Unsupported StreamJS function / method signatures: - * Stream(collection) - * Stream(string) - * Stream.empty() - * map(path) - * flatMap(path) - * Optional.empty() + * `Stream(collection)` (but `Stream.from(collection)` works) + * `Stream(string) (but `Stream.from(string)` works) + * `Stream.empty()` + * `map(path)` + * `flatMap(path)` + * `Optional.empty()` From d307a6399b0a22d24e24fc7ac1c1da98fa700ab8 Mon Sep 17 00:00:00 2001 From: Bence Eros Date: Mon, 15 Jun 2015 12:36:21 +0200 Subject: [PATCH 0082/1358] readme cleanup --- streamjs/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/streamjs/README.md b/streamjs/README.md index ba28f14426..400e3bc412 100644 --- a/streamjs/README.md +++ b/streamjs/README.md @@ -5,7 +5,7 @@ http://winterbe.github.io/streamjs/ . Unsupported StreamJS function / method signatures: * `Stream(collection)` (but `Stream.from(collection)` works) - * `Stream(string) (but `Stream.from(string)` works) + * `Stream(string)` (but `Stream.from(string)` works) * `Stream.empty()` * `map(path)` * `flatMap(path)` From 6bae89e51d9b28d4792dc29da55b969c4ec4ad4f Mon Sep 17 00:00:00 2001 From: yiting Date: Mon, 15 Jun 2015 10:52:38 -0700 Subject: [PATCH 0083/1358] Update keypress.d.ts change keydown callback type definition according to keypress document --- keypress/keypress.d.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/keypress/keypress.d.ts b/keypress/keypress.d.ts index bd831d5b0a..f3eada39dc 100644 --- a/keypress/keypress.d.ts +++ b/keypress/keypress.d.ts @@ -16,12 +16,12 @@ declare module Keypress { is_solitary: boolean; is_sequence: boolean; } - + interface Combo { keys: string; - on_keydown: () => any; - on_keyup: () => any; - on_release: () => any; + on_keydown: (event?: KeyboardEvent, count?: number) => any; + on_keyup: (event?: KeyboardEvent) => any; + on_release: (event?: KeyboardEvent) => any; this: Element; prevent_default: boolean; prevent_repeat: boolean; @@ -31,14 +31,14 @@ declare module Keypress { is_sequence: boolean; is_solitary: boolean; } - + interface Listener { new(element: Element, defaults: ListenerDefaults): Listener; new(element: Element): Listener; new(): Listener; - simple_combo(keys: string, on_keydown_callback: () => any): void; - counting_combo(keys: string, on_count_callback: () => any): void; - sequence_combo(keys: string, callback: () => any): void; + simple_combo(keys: string, on_keydown_callback: (event?: KeyboardEvent, count?: number) => any): void; + counting_combo(keys: string, on_count_callback: (event?: KeyboardEvent, count?: number) => any): void; + sequence_combo(keys: string, callback: (event?: KeyboardEvent, count?: number) => any): void; register_combo(combo: Combo): void; unregister_combo(combo: Combo): void; unregister_combo(keys: string): void; @@ -50,7 +50,7 @@ declare module Keypress { listen(): void; stop_listening(): void; } - + interface Keypress { Listener: Listener; } From 257f64d3949b59846ee2116aa638d90582a7b99b Mon Sep 17 00:00:00 2001 From: Jiayu Liu Date: Mon, 15 Jun 2015 11:32:45 -0700 Subject: [PATCH 0084/1358] PolylineOptions should extend PathOption `PolylineOptions` should extend `PathOptions`, so that user could supply options in the base class --- leaflet/leaflet.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/leaflet/leaflet.d.ts b/leaflet/leaflet.d.ts index dd57395001..ac3d4c8ff0 100755 --- a/leaflet/leaflet.d.ts +++ b/leaflet/leaflet.d.ts @@ -3448,7 +3448,7 @@ declare module L { declare module L { - export interface PolylineOptions { + export interface PolylineOptions extends PathOptions { /** * How much to simplify the polyline on each zoom level. More means better performance From cac474a0e2a81a311f4e10a5cdbfcc55823002c2 Mon Sep 17 00:00:00 2001 From: Calvin Fernandez Date: Mon, 15 Jun 2015 20:21:26 -0400 Subject: [PATCH 0085/1358] Move handlebars to handlebars-1.0.0. --- ember/ember-tests.ts | 2 +- ember/ember.d.ts | 2 +- handlebars/{handlebars.d.ts => handlebars-1.0.0.d.ts} | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename handlebars/{handlebars.d.ts => handlebars-1.0.0.d.ts} (100%) diff --git a/ember/ember-tests.ts b/ember/ember-tests.ts index ef9b7e6d11..6889eef5c4 100644 --- a/ember/ember-tests.ts +++ b/ember/ember-tests.ts @@ -1,5 +1,5 @@ /// -/// +/// var App : any; diff --git a/ember/ember.d.ts b/ember/ember.d.ts index 332d31b1aa..cd1ef6079e 100644 --- a/ember/ember.d.ts +++ b/ember/ember.d.ts @@ -4,7 +4,7 @@ // Definitions: https://github.com/borisyankov/DefinitelyTyped /// -/// +/// declare var Handlebars: HandlebarsStatic; diff --git a/handlebars/handlebars.d.ts b/handlebars/handlebars-1.0.0.d.ts similarity index 100% rename from handlebars/handlebars.d.ts rename to handlebars/handlebars-1.0.0.d.ts From 660e1252cd797916da148fb381b629443ca5771d Mon Sep 17 00:00:00 2001 From: Calvin Fernandez Date: Mon, 15 Jun 2015 20:22:32 -0400 Subject: [PATCH 0086/1358] Update handlebars definition files for handlebars 3.0.3 --- handlebars/handlebars.d.ts | 224 +++++++++++++++++++++++++++++++++++++ 1 file changed, 224 insertions(+) create mode 100644 handlebars/handlebars.d.ts diff --git a/handlebars/handlebars.d.ts b/handlebars/handlebars.d.ts new file mode 100644 index 0000000000..6526857240 --- /dev/null +++ b/handlebars/handlebars.d.ts @@ -0,0 +1,224 @@ +// Type definitions for Handlebars v3.0.3 +// Project: http://handlebarsjs.com/ +// Definitions by: Boris Yankov +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +declare module Handlebars { + export function registerHelper(name: string, fn: Function, inverse?: boolean): void; + export function registerPartial(name: string, str: any): void; + export function K(): void; + export function createFrame(object: any): any; + export function Exception(message: string): void; + export function log(level: number, obj: any): void; + export function parse(input: string): hbs.AST.Program; + export function compile(input: any, options?: any): HandlebarsTemplateDelegate; + + export var SafeString: typeof hbs.SafeString; + export var Utils: typeof hbs.Utils; + export var logger: Logger; + export var templates: HandlebarsTemplates; + + export module AST { + export var helpers: hbs.AST.helpers; + } + + interface ICompiler { + accept(node: hbs.AST.Node): void; + Program(program: hbs.AST.Program): void; + BlockStatement(block: hbs.AST.BlockStatement): void; + PartialStatement(partial: hbs.AST.PartialStatement): void; + MustacheStatement(mustache: hbs.AST.MustacheStatement): void; + ContentStatement(content: hbs.AST.ContentStatement): void; + CommentStatement(comment?: hbs.AST.CommentStatement): void; + SubExpression(sexpr: hbs.AST.SubExpression): void; + PathExpression(path: hbs.AST.PathExpression): void; + StringLiteral(str: hbs.AST.StringLiteral): void; + NumberLiteral(num: hbs.AST.NumberLiteral): void; + BooleanLiteral(bool: hbs.AST.BooleanLiteral): void; + UndefinedLiteral(): void; + NullLiteral(): void; + Hash(hash: hbs.AST.Hash): void; + } + + export class Visitor implements ICompiler { + accept(node: hbs.AST.Node): void; + acceptKey(node: hbs.AST.Node, name: string): void; + acceptArray(arr: hbs.AST.Expression[]): void; + Program(program: hbs.AST.Program): void; + BlockStatement(block: hbs.AST.BlockStatement): void; + PartialStatement(partial: hbs.AST.PartialStatement): void; + MustacheStatement(mustache: hbs.AST.MustacheStatement): void; + ContentStatement(content: hbs.AST.ContentStatement): void; + CommentStatement(comment?: hbs.AST.CommentStatement): void; + SubExpression(sexpr: hbs.AST.SubExpression): void; + PathExpression(path: hbs.AST.PathExpression): void; + StringLiteral(str: hbs.AST.StringLiteral): void; + NumberLiteral(num: hbs.AST.NumberLiteral): void; + BooleanLiteral(bool: hbs.AST.BooleanLiteral): void; + UndefinedLiteral(): void; + NullLiteral(): void; + Hash(hash: hbs.AST.Hash): void; + } +} + +/** +* Implement this interface on your MVW/MVVM/MVC views such as Backbone.View +**/ +interface HandlebarsTemplatable { + template: HandlebarsTemplateDelegate; +} + +interface HandlebarsTemplateDelegate { + (context: any, options?: any): string; +} + +interface HandlebarsTemplates { + [index: string]: HandlebarsTemplateDelegate; +} + +declare module hbs { + class SafeString { + constructor(str: string); + static toString(): string; + } + + module Utils { + function escapeExpression(str: string): string; + } +} + +interface Logger { + DEBUG: number; + INFO: number; + WARN: number; + ERROR: number; + level: number; + + methodMap: { [level: number]: string }; + + log(level: number, obj: string): void; +} + +declare module hbs { + module AST { + interface Node { + type: string; + loc: SourceLocation; + } + + interface SourceLocation { + source: string; + start: Position; + end: Position; + } + + interface Position { + line: number; + column: number; + } + + interface Program extends Node { + body: Statement[]; + blockParams: string[]; + } + + interface Statement extends Node {} + + interface MustacheStatement extends Statement { + path: PathExpression | Literal; + params: Expression[]; + hash: Hash; + escaped: boolean; + strip: StripFlags; + } + + interface BlockStatement extends Statement { + path: PathExpression; + params: Expression[]; + hash: Hash; + program: Program; + inverse: Program; + openStrip: StripFlags; + inverseStrip: StripFlags; + closeStrip: StripFlags; + } + + interface PartialStatement extends Statement { + name: PathExpression | SubExpression; + params: Expression[]; + hash: Hash; + indent: string; + strip: StripFlags; + } + + interface ContentStatement extends Statement { + value: string; + original: StripFlags; + } + + interface CommentStatement extends Statement { + value: string; + strip: StripFlags; + } + + interface Expression extends Node {} + + interface SubExpression extends Expression { + path: PathExpression; + params: Expression[]; + hash: Hash; + } + + interface PathExpression extends Expression { + data: boolean; + depth: number; + parts: string[]; + original: string; + } + + interface Literal extends Expression {} + interface StringLiteral extends Literal { + value: string; + original: string; + } + + interface BooleanLiteral extends Literal { + value: boolean; + original: boolean; + } + + interface NumberLiteral extends Literal { + value: number; + original: number; + } + + interface UndefinedLiteral extends Literal {} + + interface NullLiteral extends Literal {} + + interface Hash extends Node { + pairs: HashPair[]; + } + + interface HashPair extends Node { + key: string; + value: Expression; + } + + interface StripFlags { + open: boolean; + close: boolean; + } + + interface helpers { + helperExpression(node: Node): boolean; + scopeId(path: PathExpression): boolean; + simpleId(path: PathExpression): boolean; + } + } +} + +declare module "handlebars" { + export = Handlebars; +} From 61a910b70f9b8d3a4eae2ac489622629d79d3b77 Mon Sep 17 00:00:00 2001 From: Jiayu Liu Date: Mon, 15 Jun 2015 17:23:06 -0700 Subject: [PATCH 0087/1358] Canvas should extend TileLayer As per [document](http://leafletjs.com/reference.html#tilelayer-canvas), the `Canvas` interface should extend `TileLayer` --- leaflet/leaflet.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/leaflet/leaflet.d.ts b/leaflet/leaflet.d.ts index dd57395001..6dcd0ce145 100755 --- a/leaflet/leaflet.d.ts +++ b/leaflet/leaflet.d.ts @@ -3886,7 +3886,7 @@ declare module L { setParams(params: WMS, noRedraw?: boolean): WMS; } - export interface Canvas { + export interface Canvas extends TileLayer { /** * You need to define this method after creating the instance to draw tiles; * canvas is the actual canvas tile on which you can draw, tilePoint represents From 1b37e4ae9b7f74fd81434cb62e4e86f697095c36 Mon Sep 17 00:00:00 2001 From: Brett Date: Mon, 15 Jun 2015 18:49:48 -0700 Subject: [PATCH 0088/1358] documentdb improvements --- documentdb/documentdb-tests.ts | 61 ++++++++++++++++++++++++ documentdb/documentdb.d.ts | 87 +++++++++++++++++++++++++++++----- 2 files changed, 137 insertions(+), 11 deletions(-) diff --git a/documentdb/documentdb-tests.ts b/documentdb/documentdb-tests.ts index 13927cd93a..31f50624c4 100644 --- a/documentdb/documentdb-tests.ts +++ b/documentdb/documentdb-tests.ts @@ -13,6 +13,22 @@ docDBClient.createDatabase({ id: 'foo' }, undefined, (error, result) => { } }); +var dbQuerySpec: docDB.SqlQuerySpec = {query: 'SELECT * FROM database d WHERE d.id = @id', parameters: [{name: 'id', value: 'foo'}]} +docDBClient.queryDatabases(dbQuerySpec).toArray((error, result) => { + + if (error) { + throw new Error(error.body); + } + else { + if (result.length < 1) { + throw new Error('Database foo not found'); + } + else { + console.log('Found database: ' + result[0].id); + } + } +}) + docDBClient.createCollection('database', { id: 'foo' }, undefined, (error, result) => { if (error) { @@ -40,6 +56,41 @@ docDBClient.createStoredProcedure('collection', procedure, undefined, (error, re } }); +var trigger: docDB.Trigger = { + id: 'trigger-one', + body: function () { + console.log('bar'); + }, + triggerType: 'pre', + triggerOperation: 'all' +} + +docDBClient.createTrigger('collection', trigger, undefined, (error, result) => { + + if (error) { + throw new Error(error.body); + } + else { + console.log('Created trigger: ' + result.id); + } +}); + +var triggerQuerySpec: docDB.SqlQuerySpec = {query: 'SELECT * FROM trigger t WHERE t.id = @id', parameters: [{name: 'id', value: 'trigger-foo'}]} +docDBClient.queryTriggers('collection', triggerQuerySpec).toArray((error, result) => { + + if (error) { + throw new Error(error.body); + } + else { + if (result.length < 1) { + throw new Error('Trigger trigger-foo not found'); + } + else { + console.log('Found trigger: ' + result[0].id); + } + } +}); + var document: docDB.NewDocument<{ val: string }> = { id: '10' }; @@ -51,6 +102,16 @@ docDBClient.createDocument('collection', document, undefined, (error, result) => } else { console.log('Created document: ' + result.id); + + docDBClient.replaceDocument(result._self, document, undefined, (subError, subResult) => { + + if (subError) { + throw new Error(subError.body); + } + else { + console.log('Replaced document: ' + subResult.id); + } + }) } }); diff --git a/documentdb/documentdb.d.ts b/documentdb/documentdb.d.ts index 5815435081..6d064ef311 100644 --- a/documentdb/documentdb.d.ts +++ b/documentdb/documentdb.d.ts @@ -1,6 +1,6 @@ // Type definitions for DocumentDB // Project: https://github.com/Azure/azure-documentdb-node -// Definitions by: Noel Abrahams +// Definitions by: Noel Abrahams , Brett Gutstein // Definitions: https://github.com/borisyankov/DefinitelyTyped/documentdb declare module 'documentdb' { @@ -52,7 +52,25 @@ declare module 'documentdb' { /** Disables the automatic id generation. If id is missing in the body and this option is true, an error will be returned. */ disableAutomaticIdGeneration?: boolean; } - + + /** The Sql query parameter. */ + interface SqlParameter { + /** The name of the parameter. */ + name: string; + + /** The value of the parameter. */ + value: string; + } + + /** The Sql query specification. */ + interface SqlQuerySpec { + /** The body of the query. */ + query: string; + + /** The array of SqlParameters. */ + parameters: SqlParameter[]; + } + /** Represents the error object returned from a failed query. */ interface QueryError { @@ -130,6 +148,13 @@ declare module 'documentdb' { interface ProcedureMeta extends AbstractMeta { body: string; } + + /** Represents the meta data for a trigger. */ + interface TriggerMeta extends AbstractMeta { + body: string; + triggerType: string; + triggerOperation: string; + } /** An object that is used for authenticating requests and must contains one of the options. */ export interface AuthOptions { @@ -150,6 +175,18 @@ declare module 'documentdb' { /** The function representing the stored procedure. */ body(...params: any[]): void; } + + /** Represents a DocumentDB trigger. */ + export interface Trigger extends UniqueId { + /** The type of the trigger. Should be either 'pre' or 'post'. */ + triggerType: string; + + /** The trigger operation. Should be one of 'all', 'create', 'update', 'delete', or 'replace'. */ + triggerOperation: string; + + /** The function representing the trigger. */ + body(...params: any[]): void; + } /** Represents DocumentDB collection. */ export interface Collection extends UniqueId { @@ -195,12 +232,9 @@ declare module 'documentdb' { ExcludedPaths: string[]; } - - /** Provides a client-side logical representation of the Azure DocumentDB database account. This client is used to configure and execute requests against the service. */ export class DocumentClient { - /** * Constructs a DocumentClient. * @param urlConnection - The service endpoint to use to create the client. @@ -250,6 +284,19 @@ declare module 'documentdb' { * @param callback - The callback for the request. */ public createStoredProcedure(collectionLink: string, procedure: Procedure, options: RequestOptions, callback: RequestCallback): void; + + /** + * Create a trigger. + *

+ * DocumentDB supports pre and post triggers defined in JavaScript to be executed on creates, updates and deletes.
+ * For additional details, refer to the server-side JavaScript API documentation. + *

+ * @param collectionLink - The self-link of the collection. + * @param trigger - Represents the body of the trigger. + * @param [options] - The request options. + * @param callback - The callback for the request. + */ + public createTrigger(collectionLink: string, trigger: Trigger, options: RequestOptions, callback: RequestCallback): void; /** * Create a document. @@ -277,7 +324,7 @@ declare module 'documentdb' { * @param [options] - The feed options. * @returns - An instance of QueryIterator to handle reading feed. */ - public queryDatabases(query: string): QueryIterator; + public queryDatabases(query: string | SqlQuerySpec): QueryIterator; /** * Query the collections for the database. @@ -286,7 +333,7 @@ declare module 'documentdb' { * @param [options] - Represents the feed options. * @returns - An instance of queryIterator to handle reading feed. */ - public queryCollections(databaseLink: string, query: string): QueryIterator; + public queryCollections(databaseLink: string, query: string | SqlQuerySpec): QueryIterator; /** * Query the storedProcedures for the collection. @@ -295,7 +342,7 @@ declare module 'documentdb' { * @param [options] - Represents the feed options. * @returns - An instance of queryIterator to handle reading feed. */ - public queryStoredProcedures(collectionLink: string, query: string): QueryIterator; + public queryStoredProcedures(collectionLink: string, query: string | SqlQuerySpec): QueryIterator; /** * Query the documents for the collection. @@ -304,8 +351,17 @@ declare module 'documentdb' { * @param [options] - Represents the feed options. * @returns - An instance of queryIterator to handle reading feed. */ - public queryDocuments(collectionLink: string, query: string, options?: FeedOptions): QueryIterator>; + public queryDocuments(collectionLink: string, query: string | SqlQuerySpec, options?: FeedOptions): QueryIterator>; + /** + * Query the triggers for the collection. + * @param {string} collectionLink - The self-link of the collection. + * @param {SqlQuerySpec | string} query - A SQL query. + * @param {FeedOptions} [options] - Represents the feed options. + * @returns {QueryIterator} - An instance of queryIterator to handle reading feed. + */ + public queryTriggers(collectionLink: string, query: string | SqlQuerySpec, options?: FeedOptions): QueryIterator; + /** * Delete the document object. * @param documentLink - The self-link of the document. @@ -337,7 +393,16 @@ declare module 'documentdb' { * @param callback - The callback for the request. */ public deleteStoredProcedure(procedureLink: string, options: RequestOptions, callback: RequestCallback): void; - + + /** + * Replace the document object. + * @param {string} documentLink - The self-link of the document. + * @param {object} document - Represent the new document body. + * @param {RequestOptions} [options] - The request options. + * @param {RequestCallback} callback - The callback for the request. + */ + public replaceDocument(documentLink: string, document: NewDocument, options: RequestOptions, callback: RequestCallback>): void; + /** * Replace the StoredProcedure object. * @param procedureLink - The self-link of the stored procedure. @@ -347,4 +412,4 @@ declare module 'documentdb' { */ public replaceStoredProcedure(procedureLink: string, procedure: Procedure, options: RequestOptions, callback: RequestCallback): void; } -} \ No newline at end of file +} From 2d0a04f068aeeeacbcbfbc6fb2790a8e66b3f330 Mon Sep 17 00:00:00 2001 From: Arseniy Maximov Date: Tue, 16 Jun 2015 20:28:16 +0300 Subject: [PATCH 0089/1358] Add forEachOf, forEachOfSeries, forEachOfLimit definitions --- async/async.d.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/async/async.d.ts b/async/async.d.ts index adf6fe11be..56370c15dc 100644 --- a/async/async.d.ts +++ b/async/async.d.ts @@ -1,16 +1,23 @@ // Type definitions for Async 0.9.2 // Project: https://github.com/caolan/async -// Definitions by: Boris Yankov +// Definitions by: Boris Yankov , Arseniy Maximov // Definitions: https://github.com/borisyankov/DefinitelyTyped interface Dictionary { [key: string]: T; } +// Common interface between Arrays and Array-like objects +interface List { + [index: number]: T; + length: number; +} + interface ErrorCallback { (err?: Error): void; } interface AsyncResultCallback { (err: Error, result: T): void; } interface AsyncResultArrayCallback { (err: Error, results: T[]): void; } interface AsyncResultObjectCallback { (err: Error, results: Dictionary): void; } interface AsyncIterator { (item: T, callback: ErrorCallback): void; } +interface AsyncForEachOfIterator { (item: T, index: number, callback: ErrorCallback): void; } interface AsyncResultIterator { (item: T, callback: AsyncResultCallback): void; } interface AsyncMemoIterator { (memo: R, item: T, callback: AsyncResultCallback): void; } @@ -61,6 +68,9 @@ interface Async { each(arr: T[], iterator: AsyncIterator, callback: ErrorCallback): void; eachSeries(arr: T[], iterator: AsyncIterator, callback: ErrorCallback): void; eachLimit(arr: T[], limit: number, iterator: AsyncIterator, callback: ErrorCallback): void; + forEachOf(obj: List, iterator: AsyncForEachOfIterator, callback: ErrorCallback): void; + forEachOfSeries(obj: List, iterator: AsyncForEachOfIterator, callback: ErrorCallback): void; + forEachOfLimit(obj: List, limit: number, iterator: AsyncForEachOfIterator, callback: ErrorCallback): void; map(arr: T[], iterator: AsyncResultIterator, callback: AsyncResultArrayCallback): any; mapSeries(arr: T[], iterator: AsyncResultIterator, callback: AsyncResultArrayCallback): any; mapLimit(arr: T[], limit: number, iterator: AsyncResultIterator, callback: AsyncResultArrayCallback): any; From 7ff6577114c2c9e3354b302684dc87abc583c308 Mon Sep 17 00:00:00 2001 From: Bence Eros Date: Tue, 16 Jun 2015 19:38:51 +0200 Subject: [PATCH 0090/1358] created new Stream.Map interface, fixing build failures --- streamjs/streamjs-tests.ts | 10 +++++----- streamjs/streamjs.d.ts | 13 +++++++++---- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/streamjs/streamjs-tests.ts b/streamjs/streamjs-tests.ts index ba989f4474..f911c8f522 100644 --- a/streamjs/streamjs-tests.ts +++ b/streamjs/streamjs-tests.ts @@ -1,4 +1,4 @@ -// +/// var numStream: Stream; numStream = Stream.of(1, 2, 3); @@ -12,11 +12,11 @@ Stream.generate(() => 1); numStream = Stream.iterate(1, (n) => n * 2); -var comparator = (s1, s2) => 0; +var comparator = (s1: string, s2: string) => 0; numStream = numStream.filter(n => n % 2 == 0); var strStream = numStream - .dropWhile((n) => n % 2 == 0) + .dropWhile((n: number) => n % 2 == 0) .map(n => "number " + n) .dropWhile(/^$/) .limit(100) @@ -77,7 +77,7 @@ class MyList { var elems: any[]; -var myStream = Stream.from([new MyList, new MyList]); +var myStream: Stream = Stream.from([new MyList, new MyList]); elems = myStream .flatMap(list => list.elems) .toArray(); @@ -102,7 +102,7 @@ groupingResult = myStream.groupingBy(lst => lst.name); groupingResult = myStream.groupBy("name"); groupingResult = myStream.groupingBy("name"); -var mappingResult = myStream.toMap(lst => lst.name, (e1, e2) => e2); +var mappingResult = myStream.toMap((lst) => lst.name, (e1: MyList, e2: MyList) => e2); var aMappingResult: MyList = mappingResult["a"]; mappingResult = myStream.toMap("a"); diff --git a/streamjs/streamjs.d.ts b/streamjs/streamjs.d.ts index e36dcca239..59d8019f39 100644 --- a/streamjs/streamjs.d.ts +++ b/streamjs/streamjs.d.ts @@ -40,7 +40,7 @@ declare class Stream { groupBy(path: string): Stream.GroupingResult; groupingBy(mapper: Stream.Function): Stream.GroupingResult; groupingBy(path: string): Stream.GroupingResult; - indexBy(keyMapper: Stream.Function, mergeFunction?: Stream.Accumulator): T[]; + indexBy(keyMapper: Stream.Function, mergeFunction?: Stream.Accumulator): Stream.Map; map (mapper: Stream.Function): Stream; max(): Stream.Optional; max(comparator: Stream.Comparator): Stream.Optional; @@ -80,7 +80,7 @@ declare class Stream { sort(path: string): Stream; shuffle(): Stream; skip(n: number): Stream; - slice(begin, end): Stream; + slice(begin: number, end: number): Stream; sum(): number; sum(path: string): number; takeWhile(predicate: Stream.Predicate): Stream; @@ -88,12 +88,17 @@ declare class Stream { takeWhile(sample: Stream.Sample): Stream; toArray(): T[]; toList(): T[]; - toMap(keyMapper: Stream.Function, mergeFunction?: Stream.Accumulator): T[]; - toMap(path: string, mergeFunction?: Stream.Accumulator): T[]; + toMap(keyMapper: Stream.Function, mergeFunction?: Stream.Accumulator): Stream.Map; + toMap(path: string, mergeFunction?: Stream.Accumulator): Stream.Map; } declare module Stream { + export interface Map { + [index: string]: T + } + + export interface Sample { [index: string]: any } From 793f52d261df17aba09938590f5e0997b2d1cbc8 Mon Sep 17 00:00:00 2001 From: joswhite Date: Tue, 16 Jun 2015 13:52:13 -0600 Subject: [PATCH 0091/1358] Add jasmine.stringMatching() function See http://jasmine.github.io/2.3/introduction.html --- jasmine/jasmine.d.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/jasmine/jasmine.d.ts b/jasmine/jasmine.d.ts index c0bd008435..9e662c6e17 100644 --- a/jasmine/jasmine.d.ts +++ b/jasmine/jasmine.d.ts @@ -55,7 +55,9 @@ declare module jasmine { function getEnv(): Env; function addCustomEqualityTester(equalityTester: CustomEqualityTester): void; function addMatchers(matchers: CustomMatcherFactories): void; - + function stringMatching(str: string): Any; + function stringMatching(str: RegExp): Any; + interface Any { new (expectedClass: any): any; From 3e36972c57660da16768d170d463c64f4c763008 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Wed, 17 Jun 2015 04:06:48 -0400 Subject: [PATCH 0092/1358] Added js-beautify\js-beautify.d.ts Options sourced from https://github.com/beautify-web/js-beautify. --- js-beautify/js-beautify.d.ts | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 js-beautify/js-beautify.d.ts diff --git a/js-beautify/js-beautify.d.ts b/js-beautify/js-beautify.d.ts new file mode 100644 index 0000000000..87ede5737f --- /dev/null +++ b/js-beautify/js-beautify.d.ts @@ -0,0 +1,29 @@ +// Type definitions for js_beautify +// Project: https://github.com/beautify-web/js-beautify/ +// Definitions by: Josh Goldberg +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare var js_beautify: { + (js_source_text: string, options?: { + "indent_size"?: number; + "indent_char"?: string; + "eol"?: string; + "indent_level"?: number; + "indent_width_tabs"?: boolean; + "preserve_newlines"?: boolean; + "max_preserve_newlines"?: number; + "jslint_happy": boolean; + "space_after_anon_function": boolean; + "brace_style": string; + "keep_array_indentation": boolean; + "keep_function_indentation": boolean; + "space_before_conditional": boolean; + "break_chained_methods": boolean; + "eval_code": boolean; + "unescape_strings": boolean; + "wrap_line_length": number; + "wrap_attributes": string; + "wrap_attributes_indent_size": number; + "end_with_newline": boolean; + }): string; +}; From fe73bb68e7e2ff417eacb37d23887b29975d5abd Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Wed, 17 Jun 2015 04:09:21 -0400 Subject: [PATCH 0093/1358] Added js-beautify unit tests There are only two: a simple string for the basic usage, and a full string for the full usage. This should trigger Travis CI. --- js-beautify/js-beautify-tests.ts | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 js-beautify/js-beautify-tests.ts diff --git a/js-beautify/js-beautify-tests.ts b/js-beautify/js-beautify-tests.ts new file mode 100644 index 0000000000..bcd431c2bd --- /dev/null +++ b/js-beautify/js-beautify-tests.ts @@ -0,0 +1,28 @@ +/// + +var simple: string = js_beautify("console.log('Hello world!');"); + +var full: string = js_beautify( + "console.log('Hello world!');", + { + "indent_size": 4, + "indent_char": " ", + "eol": "\n", + "indent_level": 0, + "indent_with_tabs": false, + "preserve_newlines": true, + "max_preserve_newlines": 10, + "jslint_happy": false, + "space_after_anon_function": false, + "brace_style": "collapse", + "keep_array_indentation": false, + "keep_function_indentation": false, + "space_before_conditional": true, + "break_chained_methods": false, + "eval_code": false, + "unescape_strings": false, + "wrap_line_length": 0, + "wrap_attributes": "auto", + "wrap_attributes_indent_size": 4, + "end_with_newline": false + }); From e7046a1b8598bb1d65d57d7f07bfbee48c1d3c6f Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Wed, 17 Jun 2015 05:24:12 -0400 Subject: [PATCH 0094/1358] Removed quotes from d.ts As requested in https://github.com/borisyankov/DefinitelyTyped/pull/4658/files#r32606502 --- js-beautify/js-beautify.d.ts | 40 ++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/js-beautify/js-beautify.d.ts b/js-beautify/js-beautify.d.ts index 87ede5737f..e52614ad82 100644 --- a/js-beautify/js-beautify.d.ts +++ b/js-beautify/js-beautify.d.ts @@ -5,25 +5,25 @@ declare var js_beautify: { (js_source_text: string, options?: { - "indent_size"?: number; - "indent_char"?: string; - "eol"?: string; - "indent_level"?: number; - "indent_width_tabs"?: boolean; - "preserve_newlines"?: boolean; - "max_preserve_newlines"?: number; - "jslint_happy": boolean; - "space_after_anon_function": boolean; - "brace_style": string; - "keep_array_indentation": boolean; - "keep_function_indentation": boolean; - "space_before_conditional": boolean; - "break_chained_methods": boolean; - "eval_code": boolean; - "unescape_strings": boolean; - "wrap_line_length": number; - "wrap_attributes": string; - "wrap_attributes_indent_size": number; - "end_with_newline": boolean; + indent_size?: number; + indent_char?: string; + eol?: string; + indent_level?: number; + indent_width_tabs?: boolean; + preserve_newlines?: boolean; + max_preserve_newlines?: number; + jslint_happy: boolean; + space_after_anon_function: boolean; + brace_style: string; + keep_array_indentation: boolean; + keep_function_indentation: boolean; + space_before_conditional: boolean; + break_chained_methods: boolean; + eval_code: boolean; + unescape_strings: boolean; + wrap_line_length: number; + wrap_attributes: string; + wrap_attributes_indent_size: number; + end_with_newline: boolean; }): string; }; From 83a7215480b4d02ca8f4f93bd84ba2cb9e7a2d5a Mon Sep 17 00:00:00 2001 From: Tobias Lundin Date: Wed, 17 Jun 2015 14:12:36 +0200 Subject: [PATCH 0095/1358] chrome: use @deprecated where appropiate and add documentation strings --- chrome/chrome-cast.d.ts | 112 ++++++++++++++++++++++++---------------- 1 file changed, 68 insertions(+), 44 deletions(-) diff --git a/chrome/chrome-cast.d.ts b/chrome/chrome-cast.d.ts index 53945029f6..71a60ff10b 100644 --- a/chrome/chrome-cast.d.ts +++ b/chrome/chrome-cast.d.ts @@ -106,13 +106,14 @@ declare module chrome.cast { } /** - * @const {!Array.} - * @see https://developers.google.com/cast/docs/reference/chrome/ + * @const {!Array} + * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast#.VERSION */ var VERSION: Array; /** * @type {boolean} + * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast#.isAvailable */ var isAvailable: boolean; @@ -169,7 +170,7 @@ declare module chrome.cast { ): void /** - * @param {!Array.} receivers + * @param {!Array} receivers * @param {function()} successCallback * @param {function(chrome.cast.Error)} errorCallback */ @@ -194,7 +195,7 @@ declare module chrome.cast { /** * @param {!chrome.cast.SessionRequest} sessionRequest * @param {function(!chrome.cast.Session)} sessionListener - * @param {function(!chrome.cast.ReceiverAvailability,Array.)} + * @param {function(!chrome.cast.ReceiverAvailability,Array)} * receiverListener * @param {chrome.cast.AutoJoinPolicy=} opt_autoJoinPolicy * @param {chrome.cast.DefaultActionPolicy=} opt_defaultActionPolicy @@ -216,14 +217,14 @@ declare module chrome.cast { defaultActionPolicy: chrome.cast.DefaultActionPolicy; } - /** - * @param {!chrome.cast.ErrorCode} code - * @param {string=} opt_description - * @param {Object=} opt_details - * @constructor - * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.Error - */ interface Error { + /** + * @param {!chrome.cast.ErrorCode} code + * @param {string=} opt_description + * @param {Object=} opt_details + * @constructor + * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.Error + */ new( code: chrome.cast.ErrorCode, description?: string, @@ -252,7 +253,11 @@ declare module chrome.cast { } interface SenderApplication { - + /** + * @param {!chrome.cast.SenderPlatform} platform + * @constructor + * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.SenderApplication + */ new( platform: chrome.cast.SenderPlatform ):SenderApplication; @@ -265,7 +270,7 @@ declare module chrome.cast { interface SessionRequest { /** * @param {string} appId - * @param {!Array.=} opt_capabilities + * @param {!Array=} opt_capabilities * @param {number=} opt_timeout * @constructor * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.SessionRequest @@ -287,7 +292,7 @@ declare module chrome.cast { * @param {string} sessionId * @param {string} appId * @param {string} displayName - * @param {!Array.} appImages + * @param {!Array} appImages * @param {!chrome.cast.Receiver} receiver * @constructor * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.Session @@ -436,7 +441,7 @@ declare module chrome.cast { /** * @param {string} label * @param {string} friendlyName - * @param {Array.=} opt_capabilities + * @param {Array=} opt_capabilities * @param {chrome.cast.Volume=} opt_volume * @constructor * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.Receiver @@ -459,7 +464,7 @@ declare module chrome.cast { interface ReceiverDisplayStatus { /** * @param {string} statusText - * @param {!Array.} appImages + * @param {!Array} appImages * @constructor * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.ReceiverDisplayStatus */ @@ -558,7 +563,8 @@ declare module chrome.cast.media { } /** - * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.QueueLoadRequest + * @enum {string} + * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media#.RepeatMode */ interface RepeatMode { OFF:string; @@ -567,10 +573,12 @@ declare module chrome.cast.media { ALL_AND_SHUFFLE:string; } - /** - * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.QueueItem - */ interface QueueItem { + /** + * @param {!chrome.cast.media.MediaInfo} mediaInfo + * @constructor + * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.QueueItem + */ new( mediaInfo: chrome.cast.media.MediaInfo ):QueueItem; @@ -584,10 +592,12 @@ declare module chrome.cast.media { startTime: number; } - /** - * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.QueueLoadRequest - */ interface QueueLoadRequest { + /** + * @param {!Array} items + * @constructor + * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.QueueLoadRequest + */ new( items: Array ):QueueLoadRequest; @@ -598,10 +608,12 @@ declare module chrome.cast.media { startIndex: number; } - /** - * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.QueueInsertItemsRequest - */ interface QueueInsertItemsRequest { + /** + * @param {!Array} + * @constructor + * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.QueueInsertItemsRequest + */ new( itemsToInsert: Array ):QueueInsertItemsRequest; @@ -611,10 +623,12 @@ declare module chrome.cast.media { items: Array; } - /** - * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.QueueRemoveItemsRequest - */ interface QueueRemoveItemsRequest { + /** + * @param {!Array} + * @constructor + * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.QueueRemoveItemsRequest + */ new( itemIdsToRemove: Array ):QueueRemoveItemsRequest; @@ -623,10 +637,12 @@ declare module chrome.cast.media { itemIds: Array; } - /** - * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.QueueReorderItemsRequest - */ interface QueueReorderItemsRequest { + /** + * @param {!Array} + * @constructor + * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.QueueReorderItemsRequest + */ new( itemIdsToReorder: Array ):QueueReorderItemsRequest; @@ -636,10 +652,12 @@ declare module chrome.cast.media { itemIds: Array; } - /** - * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.QueueUpdateItemsRequest - */ interface QueueUpdateItemsRequest { + /** + * @param {!Array} + * @constructor + * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.QueueUpdateItemsRequest + */ new( itemsToUpdate: Array ):QueueUpdateItemsRequest; @@ -802,7 +820,7 @@ declare module chrome.cast.media { interface EditTracksInfoRequest { /** - * @param {Array.=} opt_activeTrackIds + * @param {Array=} opt_activeTrackIds * @param {chrome.cast.media.TextTrackStyle=} opt_textTrackStyle * @constructor * @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.EditTracksInfoRequest @@ -826,11 +844,11 @@ declare module chrome.cast.media { images: Array; metadataType: chrome.cast.media.MetadataType; releaseDate: string; + /** @deprecated. Use releaseDate instead. */ releaseYear: number; subtitle: string; title: string; - - /** Deprecated. Use metadataType instead. */ + /** @deprecated. Use metadataType instead. */ type: chrome.cast.media.MetadataType; } @@ -844,12 +862,12 @@ declare module chrome.cast.media { images: Array; metadataType: chrome.cast.media.MetadataType; releaseDate: string; + /** @deprecated. Use releaseDate instead. */ releaseYear: number; subtitle: string; title: string; studio: string; - - /** Deprecated. Use metadataType instead. */ + /** @deprecated. Use metadataType instead. */ type: chrome.cast.media.MetadataType; } @@ -868,11 +886,15 @@ declare module chrome.cast.media { images: Array; originalAirdate: string; - /** Deprecated. Use metadataType instead. */ + /** @deprecated. Use metadataType instead. */ type: chrome.cast.media.MetadataType; + /** @deprecated. Use title instead. */ episodeTitle: string; + /** @deprecated. Use season instead. */ seasonNumber: number; + /** @deprecated. Use episode instead. */ episodeNumber: number; + /** @deprecated. Use originalAirdate instead. */ releaseYear: number; } @@ -895,9 +917,11 @@ declare module chrome.cast.media { images: Array; releaseDate: string; - /** Deprecated. Use metadataType instead. */ + /** @deprecated. Use metadataType instead. */ type: chrome.cast.media.MetadataType; + /** @deprecated. Use artist instead. */ artistName: string; + /** @deprecated. Use releaseDate instead. */ releaseYear: number; } @@ -919,7 +943,7 @@ declare module chrome.cast.media { height: number; creationDateTime: string; - /** Deprecated. Use metadataType instead. */ + /** @deprecated. Use metadataType instead. */ type: chrome.cast.media.MetadataType; } @@ -973,7 +997,7 @@ declare module chrome.cast.media { supportedMediaCommands: Array; volume: chrome.cast.Volume; - /** Deprecated. Use getEstimatedTime instead */ + /** @deprecated. Use getEstimatedTime instead */ currentTime: number; /** From f00a559ddc36e8ec0b96063fbe7df9f532a21fc6 Mon Sep 17 00:00:00 2001 From: David Lipowicz Date: Wed, 17 Jun 2015 15:20:38 -0700 Subject: [PATCH 0096/1358] Adding in a few missing definitions for Dagre. --- dagre/dagre.d.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/dagre/dagre.d.ts b/dagre/dagre.d.ts index ce389f2d7e..75d7e389a7 100644 --- a/dagre/dagre.d.ts +++ b/dagre/dagre.d.ts @@ -10,20 +10,24 @@ declare module Dagre{ interface Graph { new (): Graph; - edges(): string[]; - edge(id: string): any; + edges(): Edge[]; + edge(id: any): any; nodes(): string[]; - node(id: string): any; + node(id: any): any; setDefaultEdgeLabel(callback: () => void): Graph; setEdge(sourceId: string, targetId: string): Graph; setGraph(options: { [key: string]: any }): Graph; setNode(id: string, node: { [key: string]: any }): Graph; } + interface Edge { + v: string; + w: string; + } + interface GraphLib { Graph: Graph; } } -declare var dagre: Dagre.DagreFactory; - +declare var dagre: Dagre.DagreFactory; \ No newline at end of file From b0dcd5ebfbb5441252cb27439e441b07567c4710 Mon Sep 17 00:00:00 2001 From: David Lipowicz Date: Wed, 17 Jun 2015 15:20:56 -0700 Subject: [PATCH 0097/1358] Adding in some missing definitions for SigmaJs. --- sigmajs/sigmajs.d.ts | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/sigmajs/sigmajs.d.ts b/sigmajs/sigmajs.d.ts index 62bee1980d..985686ad45 100644 --- a/sigmajs/sigmajs.d.ts +++ b/sigmajs/sigmajs.d.ts @@ -15,10 +15,17 @@ declare module SigmaJs{ graphPosition(x: number, y:number): {x: number; y: number}; ratio: number; readPrefix: string; + settings(setting: string) : any; x: number; y: number; } + interface Canvas { + edges: {[renderType: string]: Function}; + labels: {[renderType: string]: Function}; + nodes: {[renderType: string]: Function}; + } + interface Classes { configurable: Configurable; graph: Graph; @@ -39,6 +46,7 @@ declare module SigmaJs{ } interface Edge { + [key : string] : any; color?: string; id: string; size?: number; @@ -74,6 +82,11 @@ declare module SigmaJs{ nodes(ids: string[]): Node[]; } + interface GraphData { + edges: Edge[]; + nodes: Node[]; + } + interface Image { clip?: number; scale?: number; @@ -87,6 +100,7 @@ declare module SigmaJs{ } interface Node { + [key : string] : any; color?: string; id: string; image?: any; @@ -149,7 +163,7 @@ declare module SigmaJs{ interface SigmaConfigs { container?: Element; - graph?: Graph; + graph?: GraphData; id?: string; renderers?: Renderer[]; settings?: { [index: string]: any }; @@ -160,10 +174,12 @@ declare module SigmaJs{ new(container: string): Sigma; new(container: Element): Sigma; new(configuration: SigmaConfigs): Sigma; + canvas: Canvas; classes:Classes; misc: Miscellaneous; parsers: Parsers; plugins: Plugins; + svg: SVG; } interface Settings { @@ -269,8 +285,19 @@ declare module SigmaJs{ // Animation settings animationsTime?: number; } + + interface SVG { + edges: {[renderType: string]: SVGObject}; + labels: {[renderType: string]: SVGObject}; + nodes: {[renderType: string]: SVGObject}; + } + + interface SVGObject { + create: (object: T, ...a:any[]) => Element; + update: (object: T, ...a:any[]) => void; + } } declare var sigma: SigmaJs.SigmaFactory; declare var CustomShapes: SigmaJs.CustomShapes; -declare var ShapeLibrary: SigmaJs.CustomShapes; +declare var ShapeLibrary: SigmaJs.CustomShapes; \ No newline at end of file From 35de88ab7d506af1fea5d02b69fbb69d8523153d Mon Sep 17 00:00:00 2001 From: David Lipowicz Date: Wed, 17 Jun 2015 16:33:12 -0700 Subject: [PATCH 0098/1358] Added a SigmaJs test. --- sigmajs/sigmajs-tests.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sigmajs/sigmajs-tests.ts b/sigmajs/sigmajs-tests.ts index 10c6ce0294..f28a9395bd 100644 --- a/sigmajs/sigmajs-tests.ts +++ b/sigmajs/sigmajs-tests.ts @@ -23,6 +23,10 @@ module SigmaJsTests { s.refresh(); }); + sigma.canvas.edges['def'] = function() {}; + sigma.svg.nodes['def'] = {create: (obj: SigmaJs.Node) => { return new Element(); }, + update: (obj: SigmaJs.Node) => { return; }}; + var N = 100; var E = 500; // Generate a random graph: From 83b571ed149c6b2b643ef1c696cce6d81f3b6ecc Mon Sep 17 00:00:00 2001 From: sourcebits-robertbiggs Date: Wed, 17 Jun 2015 21:25:53 -0700 Subject: [PATCH 0099/1358] Added declaration file and tests for ChocolateChipJS. --- chocolatechipjs/chocolatechipjs-tests.ts | 387 ++++++ chocolatechipjs/chocolatechipjs.d.ts | 1387 ++++++++++++++++++++++ 2 files changed, 1774 insertions(+) create mode 100644 chocolatechipjs/chocolatechipjs-tests.ts create mode 100644 chocolatechipjs/chocolatechipjs.d.ts diff --git a/chocolatechipjs/chocolatechipjs-tests.ts b/chocolatechipjs/chocolatechipjs-tests.ts new file mode 100644 index 0000000000..e0eec9c53a --- /dev/null +++ b/chocolatechipjs/chocolatechipjs-tests.ts @@ -0,0 +1,387 @@ +/// +// ChocolateChipStatic -- DOM creation, etc. +$(function() { + alert('Ready to do stuff!'); +}); +var docRoot = $(); +var divTag = $('div'); +var divClass = $('.div'); +var divID = $('#div'); +var divAttr = $('[name=div]'); +var documentElement = $(); +var divTag2 = $(divTag); +var nodeName = divTag2[0].nodeName; + +// Assorted properties and functions on ChocolateChipStatic: +var version = $.version; +var libraryName = $.libraryName; +var els = $('li'); +var listItems = $.slice(els); +var madeEls = $.make('

Stuff

'); +var moreEls = $.html('

Stuff

'); +var oldTag = $('#oldTag'); +var newTag = $('#newTag'); +$.replace(oldTag, newTag); +$.require('./scripts/myscript.js', function() { + $.noop; +}); +$.defer(function() { + console.log("This comes after Squawk!"); +}); +var concatenation = $.concat('This', ' ', 'is', ' ', 'a', ' ', 'string', '.'); +var arrayOfStringWords = $.w('This is a string'); + + +// Boolean tests: +$.isString('This is a string'); +$.isArray([1, 2, 3]); +$.isFunction($.noop); +$.isObject({ name: 'Me' }); +$.isObject(new Object()); +$.isEmptyObject({}); +$.isNumber(123); +$.isInteger(123); +$.isInteger(123.123); // should return false +$.isFloat(123.123); // should return true +var newUuid = $.makeUuid(); +$.each(['a', 'b', 'c'], function(ctx, idx) { + console.log(ctx); + console.log(idx); +}); + +// Plugin interface for ChocolateChipElementArray: +$.fn.extend({ + whateverProperty: "whatever", + whateverMethod: function() { + alert("Whatever!"); + } +}); + +// ChocolateChipElementArray extensions: +$('li').each(function(ctx, idx) { + console.log(ctx.nodeName); +}); +var uniqueElements = $('li').unique(); +var secondElement = $('li').eq(1); +var lastElement = $('li').eq(-1); +var whichIndex = $('li').index($('.selected')); +var whichListItemIndex = $('li').eq(3).index(); +$('.elems').is('div').each(function(ctx) { + console.log('This element is a div.'); +}); +$('.elems').isnt('p').each(function() { + console.log('This element is not a paragraph tag.'); +}); +$('li').has('p').each(function(ctx) { + console.log('This list item has a paragraph tag.') +}); +$('li').hasnt('p').each(function(ctx) { + console.log('This list item does not have a paragraph tag.') +}); +$('ul').find('li').each(function(ctx) { + console.log(ctx); +}); +$('li').css('color'); +$('li').css('color', 'red'); +$('li').css({ "color": "red", "background-color": "yellow" }); +var elemWidth = $('#header').width(); +var elemHeight = $('#header').height(); +var offset = $('h1').offset(); +console.log(offset.top); +console.log(offset.left); +console.log(offset.bottom); +console.log(offset.right); +$('li.selected').prependTo('#selectedItems'); +$('li.selected').appendTo('#selectedItems'); +$('ul').before("

Subtitle

"); +$('ul').after("

Footer stuff here.

"); +var h1Text = $('h1').text(); +$('h1').text('The New Title'); +$('ul').insert("
  • 1
  • 2
  • 3
  • ", "first"); +$('ul').insert("
  • 1
  • 2
  • 3
  • ", "last"); +$('ul').insert("
  • 1
  • 2
  • 3
  • ", 3); +$('ul').insert("
  • 1
  • 2
  • 3
  • "); +$('ul').html('
  • 1
  • <2/li>
  • 3
  • '); +$('ul').html(''); +$('ul').prepend('
  • The title
  • '); +$('ul').append('
  • The Last Item
  • '); +var inputName = $('input').attr('name'); +$('input').attr('name', 'wobba'); +var inputName = $('input').prop('name'); +$('input').prop('name', 'wobba'); +$('input').hasAttr('disabled').css('border', 'solid 1px red'); +$('input').removeAttr('disabled'); +$('article').hasClass('current').css('display', 'block'); +$('article').addClass('current'); +$('article').removeClass('current'); +$('article').toggleClass("current"); +$('h1').dataset('status', 'ready'); +var theStatus = $('h1').dataset('status'); +var theText = $('textarea').val(); +$('textarea').val('This is the new text.'); +$('input').disable(); +$('input').enable(); +$('ul').hide(); +$('ul').hide('slow'); +$('ul').hide('fast'); +$('ul').hide(1000); +$('ul').hide('fast', function() { + console.log('Finished hiding these.'); +}); +$('ul').show(); +$('ul').show('slow'); +$('ul').show('fast'); +$('ul').show(1000); +$('ul').show('fast', function() { + console.log('Finished hiding these.'); +}); +$('#list').prev().css('display', 'none'); +$('#list').next().css('display', 'none'); +$('ul').first().css('font-weight', 'bold'); +$('ul').last().css('font-style', 'italic'); +$('ul').children().css('display', 'block'); +$('li').parent().css('border', 'solid 2px green'); +$('#list').ancestor('article').css('margin', "20px"); +$('#list').ancestor(5).css('margin', "20px"); +$('#list').closest('article').css('margin', "20px"); +$('button').siblings().css('padding', "20px"); +$('button').siblings("p").css('padding', "20px"); +var cloned = $('#list').clone(); +$('#list').wrap('
    '); +$('#list').unwrap(); +$('#list').remove(); +$('#list').empty(); +var thePrice = $('#list').data('price'); +$('#list').data('price', '$1000'); +$('#list').removeData('price'); + +// Animate: +$('#list').animate({ + "transform": "rotate3d(30, 150, 200, 180deg) scale(3) translate3d(-50%, -30%, 140%)", + "opacity": .25, + "transform-style": "preserve-3d", + "perspective": 500 +}, + '2s', + "ease-in-out" + ); + +// Form to JSON: +$.form2JSON($('form')[0], '.'); + + +// Strings: +$.camelize("this-is-a-string"); // should return "thisIsAString" +$.deCamelize("thisIsAString"); // Should return "this-is-a-string" +$.capitalize("a string"); // Should return "A string" +$.capitalize("a string", true); // Should return "A STRING" + + +// Booleans: +var isiPhone = $.isiPhone; +var isiPad = $.isiPad; +var isiPod = $.isiPod; +var isiOS = $.isiOS; +var isAndroid = $.isAndroid; +var isWebOS = $.isWebOS; +var isBlackberry = $.isBlackberry; +var isTouchEnabled = $.isTouchEnabled; +var isOnline = $.isOnline; +var isStandalone = $.isStandalone; +var isiOS6 = $.isiOS6; +var isiOS7 = $.isiOS7; +var isWin = $.isWin; +var isWinPhone = $.isWinPhone; +var isIE10 = $.isIE10; +var isIE11 = $.isIE11; +var isWebkit = $.isWebkit; +var isMobile = $.isMobile; +var isDesktop = $.isDesktop; +var isSafari = $.isSafari; +var isNativeAndroid = $.isNativeAndroid; + + +// Events: +$('li').bind('click', function() { + $.noop; +}, false); +$('li').unbind('click', function() { + $.noop; +}, false); +$('ul').delegate('click', 'li', function() { + $.noop; +}, false); +$('ul').undelegate('click', 'li', function() { + $.noop; +}, false); +$('li').on('click', function() { + $.noop; +}) +$('ul').on('click', 'li', function() { + console.log($(this).text()) +}); +$('li').off('click'); +$('li').off('click', 'li'); +$('button').trigger('click'); + +$('.selected').data('selection', 'This is awesome!'); // set the value of data value to "This is Awesome!" +$('.selected').data('selection'); // return the data value of "selection" on ".selected" + +// Promises: +var myPromise = new Promise(function(resolve, reject) { + $.noop; +}); + +var myPromise = new Promise(function(resolve, reject) { + // Resolve the promise: + resolve('Success!'); + // or reject it: + // reject('Lost in Space!'); +}); +myPromise.then(function(value) { + // Success: + console.log(value); +}, + // Opps! There was a problem: + function(reason) { + console.log(reason); + }); + +// Ajax: +$.ajax({ + url: "announcement.html", + dataType: "html", + success: function(data) { + // Insert the fragment into the page: + $("#content").html(data); + }, + error: function(data) { + $("#content").html("

    There was an error while trying to get the file.

    "); + } +}); +$.ajax({ + url: "me.json", + success: function(data) { + // Before using a JSON object, you need to parse it. + // Here we parse it and assign it to a variable: + var me = JSON.parse(data); + // Here we access the properties of the JSON object: + $("#content").html(me.firstName + " " + me.lastName); + }, + error: function(data) { + $('#content').html("

    There was an error while trying to get the file.

    "); + } +}); +var myData = { + "name": "Bozo the Clown", + "occupation": "Clown" +}; +var mySuccessCallback = function() { + console.log('The post was a success!'); +}; +var myErrorCallback = function() { + console.log('Ooops! There was a problem posting this.'); +}; +$.ajax({ + url: "/path/to/controller", + method: 'POST', + headers: { + "Content-Type": "application/x-www-form-urlencoded", + "async": true, + "Access-Control-Allow-Origin": "*", + "Accept": "text/plain" + }, + data: myData, + success: mySuccessCallback, + error: myErrorCallback +}); +$.get('http://my.com/data/stuff.html') + .then(function(response) { + console.log("Success!", response); + }, function(error) { + console.error("Failed!", error); + }); + +$.get('http://my.com/data/stuff.html') + .then(function(response) { + console.log("Success!", response); + }) + .catch(function(error) { + console.error("Failed!", error); + }); +$.get('story.json') + .then(JSON.parse) + .then(function(response) { + console.log("Yey JSON!", response); + }); +$.getJSON('/data/deserts.json', function(desserts: Array) { + desserts.forEach(function(dessert) { + $('#deserts').append('
  • ' + dessert.name + '
  • '); + }); +}); +$.post("updateUser.php", + { "name": "Joe", "time": "10PM" }, + function() { + console.log('The POST was successful.') + }, + "json" + ); +$.JSONP({ url: 'https://api.github.com/users/yui?callback=?' }) + .then(function(users) { + $('.list').append('
  • The name of the library

    ' + users.data.name + '

  • '); + }) + .catch(function(err) { + console.log('Unable to get data.') + }); + +$.JSONP({ + url: 'http://www.geonames.org/postalCodeLookupJSON?postalcode=94102&' +}) + .then(function(data) { + $('.list').append('
  • My Location

    ' + data.postalcodes[0].adminName2 + ', ' + data.postalcodes[0].adminName1 + '

  • '); + }) + .catch(function(err) { + console.log('Unable to get data.') + }); + +// Templates: +var myTemplate = '
  • Name: [[= data.name]]
  • '; +var userInfo = { + name: 'Wobba', + age: 100, + job: 'Rocket Scientist', + salary: '$1,000,000,000' +}; +var parsedTempl8 = $.template(myTemplate); +$('#user').html(parsedTempl8(userInfo)); + +// Output a simple array of data: +var simpleArray = ['One', 'Two', 'Three', 'Four', 'Five']; +var repeaterTmplate1 = '
  • [[= data ]]
  • '; +$.template.repeater($('#arrayList'), repeaterTmplate1, simpleArray); + +// Output an array of objects: +var luminaries = { + persons: + [ + { firstName: "Albert", lastName: "Einstein" }, + { firstName: "Steven", lastName: "Hawking" }, + { firstName: "Neil", lastName: "deGrasse Tyson" }, + { firstName: "Leonardo", lastName: "Da Vinci" }, + { firstName: "Nicholas", lastName: "Copernicus" } + ] +}; +var repeaterTmplate2 = '
  • [[= data.firstName ]], [[= data.lastName]]
  • '; +// Pass in the array of persons: +$.template.repeater($('#objectArrayList'), repeaterTmplate2, luminaries.persons); + +// Pub/Sub: +var arraySubscriber = function(topic: string, data: any) { + $('.list').append('
  • ' + topic + '

    ' + data + '

  • '); + var newsSubscription = $.subscribe('news/update', arraySubscriber); +}; +$.publish('news/update', 'The New York Stock Exchange rose an unprecedented 1000 points in just three minutes. Analysts and investors are confused and uncertain how to respond.'); +$.unsubscribe('news/update'); +// Due to being unsubscribed above, this does nothing: +$.publish('news/update', 'We have nothing further to comment at this time.'); + diff --git a/chocolatechipjs/chocolatechipjs.d.ts b/chocolatechipjs/chocolatechipjs.d.ts new file mode 100644 index 0000000000..269cb67904 --- /dev/null +++ b/chocolatechipjs/chocolatechipjs.d.ts @@ -0,0 +1,1387 @@ +// Type definitions for chocolatechip v3.8.11 +// Project: https://github.com/chocolatechipui/ChocolateChipJS +// Definitions by: Robert Biggs +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +/** + * Defines the base object namespace for ChocolateChipJS. + */ +declare var $chocolatechipjs: ChocolateChipStatic; +declare var $: ChocolateChipStatic; + +/** + * Static members of ChocolateChip (those on $ and ChocolateChipJS themselves) + */ +interface ChocolateChipStatic { + + /** + * Contains the version of ChocolateChipJS in use. + */ + version: string; + + /** + * Contains the name of the library (ChocolateChip). + */ + libraryName: string; + + /* + * This method takes an array-like object and returns its members as an array. + * + * @param arrayLikeObject Either the arguents object or an node collection. + */ + slice(arrayLikeObject: any): Array; + + /** + * Merge the contents of one object into the first object. If only one argument is provided, it is merged into ChocolateChipStatic. + * + * @param target An object that will receive the new properties if additional objects are passed in or that will extend the ChocolateChipStatic namespace if there is a single argument. + * @param object An object containing additional properties to merge in. + */ + extend(target: any, object?: any): any; + + /** + * Create a ChocolateChip collection object by creating elements from an HTML string. + * + * @param selector + * @return any + */ + make(selector: string): ChocolateChipElementArray; + + /** + * Create a ChocolateChip collection object by creating elements from an HTML string. This is an alias for $.make. + * + * @param selector + * @return any + */ + html(selector: string): ChocolateChipElementArray; + + /** + * Replace one element with another. + * + * @param new HTMLElement + * @param old HTMLElement + * @return HTMLElement[] + */ + replace(newElement: ChocolateChipElementArray, oldElement: ChocolateChipElementArray): void; + + /** + * Load a JavaScript file from a url, then execute it. + * + * @param url A string containing the URL where the script resides. + * @param callback A callback function that is executed after the script loads. + * @return void + */ + require(url: string, callback: Function): Function; + + /** + * Process JavaScript returned by Ajax request. An optional name can be used to create a custom variable name by which the data is exposed, otherwise it is exposed with the variable "data". + * + * @param url A string containing the URL where the script resides. + * @param callback A callback function that is executed after the script loads. + * @return Function + */ + processJSON(json: string, name?: string): any; + + /** + * This method will defer the execution of a function until the call stack is clear. + * + * @param callback A function to execute. + * @param duration The number of milliseconds to delay execution. + * @return any + */ + delay(callback: Function, duration?: number): any; + + /** + * The method will defer the execution of its callback until the call stack is clear. + * + * @param callback A callback to execute after a delay. + * @return Function. + */ + defer(callback: Function): Function; + + /** + * An empty function. + * + * @return any + */ + noop(): void; + + /** + * This method will concatenate strings or values as a cleaner alternative to using the '+' operator. + * + * @param string or number A comma separated series of strings to concatenate. + * @return string + */ + concat(...string: string[]): string; + + /** + * This method takes a space-delimited string of words and returns it as an array where the individual words are indices. + * + * @param string Any string with values separated by spaces. + * @return string[] + */ + w(string: string): string[]; + + /** + * Determine whether the argument is a string. + * + * @param obj Object to test whether or not it is a string. + * @return boolean + */ + isString(obj: any): boolean; + + /** + * Determine whether the argument is an array. + * + * @param obj Object to test whether or not it is an array. + * @return boolean + */ + isArray(obj: any): boolean; + + /** + * Determine whether the argument is a function. + * + * @param obj Object to test whether or not it is an function. + * @return boolean + */ + isFunction(obj: any): boolean; + + /** + * Determine whether the argument is an object. + * + * @param obj Object to test whether or not it is an object. + * @return boolean + */ + isObject(obj: any): boolean; + + /** + * Determine whether the argument is an empty object. + * + * @param obj Object to test whether or not it is an empty object. + * @return boolean + */ + isEmptyObject(obj: any): boolean; + + /** + * Determine whether the argument is an empty object. + * + * @param obj Object to test whether or not it is an empty object. + * @return boolean + */ + isEmptyObject(obj: any): boolean; + + /** + * Determine whether the argument is a number. + * + * @param obj Object to test whether or not it is a number. + * @return boolean + */ + isNumber(obj: any): boolean; + + /** + * Determine whether the argument is an integer. + * + * @param obj Object to test whether or not it is an integer. + * @return boolean + */ + isInteger(obj: any): boolean; + + /** + * Determine whether the argument is a float. + * + * @param obj Object to test whether or not it is a float. + * @return boolean + */ + isFloat(obj: any): boolean; + + /** + * Creates a Uuid and returns it as a string with the prefix: "chch_". + */ + makeUuid(): string; + + /** + * A generic iterator function, which can be used to seamlessly iterate over arrays. Arrays and array-like objects with a length property (such as a function's arguments object) are iterated by numeric index, from 0 to length-1. + * + * @param collection The object or array to iterate over. + * @param callback The function that will be executed on every object. + * @return any + */ + each( + collection: any, + callback: (valueOfElement: any, indexInArray: number) => any + ): any; + + + /** + * This method converts a string of hyphenated tokens into a camel cased string. + * + * @param string A string of hyphenated tokens. + * @return string + */ + camelize(string: string): string; + + /** + * This method converts a camel case string into lowercase with hyphens. + * + * @param string A camel case string. + * @return string + */ + deCamelize(string: string): string; + + /** + * This method capitalizes the first letter of a string. + * + * @param string A string. + * @param boolean A boolean value. + * @return string + */ + capitalize(string: string, boolean?: boolean): string; + + /** + * Object used to store string templates and parsed templates. + * + * @param string A string defining the template. + * @param string A label used to access an object's properties in the template. If none is provided it defaults to "data": [[= data.name]]. + * @return void + */ + templates: Object; + + /** + * This method returns a parsed template. + * + */ + template: ChocolateChipTemplate; + + + /** + * This is the base for the plugin "extend" interface, which allows you to add methods that can iterate over element collections. + */ + fn: ChocolateChipPlugin; + + /** + * Replace each element in the set of matched elements with the provided new content and return the set of elements that was removed. + * + * param newContent The content to insert. May be an HTML string, DOM element, or an array of DOM elements. + * @return void + */ + replace(newELement: HTMLElement, oldElement: HTMLElement): void; + + /** + * Perform an asynchronous HTTP (Ajax) request. + */ + ajax(settings: ChocolateChipAjaxSettings): Promise; + + /** + * Load data from the server using a HTTP GET request. + * + * @param url A string containing the URL to which the request is sent. + * @param success A callback function that is executed if the request succeeds. + * @param dataType The type of data expected from the server. Default: Intelligent Guess (json, or html). + * @return Promise + */ + get(url: string, data?: any, success?: (data: any) => any, dataType?: string): Promise; + + /** + * Load data from the server using a HTTP POST request. + * + * @param url A string containing the URL to which the request is sent. + * @param data A plain object or string that is sent to the server with the request. + * @param success A callback function that is executed if the request succeeds. + * @param dataType The type of data expected from the server. + * @return Promise + */ + post(url: string, data?: any, success?: () => any, dataType?: string): Promise; + + /** + * Load JSON-encoded data from the server using a GET HTTP request. + * + * @param url A string containing the URL to which the request is sent. + * @param data A plain object or string that is sent to the server with the request. + * @param success A callback function that is executed if the request succeeds. + * @return Promise + */ + //each(func: (ctx: any, idx: number) => any): void; + getJSON(url: string, data?: any, success?: (data: any) => any): Promise; + + /** + * Load JSON from a remote server using the JSONP technique. + * + * @param url A string + * @return Promise + */ + JSONP(options: ChocolateChipJSONP): Promise; + //JSONP({url: string, success?: (data: any), callbackType?: string, timeout?: number}): Promise; + + + + /** + * Specify a function to execute when the DOM is fully loaded. + * + * @param handler A function to execute after the DOM is ready. + * @return any + */ + ready(handler: () => any): void; + + /** + * Accepts a string containing a CSS selector which is then used to match a set of elements. + * + * @param selector A string containing a selector expression + * @param context A DOM HTMLElement to use as context + * @return HTMLElement[] + */ + (selector: string, context?: HTMLElement|ChocolateChipElementArray): ChocolateChipElementArray; + + /** + * Binds a function to be executed when the DOM has finished loading. + * + * @param callback A function to execute after the DOM is ready. + * @return void + */ + (callback: () => any): void; + + + /** + * Accepts a string containing a CSS selector which is then used to match a set of elements. + * + * @param element A DOM element to wrap in an array. + * @return HTMLElement[] + */ + (element: HTMLElement): ChocolateChipElementArray; + + /** + * Accepts a string containing a CSS selector which is then used to match a set of elements. + * + * @param elementArray An array of DOM elements to convert into a ChocolateChip Collection. + * @return HTMLElement[] + */ + (elementArray: ChocolateChipElementArray): ChocolateChipElementArray; + + /** + * If no argument is provided, return the document as a ChocolateChipElementArray. + * @return Document[] + */ + (): Document[]; + + /** + * Subscribe to a publication. You provide the topic you want to subscribe to, as well as a callback to execute when a publication occurs. + * Any data passed by the publisher is exposed to the callback as its second parameter. The callback's first parameter is the published topic. + * + * @param topic string A topic to subscribe to. This can be a single term, or any type of namespaced term with delimiters. + * @data any You can receive any type: string, number, array, object, etc. + * @return any + */ + subscribe(topic: string, callback: (topic: string, data: any) => any):any; + + /** + * Unsubscribe from a topic. Pass this the topic you wish to unsubscribe from. The subscription will be terminated immediately. + * + * @param topic string The name of the topic to unsubscribe from. + * @return void + */ + unsubscribe(topic: string): void; + + /** + * Publish a topic with data for the topic's subscribers to receive. + * + * @param topic string The topic you wish to publish. + * @param data The data to send with the publication. This can be of any type: string, number, array, object, etc. + * @return void + */ + publish(topic: string, data: any): void; + + /** + * Whether device is iPhone. + */ + isiPhone: boolean; + + /** + * Whether device is iPad. + */ + isiPad: boolean; + + /** + * Whether device is iPod. + */ + isiPod: boolean; + + /** + * Whether OS is iOS. + */ + isiOS: boolean; + + /** + * Whether OS is Android + */ + isAndroid: boolean; + + /** + * Whether OS is WebOS. + */ + isWebOS: boolean; + + /** + * Whether OS is Blackberry. + */ + isBlackberry: boolean; + + /** + * Whether OS supports touch events. + */ + isTouchEnabled: boolean; + + /** + * Whether there is a network connection. + */ + isOnline: boolean; + + /** + * Whether app is running in stanalone mode. + */ + isStandalone: boolean; + + /** + * Whether OS is iOS 6. + */ + isiOS6: boolean; + + /** + * Whether OS i iOS 7. + */ + isiOS7: boolean; + + /** + * Whether OS is Windows. + */ + isWin: boolean; + + /** + * Whether device is Windows Phone. + */ + isWinPhone: boolean; + + /** + * Whether browser is IE10. + */ + isIE10: boolean; + + /** + * Whether browser is IE11. + */ + isIE11: boolean; + + /** + * Whether browser is Webkit based. + */ + isWebkit: boolean; + + /** + * Whether browser is running on mobile device. + */ + isMobile: boolean; + + /** + * Whether browser is running on desktop. + */ + isDesktop: boolean; + + /** + * Whether browser is Safari. + */ + isSafari: boolean; + + /** + * Whether browser is Chrome. + */ + isChrome: boolean; + + /** + * Is native Android browser (not mobile Chrome). + */ + isNativeAndroid: boolean; + + /** + * Grabs values from a form and converts them into a JSON object. + * + * @param rootNode: string|HTMLElement A form whose values you want to convert to JSON. + * @param delimiter string A delimiter to namespace your form values. The default is "." + * You use the form input's name to set up the namespace structure for your JSON, e.g. name="newUser.name.first". + */ + form2JSON(rootNode: string | HTMLElement, delimiter: string): Object; +} + +interface ChocolateChipPlugin { + /** + * This method extends ChocolateChipElementArray, enabling iteration over collection items. + * + * @param object Object literal of properties and values. Value can be strings, number, array, objects or functions. + * @return HTMLElement[] + */ + extend: (object: any) => ChocolateChipElementArray; +} + +interface ChocolateChipTemplate { + /** + * This method parses a string and an optoinal variable name and returns a parsed template in the form of a function. You can then pass this function data to get rendered nodes. + * + * @param template A string of markup to use as a template. + * @param variable An option name to use in the template. If it were "myData": [[= myData.name]]. Otherwise it defaults to "data": [[= data.name]]. + * @return A function. + */ + (template: string, variable?: string): Function; + + /** + * A method to repeated output a template. + * + * @param element The target container into which the content will be inserted. + * @param template A string of markup. + * @param data The iterable data the template will consume. + * @return void. + */ + repeater: (element: ChocolateChipElementArray, template: string, data: any) => void; +} + +/** + * Represents the completion of an asynchronous operation + */ +interface Promise { + /** + * Attaches callbacks for the resolution and/or rejection of the Promise. + * + * @param onfulfilled The callback to execute when the Promise is resolved. + * @param onrejected The callback to execute when the Promise is rejected. + * @return Promise A Promise for the completion of which ever callback is executed. + * @return Promise A new Promise + */ + then(onfulfilled?: (value: T) => TResult | Promise, onrejected?: (reason: any) => TResult | Promise): Promise; + + /** + * Attaches a callback for only the rejection of the Promise. + * + * @param onrejected The callback to execute when the Promise is rejected. + * @return Promise A Promise for the completion of the callback. + * @return Promise A new Promise + */ + catch(onrejected?: (reason: any) => T | Promise): Promise; +} + +interface PromiseConstructor { + /** + * A reference to the prototype. + */ + prototype: Promise; + + /** + * Creates a new Promise. + * + * @param init A callback used to initialize the promise. This callback is passed two arguments: a resolve callback used resolve the promise with a value or the result of another promise, and a reject callback used to reject the promise with a provided reason or error. + * @return Promise A new Proimise + */ + new (init: (resolve: (value?: T | Promise) => void, reject: (reason?: any) => void) => void): Promise; + + (init: (resolve: (value?: T | Promise) => void, reject: (reason?: any) => void) => void): Promise; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises resolve, or rejected when any Promise is rejected. + * + * @param values An array of Promises. + * @return Promise A new Promise. + */ + all(values: (T | Promise)[]): Promise; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises resolve, or rejected when any Promise is rejected. + * + * @param values An array of values. + * @returns A new Promise. + */ + all(values: Promise[]): Promise; + + /** + * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved or rejected. + * + * @param values An array of Promises. + * @return Promise A new Promise. + */ + race(values: (T | Promise)[]): Promise; + + /** + * Creates a new rejected promise for the provided reason. + * + * @param reason The reason the promise was rejected. + * @return Promise A new rejected Promise. + */ + reject(reason: any): Promise; + + /** + * Creates a new rejected promise for the provided reason. + * + * @param reason The reason the promise was rejected. + * @return void A Promise is rejected. + */ + reject(reason: any): Promise; + + /** + * Creates a new resolved promise for the provided value. + * + * @param value A promise. + * @return Promise A promise whose internal state matches the provided promise. + */ + resolve(value: T | Promise): Promise; + + /** + * Creates a new resolved promise. + * + * @return Promise A resolved promise. + */ + resolve(): Promise; +} + +declare var Promise: PromiseConstructor; + + +/** + * Interface for the Ajax setting that will configure the Ajax request. + */ +interface ChocolateChipAjaxSettings { + /** + * A string containing the URL to which the request is sent. + */ + url?: string; + + /** + * A username to be used with XMLHttpRequest in response to an HTTP access authentication request. + */ + user?: string; + + /** + * A password to be used with XMLHttpRequest in response to an HTTP access authentication request. + */ + password?: string; + + /** + * The type of data that you're expecting back from the server. If none is specified, ChocolateChipJS will + * infer it based on the MIME type of the response. + */ + dataType?: string; + + /** + * The type of request to make ("POST" or "GET"), default is "GET". Note: Other HTTP request methods, + * such as PUT and DELETE, can also be used here, but they are not supported by all browsers. + */ + type?: string; + + /** + * A pre-request callback function that can be used to modify the XMLHTTPRequest object before it is sent. + * Use this to set custom headers, etc. This is an Ajax Event. Returning false in the beforeSend function will cancel the request. + * @return void + */ + beforeSend?: (xhr: XMLHttpRequest, settings: ChocolateChipAjaxSettings) => void; + + /** + * A function to be called if the request succeeds. The function gets passed three arguments: The data returned from the server, + * formatted according to the dataType parameter; a string describing the status; and the XMLHttpRequest object. This is an Ajax Event. + * @return void + */ + success?: (data: any) => void; + + /** + * A function to be called if the request fails. The function receives three arguments: The XMLHttpRequest object, a string describing + * the type of error that occurred and an optional exception object, if one occurred. Possible values for the second argument (besides null) + * are "timeout", "error", "abort", and "parsererror". When an HTTP error occurs, errorThrown receives the textual portion of the HTTP status, + * such as "Not Found" or "Internal Server Error." This is an Ajax Event. + */ + error?: (error: Error) => void; + + /** + * This object will be made the context of all Ajax-related callbacks. By default, the context is null. + */ + context?: any; + + /** + * By default, all requests are sent asynchronously (i.e. this is set to true by default). If you need synchronous requests, set this option to false. + * Cross-domain requests and dataType: "jsonp" requests do not support synchronous operation. Note that synchronous requests may temporarily lock the + * browser, disabling any actions while the request is active. + */ + async?: boolean; + + /** + * Set a timeout (in milliseconds) for the request. The timeout period starts at the point the $.ajax call is made; if several other requests are in progress + * and the browser has no connections available, it is possible for a request to time out before it can be sent. + */ + timeout?: number; + + /** + * An object of additional header key/value pairs to send along with requests using the XMLHttpRequest transport. The header X-Requested-With: XMLHttpRequest is always added, + * but its default XMLHttpRequest value can be changed here. Values in the headers setting can also be overwritten from within the beforeSend function. + */ + headers?: Object; + + /** + * Data to be sent to the server. It is converted to a query string, if not already a string. It's appended to the url for GET-requests. Object must be Key/Value pairs. + */ + data?: any; +} + +interface ChocolateChipXHR { + ajax: (settings: ChocolateChipAjaxSettings) => PromiseConstructor; +} + +interface ChocolateChipJSONP { + url: string; + success?: (data: any) => Promise; + callbackType?: string; + timeout?: number; +} + +interface ChocolateChipElementArray extends Array { + /** + * Iterate over an Array object, executing a function for each matched element. + * + * @param Function + * @return void + */ + each(func: (ctx: any, idx: number) => any): void; + + /** + * Sorts an array and removes duplicates before returning it. + * + * @return Array + */ + unique(): T[]; + + /** + * This method returns the element at the position in the array indicated by the argument. This is a zero-based number. + * When dealing with document nodes, this allows you to cherry pick a node from its collection based on its + * position amongst its siblings. + * + * @param number Index value indicating the node you wish to access from a collection. This is zero-based. + * @return HTMLElement + */ + eq(index: number): ChocolateChipElementArray; + + /** + * Search for a given element from among the matched elements on a collection. + * This method returns the index value as an integer. + * + * @return number + */ + index(): number; + + /** + * Search for a given element from among the matched elements on a collection. + * This method returns the index value as an integer. + * + * @param selector A selector representing an element to look for in a collection of elements. + * @return number + */ + index(selector: string | HTMLElement[]): number; + + /** + * Check the current matched set of elements against a selector or element and return it + * if it matches the given arguments. + * + * @param selector A string containing a selector expression to match elements against. + * @return HTMLElement[] + */ + is(selector: string): ChocolateChipElementArray; + + /** + * Check the current matched set of elements against a selector or element and return it + * if it matches the given arguments. + * + * @param elements One or more elements to match the current set of elements against. + * @ return HTMLElement[] + */ + is(element: any): ChocolateChipElementArray; + + + /** + * Check the current matched set of elements against a selector or element and return it + * if it does not match the given arguments. + * + * @param selector A string containing a selector expression to match elements against. + * @ return HTMLElement[] + */ + isnt(selector: string): ChocolateChipElementArray; + + /** + * Check the current matched set of elements against a selector or element and return it + * if it does not match the given arguments. + * + * @param elements One or more elements to match the current set of elements against. + * @ return HTMLElement[] + */ + isnt(element: any): ChocolateChipElementArray; + + /** + * Reduce the set of matched elements to those that have a descendant that matches the selector or DOM element. + * + * @param selector A string containing a selector expression to match elements against. + * @ return HTMLElement[] + */ + has(selector: string): ChocolateChipElementArray; + /** + * Reduce the set of matched elements to those that have a descendant that matches the selector or DOM element. + * + * @param contained A DOM element to match elements against. + * @ return HTMLElement[] + */ + has(contained: HTMLElement): ChocolateChipElementArray; + + /** + * Reduce the set of matched elements to those that have a descendant that does not match the selector or DOM element. + * + * @param selector A string containing a selector expression to match elements against. + * @ return HTMLElement[] + */ + hasnt(selector: string): ChocolateChipElementArray; + /** + * Reduce the set of matched elements to those that have a descendant that does not match the selector or DOM element. + * + * @param contained A DOM element to match elements against. + * @ return HTMLElement[] + */ + hasnt(contained: HTMLElement): ChocolateChipElementArray; + + /** + * Get the descendants of each element in the current set of matched elements, filtered by a selector or element. + * + * @param selector A string containing a selector expression to match elements against. + * @ return HTMLElement[] + */ + find(selector: string): ChocolateChipElementArray; + + /** + * Get the descendants of each element in the current set of matched elements, filtered by a selector or element. + * + * @param element An element to match elements against. + * @ return HTMLElement[] + */ + find(element: HTMLElement): ChocolateChipElementArray; + + /** + * Get the immediately preceding sibling of each element in the set of matched elements. + * + * @ return HTMLElement[] + */ + prev(): ChocolateChipElementArray; + + /** + * Get the immediately following sibling of each element in the set of matched elements. + * + * @ return HTMLElement[] + */ + next(): ChocolateChipElementArray; + + /** + * Reduce the set of matched elements to the first in the set. + */ + first(): ChocolateChipElementArray; + + /** + * Reduce the set of matched elements to the last in the set. + * + * @return HTMLElement[] + */ + last(): ChocolateChipElementArray; + + /** + * Get the children of each element in the set of matched elements, optionally filtered by a selector. + * + * @param selector A string containing a selector expression to match elements against. + * @return HTMLElement[] + */ + children(selector?: string): ChocolateChipElementArray; + + /** + * Get the parent of each element in the current set of matched elements, optionally filtered by a selector. + * If multiple elements have the same parent, only one instance of the parent is returned. + * + * @param selector A string containing a selector expression to match elements against. + * @return HTMLElement[] + */ + parent(selector?: string): ChocolateChipElementArray; + + /** + * For each element in the set, get the first element that matches the selector by testing the element + * itself and traversing up through its ancestors in the DOM tree, or, if a number is provided, + * retrieving that ancestor based on its distance from the element. + * + * @param selector A string containing a selector expression to match elements against. + * @return HTMLElement[] + */ + ancestor(selector: string | number): ChocolateChipElementArray; + + /** + * For each element in the set, get the first element that matches the selector by testing the element + * itself and traversing up through its ancestors in the DOM tree. + * + * @param selector A string containing a selector expression to match elements against. + * @return HTMLElement[] + */ + closest(selector: string | number): ChocolateChipElementArray; + + + /** + * Get the siblings of each element in the set of matched elements, optionally filtered by a selector. + * + * @param selector A string containing a selector expression to match elements against. + * @return HTMLElement[] + */ + siblings(selector?: string): ChocolateChipElementArray; + + /** + * Get the HTML contents of the first element in the set of matched elements. + * + * @return HTMLElement[] + */ + html(): ChocolateChipElementArray; + + /** + * Set the HTML contents of each element in the set of matched elements. + * + * @param htmlString A string of HTML to set as the content of each matched element. + * @return HTMLElement[] + */ + html(htmlString: string): ChocolateChipElementArray; + + + /** + * Get the value of style properties for the first element in the set of matched elements. + * + * @param propertyName A CSS property. + * @return string + */ + css(propertyName: string): string; + + /** + * Set one or more CSS properties for the set of matched elements using a quoted string. + * + * @param propertyName A CSS property name. + * @param value A value to set for the property. + * @return HTMLElement[] + */ + css(propertyName: string, value: string): ChocolateChipElementArray; + + /** + * Set one or more CSS properties for the set of matched elements. + * + * @param properties An object of property-value pairs to set. + * @return HTMLElement[] + */ + css(properties: Object): ChocolateChipElementArray; + + /** + * Get the value of an attribute for the first element in the set of matched elements. + * + * @param attributeName The name of the attribute to get. + * @return string + */ + attr(attributeName: string): string; + + /** + * Set an attribute for the set of matched elements. + * + * @param attributeName A string indicating the attribute to set. + * @param value A string indicating the value to set the attribute to. + * @return HTMLElement[] + */ + attr(attributeName: string, value: string): ChocolateChipElementArray; + + /** + * Remove an attribute from a node. + * + * @param attributeName A string indicating the attribute to remove. + * @return HTMLElement[] + */ + removeAttr(attributeName: string): ChocolateChipElementArray; + + /** + * Return any of the matched elements that have the given attribute. + * + * @param className The class name to search for. + * @return HTMLElement[] + */ + hasAttr(attributeName: string): ChocolateChipElementArray; + + + /** + * Get the value of an attribute for the first element in the set of matched elements. + * + * @param attributeName The name of the attribute to get. + * @return string + */ + prop(attributeName: string): string; + + /** + * Set an property for the set of matched elements. + * + * @param propertyName A string indicating the property to set. + * @param value A string indicating the value to set the property to. + * @return HTMLElement[] + */ + prop(propertyName: string, value: string): ChocolateChipElementArray; + + /** + * Adds the specified class(es) to each of the set of matched elements. + * + * @param className One or more space-separated classes to be added to the class attribute of each matched element. + * @return HTMLElement[] + */ + addClass(className: string): ChocolateChipElementArray; + + /** + * Remove a single class or multiple classes from each element in the set of matched elements. + * + * @param className One or more space-separated classes to be removed from the class attribute of each matched element. + * @return HTMLElement[] + */ + removeClass(className?: string): ChocolateChipElementArray; + + /** + * Add or remove a classe from each element in the set of matched elements, depending on whether the class is present or not. + * + * @param className One or more class names (separated by spaces) to be toggled for each element in the matched set. + * @return HTMLElement[] + */ + toggleClass(className: string, swtch?: boolean): ChocolateChipElementArray; + + /** + * Return any of the matched elements that have the given class. + * + * @param className The class name to search for. + * @return HTMLElement[] + */ + hasClass(className: string): ChocolateChipElementArray; + + /** + * Store arbitrary data associated with the matched elements. + * + * @param key A string naming the piece of data to set. + * @param value The new data value; it can be any Javascript type including Array or Object. + * @return HTMLElement[] + */ + data(key: string, value: any): ChocolateChipElementArray; + + /** + * Return the value at the named data store for the first element in the element collection, as set by + * data(name). + * + * @param key Name of the data stored. + * @return any + */ + data(key: string): any; + + /** + * Remove the value at the named data store for the first element in the element collection, as set by data(name, value). + * + * @param key Name of the data stored. + * @return any + */ + removeData(key: string): any; + + /** + * Store string data associated with the matched elements. + * + * @param key A string naming the piece of data to set. + * @param value The new data value; it must be a string. You can convert JSON into a string to use with this. + * @return HTMLElement[] + */ + dataset(key: string, value: any): ChocolateChipElementArray; + + /** + * Retrieve a dataset key's value for the first element in the element collection. + * + * @param key A string naming the piece of data to set. + * @return HTMLElement[] + */ + dataset(key: string): ChocolateChipElementArray; + + /** + * Return the value at the named data store for the first element in the element collection, as set by data(name, value). + * + * @param key Name of the data stored. + * @return any + */ + data(key: string): any; + + /** + * Store arbitrary data associated with the matched element. + * + * @param key A string naming the piece of data to set. + * @param value The new data value; it can be any Javascript type including Array or Object. + * @return HTMLElement[] + */ + data(key: string, value?: any): ChocolateChipElementArray; + + /** + * Get the current value of the first element in the set of matched elements. + */ + val(): any; + + /** + * Set the value of each element in the set of matched elements. + * + * @param value A string of text or an array of strings corresponding to the value of each matched element + * to set as selected/checked. + * @return any + */ + val(value: string): ChocolateChipElementArray; + + /** + * Set the property of an element to enabled by removing the "disabled" attribute. + * + * @return HTMLElement[] + */ + enable(): ChocolateChipElementArray; + + /** + * Set the property of an element to "disabled". + * + * @return HTMLElement[] + */ + disable(): ChocolateChipElementArray; + + /** + * Display the matched elements. + * + * @param speed A string or number determining how long the animation will run. + * @param callback A function to call once the animation is complete. + * @return HTMLElement[] + */ + show(duration?: number | string, callback?: Function): ChocolateChipElementArray; + + /** + * Hide the matched elements. + * + * @param duration A string or number determining how long the animation will run. + * @param callback A function to call once the animation is complete. + * @return HTMLElement[] + */ + hide(duration?: number | string, callback?: Function): ChocolateChipElementArray; + + /** + * Insert content, specified by the parameter, before each element in the set of matched elements. + * + * @param content HTML string, DOM element, array of elements to insert before each element in the set of matched elements. + * @return HTMLElement[] + */ + before(content: ChocolateChipElementArray | HTMLElement | string): ChocolateChipElementArray; + + /** + * Insert content, specified by the parameter, after each element in the set of matched elements. + * + * @param content HTML string, DOM element, array of elements to insert after each element in the set of matched elements. + * @return HTMLElement[] + */ + after(content: ChocolateChipElementArray | HTMLElement | string): ChocolateChipElementArray; + + /** + * Insert content, specified by the parameter, to the end of each element in the set of matched elements. + * + * @param content DOM element, array of elements, or HTML string to insert at the end of each element in the set + * of matched elements. + * @return HTMLElement[] + */ + append(content: ChocolateChipElementArray|HTMLElement|Text|string): ChocolateChipElementArray; + + /** + * Insert content, specified by the parameter, at the beginning of each element in the set of matched elements. + * + * @param content DOM element, array of elements, or HTML string to insert at the beginning of each element in the set of matched elements. + * @return HTMLElement[] + */ + prepend(content: ChocolateChipElementArray|HTMLElement|Text|string): ChocolateChipElementArray; + + /** + * Insert every element in the set of matched elements to the beginning of the target. + * + * @param target A selector, element, or HTML string. The matched set of elements will be inserted at the beginning of the element specified by this parameter. + * @return HTMLElement[] + */ + prependTo(target: any[]|HTMLElement|string): ChocolateChipElementArray; + + /** + * Insert every element in the set of matched elements to the end of the target. + * + * @param target A selector, element, or HTML string. The matched set of elements will be inserted at the end of the element specified by this parameter. + * If no position value is provided it will simply append the content to the target. + * @return HTMLElement[] + */ + appendTo(target: any[]|HTMLElement|string): ChocolateChipElementArray; + + /** + * Insert element(s) into the target element. + * + * @return HTMLElement[] + */ + insert(content: string, position?: number | string): ChocolateChipElementArray; + + /** + * Create a copy of the set of matched elements. + * + * @param value A Boolean indicating whether to copy the element(s) with their children. A true value copies the children. + * @return HTMLElement[] + */ + clone(value?: boolean): ChocolateChipElementArray; + + /** + * Wrap an HTML structure around each element in the set of matched elements. + * + * @param wrappingElement A selector or HTML string specifying the structure to wrap around the matched elements. + * @return HTMLElement[] + */ + wrap(wrappingElement: string): ChocolateChipElementArray; + + /** + * Remove the parents of the set of matched elements from the DOM, leaving the matched elements in their place. + * + * @return HTMLElement[] + */ + unwrap(): ChocolateChipElementArray; + + /** + * Remove the set of matched elements from the DOM. If there are any attached events, this will remove them to prevent memory leaks. + * + * @param selector A selector expression that filters the set of matched elements to be removed. + * @return HTMLElement[] + */ + remove(selector?: string): ChocolateChipElementArray; + + /** + * Remove all child nodes of the set of matched elements from the DOM. + * + * @return HTMLElement[] + */ + empty(): ChocolateChipElementArray; + + /** + * Get an object of the current coordinates of the first element in the set of matched elements, relative to the document. + * These are: top, left, bottom and right. The values are numbers representing pixel values. + * @return Object + */ + offset(): ChocolateChipOffsetObject; + + /** + * Get the current computed width for the first element in the set of matched elements, + * including padding but excluding borders. + * + * @return number + */ + width(): number; + + /** + * Get the current computed height for the first element in the set of matched elements, + * including padding but excluding borders. + * + * @return number + */ + height(): number; + + /** + * Get the combined text contents of each element in the set of matched elements, including their descendants. + * + * @return string + */ + text(): string; + + /** + * Set the content of each element in the set of matched elements to the specified text. + * + * @param text The text to set as the content of each matched element. When Number is supplied, it will be converted to a String representation. To delete text, use ChocolateChipElementArray.empty() or ChocolateChipElementArray.remove(). + * @return HTMLElement + */ + text(text: string | number): HTMLElement; + + /** + * Attach a handler to an event for the elements. + * + * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. + * @param handler A function to execute each time the event is triggered. + * @param useCapture Setting the third argument to true will trigger event bubbling. The default is false. + * @return ChocolateChipStatic + */ + bind(eventType: string, handler: (eventObject: Event) => any, useCapture?: boolean): ChocolateChipStatic; + + /** + * Remove a handler for an event from the elements. + * + * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. + * @param handler A function to execute each time the event is triggered. + * @param useCapture Setting the third argument to true will trigger event bubbling. The default is false. + * @return ChocolateChipStatic + */ + unbind(eventType: string, handler: (eventObject: Event) => any, useCapture?: boolean): ChocolateChipStatic; + + /** + * Add a delegated event to listen for the provided event on the descendant elements. + * + * @param selector A string defining the descendant elements to listen on for the designated event. + * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. + * @param handler A function to execute each time the event is triggered. The keyword "this" will refer + * to the element receiving the event. + * @param useCapture Setting the third argument to true will trigger event bubbling. The default is false. + * @return ChocolateChipStatic + */ + delegate(selector: any, eventType: string, handler: (eventObject: Event) => any, useCapture?: boolean): ChocolateChipStatic; + + /** + * Add a delegated event to listen for the provided event on the descendant elements. + * + * @param selector A string defining the descendant elements are listening for the event. + * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. + * @param handler A function handler assigned to this event. + * @param useCapture Setting the third argument to true will trigger event bubbling. The default is false. + * @return ChocolateChipStatic + */ + undelegate(selector: any, eventType: string, handler: (eventObject: Event) => any, useCapture?: boolean): ChocolateChipStatic; + + /** + * Add a handler to an event for elements. If a selector is provided as the second argument, this implements a delegated event. + * + * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. + * @param selector A string defining the descendant elements are listening for the event. + * @param handler A function handler assigned to this event. + * @param useCapture Setting the third argument to true will trigger event bubbling. The default is false. + * @return ChocolateChipStatic + */ + on( eventType: string, selector: any, handler?: (eventObject: Event) => any, capturePhase?: boolean): ChocolateChipStatic; + + /** + * Remove a handler for an event from the elements. If the second argument is a selector, it tries to undelegate the event. + * If no arugments are provided, it removes all events from the element(s). + * + * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. + * @param selector A string defining the descendant elements are listening for the event. + * @param handler A function handler assigned to this event. + * @param useCapture Setting the third argument to true will trigger event bubbling. The default is false. + * @return ChocolateChipStatic + */ + off( eventType?: string, selector?: any, handler?: (eventObject: Event) => any, capturePhase?: boolean): ChocolateChipStatic; + + /** + * + */ + trigger(eventType: string): void; + + /** + * A method to animate DOM nodes using CSS. This uses CSS transitions. + * + * @param options And object of key value pairs define the CSS properties and values to animate. + * @param duration A string representing the time. Should have a time identifier: "200s", "200ms", etc. + * @param easing A string indicating the easing for the animation, such as "ease-out", "ease-in", "ease-in-out". + * @return void + */ + animate(options: Object, duration?: string, easing?: string ): void; +} + +/** + * Interface for offset object. + */ +interface ChocolateChipOffsetObject { + top: number; + left: number; + bottom: number; + right: number; +} From 1e5786baeffd436ef5b9b912912b185d76d8410e Mon Sep 17 00:00:00 2001 From: Jan Trejbal Date: Thu, 18 Jun 2015 14:17:16 +0200 Subject: [PATCH 0100/1358] Fix MapTypeStyle (elementType and featureType accept only string) --- googlemaps/google.maps.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/googlemaps/google.maps.d.ts b/googlemaps/google.maps.d.ts index 2250527c3a..fdd5eeaf2a 100644 --- a/googlemaps/google.maps.d.ts +++ b/googlemaps/google.maps.d.ts @@ -225,7 +225,7 @@ declare module google.maps { setStyle(style: Data.StylingFunction|Data.StyleOptions): void; toGeoJson(callback: (feature: Object) => void): void; } - + export module Data { export interface DataOptions { map?: Map; @@ -1204,8 +1204,8 @@ declare module google.maps { } export interface MapTypeStyle { - elementType?: MapTypeStyleElementType; - featureType?: MapTypeStyleFeatureType; + elementType?: string|MapTypeStyleElementType; + featureType?: string|MapTypeStyleFeatureType; stylers?: MapTypeStyler[]; } From 98c5ba0d560efae32b801ca47533ecfef932a94f Mon Sep 17 00:00:00 2001 From: Jan Trejbal Date: Thu, 18 Jun 2015 02:59:04 +0200 Subject: [PATCH 0101/1358] Add missing semicolons --- googlemaps/google.maps.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/googlemaps/google.maps.d.ts b/googlemaps/google.maps.d.ts index fdd5eeaf2a..1b0844f7bf 100644 --- a/googlemaps/google.maps.d.ts +++ b/googlemaps/google.maps.d.ts @@ -261,8 +261,8 @@ declare module google.maps { getProperty(name: string): any; removeProperty(name: string): void; setGeometry(newGeometry: Data.Geometry|LatLng): void; // TODO LatLngLiteral - setProperty(name: string, newValue: any): void - toGeoJson(callback: (feature: Object) => void): void + setProperty(name: string, newValue: any): void; + toGeoJson(callback: (feature: Object) => void): void; } export interface FeatureOptions { From 17f143452612e442dcbd36fb80e37673ca71a9c7 Mon Sep 17 00:00:00 2001 From: Jan Trejbal Date: Thu, 18 Jun 2015 03:06:43 +0200 Subject: [PATCH 0102/1358] Fix PhpStorm lexical analysis --- googlemaps/google.maps.d.ts | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/googlemaps/google.maps.d.ts b/googlemaps/google.maps.d.ts index 1b0844f7bf..9fa61ddab1 100644 --- a/googlemaps/google.maps.d.ts +++ b/googlemaps/google.maps.d.ts @@ -209,20 +209,20 @@ declare module google.maps { /***** Data *****/ export class Data extends MVCObject { - constructor(options?: Data.DataOptions); - add(feature: Data.Feature|Data.FeatureOptions): Data.Feature; - addGeoJson(geoJson: Object, options?: Data.GeoJsonOptions): Data.Feature[]; - contains(feature: Data.Feature): boolean; - forEach(callback: (feature: Data.Feature) => void): void; - getFeatureById(id: number|string): Data.Feature; + constructor(options?: google.maps.Data.DataOptions); + add(feature: google.maps.Data.Feature|google.maps.Data.FeatureOptions): google.maps.Data.Feature; + addGeoJson(geoJson: Object, options?: google.maps.Data.GeoJsonOptions): google.maps.Data.Feature[]; + contains(feature: google.maps.Data.Feature): boolean; + forEach(callback: (feature:google.maps.Data.Feature) => void): void; + getFeatureById(id: number|string): google.maps.Data.Feature; getMap(): Map; - getStyle(): Data.StylingFunction|Data.StyleOptions; - loadGeoJson(url: string, options?: Data.GeoJsonOptions, callback?: (features: Data.Feature[]) => void): void; - overrideStyle(feature: Data.Feature, style: Data.StyleOptions): void; - remove(feature: Data.Feature): void; - revertStyle(feature?: Data.Feature): void; + getStyle(): google.maps.Data.StylingFunction|google.maps.Data.StyleOptions; + loadGeoJson(url: string, options?: google.maps.Data.GeoJsonOptions, callback?: (features:google.maps.Data.Feature[]) => void): void; + overrideStyle(feature: google.maps.Data.Feature, style: google.maps.Data.StyleOptions): void; + remove(feature: google.maps.Data.Feature): void; + revertStyle(feature?: google.maps.Data.Feature): void; setMap(map: Map): void; - setStyle(style: Data.StylingFunction|Data.StyleOptions): void; + setStyle(style: google.maps.Data.StylingFunction|google.maps.Data.StyleOptions): void; toGeoJson(callback: (feature: Object) => void): void; } From 689ee644bbc032d226e646c881cfb76bda8fcffb Mon Sep 17 00:00:00 2001 From: Jan Trejbal Date: Thu, 18 Jun 2015 03:16:27 +0200 Subject: [PATCH 0103/1358] Add tests --- googlemaps/google.maps-tests.ts | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/googlemaps/google.maps-tests.ts b/googlemaps/google.maps-tests.ts index 23931850db..9b10c40ad3 100644 --- a/googlemaps/google.maps-tests.ts +++ b/googlemaps/google.maps-tests.ts @@ -115,4 +115,28 @@ var icon: google.maps.Icon = { scaledSize: new google.maps.Size(32, 32), size: new google.maps.Size(32, 32), url: "dummy" -} \ No newline at end of file +}; + +/***** MapTypeStyle *****/ + +var mapTypeStyle: google.maps.MapTypeStyle ={ + featureType: 'all', +}; + +var mapTypeStyle: google.maps.MapTypeStyle ={ + featureType: 'administrative.country', + elementType: 'all', + stylers: [], +}; + +var mapTypeStyle: google.maps.MapTypeStyle ={ + featureType: 'landscape.natural', + elementType: 'geometry', + stylers: [], +}; + +var mapTypeStyle: google.maps.MapTypeStyle ={ + featureType: 'poi.school', + elementType: 'labels', + stylers: [], +}; From dea8dc1a00c12289fbb4f68e8103620e1bf176fb Mon Sep 17 00:00:00 2001 From: Ben Dixon Date: Thu, 18 Jun 2015 15:09:37 +0100 Subject: [PATCH 0104/1358] Add definitions for ScrollToFixed https://github.com/bigspotteddog/ScrollToFixed --- scrolltofixed/scrolltofixed-tests.ts | 35 ++++++++++++++++++++++ scrolltofixed/scrolltofixed.d.ts | 43 ++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 scrolltofixed/scrolltofixed-tests.ts create mode 100644 scrolltofixed/scrolltofixed.d.ts diff --git a/scrolltofixed/scrolltofixed-tests.ts b/scrolltofixed/scrolltofixed-tests.ts new file mode 100644 index 0000000000..23b7873048 --- /dev/null +++ b/scrolltofixed/scrolltofixed-tests.ts @@ -0,0 +1,35 @@ +/// + +$(document).ready(function() { + $('#mydiv').scrollToFixed(); +}); + +$(document).ready(function() { + $('.header').scrollToFixed({ + preFixed: function() { $(this).find('h1').css('color', 'blue'); }, + postFixed: function() { $(this).find('h1').css('color', ''); } + }); + + $('.footer').scrollToFixed( { + bottom: 0, + limit: $('.footer').offset().top, + preFixed: function() { $(this).find('h1').css('color', 'blue'); }, + postFixed: function() { $(this).find('h1').css('color', ''); } + }); + + // Order matters because our summary limit is based on the position + // of the footer. On window refresh, the summary needs to recalculate + // after the footer. + $('#summary').scrollToFixed({ + marginTop: $('.header').outerHeight() + 10, + limit: function() { + var limit = $('.footer').offset().top - $('#summary').outerHeight(true) - 10; + return limit; + }, + zIndex: 999, + preFixed: function() { $(this).find('.title').css('color', 'blue'); }, + preAbsolute: function() { $(this).find('.title').css('color', 'red'); }, + postFixed: function() { $(this).find('.title').css('color', ''); }, + postAbsolute: function() { $(this).find('.title').css('color', ''); } + }); +}); \ No newline at end of file diff --git a/scrolltofixed/scrolltofixed.d.ts b/scrolltofixed/scrolltofixed.d.ts new file mode 100644 index 0000000000..2a1ef70a8d --- /dev/null +++ b/scrolltofixed/scrolltofixed.d.ts @@ -0,0 +1,43 @@ +// Type definitions for ScrollToFixed +// Project: https://github.com/bigspotteddog/ScrollToFixed +// Definitions by: Ben Dixon +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module ScrollToFixed { + interface ScrollToFixedOptions { + marginTop? : number | (() => number); + limit? : number | (() => number); + bottom?: number; + zIndex? : number; + spacerClass? : string; + preFixed?: () => void; + fixed?: () => void; + postFixed?: () => void; + preUnfixed?: () => void; + unfixed?: () => void; + postUnfixed?: () => void; + preAbsolute?: () => void; + postAbsolute?: () => void; + offsets? : boolean; + minWidth? : number; + maxWidth? : number; + dontCheckForPositionFixedSupport? : boolean; + dontSetWidth? : boolean; + removeOffsets? : boolean; + } +} + +interface JQuery { + isScrollToFixed(el: Element) : JQuery; + isScrollToFixed(el: Element[]) : JQuery; + isScrollToFixed(el: {}) : JQuery; + isScrollToFixed(el: JQuery) : JQuery; + ScrollToFixed(el : Element, options : ScrollToFixed.ScrollToFixedOptions) : JQuery; + ScrollToFixed(el: Element[], options : ScrollToFixed.ScrollToFixedOptions) : JQuery; + ScrollToFixed(el: {}, options : ScrollToFixed.ScrollToFixedOptions) : JQuery; + ScrollToFixed(el: JQuery, options : ScrollToFixed.ScrollToFixedOptions) : JQuery; + + scrollToFixed : (options? : ScrollToFixed.ScrollToFixedOptions) => JQuery[]; +} \ No newline at end of file From 018e116d13ec1ad7d571c7e313bda7773d32728d Mon Sep 17 00:00:00 2001 From: Ben Dixon Date: Thu, 18 Jun 2015 15:27:56 +0100 Subject: [PATCH 0105/1358] Update ScrollToFixed definitions --- scrolltofixed/scrolltofixed.d.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scrolltofixed/scrolltofixed.d.ts b/scrolltofixed/scrolltofixed.d.ts index 2a1ef70a8d..a4581a3684 100644 --- a/scrolltofixed/scrolltofixed.d.ts +++ b/scrolltofixed/scrolltofixed.d.ts @@ -13,10 +13,10 @@ declare module ScrollToFixed { zIndex? : number; spacerClass? : string; preFixed?: () => void; - fixed?: () => void; postFixed?: () => void; - preUnfixed?: () => void; + fixed?: () => void; unfixed?: () => void; + preUnfixed?: () => void; postUnfixed?: () => void; preAbsolute?: () => void; postAbsolute?: () => void; @@ -26,6 +26,8 @@ declare module ScrollToFixed { dontCheckForPositionFixedSupport? : boolean; dontSetWidth? : boolean; removeOffsets? : boolean; + baseClassName?: string; + className?: string; } } From b58db06e15c6e16bc029ce2ca750c2446726ea06 Mon Sep 17 00:00:00 2001 From: Maxime Fabre Date: Thu, 18 Jun 2015 17:14:16 +0200 Subject: [PATCH 0106/1358] Update Angular module in angular-resource --- angularjs/angular-resource.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/angularjs/angular-resource.d.ts b/angularjs/angular-resource.d.ts index 7f02a533ea..4688a9c6f5 100644 --- a/angularjs/angular-resource.d.ts +++ b/angularjs/angular-resource.d.ts @@ -147,7 +147,7 @@ declare module angular.resource { } // IResourceServiceProvider used to configure global settings - interface IResourceServiceProvider extends ng.IServiceProvider { + interface IResourceServiceProvider extends angular.IServiceProvider { defaults: IResourceOptions; } From 55e444180a0f37a8910c96250a3957c6c79607da Mon Sep 17 00:00:00 2001 From: Ben Dixon Date: Thu, 18 Jun 2015 16:51:47 +0100 Subject: [PATCH 0107/1358] Update ScrollToFixed definitions --- scrolltofixed/scrolltofixed-tests.ts | 7 +++---- scrolltofixed/scrolltofixed.d.ts | 12 ++++++++---- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/scrolltofixed/scrolltofixed-tests.ts b/scrolltofixed/scrolltofixed-tests.ts index 23b7873048..80d67922f7 100644 --- a/scrolltofixed/scrolltofixed-tests.ts +++ b/scrolltofixed/scrolltofixed-tests.ts @@ -17,9 +17,6 @@ $(document).ready(function() { postFixed: function() { $(this).find('h1').css('color', ''); } }); - // Order matters because our summary limit is based on the position - // of the footer. On window refresh, the summary needs to recalculate - // after the footer. $('#summary').scrollToFixed({ marginTop: $('.header').outerHeight() + 10, limit: function() { @@ -32,4 +29,6 @@ $(document).ready(function() { postFixed: function() { $(this).find('.title').css('color', ''); }, postAbsolute: function() { $(this).find('.title').css('color', ''); } }); -}); \ No newline at end of file +}); + +var b = $.isScrollToFixed('.header'); \ No newline at end of file diff --git a/scrolltofixed/scrolltofixed.d.ts b/scrolltofixed/scrolltofixed.d.ts index a4581a3684..f9fed47c59 100644 --- a/scrolltofixed/scrolltofixed.d.ts +++ b/scrolltofixed/scrolltofixed.d.ts @@ -31,15 +31,19 @@ declare module ScrollToFixed { } } -interface JQuery { +interface JQuery { + scrollToFixed : (options? : ScrollToFixed.ScrollToFixedOptions) => JQuery[]; +} + +interface JQueryStatic { isScrollToFixed(el: Element) : JQuery; isScrollToFixed(el: Element[]) : JQuery; isScrollToFixed(el: {}) : JQuery; isScrollToFixed(el: JQuery) : JQuery; + + ScrollToFixed(el: Element, options: ScrollToFixed.ScrollToFixedOptions): void; ScrollToFixed(el : Element, options : ScrollToFixed.ScrollToFixedOptions) : JQuery; ScrollToFixed(el: Element[], options : ScrollToFixed.ScrollToFixedOptions) : JQuery; ScrollToFixed(el: {}, options : ScrollToFixed.ScrollToFixedOptions) : JQuery; - ScrollToFixed(el: JQuery, options : ScrollToFixed.ScrollToFixedOptions) : JQuery; - - scrollToFixed : (options? : ScrollToFixed.ScrollToFixedOptions) => JQuery[]; + ScrollToFixed(el: JQuery, options : ScrollToFixed.ScrollToFixedOptions) : JQuery; } \ No newline at end of file From de9dee624b14808d2a7f16a42f9f810a89cb335d Mon Sep 17 00:00:00 2001 From: flyfishMT Date: Thu, 18 Jun 2015 10:01:25 -0600 Subject: [PATCH 0108/1358] 'uniform.js' --- jquery.uniform/jquery.uniform-tests.ts | 76 ++++++++++++++++++++++++++ jquery.uniform/jquery.uniform.d.ts | 44 +++++++++++++++ 2 files changed, 120 insertions(+) create mode 100644 jquery.uniform/jquery.uniform-tests.ts create mode 100644 jquery.uniform/jquery.uniform.d.ts diff --git a/jquery.uniform/jquery.uniform-tests.ts b/jquery.uniform/jquery.uniform-tests.ts new file mode 100644 index 0000000000..2515fc53d0 --- /dev/null +++ b/jquery.uniform/jquery.uniform-tests.ts @@ -0,0 +1,76 @@ +/// elements +$("select").uniform(); +// Style everything +$("select, input, a.button, button").uniform(); +// Avoid styling some elements +$("select").not(".skip_these").uniform(); // Method 1 +$('select[class!="skip_these"]').uniform(); // Method 2 + +$("select").uniform({ + fileDefaultText: 'Keine Datei ausgewählt', + fileBtnText: 'Wählen Sie Datei', +}); + +$.uniform.defaults.checkedClass = "uniformCheckedClass"; +$.uniform.defaults.fileBtnHtml = "Pick a file"; + +$("select").uniform({activeClass: 'myActiveClass'}); + +$("input[type=button]").uniform({buttonClass: 'myBtnClass'}); + +$(":checkbox").uniform({checkboxClass: 'myCheckClass'}); + +$(":radio, :checkbox").uniform({checkedClass: 'myCheckedClass'}); + +$("select").uniform({disabledClass: 'myDisabledClass'}); + +$("select").uniform({eventNamespace: '.uniformEvents'}); + +$(":file").uniform({fileButtonClass: 'myFileBtnClass'}); + +$(":file").uniform({fileButtonHtml: 'Choose …'}); + +$(":file").uniform({fileClass: 'myFileClass'}); + +$(":file").uniform({fileDefaultHtml: 'Select a file please'}); + +$(":file").uniform({filenameClass: 'myFilenameClass'}); + +$("select").uniform({focusClass: 'myFocusClass'}); + +$("select").uniform({hoverClass: 'myHoverClass'}); + +$("select").uniform({idPrefix: 'container'}); + +$("input").uniform({inputAddTypeAsClass: true}); + +$("input").uniform({inputClass: "inputElement"}); + +$(":radio").uniform({radioClass: 'myRadioClass'}); + +$("input[type='reset']).uniform({resetDefaultHtml: "Clear"}); + +$("select").uniform({resetSelector: 'input[type="reset"]'}); + +$("select").uniform({selectClass: 'mySelectClass'}); + +$("select").uniform({selectMultiClass: 'myMultiSelectClass'}); + +$("input[type='submit']).uniform({resetDefaultHtml: "Submit Form"}); + +$("textarea").uniform({textareaClass: "myTextareaClass"}); + +$("select").uniform({useID: false}); + +$('input.blue').uniform({wrapperClass: "blueTheme"}); +$('input').uniform({wrapperClass: "defaultTheme"}); + +$.uniform.update("#myUpdatedCheckbox"); + +$.uniform.update(); + +$.uniform.restore("select"); + +var uniforms = $.uniform.elements; diff --git a/jquery.uniform/jquery.uniform.d.ts b/jquery.uniform/jquery.uniform.d.ts new file mode 100644 index 0000000000..8517bddb98 --- /dev/null +++ b/jquery.uniform/jquery.uniform.d.ts @@ -0,0 +1,44 @@ +// Type definitions for Uniform.js +// Project: https://github.com/pixelmatrix/uniform +// Definitions by: flyfishMT +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +interface UniformOptions { + activeClass?: string; + autoHide?: boolean; + buttonClass?: string; + checkboxClass?: string; + checkedClass?: string; + disabledClass?: string; + eventNamespace?: string; + fileButtonClass?: string; + fileButtonHtml?: string; + fileClass?: string; + fileDefaultHtml?: string; + filenameClass?: string; + focusClass?: string; + hoverClass?: string; + idPrefix?: string; + inputAddTypeAsClass?: boolean; + radioClass?: string; + resetDefaultHtml?: string; + resetSelector?: any; + selectAutoWidth?: boolean; + selectClass?: string; + selectMultiClass?: string; + submitDefaultHtml?: string; + textareaClass?: string; + useID?: boolean; + wrapperClass?: string; +} +interface Uniform { + (options?: UniformOptions): JQuery; + update(any?): void; + restore(any?): void; + elements: JQuery[]; +} +interface JQueryStatic { + uniform: Uniform; +} From f647477b32325d53783dd9e6ab9cedb245f1fa39 Mon Sep 17 00:00:00 2001 From: flyfishMT Date: Thu, 18 Jun 2015 10:14:47 -0600 Subject: [PATCH 0109/1358] uniform.js --- jquery.uniform/jquery.uniform-tests.ts | 6 +++--- jquery.uniform/jquery.uniform.d.ts | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/jquery.uniform/jquery.uniform-tests.ts b/jquery.uniform/jquery.uniform-tests.ts index 2515fc53d0..130c51aab1 100644 --- a/jquery.uniform/jquery.uniform-tests.ts +++ b/jquery.uniform/jquery.uniform-tests.ts @@ -1,5 +1,5 @@ -/// elements $("select").uniform(); // Style everything @@ -50,7 +50,7 @@ $("input").uniform({inputClass: "inputElement"}); $(":radio").uniform({radioClass: 'myRadioClass'}); -$("input[type='reset']).uniform({resetDefaultHtml: "Clear"}); +$("input[type='reset']").uniform({resetDefaultHtml: "Clear"}); $("select").uniform({resetSelector: 'input[type="reset"]'}); diff --git a/jquery.uniform/jquery.uniform.d.ts b/jquery.uniform/jquery.uniform.d.ts index 8517bddb98..172fdc78c7 100644 --- a/jquery.uniform/jquery.uniform.d.ts +++ b/jquery.uniform/jquery.uniform.d.ts @@ -35,8 +35,8 @@ interface UniformOptions { } interface Uniform { (options?: UniformOptions): JQuery; - update(any?): void; - restore(any?): void; + update(elemOrSelector?: any): void; + restore(elemOrSelector?: any): void; elements: JQuery[]; } interface JQueryStatic { From 2a0415acb2e99c8077514f4cb3e0dddcc07d18ec Mon Sep 17 00:00:00 2001 From: flyfishMT Date: Thu, 18 Jun 2015 10:19:41 -0600 Subject: [PATCH 0110/1358] Uniform.js --- jquery.uniform/jquery.uniform-tests.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jquery.uniform/jquery.uniform-tests.ts b/jquery.uniform/jquery.uniform-tests.ts index 130c51aab1..0ffeed0314 100644 --- a/jquery.uniform/jquery.uniform-tests.ts +++ b/jquery.uniform/jquery.uniform-tests.ts @@ -1,4 +1,4 @@ -/// // Style all ')).toHaveValue('some text') */ - toHaveValue(value): boolean; + toHaveValue(value : string): boolean; /** * Check if DOM element has the given data. * This can only be applied for element on with jQuery data(key) can be called. * */ - toHaveData(key, expectedValue): boolean; + toHaveData(key : string, expectedValue : string): boolean; toBe(selector: JQuery): boolean; /** @@ -295,7 +295,7 @@ declare module jasmine { * @example * expect($form).toHandleWith("submit", yourSubmitCallback) */ - toHandleWith(eventName: string, eventHandler): boolean; + toHandleWith(eventName: string, eventHandler : JQueryCallback): boolean; /** * Checks if event was triggered. @@ -381,7 +381,7 @@ declare module jasmine { wasTriggeredWith(selector: string, eventName: string, expectedArgs: any, env: jasmine.Env): boolean; wasPrevented(selector: string, eventName: string): boolean; wasStopped(selector: string, eventName: string): boolean; - cleanUp(); + cleanUp() : void; } var JQuery: JasmineJQuery; From b53cbfb5b5dd9c471ad2f2220bd8c6adf8613288 Mon Sep 17 00:00:00 2001 From: Mohsen Azimi Date: Mon, 22 Jun 2015 17:41:15 -0700 Subject: [PATCH 0138/1358] Add `xit` and `xdescribe` In Mocha you can comment out tests by changing their `it` or `describe` blocks to `xit` or `xdescribe`. This change will add support for those functions. --- mocha/mocha.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mocha/mocha.d.ts b/mocha/mocha.d.ts index fefd919466..1d57bc45ce 100644 --- a/mocha/mocha.d.ts +++ b/mocha/mocha.d.ts @@ -37,11 +37,13 @@ interface MochaDone { declare var mocha: Mocha; declare var describe: Mocha.IContextDefinition; +declare var xdescribe: Mocha.IContextDefinition; // alias for `describe` declare var context: Mocha.IContextDefinition; // alias for `describe` declare var suite: Mocha.IContextDefinition; declare var it: Mocha.ITestDefinition; +declare var xit: Mocha.ITestDefinition; // alias for `it` declare var test: Mocha.ITestDefinition; From 567c33f879c6bec49728d753623bc5b085040ad1 Mon Sep 17 00:00:00 2001 From: John Vilk Date: Mon, 22 Jun 2015 21:59:09 -0700 Subject: [PATCH 0139/1358] [decimal.js] Change module name to standard 'decimal.js'. --- decimal.js/decimal.js.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/decimal.js/decimal.js.d.ts b/decimal.js/decimal.js.d.ts index da2489a5f7..74910614e2 100644 --- a/decimal.js/decimal.js.d.ts +++ b/decimal.js/decimal.js.d.ts @@ -6,7 +6,7 @@ declare var Decimal: decimal.IDecimalStatic; // Support AMD require -declare module 'decimal' { +declare module 'decimal.js' { export = Decimal; } From 6f0bcac0caf998f1e943d43b7f9bf240c68ba13e Mon Sep 17 00:00:00 2001 From: Rodney Lorrimar Date: Tue, 23 Jun 2015 13:00:22 +0800 Subject: [PATCH 0140/1358] Revert "moment: Use type alias for moment-like parameters" This reverts commit 8f9ff607f0a79e5a976682d00ce156781f9efd19 which fails to compile on typescript@1.4.1 (however it compiles with typescript@1.5.0-beta). --- moment/moment-node.d.ts | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/moment/moment-node.d.ts b/moment/moment-node.d.ts index f491833f9d..eaacb8855f 100644 --- a/moment/moment-node.d.ts +++ b/moment/moment-node.d.ts @@ -216,8 +216,8 @@ declare module moment { dayOfYear(): number; dayOfYear(d: number): Moment; - from(f: MomentLike, suffix?: boolean): string; - to(f: MomentLike, suffix?: boolean): string; + from(f: Moment|string|number|Date|number[], suffix?: boolean): string; + to(f: Moment|string|number|Date|number[], suffix?: boolean): string; diff(b: Moment): number; diff(b: Moment, unitOfTime: string): number; @@ -240,13 +240,13 @@ declare module moment { isDST(): boolean; isBefore(): boolean; - isBefore(b: MomentLike, granularity?: string): boolean; + isBefore(b: Moment|string|number|Date|number[], granularity?: string): boolean; isAfter(): boolean; - isAfter(b: MomentLike, granularity?: string): boolean; + isAfter(b: Moment|string|number|Date|number[], granularity?: string): boolean; - isSame(b: MomentLike, granularity?: string): boolean; - isBetween(a: MomentLike, b: MomentLike, granularity?: string): boolean; + isSame(b: Moment|string|number|Date|number[], granularity?: string): boolean; + isBetween(a: Moment|string|number|Date|number[], b: Moment|string|number|Date|number[], granularity?: string): boolean; // Deprecated as of 2.8.0. lang(language: string): Moment; @@ -262,11 +262,11 @@ declare module moment { localeData(): MomentLanguage; // Deprecated as of 2.7.0. - max(date: MomentLike|any[]): Moment; + max(date: Moment|string|number|Date|any[]): Moment; max(date: string, format: string): Moment; // Deprecated as of 2.7.0. - min(date: MomentLike|any[]): Moment; + min(date: Moment|string|number|Date|any[]): Moment; min(date: string, format: string): Moment; get(unit: string): number; @@ -439,9 +439,6 @@ declare module moment { } - // Moment.js automatically converts datetime parameters from a number of types - type MomentLike = Moment | string | number | Date | number[]; - } declare module 'moment' { From 979de8c421274ae0ba9481558c2e69fed4c2250a Mon Sep 17 00:00:00 2001 From: itokentr Date: Tue, 23 Jun 2015 19:38:39 +0900 Subject: [PATCH 0141/1358] node: Add methods Buffer.compare(), NodeBuffer.equals() and NodeBuffer.compare(). --- node/node.d.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/node/node.d.ts b/node/node.d.ts index c4f778139b..2bbab98e3c 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -127,6 +127,10 @@ declare var Buffer: { * If totalLength is not provided, it is read from the buffers in the list. However, this adds an additional loop to the function, so it is faster to provide the length explicitly. */ concat(list: Buffer[], totalLength?: number): Buffer; + /** + * The same as buf1.compare(buf2). + */ + compare(buf1: Buffer, buf2: Buffer): number; }; /************************************************ @@ -327,6 +331,8 @@ interface NodeBuffer { toString(encoding?: string, start?: number, end?: number): string; toJSON(): any; length: number; + equals(otherBuffer: Buffer): boolean; + compare(otherBuffer: Buffer): number; copy(targetBuffer: Buffer, targetStart?: number, sourceStart?: number, sourceEnd?: number): number; slice(start?: number, end?: number): Buffer; writeUIntLE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; From a44984a2d94a68cd388a5d2a1cdbdb370602cae9 Mon Sep 17 00:00:00 2001 From: itokentr Date: Tue, 23 Jun 2015 19:43:59 +0900 Subject: [PATCH 0142/1358] node: Add methods fs.access(), fs.accessSync and related constants. --- node/node.d.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/node/node.d.ts b/node/node.d.ts index 2bbab98e3c..0f7904fde7 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -1264,6 +1264,19 @@ declare module "fs" { export function watch(filename: string, options: { persistent?: boolean; }, listener?: (event: string, filename: string) => any): FSWatcher; export function exists(path: string, callback?: (exists: boolean) => void): void; export function existsSync(path: string): boolean; + /** Constant for fs.access(). File is visible to the calling process. */ + export var F_OK: number; + /** Constant for fs.access(). File can be read by the calling process. */ + export var R_OK: number; + /** Constant for fs.access(). File can be written by the calling process. */ + export var W_OK: number; + /** Constant for fs.access(). File can be executed by the calling process. */ + export var X_OK: number; + /** Tests a user's permissions for the file specified by path. */ + export function access(path: string, callback: (err: NodeJS.ErrnoException) => void): void; + export function access(path: string, mode: number, callback: (err: NodeJS.ErrnoException) => void): void; + /** Synchronous version of fs.access. This throws if any accessibility checks fail, and does nothing otherwise. */ + export function accessSync(path: string, mode ?: number): void; export function createReadStream(path: string, options?: { flags?: string; encoding?: string; From 324dfabbff0dadfde41b6a2154d4193006de466f Mon Sep 17 00:00:00 2001 From: itokentr Date: Tue, 23 Jun 2015 19:45:09 +0900 Subject: [PATCH 0143/1358] node: Add module "constants". --- node/node.d.ts | 224 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 224 insertions(+) diff --git a/node/node.d.ts b/node/node.d.ts index 0f7904fde7..0c6b42740d 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -1829,3 +1829,227 @@ declare module "domain" { export function create(): Domain; } + +declare module "constants" { + export var E2BIG: number; + export var EACCES: number; + export var EADDRINUSE: number; + export var EADDRNOTAVAIL: number; + export var EAFNOSUPPORT: number; + export var EAGAIN: number; + export var EALREADY: number; + export var EBADF: number; + export var EBADMSG: number; + export var EBUSY: number; + export var ECANCELED: number; + export var ECHILD: number; + export var ECONNABORTED: number; + export var ECONNREFUSED: number; + export var ECONNRESET: number; + export var EDEADLK: number; + export var EDESTADDRREQ: number; + export var EDOM: number; + export var EEXIST: number; + export var EFAULT: number; + export var EFBIG: number; + export var EHOSTUNREACH: number; + export var EIDRM: number; + export var EILSEQ: number; + export var EINPROGRESS: number; + export var EINTR: number; + export var EINVAL: number; + export var EIO: number; + export var EISCONN: number; + export var EISDIR: number; + export var ELOOP: number; + export var EMFILE: number; + export var EMLINK: number; + export var EMSGSIZE: number; + export var ENAMETOOLONG: number; + export var ENETDOWN: number; + export var ENETRESET: number; + export var ENETUNREACH: number; + export var ENFILE: number; + export var ENOBUFS: number; + export var ENODATA: number; + export var ENODEV: number; + export var ENOENT: number; + export var ENOEXEC: number; + export var ENOLCK: number; + export var ENOLINK: number; + export var ENOMEM: number; + export var ENOMSG: number; + export var ENOPROTOOPT: number; + export var ENOSPC: number; + export var ENOSR: number; + export var ENOSTR: number; + export var ENOSYS: number; + export var ENOTCONN: number; + export var ENOTDIR: number; + export var ENOTEMPTY: number; + export var ENOTSOCK: number; + export var ENOTSUP: number; + export var ENOTTY: number; + export var ENXIO: number; + export var EOPNOTSUPP: number; + export var EOVERFLOW: number; + export var EPERM: number; + export var EPIPE: number; + export var EPROTO: number; + export var EPROTONOSUPPORT: number; + export var EPROTOTYPE: number; + export var ERANGE: number; + export var EROFS: number; + export var ESPIPE: number; + export var ESRCH: number; + export var ETIME: number; + export var ETIMEDOUT: number; + export var ETXTBSY: number; + export var EWOULDBLOCK: number; + export var EXDEV: number; + export var WSAEINTR: number; + export var WSAEBADF: number; + export var WSAEACCES: number; + export var WSAEFAULT: number; + export var WSAEINVAL: number; + export var WSAEMFILE: number; + export var WSAEWOULDBLOCK: number; + export var WSAEINPROGRESS: number; + export var WSAEALREADY: number; + export var WSAENOTSOCK: number; + export var WSAEDESTADDRREQ: number; + export var WSAEMSGSIZE: number; + export var WSAEPROTOTYPE: number; + export var WSAENOPROTOOPT: number; + export var WSAEPROTONOSUPPORT: number; + export var WSAESOCKTNOSUPPORT: number; + export var WSAEOPNOTSUPP: number; + export var WSAEPFNOSUPPORT: number; + export var WSAEAFNOSUPPORT: number; + export var WSAEADDRINUSE: number; + export var WSAEADDRNOTAVAIL: number; + export var WSAENETDOWN: number; + export var WSAENETUNREACH: number; + export var WSAENETRESET: number; + export var WSAECONNABORTED: number; + export var WSAECONNRESET: number; + export var WSAENOBUFS: number; + export var WSAEISCONN: number; + export var WSAENOTCONN: number; + export var WSAESHUTDOWN: number; + export var WSAETOOMANYREFS: number; + export var WSAETIMEDOUT: number; + export var WSAECONNREFUSED: number; + export var WSAELOOP: number; + export var WSAENAMETOOLONG: number; + export var WSAEHOSTDOWN: number; + export var WSAEHOSTUNREACH: number; + export var WSAENOTEMPTY: number; + export var WSAEPROCLIM: number; + export var WSAEUSERS: number; + export var WSAEDQUOT: number; + export var WSAESTALE: number; + export var WSAEREMOTE: number; + export var WSASYSNOTREADY: number; + export var WSAVERNOTSUPPORTED: number; + export var WSANOTINITIALISED: number; + export var WSAEDISCON: number; + export var WSAENOMORE: number; + export var WSAECANCELLED: number; + export var WSAEINVALIDPROCTABLE: number; + export var WSAEINVALIDPROVIDER: number; + export var WSAEPROVIDERFAILEDINIT: number; + export var WSASYSCALLFAILURE: number; + export var WSASERVICE_NOT_FOUND: number; + export var WSATYPE_NOT_FOUND: number; + export var WSA_E_NO_MORE: number; + export var WSA_E_CANCELLED: number; + export var WSAEREFUSED: number; + export var SIGHUP: number; + export var SIGINT: number; + export var SIGILL: number; + export var SIGABRT: number; + export var SIGFPE: number; + export var SIGKILL: number; + export var SIGSEGV: number; + export var SIGTERM: number; + export var SIGBREAK: number; + export var SIGWINCH: number; + export var SSL_OP_ALL: number; + export var SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION: number; + export var SSL_OP_CIPHER_SERVER_PREFERENCE: number; + export var SSL_OP_CISCO_ANYCONNECT: number; + export var SSL_OP_COOKIE_EXCHANGE: number; + export var SSL_OP_CRYPTOPRO_TLSEXT_BUG: number; + export var SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS: number; + export var SSL_OP_EPHEMERAL_RSA: number; + export var SSL_OP_LEGACY_SERVER_CONNECT: number; + export var SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER: number; + export var SSL_OP_MICROSOFT_SESS_ID_BUG: number; + export var SSL_OP_MSIE_SSLV2_RSA_PADDING: number; + export var SSL_OP_NETSCAPE_CA_DN_BUG: number; + export var SSL_OP_NETSCAPE_CHALLENGE_BUG: number; + export var SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG: number; + export var SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG: number; + export var SSL_OP_NO_COMPRESSION: number; + export var SSL_OP_NO_QUERY_MTU: number; + export var SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION: number; + export var SSL_OP_NO_SSLv2: number; + export var SSL_OP_NO_SSLv3: number; + export var SSL_OP_NO_TICKET: number; + export var SSL_OP_NO_TLSv1: number; + export var SSL_OP_NO_TLSv1_1: number; + export var SSL_OP_NO_TLSv1_2: number; + export var SSL_OP_PKCS1_CHECK_1: number; + export var SSL_OP_PKCS1_CHECK_2: number; + export var SSL_OP_SINGLE_DH_USE: number; + export var SSL_OP_SINGLE_ECDH_USE: number; + export var SSL_OP_SSLEAY_080_CLIENT_DH_BUG: number; + export var SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG: number; + export var SSL_OP_TLS_BLOCK_PADDING_BUG: number; + export var SSL_OP_TLS_D5_BUG: number; + export var SSL_OP_TLS_ROLLBACK_BUG: number; + export var ENGINE_METHOD_DSA: number; + export var ENGINE_METHOD_DH: number; + export var ENGINE_METHOD_RAND: number; + export var ENGINE_METHOD_ECDH: number; + export var ENGINE_METHOD_ECDSA: number; + export var ENGINE_METHOD_CIPHERS: number; + export var ENGINE_METHOD_DIGESTS: number; + export var ENGINE_METHOD_STORE: number; + export var ENGINE_METHOD_PKEY_METHS: number; + export var ENGINE_METHOD_PKEY_ASN1_METHS: number; + export var ENGINE_METHOD_ALL: number; + export var ENGINE_METHOD_NONE: number; + export var DH_CHECK_P_NOT_SAFE_PRIME: number; + export var DH_CHECK_P_NOT_PRIME: number; + export var DH_UNABLE_TO_CHECK_GENERATOR: number; + export var DH_NOT_SUITABLE_GENERATOR: number; + export var NPN_ENABLED: number; + export var RSA_PKCS1_PADDING: number; + export var RSA_SSLV23_PADDING: number; + export var RSA_NO_PADDING: number; + export var RSA_PKCS1_OAEP_PADDING: number; + export var RSA_X931_PADDING: number; + export var RSA_PKCS1_PSS_PADDING: number; + export var POINT_CONVERSION_COMPRESSED: number; + export var POINT_CONVERSION_UNCOMPRESSED: number; + export var POINT_CONVERSION_HYBRID: number; + export var O_RDONLY: number; + export var O_WRONLY: number; + export var O_RDWR: number; + export var S_IFMT: number; + export var S_IFREG: number; + export var S_IFDIR: number; + export var S_IFCHR: number; + export var S_IFLNK: number; + export var O_CREAT: number; + export var O_EXCL: number; + export var O_TRUNC: number; + export var O_APPEND: number; + export var F_OK: number; + export var R_OK: number; + export var W_OK: number; + export var X_OK: number; + export var UV_UDP_REUSEADDR: number; +} From 098def61bc44ee29dae7e7a5c719873195086ac2 Mon Sep 17 00:00:00 2001 From: vvakame Date: Tue, 23 Jun 2015 21:38:32 +0900 Subject: [PATCH 0144/1358] separate mocha node.js definition --- mocha/mocha-node-tests.ts | 37 +++++++++++++++++++++++++++++++++++++ mocha/mocha-node.d.ts | 16 ++++++++++++++++ mocha/mocha-tests.ts | 34 ---------------------------------- mocha/mocha.d.ts | 18 ++++++++---------- 4 files changed, 61 insertions(+), 44 deletions(-) create mode 100644 mocha/mocha-node-tests.ts create mode 100644 mocha/mocha-node.d.ts diff --git a/mocha/mocha-node-tests.ts b/mocha/mocha-node-tests.ts new file mode 100644 index 0000000000..e27ec8e6d9 --- /dev/null +++ b/mocha/mocha-node-tests.ts @@ -0,0 +1,37 @@ +/// + +import MochaDef = require('mocha'); + +class CustomSpecReporter extends MochaDef.reporters.Spec { + constructor(runner: Mocha.IRunner) { + super(runner); + + runner.on('test', (test: Mocha.ITest) => { + console.log(test.parent.title + '/' + test.title); + }); + } +} + +class MyReporter extends MochaDef.reporters.Base { + passes: number = 0; + failures: number = 0; + + constructor(runner: Mocha.IRunner) { + super(runner); + + runner.on('pass', (test: Mocha.ITest) => { + this.passes++; + console.log('pass: %s', test.fullTitle()); + }); + + runner.on('fail', (test: Mocha.ITest, err: Error) => { + this.failures++; + console.log('fail: %s -- error: %s', test.fullTitle(), err.message); + }); + + runner.on('end', () => { + console.log('end: %d/%d', this.passes, this.passes + this.failures); + process.exit(this.failures); + }); + } +} diff --git a/mocha/mocha-node.d.ts b/mocha/mocha-node.d.ts new file mode 100644 index 0000000000..b0fa0a6ac7 --- /dev/null +++ b/mocha/mocha-node.d.ts @@ -0,0 +1,16 @@ +// Type definitions for mocha 2.2.5 +// Project: http://mochajs.org/ +// Definitions by: Vadim Macagon , vvakame +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +/// + +declare module Mocha { + interface IRunnable extends NodeJS.EventEmitter { + } + interface ISuite extends NodeJS.EventEmitter { + } + interface IRunner extends NodeJS.EventEmitter { + } +} diff --git a/mocha/mocha-tests.ts b/mocha/mocha-tests.ts index a2e2b07961..f90fefaf96 100644 --- a/mocha/mocha-tests.ts +++ b/mocha/mocha-tests.ts @@ -249,37 +249,3 @@ function test_run_withOnComplete() { console.log(failures); }); } - -class CustomSpecReporter extends MochaDef.reporters.Spec { - constructor(runner: Mocha.IRunner) { - super(runner); - - runner.on('test', (test: Mocha.ITest) => { - console.log(test.parent.title + '/' + test.title); - }); - } -} - -class MyReporter extends MochaDef.reporters.Base { - passes: number = 0; - failures: number = 0; - - constructor(runner: Mocha.IRunner) { - super(runner); - - runner.on('pass', (test: Mocha.ITest) => { - this.passes++; - console.log('pass: %s', test.fullTitle()); - }); - - runner.on('fail', (test: Mocha.ITest, err: Error) => { - this.failures++; - console.log('fail: %s -- error: %s', test.fullTitle(), err.message); - }); - - runner.on('end', () => { - console.log('end: %d/%d', this.passes, this.passes + this.failures); - process.exit(this.failures); - }); - } -} diff --git a/mocha/mocha.d.ts b/mocha/mocha.d.ts index fefd919466..e3484bd72c 100644 --- a/mocha/mocha.d.ts +++ b/mocha/mocha.d.ts @@ -3,8 +3,6 @@ // Definitions by: Kazi Manzur Rashid , otiai10 , jt000 , Vadim Macagon // Definitions: https://github.com/borisyankov/DefinitelyTyped -/// - interface MochaSetupOptions { //milliseconds to wait before considering a test slow slow?: number; @@ -30,7 +28,7 @@ interface MochaSetupOptions { // grep string or regexp to filter tests with grep?: any; } - + interface MochaDone { (error?: Error): void; } @@ -118,7 +116,7 @@ declare class Mocha { // merge the Mocha class declaration with a module declare module Mocha { /** Partial interface for Mocha's `Runnable` class. */ - interface IRunnable extends NodeJS.EventEmitter { + interface IRunnable { title: string; fn: Function; async: boolean; @@ -127,10 +125,10 @@ declare module Mocha { } /** Partial interface for Mocha's `Suite` class. */ - interface ISuite extends NodeJS.EventEmitter { + interface ISuite { parent: ISuite; title: string; - + fullTitle(): string; } @@ -138,12 +136,12 @@ declare module Mocha { interface ITest extends IRunnable { parent: ISuite; pending: boolean; - + fullTitle(): string; } /** Partial interface for Mocha's `Runner` class. */ - interface IRunner extends NodeJS.EventEmitter {} + interface IRunner {} interface IContextDefinition { (description: string, spec: () => void): ISuite; @@ -151,7 +149,7 @@ declare module Mocha { skip(description: string, spec: () => void): void; timeout(ms: number): void; } - + interface ITestDefinition { (expectation: string, assertion?: () => void): ITest; (expectation: string, assertion?: (done: MochaDone) => void): ITest; @@ -174,7 +172,7 @@ declare module Mocha { constructor(runner: IRunner); } - + export class Doc extends Base {} export class Dot extends Base {} export class HTML extends Base {} From 7bf24210432d20a4e52ab0975fe3afd2d1edadbe Mon Sep 17 00:00:00 2001 From: vvakame Date: Tue, 23 Jun 2015 22:00:50 +0900 Subject: [PATCH 0145/1358] update CONTRIBUTORS.md --- CONTRIBUTORS.md | 125 ++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 101 insertions(+), 24 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index a41d225ecc..d0567940a8 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -12,7 +12,8 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](amcharts/AmCharts.d.ts) [amCharts](http://www.amcharts.com) by [aleksey-bykov](https://github.com/aleksey-bykov) * [:link:](amplifyjs/amplifyjs.d.ts) [AmplifyJs](http://amplifyjs.com) by [Jonas Eriksson](https://github.com/joeriks) * [:link:](amqp-rpc/amqp-rpc.d.ts) [amqp-rpc](https://github.com/demchenkoe/node-amqp-rpc) by [Wonshik Kim](https://github.com/wokim) -* [:link:](angular-file-upload/angular-file-upload.d.ts) [Angular File Upload](https://github.com/danialfarid/angular-file-upload) by [John Reilly](https://github.com/johnnyreilly) +* [:link:](angular2/angular2.d.ts) [Angular](http://angular.io) by [angular team](https://github.com/angular) +* [:link:](angular-file-upload/angular-file-upload.d.ts) [Angular File Upload](https://github.com/danialfarid/ng-file-upload) by [John Reilly](https://github.com/johnnyreilly) * [:link:](angular-growl-v2/angular-growl-v2.d.ts) [Angular Growl 2 v.0.7.3](http://janstevens.github.io/angular-growl-2) by [Tadeusz Hucal](https://github.com/mkp05) * [:link:](angularjs/angular.d.ts) [Angular JS](http://angularjs.org) by [Diego Vilar](http://github.com/diegovilar) * [:link:](angularjs/angular-animate.d.ts) [Angular JS (ngAnimate module)](http://angularjs.org) by [Michel Salib](https://github.com/michelsalib), [Adi Dahiya](https://github.com/adidahiya), [Raphael Schweizer](https://github.com/rasch) @@ -22,6 +23,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](angularjs/angular-route.d.ts) [Angular JS (ngRoute module)](http://angularjs.org) by [Jonathan Park](https://github.com/park9140) * [:link:](angularjs/angular-sanitize.d.ts) [Angular JS (ngSanitize module)](http://angularjs.org) by [Diego Vilar](http://github.com/diegovilar) * [:link:](angular-ui-router/angular-ui-router.d.ts) [Angular JS (ui.router module)](https://github.com/angular-ui/ui-router) by [Michel Salib](https://github.com/michelsalib) +* [:link:](angular-meteor/angular-meteor.d.ts) [Angular JS Meteor (angular.meteor module)](https://github.com/Urigo/angular-meteor) by [Peter Grman](https://github.com/pgrm) * [:link:](angular-material/angular-material.d.ts) [Angular Material (angular.material module)](https://github.com/angular/material) by [Matt Traynham](https://github.com/mtraynham) * [:link:](angular-protractor/angular-protractor.d.ts) [Angular Protractor](https://github.com/angular/protractor) by [Bill Armstrong](https://github.com/BillArmstrong) * [:link:](angular-scenario/angular-scenario.d.ts) [Angular Scenario Testing (ngScenario module)](http://angularjs.org) by [RomanoLindano](https://github.com/RomanoLindano) @@ -29,15 +31,20 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](angular-ui-bootstrap/angular-ui-bootstrap.d.ts) [Angular UI Bootstrap](https://github.com/angular-ui/bootstrap) by [Brian Surowiec](https://github.com/xt0rted) * [:link:](angular-wizard/angular-wizard.d.ts) [Angular Wizard](https://github.com/mgonto/angular-wizard) by [Marko Jurisic](https://github.com/mjurisic) * [:link:](angular-bootstrap-lightbox/angular-bootstrap-lightbox.d.ts) [angular-bootstrap-lightbox](https://github.com/compact/angular-bootstrap-lightbox) by [Roland Zwaga](https://github.com/rolandzwaga) +* [:link:](angular-dynamic-locale/angular-dynamic-locale.d.ts) [angular-dynamic-locale](https://github.com/lgalfaso/angular-dynamic-locale) by [Stephen Lautier](https://github.com/stephenlautier) * [:link:](angular-hotkeys/angular-hotkeys.d.ts) [angular-hotkeys](https://github.com/chieffancypants/angular-hotkeys) by [Jason Zhao](https://github.com/jlz27), [Stefan Steinhart](https://github.com/reppners) * [:link:](angular-http-auth/angular-http-auth.d.ts) [angular-http-auth](https://github.com/witoldsz/angular-http-auth) by [vvakame](https://github.com/vvakame) +* [:link:](angular-jwt/angular-jwt.d.ts) [angular-jwt](https://github.com/auth0/angular-jwt) by [Reto Rezzonico](https://github.com/rerezz) * [:link:](angular-local-storage/angular-local-storage.d.ts) [angular-local-storage](https://github.com/grevory/angular-local-storage) by [Ken Fukuyama](https://github.com/kenfdev) +* [:link:](angular-localForage/angular-localForage.d.ts) [angular-localForage](https://github.com/ocombe/angular-localForage) by [Stefan Steinhart](https://github.com/reppners) * [:link:](angular-notify/angular-notify.d.ts) [angular-notify](https://github.com/cgross/angular-notify) by [Suwato](https://github.com/Suwato/DefinitelyTyped) * [:link:](angular-scroll/angular-scroll.d.ts) [angular-scroll](https://github.com/oblador/angular-scroll) by [Sam Herrmann](https://github.com/samherrmann) * [:link:](angular-spinner/angular-spinner.d.ts) [angular-spinner.js](https://github.com/urish/angular-spinner) by [Marcin Biegała](https://github.com/Biegal) +* [:link:](angular-storage/angular-storage.d.ts) [angular-storage](https://github.com/auth0/angular-storage) by [Matthew DeKrey](https://github.com/mdekrey) * [:link:](angular-ui-sortable/angular-ui-sortable.d.ts) [angular.ui.sortable module](https://github.com/angular-ui/ui-sortable) by [Thodoris Greasidis](https://github.com/thgreasi) * [:link:](angular-agility/angular-agility.d.ts) [AngularAgility](https://github.com/AngularAgility/AngularAgility) by [Roland Zwaga](https://github.com/rolandzwaga) * [:link:](angularfire/angularfire.d.ts) [AngularFire](http://angularfire.com) by [Dénes Harmath](http://github.com/thSoft) +* [:link:](angularjs-toaster/angularjs-toaster.d.ts) [angularjs-toaster](https://github.com/jirikavi/AngularJS-Toaster) by [Ben Tesser](https://github.com/btesser) * [:link:](angularLocalStorage/angularLocalStorage.d.ts) [AngularLocalStorage](https://github.com/agrublev/angularLocalStorage) by [Horiuchi_H](https://github.com/horiuchi) * [:link:](animation-frame/animation-frame.d.ts) [animation-frame](https://github.com/kof/animation-frame) by [Qinfeng Chen](https://github.com/qinfchen) * [:link:](ansi-styles/ansi-styles.d.ts) [ansi-styles](https://github.com/sindresorhus/ansi-styles) by [bryn austin bellomy](https://github.com/brynbellomy) @@ -48,6 +55,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](cordova-plugin-email-composer/cordova-plugin-email-composer.d.ts) [Apache Cordova Email Composer plugin](https://github.com/katzer/cordova-plugin-email-composer) by [Dave Taylor](http://davetayls.me) * [:link:](polymer/polymer.app-router.d.ts) [app-router](https://github.com/erikringsmuth/app-router) by [Louis Grignon](https://github.com/lgrignon) * [:link:](appframework/appframework.d.ts) [AppFramework](http://app-framework-software.intel.com) by [kyo_ago](https://github.com/kyo-ago) +* [:link:](applicationinsights/applicationinsights.d.ts) [Application Insights](https://github.com/Microsoft/ApplicationInsights-node.js) by [Scott Southwood](https://github.com/scsouthw) * [:link:](arbiter/Arbiter.d.ts) [Arbiter.js](http://arbiterjs.com) by [Arash Shakery](https://github.com/arash16) * [:link:](arcgis-js-api/arcgis-js-api.d.ts) [ArcGIS API for JavaScript](http://js.arcgis.com) by [Esri](http://www.esri.com) * [:link:](archy/archy.d.ts) [archy](https://github.com/substack/node-archy) by [vvakame](https://github.com/vvakame) @@ -55,7 +63,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](aspnet-identity-pw/aspnet-identity-pw.d.ts) [aspnet-identity-pw](https://github.com/Syncbak-Git/aspnet-identity-pw) by [jt000](https://github.com/jt000) * [:link:](assert/assert.d.ts) [assert and power-assert](https://github.com/Jxck/assert) by [vvakame](https://github.com/vvakame) * [:link:](assertion-error/assertion-error.d.ts) [assertion-error](https://github.com/chaijs/assertion-error) by [Bart van der Schoor](https://github.com/Bartvds) -* [:link:](async/async.d.ts) [Async](https://github.com/caolan/async) by [Boris Yankov](https://github.com/borisyankov) +* [:link:](async/async.d.ts) [Async](https://github.com/caolan/async) by [Boris Yankov](https://github.com/borisyankov), [Arseniy Maximov](https://github.com/kern0) * [:link:](asyncblock/asyncblock.d.ts) [asyncblock](https://github.com/scriby/asyncblock) by [Hiroki Horiuchi](https://github.com/horiuchi) * [:link:](atmosphere/atmosphere.d.ts) [Atmosphere](https://github.com/Atmosphere/atmosphere-javascript) by [Kai Toedter](https://github.com/toedter) * [:link:](atom/atom.d.ts) [Atom](https://atom.io) by [vvakame](https://github.com/vvakame) @@ -65,6 +73,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](auth0.lock/auth0.lock.d.ts) [Auth0Widget.js](http://auth0.com) by [Robert McLaws](https://github.com/advancedrei) * [:link:](auth0.widget/auth0.widget.d.ts) [Auth0Widget.js](http://auth0.com) by [Robert McLaws](https://github.com/advancedrei) * [:link:](autobahn/autobahn.d.ts) [AutobahnJS](http://autobahn.ws/js) by [Elad Zelingher](https://github.com/darkl) +* [:link:](autoprefixer-core/autoprefixer-core.d.ts) [Autoprefixer Core](https://github.com/postcss/autoprefixer-core) by [Asana](https://asana.com) * [:link:](aws-sdk/aws-sdk.d.ts) [aws-sdk](https://github.com/aws/aws-sdk-js) by [midknight41](https://github.com/midknight41) * [:link:](axios/axios.d.ts) [axios](https://github.com/mzabriskie/axios) by [Marcel Buesing](https://github.com/marcelbuesing) * [:link:](node-azure/azure.d.ts) [Azure SDK for Node](https://github.com/WindowsAzure/azure-sdk-for-node) by [Andrew Gaspar](https://github.com/AndrewGaspar), [Anti Veeranna](https://github.com/antiveeranna), [Maxime LUCE](https://github.com/SomaticIT) @@ -90,10 +99,11 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker.d.ts) [Bootstrap datetimepicker v3](http://eonasdan.github.io/bootstrap-datetimepicker) by [Jesica N. Fera](https://github.com/bayitajesi) * [:link:](bootstrap-touchspin/bootstrap-touchspin.d.ts) [Bootstrap TouchSpin](http://www.virtuosoft.eu/code/bootstrap-touchspin) by [Albin Sunnanbo](https://github.com/albinsunnanbo) * [:link:](bootstrap-notify/bootstrap-notify.d.ts) [bootstrap-notify](https://github.com/Nijikokun/bootstrap-notify) by [Blake Niemyjski](https://github.com/niemyjski) +* [:link:](bootstrap-slider/bootstrap-slider.d.ts) [bootstrap-slider.js](https://github.com/seiyria/bootstrap-slider) by [Daniel Beckwith](https://github.com/dbeckwith) * [:link:](bootstrap.datepicker/bootstrap.datepicker.d.ts) [bootstrap.datepicker](https://github.com/eternicode/bootstrap-datepicker) by [Boris Yankov](https://github.com/borisyankov) * [:link:](bootstrap.paginator/bootstrap.paginator.d.ts) [bootstrap.paginator](https://github.com/lyonlai/bootstrap-paginator) by [derikwhittaker](https://github.com/derikwhittaker) -* [:link:](bootstrap.timepicker/bootstrap.timepicker.d.ts) [bootstrap.timepicker](https://github.com/jdewit/bootstrap-timepicker) by [derikwhittaker](https://github.com/derikwhittaker) * [:link:](box2d/box2dweb.d.ts) [bootstrap.timepicker](http://code.google.com/p/box2dweb) by [jbaldwin](https://github.com/jbaldwin) +* [:link:](bootstrap.timepicker/bootstrap.timepicker.d.ts) [bootstrap.timepicker](https://github.com/jdewit/bootstrap-timepicker) by [derikwhittaker](https://github.com/derikwhittaker) * [:link:](breeze/breeze.d.ts) [Breeze 1.5.x](http://www.breezejs.com) by [Boris Yankov](https://github.com/borisyankov), [IdeaBlade](https://github.com/IdeaBlade/Breeze) * [:link:](browser-harness/browser-harness.d.ts) [Browser Harness](https://github.com/scriby/browser-harness) by [Chris Scribner](https://github.com/scriby) * [:link:](browser-sync/browser-sync.d.ts) [browser-sync](http://www.browsersync.io) by [Asana](https://asana.com) @@ -103,28 +113,31 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](bl/bl.d.ts) [BufferList](https://github.com/rvagg/bl) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](buffers/buffers.d.ts) [buffers](https://github.com/substack/node-buffers) by [Robert Hencke](https://github.com/rhencke) * [:link:](bufferstream/bufferstream.d.ts) [bufferstream](https://github.com/dodo/node-bufferstream) by [Bart van der Schoor](https://github.com/Bartvds) -* [:link:](bunyan-prettystream/bunyan-prettystream.d.ts) [bunyan-prettystream](https://www.npmjs.com/package/bunyan-prettystream) by [Jason Swearingen](https://github.com/jasonswearingen) +* [:link:](bunyan-prettystream/bunyan-prettystream.d.ts) [bunyan-prettystream](https://www.npmjs.com/package/bunyan-prettystream) by [Jason Swearingen](https://github.com/jasonswearingen), [Vadim Macagon](https://github.com/enlight) * [:link:](business-rules-engine/business-rules-engine.d.ts) [business-rules-engine](https://github.com/rsamec/form) by [Roman Samec](https://github.com/rsamec) * [:link:](byline/byline.d.ts) [byline](https://github.com/jahewson/node-byline) by [Stefan Steinhart](https://github.com/reppners) * [:link:](calq/calq.d.ts) [calq](https://calq.io/docs/client/javascript/reference) by [Eirik Hoem](https://github.com/eirikhm) * [:link:](camljs/camljs.d.ts) [camljs](http://camljs.codeplex.com) by [Andrey Markeev](http://markeev.com) * [:link:](canvasjs/canvasjs.d.ts) [CanvasJS](http://canvasjs.com) by [Mark Overholt](https://github.com/mover5) * [:link:](casperjs/casperjs.d.ts) [CasperJS](http://casperjs.org) by [Jed Mao](https://github.com/jedmao) -* [:link:](chai/chai.d.ts) [chai](http://chaijs.com) by [Jed Mao](https://github.com/jedmao), [Bart van der Schoor](https://github.com/Bartvds) +* [:link:](chai/chai.d.ts) [chai](http://chaijs.com) by [Jed Mao](https://github.com/jedmao), [Bart van der Schoor](https://github.com/Bartvds), [Andrew Brown](https://github.com/AGBrown) * [:link:](chai-as-promised/chai-as-promised.d.ts) [chai-as-promised](https://github.com/domenic/chai-as-promised) by [jt000](https://github.com/jt000) * [:link:](chai-datetime/chai-datetime.d.ts) [chai-datetime](https://github.com/gaslight/chai-datetime.git) by [Cliff Burger](https://github.com/cliffburger) * [:link:](chai-fuzzy/chai-fuzzy.d.ts) [chai-fuzzy](http://chaijs.com/plugins/chai-fuzzy) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](chai-http/chai-http.d.ts) [chai-http](https://github.com/chaijs/chai-http) by [Wim Looman](https://github.com/Nemo157) * [:link:](chai-jquery/chai-jquery.d.ts) [chai-jquery](https://github.com/chaijs/chai-jquery) by [Kazi Manzur Rashid](https://github.com/kazimanzurrashid) +* [:link:](chai-subset/chai-subset.d.ts) [chai-subset](https://github.com/e-conomic/chai-subset) by [Sam Noedel](https://github.com/delta62), [Andrew Brown](https://github.com/AGBrown) * [:link:](chalk/chalk.d.ts) [chalk](https://github.com/sindresorhus/chalk) by [Diullei Gomes](https://github.com/Diullei), [Bart van der Schoor](https://github.com/Bartvds) * [:link:](chance/chance.d.ts) [Chance](http://chancejs.com) by [Chris Bowdon](https://github.com/cbowdon) * [:link:](change-case/change-case.d.ts) [change-case](https://github.com/blakeembrey/change-case) by [Asana](https://asana.com) * [:link:](chartjs/chart.d.ts) [Chart.js](https://github.com/nnnick/Chart.js) by [Steve Fenton](https://github.com/Steve-Fenton) * [:link:](checksum/checksum.d.ts) [checksum](https://github.com/dshaw/checksum) by [Rogier Schouten](https://github.com/rogierschouten) * [:link:](cheerio/cheerio.d.ts) [Cheerio](https://github.com/cheeriojs/cheerio) by [Bret Little](https://github.com/blittle), [VILIC VANE](http://vilic.info), [Wayne Maurer](https://github.com/wmaurer) +* [:link:](chocolatechipjs/chocolatechipjs.d.ts) [chocolatechip](https://github.com/chocolatechipui/ChocolateChipJS) by [Robert Biggs](http://chocolatechip-ui.com) * [:link:](chokidar/chokidar.d.ts) [chokidar](https://github.com/paulmillr/chokidar) by [Stefan Steinhart](https://github.com/reppners) * [:link:](chosen/chosen.jquery.d.ts) [Chosen.JQuery](http://harvesthq.github.com/chosen) by [Boris Yankov](https://github.com/borisyankov) * [:link:](chroma-js/chroma-js.d.ts) [Chroma.js](https://github.com/gka/chroma.js) by [Sebastian Brückner](https://github.com/invliD) +* [:link:](chrome/chrome-cast.d.ts) [Chrome Cast application development](https://developers.google.com/cast) by [Thomas Stig Jacobsen](https://github.com/eXeDK) * [:link:](chrome/chrome.d.ts) [Chrome extension development](http://developer.chrome.com/extensions) by [Matthew Kimber](https://github.com/matthewkimber), [otiai10](https://github.com/otiai10) * [:link:](chrome/chrome-app.d.ts) [Chrome packaged application development](http://developer.chrome.com/apps) by [Adam Lay](https://github.com/AdamLay), [MIZUNE Pine](https://github.com/pine613), [MIZUSHIMA Junki](https://github.com/mzsm) * [:link:](circular-json/circular-json.d.ts) [circular-json](https://github.com/WebReflection/circular-json) by [Jonathan Pevarnek](https://github.com/jpevarnek) @@ -160,11 +173,12 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](csv-stringify/csv-stringify.d.ts) [csv-stringify](https://github.com/wdavidw/node-csv-stringify) by [Rogier Schouten](https://github.com/rogierschouten) * [:link:](custom-error-generator/custom-error-generator.d.ts) [custom-error-generator](https://github.com/jproulx/node-custom-error) by [Thierry Miceli](https://github.com/thmiceli) * [:link:](md5/md5.d.ts) [CybozuLabs.MD5](http://labs.cybozu.co.jp/blog/mitsunari/2007/07/md5js_1.html) by [MIZUNE Pine](https://github.com/pine613) -* [:link:](d3/d3.d.ts) [d3JS](http://d3js.org) by [Boris Yankov](https://github.com/borisyankov) +* [:link:](d3/d3.d.ts) [d3JS](http://d3js.org) by [Alex Ford](https://github.com/gustavderdrache), [Boris Yankov](https://github.com/borisyankov) * [:link:](d3.cloud.layout/d3.cloud.layout.d.ts) [d3JS cloud layout plugin by Jason Davies](https://github.com/jasondavies/d3-cloud) by [hans windhoff](https://github.com/hansrwindhoff) * [:link:](dagre/dagre.d.ts) [dagre](https://github.com/cpettitt/dagre) by [Qinfeng Chen](https://github.com/qinfchen) * [:link:](dagre-d3/dagre-d3.d.ts) [dagre-d3.core.js](https://github.com/cpettitt/dagre-d3) by [Mark Wong Siang Kai](https://github.com/markwongsk) * [:link:](dat-gui/dat-gui.d.ts) [dat.GUI](https://github.com/dataarts/dat.gui) by [Satoru Kimura](https://github.com/gyohk) +* [:link:](DataStream.js/DataStream.js.d.ts) [DataStream.js](https://github.com/kig/DataStream.js) by [Tat](https://github.com/tatchx) * [:link:](date.format.js/date.format.d.ts) [Date Format](http://blog.stevenlevithan.com/archives/date-time-format) by [Rob Stutton](https://github.com/balrob) * [:link:](datejs/datejs.d.ts) [DateJS](http://www.datejs.com) by [David Khristepher Santos](http://github.com/rupertavery) * [:link:](dcjs/dc.d.ts) [DCJS](https://github.com/dc-js/dc.js) by [hans windhoff](https://github.com/hansrwindhoff), [matt traynham](https://github.com/mtraynham) @@ -183,7 +197,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](diff/diff.d.ts) [diff](https://github.com/kpdecker/jsdiff) by [vvakame](https://github.com/vvakame) * [:link:](docCookies/docCookies.d.ts) [docCookies](https://developer.mozilla.org/en-US/docs/Web/API/document.cookie) by [Jon Egerton](https://github.com/jonegerton) * [:link:](dock-spawn/dock-spawn.d.ts) [Dock Spawn](http://dockspawn.com) by [Drew Noakes](https://drewnoakes.com) -* [:link:](documentdb/documentdb.d.ts) [DocumentDB](https://github.com/Azure/azure-documentdb-node) by [Noel Abrahams](https://github.com/NoelAbrahams) +* [:link:](documentdb/documentdb.d.ts) [DocumentDB](https://github.com/Azure/azure-documentdb-node) by [Noel Abrahams](https://github.com/NoelAbrahams), [Brett Gutstein](https://github.com/brettferdosi) * [:link:](dojo/dojo.d.ts) [Dojo](http://dojotoolkit.org) by [Michael Van Sickle](https://github.com/vansimke) * [:link:](dompurify/dompurify.d.ts) [DOM Purify](https://github.com/cure53/DOMPurify) by [Dave Taylor](http://davetayls.me) * [:link:](domo/domo.d.ts) [Domo](http://domo-js.com) by [Steve Fenton](https://github.com/Steve-Fenton) @@ -198,6 +212,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](dsv/dsv.d.ts) [dsv](https://www.npmjs.com/package/dsv) by [Jason Swearingen](https://jasonswearingen.github.io) * [:link:](dts-bundle/dts-bundle.d.ts) [dts-bundle](https://github.com/TypeStrong/dts-bundle) by [Asana](https://asana.com) * [:link:](durandal/durandal.d.ts) [Durandal](http://durandaljs.com) by [Blue Spire](https://github.com/BlueSpire) +* [:link:](dymo-label-framework/dymo-label-framework.d.ts) [DYMO Label Framework](http://www.labelwriter.com/software/dls/sdk/docs/DYMOLabelFrameworkJavaScriptHelp/index.html) by [Thijs Kuipers](https://github.com/thijskuipers) * [:link:](easeljs/easeljs.d.ts) [EaselJS](http://www.createjs.com/#!/EaselJS) by [Pedro Ferreira](https://bitbucket.org/drk4), [Chris Smith](https://github.com/evilangelist) * [:link:](easy-session/easy-session.d.ts) [easy-session](https://github.com/DeadAlready/node-easy-session) by [Karl Düüna](https://github.com/DeadAlready) * [:link:](easy-table/easy-table.d.ts) [easy-table](https://github.com/eldargab/easy-table) by [Bart van der Schoor](https://github.com/Bartvds) @@ -205,6 +220,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](egg.js/egg.js.d.ts) [Egg.js](https://github.com/mikeflynn/egg.js) by [Markus Peloso](https://github.com/ToastHawaii) * [:link:](ejs-locals/ejs-locals.d.ts) [ejs-locals](https://github.com/randometc/ejs-locals) by [jt000](https://github.com/jt000) * [:link:](jquery.elang/jquery.elang.d.ts) [eLang](https://github.com/sumegizoltan/ELang) by [Zoltan Sumegi](https://github.com/sumegizoltan) +* [:link:](github-electron/github-electron.d.ts) [Electron (shared between main and rederer processes)](http://electron.atom.io) by [jedmao](https://github.com/jedmao) * [:link:](element-resize-event/element-resize-event.d.ts) [element-resize-event](https://github.com/KyleAMathews/element-resize-event) by [Rogier Schouten](https://github.com/rogierschouten) * [:link:](elm/elm.d.ts) [Elm](http://elm-lang.org) by [Dénes Harmath](https://github.com/thSoft) * [:link:](ember/ember.d.ts) [Ember.js](http://emberjs.com) by [Jed Mao](https://github.com/jedmao) @@ -234,9 +250,10 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](extend/extend.d.ts) [extend](https://www.npmjs.com/package/extend) by [Stefan Steinhart](https://github.com/reppners) * [:link:](extjs/ExtJS.d.ts) [ExtJS](http://www.sencha.com/products/extjs) by [Brian Kotek](https://github.com/brian428) * [:link:](eyes/eyes.d.ts) [eyes](https://github.com/cloudhead/eyes.js) by [bryn austin bellomy](https://github.com/brynbellomy) -* [:link:](fabricjs/fabricjs.d.ts) [FabricJS](http://fabricjs.com) by [Oliver Klemencic](https://github.com/oklemencic) +* [:link:](fabricjs/fabricjs.d.ts) [FabricJS](http://fabricjs.com) by [Oliver Klemencic](https://github.com/oklemencic), [Joseph Livecchi](https://github.com/joewashear007) * [:link:](fbsdk/fbsdk.d.ts) [Facebook Javascript SDK](https://developers.facebook.com/docs/javascript) by [Joshua Strobl](https://github.com/JoshStrobl) * [:link:](fancybox/fancybox.d.ts) [fancyBox](https://github.com/fancyapps/fancyBox) by [Boris Yankov](https://github.com/borisyankov) +* [:link:](farbtastic/farbtastic.d.ts) [Farbtastic: jQuery Color Wheel](http://mattfarina.github.io/farbtastic) by [Matt Brooks](https://github.com/EnableSoftware) * [:link:](fast-stats/fast-stats.d.ts) [fast-stats](https://github.com/bluesmoon/node-faststats) by [Rogier Schouten](https://github.com/rogierschouten) * [:link:](fastclick/fastclick.d.ts) [FastClick](https://github.com/ftlabs/fastclick) by [Shinnosuke Watanabe](https://github.com/shinnn) * [:link:](whatwg-fetch/whatwg-fetch.d.ts) [fetch API](https://github.com/github/fetch) by [Ryan Graham](https://github.com/ryan-codingintrigue) @@ -257,6 +274,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](flux/flux.d.ts) [Flux](http://facebook.github.io/flux) by [Steve Baker](https://github.com/stkb) * [:link:](fluxxor/fluxxor.d.ts) [Fluxxor](https://github.com/BinaryMuse/fluxxor) by [Yuichi Murata](https://github.com/mrk21) * [:link:](ion.rangeSlider/ion.rangeSlider.d.ts) [for Ion.RangeSlider](https://github.com/IonDen/ion.rangeSlider) by [Sixin Li](https://github.com/sixinli) +* [:link:](forge-di/forge-di.d.ts) [forge-di](https://github.com/nkohari/forge) by [Adam Carr](https://github.com/adamcarr) * [:link:](form-data/form-data.d.ts) [form-data](https://github.com/felixge/node-form-data) by [Carlos Ballesteros Velasco](https://github.com/soywiz) * [:link:](formidable/formidable.d.ts) [Formidable](https://github.com/felixge/node-formidable) by [Wim Looman](https://github.com/Nemo157) * [:link:](foundation/foundation.d.ts) [Foundation](http://foundation.zurb.com) by [Boris Yankov](https://github.com/borisyankov) @@ -287,10 +305,11 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](google.analytics/ga.d.ts) [Google Analytics (Classic and Universal)](https://developers.google.com/analytics/devguides/collection/gajs) by [Ronnie Haakon Hegelund](http://ronniehegelund.blogspot.dk), [Pat Kujawa](http://patkujawa.com) * [:link:](gapi/gapi.d.ts) [Google API Client](https://code.google.com/p/google-api-javascript-client) by [Frank M](https://github.com/sgtfrankieboy) * [:link:](google.feeds/google.feed.api.d.ts) [Google Feed Apis](https://developers.google.com/feed) by [RodneyJT](https://github.com/RodneyJT) -* [:link:](googlemaps/google.maps.d.ts) [Google Geolocation](https://developers.google.com/maps) by [Folia A/S](http://www.folia.dk) * [:link:](google.geolocation/google.geolocation.d.ts) [Google Geolocation](https://code.google.com/p/geo-location-javascript) by [Vincent Bortone](https://github.com/vbortone) +* [:link:](googlemaps/google.maps.d.ts) [Google Maps JavaScript API](https://developers.google.com/maps) by [Folia A/S](http://www.folia.dk), [Chris Wrench](https://github.com/cgwrench) * [:link:](gapi.pagespeedonline/gapi.pagespeedonline.d.ts) [Google Page Speed Online Api](https://developers.google.com/speed/pagespeed) by [Frank M](https://github.com/sgtfrankieboy) * [:link:](google.picker/google.picker.d.ts) [Google Picker API](https://developers.google.com/picker) by [grapswiz](https://github.com/grapswiz) +* [:link:](google-drive-realtime-api/google-drive-realtime-api.d.ts) [Google Realtime API](https://developers.google.com/google-apps/realtime) by [Dustin Wehr](http://cs.toronto.edu/~wehr) * [:link:](recaptcha/recaptcha.d.ts) [Google Recaptcha](https://www.google.com/recaptcha) by [Brent Jenkins](https://github.com/brentj73) * [:link:](grecaptcha/grecaptcha.d.ts) [Google Recaptcha v2](https://www.google.com/recaptcha) by [Kristof Mattei](http://kristofmattei.be) * [:link:](gapi.translate/gapi.translate.d.ts) [Google Translate API](https://developers.google.com/translate) by [Frank M](https://github.com/sgtfrankieboy) @@ -302,8 +321,8 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](greensock/greensock.d.ts) [GreenSock Animation Platform](http://www.greensock.com/get-started-js) by [Robert S](https://github.com/codebelt) * [:link:](gridfs-stream/gridfs-stream.d.ts) [gridfs-stream](https://github.com/aheckmann/gridfs-stream) by [Lior Mualem](https://github.com/liorm) * [:link:](gruntjs/gruntjs.d.ts) [Grunt 0.4.x](http://gruntjs.com) by [Jeff May](https://github.com/jeffmay), [Basarat Ali Syed](https://github.com/basarat) -* [:link:](gsap/Ease.d.ts) [GSAP](http://greensock.com) by [VILIC VANE](https://vilic.github.io) * [:link:](gsap/Core.d.ts) [GSAP](http://greensock.com) by [VILIC VANE](https://vilic.github.io) +* [:link:](gsap/Ease.d.ts) [GSAP](http://greensock.com) by [VILIC VANE](https://vilic.github.io) * [:link:](gsap/TweenLite.d.ts) [GSAP](http://greensock.com) by [VILIC VANE](https://vilic.github.io) * [:link:](gulp/gulp.d.ts) [Gulp v3.8.x](http://gulpjs.com) by [Drew Noakes](https://drewnoakes.com) * [:link:](gulp-autoprefixer/gulp-autoprefixer.d.ts) [gulp-autoprefixer](https://github.com/sindresorhus/gulp-autoprefixer) by [Asana](https://asana.com) @@ -329,9 +348,11 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](handlebars/handlebars.d.ts) [Handlebars](http://handlebarsjs.com) by [Boris Yankov](https://github.com/borisyankov) * [:link:](hapi/hapi.d.ts) [hapi](http://github.com/spumko/hapi) by [Jason Swearingen](http://github.com/jasonswearingen) * [:link:](hasher/hasher.d.ts) [Hasher.js](https://github.com/millermedeiros/hasher) by [flyfishMT](https://github.com/flyfishMT) +* [:link:](hashids/hashids.d.ts) [Hashids.js 1.x](https://github.com/ivanakimov/hashids.node.js) by [Paulo Cesar](https://github.com/pocesar) * [:link:](hashmap/hashmap.d.ts) [HashMap](https://github.com/flesler/hashmap) by [Rafał Wrzeszcz](http://wrzasq.pl) * [:link:](he/he.d.ts) [he](https://github.com/mathiasbynens/he) by [Simon Edwards](https://github.com/sedwards2009) * [:link:](Headroom/headroom.d.ts) [headroom.js](http://wicky.nillia.ms/headroom.js) by [Jakub Olek](https://github.com/hakubo) +* [:link:](heap/heap.d.ts) [heap](https://github.com/qiao/heap.js) by [Ryan McNamara](https://github.com/ryan10132) * [:link:](heatmap.js/heatmap.d.ts) [heatmap.js](https://github.com/pa7/heatmap.js) by [Yang Guan](https://github.com/lookuptable) * [:link:](hellojs/hellojs.d.ts) [hello.js](http://adodson.com/hello.js) by [Pavel Zika](https://github.com/PavelPZ) * [:link:](highcharts/highcharts.d.ts) [Highcharts](http://www.highcharts.com) by [Damiano Gambarotto](http://github.com/damianog) @@ -348,21 +369,23 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](humane/humane.d.ts) [Humane](http://wavded.github.com/humane-js) by [jmvrbanac](https://github.com/jmvrbanac) * [:link:](hypertext-application-language/hypertext-application-language.d.ts) [Hypertext Application Language Draft 6](https://tools.ietf.org/html/draft-kelly-json-hal-06) by [Maks3w](https://github.com/maks3w) * [:link:](i18n-node/i18n-node.d.ts) [i18n-node](https://github.com/mashpie/i18n-node) by [Maxime LUCE](https://github.com/SomaticIT) -* [:link:](ng-i18next/ng-i18next.d.ts) [i18next](https://github.com/i18next/ng-i18next) by [Cyril Schumacher](https://github.com/cyrilschumacher) * [:link:](i18next/i18next.d.ts) [i18next](http://i18next.com) by [Maarten Docter](https://github.com/mdocter) +* [:link:](ng-i18next/ng-i18next.d.ts) [i18next](https://github.com/i18next/ng-i18next) by [Cyril Schumacher](https://github.com/cyrilschumacher) * [:link:](iban/iban.d.ts) [iban.js](https://github.com/arhs/iban.js) by [Cyril Schumacher](https://github.com/cyrilschumacher) * [:link:](icheck/icheck.d.ts) [iCheck](http://damirfoy.com/iCheck) by [Dániel Tar](https://github.com/qcz) * [:link:](imagemagick/imagemagick.d.ts) [imagemagick](http://github.com/rsms/node-imagemagick) by [Carlos Ballesteros Velasco](https://github.com/soywiz) +* [:link:](imagemagick-native/imagemagick-native.d.ts) [imagemagick-native](https://www.npmjs.org/package/imagemagick-native) by [Hiroki Horiuchi](https://github.com/horiuchi) * [:link:](imap/imap.d.ts) [imap](https://www.npmjs.com/package/imap) by [Peter Snider](https://github.com/psnider) * [:link:](imgur-rest-api/imgur-rest-api.d.ts) [Imgur REST API v3](https://api.imgur.com) by [Luke William Westby](http://github.com/lukewestby) * [:link:](impress/impress.d.ts) [Impress.js](https://github.com/bartaz/impress.js) by [Boris Yankov](https://github.com/borisyankov) * [:link:](inflection/inflection.d.ts) [inflection](https://github.com/dreamerslab/node.inflection) by [Shogo Iwano](https://github.com/shiwano) * [:link:](ini/ini.d.ts) [ini](https://github.com/isaacs/ini) by [Marcin Porębski](https://github.com/marcinporebski) * [:link:](insight/insight.d.ts) [insight](https://github.com/yeoman/insight) by [vvakame](http://github.com/vvakame) -* [:link:](interactjs/interact.d.ts) [Interacting for interact.js](https://github.com/taye/interact.js) by [Douglas Eichelberger](https://github.com/dduugg), [Adi Dahiya](https://github.com/adidahiya) +* [:link:](interactjs/interact.d.ts) [Interacting for interact.js](https://github.com/taye/interact.js) by [Douglas Eichelberger](https://github.com/dduugg), [Adi Dahiya](https://github.com/adidahiya), [Tom Hasner](https://github.com/thasner) * [:link:](intercomjs/intercom.d.ts) [intercom.js](https://github.com/diy/intercom.js) by [spencerwi](http://github.com/spencerwi) * [:link:](inversify/inversify.d.ts) [inversify](https://github.com/inversify/InversifyJS) by [inversify](https://github.com/inversify) * [:link:](cordova-ionic/cordova-ionic.d.ts) [Ionic Cordova plugins](https://github.com/driftyco) by [Hendrik Maus](https://github.com/hendrikmaus) +* [:link:](irc/irc.d.ts) [irc](https://github.com/martynsmith/node-irc) by [phillips1012](https://github.com/phillips1012) * [:link:](is_js/is_js.d.ts) [is.js](http://arasatasaygin.github.io/is.js) by [Rodrigo Cabral](https://github.com/cabralRodrigo) * [:link:](iscroll/iscroll.d.ts) [iScroll](http://cubiq.org/iscroll-4) by [Boris Yankov](https://github.com/borisyankov), [Christiaan Rakowski](https://github.com/csrakowski) * [:link:](iscroll/iscroll-5.d.ts) [iScroll 5](http://cubiq.org/iscroll-5-ready-for-beta-test) by [Christiaan Rakowski](https://github.com/csrakowski) @@ -373,6 +396,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](jake/jake.d.ts) [jake](https://github.com/mde/jake) by [Kon](http://phyzkit.net) * [:link:](jasmine/jasmine.d.ts) [Jasmine](http://jasmine.github.io) by [Boris Yankov](https://github.com/borisyankov), [Theodore Brown](https://github.com/theodorejb), [David Pärsson](https://github.com/davidparsson) * [:link:](jasmine-data_driven_tests/jasmine-data_driven_tests.d.ts) [Jasmine Data Driven Tests](https://github.com/gburghardt/jasmine-data_driven_tests) by [Anthony MacKinnon](https://github.com/AnthonyMacKinnon) +* [:link:](jasmine-ajax/jasmine-ajax.d.ts) [jasmine-ajax](https://github.com/jasmine/jasmine-ajax) by [Louis Grignon](https://github.com/lgrignon) * [:link:](jasmine-fixture/jasmine-fixture.d.ts) [Jasmine-fixture](https://github.com/searls/jasmine-fixture) by [Craig Brett](https://github.com/craigbrett17) * [:link:](jasmine-jquery/jasmine-jquery.d.ts) [Jasmine-JQuery](https://github.com/velesin/jasmine-jquery) by [Gregor Stamac](https://github.com/gstamac) * [:link:](jasmine-matchers/jasmine-matchers.d.ts) [jasmine-matchers](https://github.com/uxebu/jasmine-matchers) by [Bart van der Schoor](https://github.com/Bartvds) @@ -384,6 +408,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](jest/jest.d.ts) [Jest](http://facebook.github.io/jest) by [Asana](https://asana.com) * [:link:](jjv/jjv.d.ts) [JJV](https://github.com/acornejo/jjv) by [Wim Looman](https://github.com/Nemo157) * [:link:](jjve/jjve.d.ts) [JJVE](https://github.com/silas/jjve) by [Wim Looman](https://github.com/Nemo157) +* [:link:](joData/joData.d.ts) [joData](https://github.com/mccow002/joData) by [Chris Wrench](https://github.com/cgwrench) * [:link:](johnny-five/johnny-five.d.ts) [johnny-five](https://github.com/rwaldron/johnny-five) by [Toshiya Nakakura](https://github.com/nakakura) * [:link:](joi/joi.d.ts) [joi](https://github.com/spumko/joi) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](jointjs/jointjs.d.ts) [Joint JS](http://www.jointjs.com) by [Aidan Reel](http://github.com/areel), [David Durman](http://github.com/DavidDurman), [Ewout Van Gossum](https://github.com/DenEwout) @@ -407,6 +432,8 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](jquery.rowGrid/jquery.rowGrid.d.ts) [jQuery rowGrid.js plugin (v1.0.2)](https://github.com/brunjo/rowGrid.js) by [Vinayak Garg](https://github.com/vinayak-garg) * [:link:](royalslider/royalslider.d.ts) [jQuery royal-slider](http://dimsemenov.com/plugins/royal-slider/documentation) by [Christiaan Rakowski](https://github.com/csrakowski) * [:link:](jquery.simplePagination/jquery.simplePagination.d.ts) [jQuery simplePagination.js](https://github.com/flaviusmatis/simplePagination.js) by [Natan Vivo](https://github.com/nvivo) +* [:link:](jquery-sortable/jquery-sortable.d.ts) [jQuery Sortable](http://johnny.github.io/jquery-sortable) by [Nathan Pitman](https://github.com/Seltzer) +* [:link:](succinct/succinct.d.ts) [jQuery Succinct](http://mikeking.io/succinct) by [Matt Brooks](https://github.com/EnableSoftware) * [:link:](jquery.tagsmanager/jquery.tagsmanager.d.ts) [jQuery Tags Manager](http://welldonethings.com/tags/manager) by [Vincent Bortone](https://github.com/vbortone) * [:link:](jquery.tinycarousel/jquery.tinycarousel.d.ts) [jQuery tinycarousel](http://baijs.nl/tinycarousel) by [Christiaan Rakowski](https://github.com/csrakowski) * [:link:](jquery.tinyscrollbar/jquery.tinyscrollbar.d.ts) [jQuery tinyscrollbar](http://baijs.nl/tinyscrollbar) by [Christiaan Rakowski](https://github.com/csrakowski) @@ -439,7 +466,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](jquery.noty/jquery.noty.d.ts) [jQuery.noty](http://needim.github.io/noty) by [Aaron King](https://github.com/kingdango) * [:link:](jquery.payment/jquery.payment.d.ts) [jQuery.payment](https://github.com/stripe/jquery.payment) by [Eric J. Smith](https://github.com/ejsmith) * [:link:](jquery.pjax.falsandtru/jquery.pjax.d.ts) [jquery.pjax.ts by falsandtru](https://github.com/falsandtru/jquery.pjax.js) by [新ゝ月 NewNotMoon](http://new.not-moon.net) -* [:link:](jquery.placeholder/jquery.placeholder.d.ts) [jquery.placeholder.js](https://github.com/mathiasbynens/jquery-placeholder) by [Peter Gill](https://github.com/majorsilence) +* [:link:](jquery.placeholder/jquery.placeholder.d.ts) [jquery.placeholder.js](https://github.com/mathiasbynens/jquery-placeholder) by [Peter Gill](https://github.com/majorsilence), [Neil Culver](https://github.com/EnableSoftware) * [:link:](jquery.pnotify/jquery.pnotify.d.ts) [jquery.pnotify 2.x](https://github.com/sciactive/pnotify) by [David Sichau](https://github.com/DavidSichau) * [:link:](jquery.scrollTo/jquery.scrollTo.d.ts) [jQuery.scrollTo.js](https://github.com/flesler/jquery.scrollTo) by [Neil Stalker](https://github.com/nestalk) * [:link:](jquery.simulate/jquery.simulate.d.ts) [jquery.simulate.js](https://github.com/jquery/jquery-simulate) by [Derek Cicerone](https://github.com/derekcicerone) @@ -454,10 +481,13 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](jquery.timer/jquery.timer.d.ts) [jQueryTimer](https://github.com/jchavannes/jquery-timer) by [Joshua Strobl](https://github.com/JoshStrobl) * [:link:](jquery.total-storage/jquery.total-storage.d.ts) [jQueryTotalStorage](https://github.com/Upstatement/jquery-total-storage) by [Jeremy Brooks](https://github.com/JeremyCBrooks) * [:link:](jqueryui/jqueryui.d.ts) [jQueryUI](http://jqueryui.com) by [Boris Yankov](https://github.com/borisyankov), [John Reilly](https://github.com/johnnyreilly) +* [:link:](js-cookie/js-cookie.d.ts) [js-cookie](https://github.com/js-cookie/js-cookie) by [Theodore Brown](https://github.com/theodorejb) * [:link:](js-fixtures/fixtures.d.ts) [js-fixtures](https://github.com/badunk/js-fixtures) by [Kazi Manzur Rashid](https://github.com/kazimanzurrashid) * [:link:](js-git/js-git.d.ts) [js-git](https://github.com/creationix/js-git) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](js-signals/js-signals.d.ts) [JS-Signals](http://millermedeiros.github.io/js-signals) by [Diullei Gomes](https://github.com/diullei) * [:link:](js-yaml/js-yaml.d.ts) [js-yaml](https://github.com/nodeca/js-yaml) by [Bart van der Schoor](https://github.com/Bartvds) +* [:link:](js-beautify/js-beautify.d.ts) [js_beautify](https://github.com/beautify-web/js-beautify) by [Josh Goldberg](https://github.com/JoshuaKGoldberg) +* [:link:](blocks/blocks.d.ts) [jsblocks](http://jsblocks.com) by [Krzysztof Śmigiel](https://github.com/ksmigiel) * [:link:](jsbn/jsbn.d.ts) [jsbn](http://www-cs-students.stanford.edu/%7Etjw/jsbn) by [Eugene Chernyshov](https://github.com/Evgenus) * [:link:](jscrollpane/jscrollpane.d.ts) [jScrollPane](http://jscrollpane.kelvinluck.com) by [Dániel Tar](https://github.com/qcz) * [:link:](js-data/js-data.d.ts) [JSData](https://github.com/js-data/js-data) by [Stefan Steinhart](https://github.com/reppners) @@ -489,6 +519,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](jwt-simple/jwt-simple.d.ts) [jwt-simple](https://github.com/hokaccha/node-jwt-simple) by [Ken Fukuyama](https://github.com/kenfdev) * [:link:](kafka-node/kafka-node.d.ts) [kafka-node](https://github.com/SOHU-Co/kafka-node) by [Daniel Imrie-Situnayake](https://github.com/dansitu) * [:link:](karma-jasmine/karma-jasmine.d.ts) [karma-jasmine plugin](https://github.com/karma-runner/karma-jasmine) by [Michel Salib](https://github.com/michelsalib) +* [:link:](kendo-ui/kendo-ui.d.ts) [Kendo UI Professional](http://www.telerik.com/kendo-ui) by [Telerik](https://github.com/telerik) * [:link:](keyboardjs/keyboardjs.d.ts) [KeyboardJS](https://github.com/RobertWHurst/KeyboardJS) by [Vincent Bortone](https://github.com/vbortone) * [:link:](keymaster/keymaster.d.ts) [keymaster](https://github.com/madrobby/keymaster) by [Martin W. Kirst](https://github.com/nitram509) * [:link:](keypress/keypress.d.ts) [Keypress](https://github.com/dmauro/Keypress) by [Roger Chen](https://github.com/rcchen) @@ -502,7 +533,9 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](knockout.amd.helpers/knockout-amd-helpers.d.ts) [knockout-amd-helpers](https://github.com/rniemeyer/knockout-amd-helpers) by [David Sichau](https://github.com/DavidSichau) * [:link:](knockout.editables/ko.editables.d.ts) [knockout-editables](http://romanych.github.com/ko.editables) by [Boris Yankov](https://github.com/borisyankov) * [:link:](knockout.es5/knockout.es5.d.ts) [Knockout-ES5](https://github.com/SteveSanderson/knockout-es5) by [Sebastián Galiano](https://github.com/sgaliano) +* [:link:](knockout-paging/knockout-paging.d.ts) [knockout-paging](https://github.com/ErikSchierboom/knockout-paging) by [Erik Schierboom](https://github.com/ErikSchierboom) * [:link:](knockout.postbox/knockout-postbox.d.ts) [knockout-postbox](https://github.com/rniemeyer/knockout-postbox) by [Judah Gabriel Himango](https://debuggerdotbreak.wordpress.com) +* [:link:](knockout-pre-rendered/knockout-pre-rendered.d.ts) [knockout-pre-rendered](https://github.com/ErikSchierboom/knockout-pre-rendered) by [Erik Schierboom](https://github.com/ErikSchierboom) * [:link:](knockout.projections/knockout.projections.d.ts) [knockout-projections](https://github.com/stevesanderson/knockout-projections) by [John Reilly](https://github.com/johnnyreilly) * [:link:](knockout-secure-binding/knockout-secure-binding.d.ts) [knockout-secure-binding](https://github.com/brianmhunt/knockout-secure-binding) by [Pine Mizune](https://github.com/pine613) * [:link:](knockout-transformations/knockout-transformations.d.ts) [knockout-transformations](https://github.com/One-com/knockout-transformations) by [John Reilly](https://github.com/johnnyreilly), [Wim Looman](https://github.com/Nemo157) @@ -536,14 +569,18 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](log4js/log4js.d.ts) [log4js](https://github.com/nomiddlename/log4js-node) by [Kentaro Okuno](http://github.com/armorik83) * [:link:](logg/logg.d.ts) [logg](https://github.com/dpup/node-logg) by [Bret Little](https://github.com/blittle) * [:link:](loggly/loggly.d.ts) [loggly](https://github.com/nodejitsu/node-loggly) by [Ray Martone](https://github.com/rmartone) +* [:link:](loglevel/loglevel.d.ts) [loglevel](https://github.com/pimterry/loglevel) by [Stefan Profanter](https://github.com/Pro) * [:link:](logrotate-stream/logrotate-stream.d.ts) [logrotate-stream](https://github.com/dstokes/logrotate-stream) by [Rogier Schouten](https://github.com/rogierschouten) +* [:link:](lokijs/lokijs.d.ts) [lokijs](https://github.com/techfort/LokiJS) by [TeamworkGuy2](https://github.com/TeamworkGuy2) * [:link:](lolex/lolex.d.ts) [lolex](https://github.com/sinonjs/lolex) by [Wim Looman](https://github.com/Nemo157) * [:link:](long/long.d.ts) [Long.js](https://github.com/dcodeIO/Long.js) by [Toshihide Hara](https://github.com/kerug) * [:link:](lory.js/lory.js.d.ts) [lory](https://github.com/meandmax/lory) by [kubosho](https://github.com/kubosho) +* [:link:](lovefield/lovefield.d.ts) [Lovefield](http://google.github.io/lovefield) by [freshp86](https://github.com/freshp86) * [:link:](lru-cache/lru-cache.d.ts) [lru-cache](https://github.com/isaacs/node-lru-cache) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](lscache/lscache.d.ts) [lscache](https://github.com/pamelafox/lscache) by [Chris Martinez](https://github.com/Chris-Martinezz) * [:link:](lunr/lunr.d.ts) [lunr.js](https://github.com/olivernn/lunr.js) by [Sebastian Lenz](https://github.com/sebastian-lenz) * [:link:](lz-string/lz-string.d.ts) [lz-string](https://github.com/pieroxy/lz-string) by [Roman Nikitin](https://github.com/M0ns1gn0r) +* [:link:](magicsuggest/magicsuggest.d.ts) [MagicSuggest](http://nicolasbize.com/magicsuggest) by [Leonardo Chaia](http://github.com/leonardochaia) * [:link:](mailcheck/mailcheck.d.ts) [Mailcheck](https://github.com/mailcheck/mailcheck) by [Paulo Cesar](http://github.com/pocesar) * [:link:](main-bower-files/main-bower-files.d.ts) [main-bower-files](https://github.com/ck86/main-bower-files) by [Keita Kagurazaka](https://github.com/k-kagurazaka) * [:link:](mandrill-api/mandrill-api.d.ts) [Mandrill API 1.x](http://mandrill.com) by [Paulo Cesar](https://github.com/pocesar) @@ -552,6 +589,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](mariasql/mariasql.d.ts) [mariasql](https://github.com/mscdex/node-mariasql) by [MichaelBennett](https://github.com/bennett000) * [:link:](marionette/marionette.d.ts) [Marionette](https://github.com/marionettejs) by [Zeeshan Hamid](https://github.com/zhamid), [Natan Vivo](https://github.com/nvivo), [Sven Tschui](https://github.com/sventschui) * [:link:](marked/marked.d.ts) [Marked](https://github.com/chjj/marked) by [William Orr](https://github.com/worr) +* [:link:](markerclustererplus/markerclustererplus.d.ts) [MarkerClustererPlus for Google Maps V3](http://github.com/mahnunchik/markerclustererplus) by [Mathias Rodriguez](http://github.com/enanox) * [:link:](maskedinput/maskedinput.d.ts) [Masked Input plugin for jQuery](http://digitalbush.com/projects/masked-input-plugin) by [Lokesh Peta](https://github.com/lokeshpeta) * [:link:](mathjax/mathjax.d.ts) [MathJax](https://github.com/mathjax/MathJax) by [Roland Zwaga](https://github.com/rolandzwaga) * [:link:](matter-js/matter-js.d.ts) [Matter.js](https://github.com/liabru/matter-js) by [Ivane Gegia](https://twitter.com/ivanegegia) @@ -586,28 +624,33 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](mixto/mixto.d.ts) [mixto](https://github.com/atom/mixto) by [vvakame](https://github.com/vvakame) * [:link:](mkdirp/mkdirp.d.ts) [mkdirp](http://github.com/substack/node-mkdirp) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](mkpath/mkpath.d.ts) [mkpath](https://www.npmjs.com/package/mkpath) by [Jared Klopper](https://github.com/optical) -* [:link:](mocha/mocha.d.ts) [mocha](http://mochajs.org) by [Kazi Manzur Rashid](https://github.com/kazimanzurrashid), [otiai10](https://github.com/otiai10), [jt000](https://github.com/jt000) +* [:link:](mobile-detect/mobile-detect.d.ts) [mobile-detect](http://hgoebl.github.io/mobile-detect.js) by [Martin McWhorter](https://github.com/martinmcwhorter) +* [:link:](mocha/mocha.d.ts) [mocha](http://mochajs.org) by [Kazi Manzur Rashid](https://github.com/kazimanzurrashid), [otiai10](https://github.com/otiai10), [jt000](https://github.com/jt000), [Vadim Macagon](https://github.com/enlight) * [:link:](mocha-phantomjs/mocha-phantomjs.d.ts) [mocha-phantomjs](http://metaskills.net/mocha-phantomjs) by [Erik Schierboom](https://github.com/ErikSchierboom) * [:link:](mock-fs/mock-fs.d.ts) [mock-fs](https://github.com/tschaub/mock-fs) by [Wim Looman](https://github.com/Nemo157) * [:link:](mockery/mockery.d.ts) [mockery](https://github.com/mfncooper/mockery) by [jt000](https://github.com/jt000) * [:link:](modernizr/modernizr.d.ts) [Modernizr](http://modernizr.com) by [Boris Yankov](https://github.com/borisyankov), [Theodore Brown](https://github.com/theodorejb) * [:link:](moment-timezone/moment-timezone.d.ts) [moment-timezone.js](http://momentjs.com/timezone) by [Michel Salib](https://github.com/michelsalib) +* [:link:](moment/moment-node.d.ts) [Moment.js](https://github.com/timrwood/moment) by [Michael Lakerveld](https://github.com/Lakerfield), [Aaron King](https://github.com/kingdango), [Hiroki Horiuchi](https://github.com/horiuchi), [Dick van den Brink](https://github.com/DickvdBrink), [Adi Dahiya](https://github.com/adidahiya) * [:link:](moment/moment.d.ts) [Moment.js](https://github.com/timrwood/moment) by [Michael Lakerveld](https://github.com/Lakerfield), [Aaron King](https://github.com/kingdango), [Hiroki Horiuchi](https://github.com/horiuchi), [Dick van den Brink](https://github.com/DickvdBrink), [Adi Dahiya](https://github.com/adidahiya) * [:link:](mongodb/mongodb.d.ts) [MongoDB](https://github.com/mongodb/node-mongodb-native) by [Boris Yankov](https://github.com/borisyankov) * [:link:](mongoose/mongoose.d.ts) [Mongoose](http://mongoosejs.com) by [horiuchi](https://github.com/horiuchi) * [:link:](mongoose-mock/mongoose-mock.d.ts) [mongoose-mock](https://github.com/JohanObrink/mongoose-mock) by [jt000](https://github.com/jt000) * [:link:](morgan/morgan.d.ts) [morgan](https://github.com/expressjs/morgan) by [James Roland Cabresos](https://github.com/staticfunction) -* [:link:](mousetrap/mousetrap.d.ts) [Mousetrap](http://craig.is/killing/mice) by [Dániel Tar](https://github.com/qcz) * [:link:](mousetrap/mousetrap-global-bind.d.ts) [Mousetrap 1.4.6's global-bind extension](http://craig.is/killing/mice#extensions.global) by [Andrew Bradley](https://github.com/cspotcode) +* [:link:](mousetrap/mousetrap.d.ts) [Mousetrap 1.5.x](http://craig.is/killing/mice) by [Dániel Tar](https://github.com/qcz) * [:link:](moviedb/moviedb.d.ts) [MovieDB](https://github.com/danzajdband/moviedb) by [Basarat Ali Syed](https://github.com/basarat) * [:link:](firefox/firefox.d.ts) [Mozilla Web API](https://developer.mozilla.org/en-US/docs/Web/API) by [vvakame](https://github.com/vvakame) -* [:link:](localForage/localForage.d.ts) [Mozilla's localForage](https://github.com/mozilla/localforage) by [david pichsenmeister](https://github.com/3x14159265) +* [:link:](localForage/localForage.d.ts) [Mozilla's localForage](https://github.com/mozilla/localforage) by [yuichi david pichsenmeister](https://github.com/3x14159265) +* [:link:](mpromise/mpromise.d.ts) [mpromise](https://github.com/aheckmann/mpromise) by [Seulgi Kim](https://github.com/sgkim126) * [:link:](msgpack/msgpack.d.ts) [msgpack.js - MessagePack JavaScript Implementation](https://github.com/uupaa/msgpack.js) by [Shinya Mochizuki](https://github.com/enrapt-mochizuki) * [:link:](msnodesql/msnodesql.d.ts) [msnodesql](https://github.com/WindowsAzure/node-sqlserver) by [Boris Yankov](https://github.com/borisyankov), [Maxime LUCE](https://github.com/SomaticIT) * [:link:](mssql/mssql.d.ts) [mssql](https://www.npmjs.com/package/mssql) by [COLSA Corporation](http://www.colsa.com) * [:link:](mu2/mu2.d.ts) [mu2](http://github.com/raycmorgan/mu) by [Jeff Goddard](https://github.com/jedigo) * [:link:](multer/multer.d.ts) [multer](https://github.com/expressjs/multer) by [jt000](https://github.com/jt000) +* [:link:](multiplexjs/multiplexjs.d.ts) [Multiplex.js](http://github.com/multiplex/multiplex.js) by [Kamyar Nazeri](http://github.com/KamyarNazeri) * [:link:](mustache/mustache.d.ts) [Mustache](https://github.com/janl/mustache.js) by [Mark Ashley Bell](https://github.com/markashleybell) +* [:link:](navigation/navigation.d.ts) [Navigation](http://grahammendick.github.io/navigation) by [Graham Mendick](https://github.com/grahammendick) * [:link:](nconf/nconf.d.ts) [nconf](https://github.com/flatiron/nconf) by [Jeff Goddard](https://github.com/jedigo), [Jean-Martin Thibault](https://github.com/jmthibault) * [:link:](ncp/ncp.d.ts) [ncp](https://github.com/AvianFlu/ncp) by [Bart van der Schoor](https://github.com/bartvds) * [:link:](nedb/nedb.d.ts) [NeDB](https://github.com/louischatriot/nedb) by [Stefan Steinhart](https://github.com/reppners) @@ -621,12 +664,15 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](noble/noble.d.ts) [noble](https://github.com/sandeepmistry/noble) by [Seon-Wook Park](https://github.com/swook) * [:link:](nock/nock.d.ts) [nock](https://github.com/pgte/nock) by [bonnici](https://github.com/bonnici) * [:link:](node-imap/imap.d.ts) [node imap](https://github.com/mscdex/node-imap) by [Steve Fenton](https://github.com/Steve-Fenton) +* [:link:](node-sass/node-sass.d.ts) [Node Sass](https://github.com/sass/node-sass) by [Asana](https://asana.com) * [:link:](bunyan/bunyan.d.ts) [node-bunyan](https://github.com/trentm/node-bunyan) by [Alex Mikhalev](https://github.com/amikhalev) * [:link:](bunyan-logentries/bunyan-logentries.d.ts) [node-bunyan-logentries](https://github.com/nemtsov/node-bunyan-logentries) by [Aymeric Beaumet](http://aymericbeaumet.me) +* [:link:](node-calendar/node-calendar.d.ts) [node-calendar](https://www.npmjs.com/package/node-calendar) by [Luzian Zagadinow](https://github.com/luzianz) * [:link:](convict/convict.d.ts) [node-convict](https://github.com/mozilla/node-convict) by [Wim Looman](https://github.com/Nemo157) * [:link:](node-ffi/node-ffi.d.ts) [node-ffi](https://github.com/rbranson/node-ffi) by [Paul Loyd](https://github.com/loyd) * [:link:](node-fibers/node-fibers.d.ts) [node-fibers](https://github.com/laverdet/node-fibers) by [Cary Haynie](https://github.com/caryhaynie) * [:link:](node-form/node-form.d.ts) [node-form](https://github.com/rsamec/form) by [Roman Samec](https://github.com/rsamec) +* [:link:](node-gcm/node-gcm.d.ts) [node-gcm](https://www.npmjs.org/package/node-gcm) by [Hiroki Horiuchi](https://github.com/horiuchi) * [:link:](node-git/node-git.d.ts) [node-git](https://github.com/christkv/node-git) by [vvakame](https://github.com/vvakame) * [:link:](ip/ip.d.ts) [node-ip](https://github.com/indutny/node-ip) by [Peter Harris](https://github.com/codeanimal) * [:link:](multiparty/multiparty.d.ts) [node-multiparty](https://github.com/andrewrk/node-multiparty) by [Ken Fukuyama](https://github.com/kenfdev) @@ -635,13 +681,14 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](node-polyglot/node-polyglot.d.ts) [node-polyglot](https://github.com/airbnb/polyglot.js) by [Tim Jackson-Kiely](https://github.com/timjk) * [:link:](promptly/promptly.d.ts) [node-promptly](https://github.com/IndigoUnited/node-promptly) by [Dan Spencer](https://github.com/danrspencer) * [:link:](radius/radius.d.ts) [node-radius](https://github.com/retailnext/node-radius) by [Peter Harris](https://github.com/codeanimal) +* [:link:](stack-trace/stack-trace.d.ts) [node-stack-trace](https://github.com/felixge/node-stack-trace) by [Exceptionless](https://github.com/exceptionless) * [:link:](node-uuid/node-uuid.d.ts) [node-uuid.js](https://github.com/broofa/node-uuid) by [Jeff May](https://github.com/jeffmay) * [:link:](node-webkit/node-webkit.d.ts) [node-webkit](https://github.com/rogerwang/node-webkit) by [Pedro Casaubon](https://github.com/xperiments) * [:link:](xml2js/xml2js.d.ts) [node-xml2js](https://github.com/Leonidas-from-XIV/node-xml2js) by [Michel Salib](https://github.com/michelsalib), [Jason McNeil](https://github.com/jasonrm) * [:link:](node/node.d.ts) [Node.js](http://nodejs.org) by [Microsoft TypeScript](http://typescriptlang.org), [DefinitelyTyped](https://github.com/borisyankov/DefinitelyTyped) * [:link:](restify/restify.d.ts) [node.js REST framework](https://github.com/mcavage/node-restify) by [Bret Little](https://github.com/blittle) -* [:link:](acl/acl-mongodbBackend.d.ts) [node_acl](https://github.com/optimalbits/node_acl) by [Qubo](https://github.com/tkQubo) * [:link:](acl/acl-redisBackend.d.ts) [node_acl](https://github.com/optimalbits/node_acl) by [Qubo](https://github.com/tkQubo) +* [:link:](acl/acl-mongodbBackend.d.ts) [node_acl](https://github.com/optimalbits/node_acl) by [Qubo](https://github.com/tkQubo) * [:link:](acl/acl.d.ts) [node_acl](https://github.com/optimalbits/node_acl) by [Qubo](https://github.com/tkQubo) * [:link:](mdns/mdns.d.ts) [node_mdns](https://github.com/agnat/node_mdns) by [Stefan Steinhart](https://github.com/reppners) * [:link:](node_redis/node_redis.d.ts) [node_redis](https://github.com/mranney/node_redis) by [Boris Yankov](https://github.com/borisyankov) @@ -656,11 +703,12 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](nopt/nopt.d.ts) [nopt](https://github.com/npm/nopt) by [jbondc](https://github.com/jbondc) * [:link:](notify/notify.d.ts) [Notify.js](https://github.com/jpillora/notifyjs) by [Xiaohan Zhang](https://github.com/hellochar) * [:link:](notifyjs/notifyjs.d.ts) [notify.js](https://github.com/alexgibson/notify.js) by [soundTricker](https://github.com/soundTricker) -* [:link:](nouislider/nouislider.d.ts) [nouislider](https://github.com/leongersen/noUiSlider) by [Corey Jepperson](https://github.com/acoreyj) * [:link:](wnumb/wnumb.d.ts) [nouislider](https://github.com/leongersen/wnumb) by [Corey Jepperson](https://github.com/acoreyj) +* [:link:](nouislider/nouislider.d.ts) [nouislider](https://github.com/leongersen/noUiSlider) by [Corey Jepperson](https://github.com/acoreyj) * [:link:](noVNC/noVNC.d.ts) [noVNC](https://github.com/kanaka/noVNC) by [Ken Smith](https://github.com/smithkl42) * [:link:](npm/npm.d.ts) [npm](https://github.com/npm/npm) by [Maxime LUCE](https://github.com/SomaticIT) * [:link:](nprogress/NProgress.d.ts) [NProgress](https://github.com/rstacruz/nprogress) by [Judah Gabriel Himango](http://debuggerdotbreak.wordpress.com) +* [:link:](numbro/numbro.d.ts) [Numbro.js](https://github.com/foretagsplatsen/numbro) by [Vincent Bortone](https://github.com/vbortone) * [:link:](numeraljs/numeraljs.d.ts) [Numeral.js](https://github.com/adamwdraper/Numeral-js) by [Vincent Bortone](https://github.com/vbortone) * [:link:](object-hash/object-hash.d.ts) [object-hash](https://github.com/puleos/object-hash) by [Michael Zabka](https://github.com/misak113) * [:link:](object-path/object-path.d.ts) [objectPath v0.9.x](https://github.com/mariocasciaro/object-path) by [Paulo Cesar](https://github.com/pocesar) @@ -673,12 +721,15 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](opn/opn.d.ts) [opn](https://github.com/sindresorhus/opn) by [Shinnosuke Watanabe](https://github.com/shinnn) * [:link:](optimist/optimist.d.ts) [optimist](https://github.com/substack/node-optimist) by [Carlos Ballesteros Velasco](https://github.com/soywiz) * [:link:](page/page.d.ts) [page](http://visionmedia.github.io/page.js) by [Alan Norbauer](http://alan.norbauer.com) +* [:link:](papaparse/papaparse.d.ts) [PapaParse](https://github.com/mholt/PapaParse) by [Pedro Flemming](https://github.com/torpedro) * [:link:](parallel/parallel.d.ts) [parallel.js](http://adambom.github.io/parallel.js) by [Josh Baldwin](https://github.com/jbaldwin) * [:link:](parse/parse.d.ts) [Parse](https://parse.com) by [Ullisen Media Group](http://ullisenmedia.com) * [:link:](parsimmon/parsimmon.d.ts) [Parsimmon](https://github.com/jneen/parsimmon) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](passport/passport.d.ts) [Passport](http://passportjs.org) by [Horiuchi_H](https://github.com/horiuchi) * [:link:](passport-strategy/passport-strategy.d.ts) [Passport Strategy module](https://github.com/jaredhanson/passport-strategy) by [Lior Mualem](https://github.com/liorm) +* [:link:](passport-twitter/passport-twitter.d.ts) [passport-facebook](https://github.com/jaredhanson/passport-facebook) by [James Roland Cabresos](https://github.com/staticfunction) * [:link:](passport-facebook/passport-facebook.d.ts) [passport-facebook](https://github.com/jaredhanson/passport-facebook) by [James Roland Cabresos](https://github.com/staticfunction) +* [:link:](passport-google-oauth/passport-google-oauth.d.ts) [passport-facebook](https://github.com/jaredhanson/passport-facebook) by [James Roland Cabresos](https://github.com/staticfunction) * [:link:](passport-facebook-token/passport-facebook-token.d.ts) [passport-facebook-token](https://github.com/drudge/passport-facebook-token) by [Ray Martone](https://github.com/rmartone) * [:link:](passport-local/passport-local.d.ts) [passport-local](https://github.com/jaredhanson/passport-local) by [Maxime LUCE](https://github.com/SomaticIT) * [:link:](path-to-regexp/path-to-regexp.d.ts) [path-to-regexp](https://github.com/pillarjs/path-to-regexp) by [xica](https://github.com/xica) @@ -694,19 +745,22 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](phonegap/phonegap.d.ts) [PhoneGap](http://phonegap.com) by [Boris Yankov](https://github.com/borisyankov), [Dick van den Brink](https://github.com/DickvdBrink) * [:link:](photoswipe/photoswipe.d.ts) [PhotoSwipe](http://photoswipe.com) by [Xiaohan Zhang](https://github.com/hellochar) * [:link:](physijs/physijs.d.ts) [Physijs](http://chandlerprall.github.io/Physijs) by [Satoru Kimura](https://github.com/gyohk) -* [:link:](pickadate/pickadate.d.ts) [pickadate.js](https://github.com/amsul/pickadate.js) by [Adi Dahiya](https://github.com/adidahiya) +* [:link:](pickadate/pickadate.d.ts) [pickadate.js](https://github.com/amsul/pickadate.js) by [Theodore Brown](https://github.com/theodorejb) +* [:link:](pikaday/pikaday.d.ts) [pikaday](https://github.com/dbushell/Pikaday) by [Rudolph Gottesheim](http://midnight-design.at) +* [:link:](piwik-tracker/piwik-tracker.d.ts) [PiwikTracker](https://www.npmjs.com/package/piwik-tracker) by [Guilherme Bernal](https://github.com/lbguilherme) * [:link:](pixi/pixi.d.ts) [PIXI](https://github.com/GoodBoyDigital/pixi.js) by [xperiments](http://github.com/xperiments) * [:link:](platform/platform.d.ts) [Platform](https://github.com/bestiejs/platform.js) by [Jake Hickman](https://github.com/JakeH) * [:link:](playerframework/playerFramework.d.ts) [Player Framework (MMPPF)](https://playerframework.codeplex.com) by [Ricardo Sabino](https://github.com/ricardosabino) * [:link:](pleasejs/please.d.ts) [PleaseJS](http://www.checkman.io/please) by [Toshiya Nakakura](https://github.com/nakakura) +* [:link:](pluralize/pluralize.d.ts) [pluralize](https://www.npmjs.com/package/pluralize) by [Syu Kato](https://github.com/ukyo) * [:link:](png-async/png-async.d.ts) [png-async](https://github.com/kanreisa/node-png-async) by [Yuki KAN](https://github.com/kanreisa) * [:link:](podcast/podcast.d.ts) [podcast](http://github.com/maxnowack/node-podcast) by [Niklas Mollenhauer](https://github.com/nikeee) * [:link:](poly2tri/poly2tri.d.ts) [poly2tri](http://github.com/r3mi/poly2tri.js) by [Elemar Junior](https://github.com/elemarjr) * [:link:](polymer/polymer.d.ts) [polymer](https://github.com/polymer) by [Louis Grignon](https://github.com/lgrignon) * [:link:](polymer/polymer.paper-dialog.d.ts) [polymer's paper-dialog](https://github.com/Polymer/paper-dialog) by [Louis Grignon](https://github.com/lgrignon) +* [:link:](polymer/polymer.core-selector.d.ts) [polymer's paper-toast](https://github.com/Polymer/core-selector) by [Louis Grignon](https://github.com/lgrignon) * [:link:](polymer/polymer.core-drawer-panel.d.ts) [polymer's paper-toast](https://github.com/Polymer/core-drawer-panel) by [Louis Grignon](https://github.com/lgrignon) * [:link:](polymer/polymer.core-overlay.d.ts) [polymer's paper-toast](https://github.com/Polymer/core-selector) by [Louis Grignon](https://github.com/lgrignon) -* [:link:](polymer/polymer.core-selector.d.ts) [polymer's paper-toast](https://github.com/Polymer/core-selector) by [Louis Grignon](https://github.com/lgrignon) * [:link:](polymer/polymer.paper-toast.d.ts) [polymer's paper-toast](https://github.com/Polymer/paper-toast) by [Louis Grignon](https://github.com/lgrignon) * [:link:](popcorn/popcorn.d.ts) [Popcorn](https://github.com/mozilla/popcorn-js) by [grapswiz](https://github.com/grapswiz) * [:link:](pouchDB/pouch.d.ts) [Pouch](http://pouchdb.com) by [Bill Sears](https://github.com/MrBigDog2U) @@ -720,6 +774,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](promises-a-plus/promises-a-plus.d.ts) [promises-a-plus](http://promisesaplus.com) by [Igor Oleinikov](https://github.com/Igorbek) * [:link:](protobufjs/protobufjs.d.ts) [ProtoBuf.js](https://github.com/dcodeIO/ProtoBuf.js) by [Panu Horsmalahti](https://github.com/panuhorsmalahti) * [:link:](proxyquire/proxyquire.d.ts) [Proxyquire](https://github.com/thlorenz/proxyquire) by [jt000](https://github.com/jt000) +* [:link:](pty.js/pty.js.d.ts) [pty.js 0.2.7-1](https://github.com/chjj/pty.js) by [Vadim Macagon](https://github.com/enlight) * [:link:](pubsubjs/pubsub.d.ts) [PubSubJS](https://github.com/mroderick/PubSubJS) by [Boris Yankov](https://github.com/borisyankov) * [:link:](purl/purl.d.ts) [Purl](https://github.com/allmarkedup/purl) by [Daniel Ferreira Monteiro Alves](https://github.com/danfma) * [:link:](q/Q.d.ts) [Q](https://github.com/kriskowal/q) by [Barrie Nemetchek](https://github.com/bnemetchek), [Andrew Gaspar](https://github.com/AndrewGaspar), [John Reilly](https://github.com/johnnyreilly) @@ -727,12 +782,14 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](q-retry/q-retry.d.ts) [q-retry](https://github.com/vilic/q-retry) by [VILIC VANE](https://github.com/vilic) * [:link:](qajax/qajax.d.ts) [Qajax](https://github.com/gre/qajax) by [Boltmade](https://github.com/Boltmade) * [:link:](qtip2/qtip2.d.ts) [qtip2](http://qtip2.com) by [Nathan Pitman](https://github.com/Seltzer) +* [:link:](quixote/quixote.d.ts) [quixote](http://quixote-css.com) by [Aleksandr Filatov](https://github.com/greybax) * [:link:](qunit/qunit.d.ts) [QUnit](http://qunitjs.com) by [Diullei Gomes](https://github.com/diullei) * [:link:](rabbit.js/rabbit.js.d.ts) [rabbit.js](https://github.com/squaremo/rabbit.js) by [Wonshik Kim](https://github.com/wokim) * [:link:](ractive/ractive.d.ts) [Ractive](http://ractivejs.org) by [Han Lin Yap](http://yap.nu) * [:link:](raphael/raphael.d.ts) [Raphael](http://raphaeljs.com) by [CheCoxshall](https://github.com/CheCoxshall) * [:link:](rappid/rappid.d.ts) [Rappid](http://jointjs.com/about-rappid) by [Ewout Van Gossum](https://github.com/DenEwout) * [:link:](ravenjs/ravenjs.d.ts) [Raven.js](https://github.com/getsentry/raven-js) by [Santi Albo](https://github.com/santialbo) +* [:link:](raygun4js/raygun4js.d.ts) [raygun4js](https://github.com/MindscapeHQ/raygun4js) by [Brian Surowiec](https://github.com/xt0rted) * [:link:](react/react.d.ts) [React (external module)](http://facebook.github.io/react) by [Asana](https://asana.com), [AssureSign](http://www.assuresign.com) * [:link:](react/react-global.d.ts) [React (internal module)](http://facebook.github.io/react) by [Asana](https://asana.com), [AssureSign](http://www.assuresign.com) * [:link:](react-router/react-router.d.ts) [React Router](https://github.com/rackt/react-router) by [Yuichi Murata](https://github.com/mrk21) @@ -755,6 +812,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](rickshaw/rickshaw.d.ts) [Rickshaw](http://code.shutterstock.com/rickshaw) by [Blake Niemyjski](https://github.com/niemyjski) * [:link:](rimraf/rimraf.d.ts) [rimraf](https://github.com/isaacs/rimraf) by [Carlos Ballesteros Velasco](https://github.com/soywiz) * [:link:](riotjs/riotjs.d.ts) [riot.js](https://github.com/moot/riotjs) by [vvakame](https://github.com/vvakame) +* [:link:](rivets/rivets.d.ts) [rivets](http://rivetsjs.com) by [Trevor Baron](https://github.com/TrevorDev) * [:link:](routie/routie.d.ts) [routie](https://github.com/jgallen23/routie) by [Adilson](https://github.com/Adilson) * [:link:](rtree/rtree.d.ts) [rtree](https://github.com/leaflet-extras/RTree) by [Omede Firouz](https://github.com/oefirouz) * [:link:](run-sequence/run-sequence.d.ts) [run-sequence](https://github.com/OverZealous/run-sequence) by [Keita Kagurazaka](https://github.com/k-kagurazaka) @@ -779,14 +837,15 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](sanitizer/sanitizer.d.ts) [Sanitizer](https://github.com/theSmaw/Caja-HTML-Sanitizer) by [Dave Taylor](http://davetayls.me) * [:link:](sax/sax.d.ts) [sax js](https://github.com/isaacs/sax-js) by [Asana](https://asana.com) * [:link:](screenfull/screenfull.d.ts) [screenfull.js](https://github.com/sindresorhus/screenfull.js) by [Ilia Choly](http://github.com/icholy) +* [:link:](scrolltofixed/scrolltofixed.d.ts) [ScrollToFixed](https://github.com/bigspotteddog/ScrollToFixed) by [Ben Dixon](https://github.com/bmdixon) * [:link:](select2/select2.d.ts) [Select2](http://ivaynberg.github.com/select2) by [Boris Yankov](https://github.com/borisyankov) * [:link:](selectize/selectize.d.ts) [Selectize](https://github.com/brianreavis/selectize.js) by [Adi Dahiya](https://github.com/adidahiya) * [:link:](selenium-webdriver/selenium-webdriver.d.ts) [Selenium WebDriverJS](https://code.google.com/p/selenium) by [Bill Armstrong](https://github.com/BillArmstrong) * [:link:](semver/semver.d.ts) [semver](https://github.com/isaacs/node-semver) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](sendgrid/sendgrid.d.ts) [sendgrid](https://github.com/sendgrid/sendgrid-nodejs) by [Maxime LUCE](https://github.com/SomaticIT) * [:link:](sequelize/sequelize.d.ts) [Sequelize 2.0.0 dev13](http://sequelizejs.com) by [samuelneff](https://github.com/samuelneff), [Peter Harris](https://github.com/codeanimal) -* [:link:](on-headers/on-headers.d.ts) [serve-favicon](https://github.com/jshttp/on-headers) by [John Jeffery](https://github.com/jjeffery) * [:link:](serve-favicon/serve-favicon.d.ts) [serve-favicon](https://github.com/expressjs/serve-favicon) by [Uros Smolnik](https://github.com/urossmolnik) +* [:link:](on-headers/on-headers.d.ts) [serve-favicon](https://github.com/jshttp/on-headers) by [John Jeffery](https://github.com/jjeffery) * [:link:](serve-static/serve-static.d.ts) [serve-static](https://github.com/expressjs/serve-static) by [Uros Smolnik](https://github.com/urossmolnik) * [:link:](sharedworker/SharedWorker.d.ts) [SharedWorker](http://www.w3.org/TR/workers) by [Toshiya Nakakura](https://github.com/nakakura) * [:link:](shelljs/shelljs.d.ts) [ShellJS](http://shelljs.org) by [Niklas Mollenhauer](https://github.com/nikeee) @@ -826,13 +885,17 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](sqlite3/sqlite3.d.ts) [sqlite3](https://github.com/mapbox/node-sqlite3) by [Nick Malaguti](https://github.com/nmalaguti) * [:link:](squirejs/squirejs.d.ts) [Squire](https://github.com/iammerrick/Squire.js) by [Bradley Ayers](https://github.com/bradleyayers) * [:link:](stack-mapper/stack-mapper.d.ts) [stack-mapper](https://github.com/thlorenz/stack-mapper) by [Rogier Schouten](https://github.com/rogierschouten) +* [:link:](stacktrace-js/stacktrace-js.d.ts) [stacktrace.js](https://github.com/stacktracejs/stacktrace.js) by [Exceptionless](https://github.com/exceptionless) * [:link:](stampit/stampit.d.ts) [stampit](https://github.com/ericelliott/stampit) by [Vasyl Boroviak](https://github.com/koresar) * [:link:](stats/stats.d.ts) [Stats.js r12](http://github.com/mrdoob/stats.js) by [Gregory Dalton](https://github.com/gregolai) +* [:link:](statsd-client/statsd-client.d.ts) [statsd-client](https://github.com/msiebuhr/node-statsd-client) by [Peter Kooijmans](https://github.com/peterkooijmans) * [:link:](status-bar/status-bar.d.ts) [status-bar](https://github.com/atom/status-bar) by [vvakame](https://github.com/vvakame) * [:link:](storejs/storejs.d.ts) [store.js](https://github.com/marcuswestin/store.js) by [Vincent Bortone](https://github.com/vbortone) * [:link:](stream-series/stream-series.d.ts) [stream-series](https://github.com/rschmukler/stream-series) by [Keita Kagurazaka](https://github.com/k-kagurazaka) * [:link:](stream-to-array/stream-to-array.d.ts) [stream-to-array](https://github.com/stream-utils/stream-to-array) by [Bart van der Schoor](https://github.com/Bartvds) +* [:link:](streamjs/streamjs.d.ts) [streamjs](http://winterbe.github.io/streamjs) by [Bence Eros](https://github.com/erosb) * [:link:](stripe/stripe.d.ts) [stripe](https://stripe.com) by [Eric J. Smith](https://github.com/ejsmith) +* [:link:](stripe-checkout/stripe-checkout.d.ts) [Stripe Checkout](https://stripe.com/checkout) by [Chris Wrench](https://github.com/cgwrench) * [:link:](stripe/stripe-node.d.ts) [stripe-node](https://github.com/stripe/stripe-node) by [William Johnston](https://github.com/wjohnsto) * [:link:](strophe/strophe.d.ts) [Strophe.js](http://strophe.im/strophejs) by [David Deutsch](https://github.com/DavidKDeutsch) * [:link:](stylus/stylus.d.ts) [stylus](https://github.com/LearnBoost/stylus) by [Maxime LUCE](https://github.com/SomaticIT) @@ -847,19 +910,22 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](sweetalert/sweetalert.d.ts) [SweetAlert](https://github.com/t4t5/sweetalert) by [Markus Peloso](https://github.com/ToastHawaii) * [:link:](swfobject/swfobject.d.ts) [swfobject](https://code.google.com/p/swfobject) by [rou](https://github.com/rou) * [:link:](swig/swig.d.ts) [swig](http://github.com/paularmstrong/swig) by [Peter Harris](https://github.com/CodeAnimal), [Carlos Ballesteros Velasco](https://github.com/soywiz) +* [:link:](swipe/swipe.d.ts) [Swipe](https://github.com/thebird/Swipe) by [Andrey Kurdyumov](https://github.com/kant2002) * [:link:](swiper/swiper.d.ts) [Swiper](https://github.com/nolimits4web/Swiper) by [Sebastián Galiano](https://github.com/sgaliano) * [:link:](swipeview/swipeview.d.ts) [SwipeView](http://cubiq.org/swipeview) by [Boris Yankov](https://github.com/borisyankov) * [:link:](switchery/switchery.d.ts) [switchery](https://github.com/abpetkov/switchery) by [Bruno Grieder](https://github.com/bgrieder) * [:link:](swiz/swiz.d.ts) [swiz](https://github.com/racker/node-swiz) by [Jeff Goddard](https://github.com/jedigo) * [:link:](tape/tape.d.ts) [tape](https://github.com/substack/tape) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](tar/tar.d.ts) [tar](https://github.com/npm/node-tar) by [Maxime LUCE](https://github.com/SomaticIT) -* [:link:](tcomb/tcomb.d.ts) [tcomb](http://gcanti.github.io/tcomb/guide/index.html) by [Jed Mao](https://github.com/jedmao) +* [:link:](tcomb/tcomb.d.ts) [tcomb](http://gcanti.github.io/tcomb/guide/index.html) by [Hans Windhoff](https://github.com/hansrwindhoff) * [:link:](tedious/tedious.d.ts) [tedious](https://pekim.github.io/tedious) by [Rogier Schouten](https://github.com/rogierschouten) * [:link:](tedious-connection-pool/tedious-connection-pool.d.ts) [tedious-connection-pool](https://github.com/pekim/tedious-connection-pool) by [Cyprien Autexier](https://github.com/sandorfr) * [:link:](teechart/teechart.d.ts) [TeeChart](http://www.steema.com) by [Steema Software](https://steema.com) * [:link:](tether/tether.d.ts) [Tether](http://github.hubspot.com/tether) by [Adi Dahiya](https://github.com/adidahiya) * [:link:](text-buffer/text-buffer.d.ts) [text-buffer](https://github.com/atom/text-buffer) by [vvakame](https://github.com/vvakame) * [:link:](text-encoding/text-encoding.d.ts) [text-encoding](https://github.com/inexorabletash/text-encoding) by [MIZUNE Pine](https://github.com/pine613) +* [:link:](github-electron/github-electron-main.d.ts) [the Electron 0.25.2 main process](http://electron.atom.io) by [jedmao](https://github.com/jedmao) +* [:link:](github-electron/github-electron-renderer.d.ts) [the Electron 0.25.2 renderer process (web page)](http://electron.atom.io) by [jedmao](https://github.com/jedmao) * [:link:](threejs/three-canvasrenderer.d.ts) [three.js (CanvasRenderer.js)](https://github.com/mrdoob/three.js/blob/master/examples/js/renderers/CanvasRenderer.js) by [Satoru Kimura](https://github.com/gyohk) * [:link:](threejs/three-copyshader.d.ts) [three.js (CopyShader.js)](https://github.com/mrdoob/three.js/blob/r68/examples/js/shaders/CopyShader.js) by [Satoru Kimura](https://github.com/gyohk) * [:link:](threejs/three-css3drenderer.d.ts) [three.js (CSS3DRenderer.js)](https://github.com/mrdoob/three.js/blob/master/examples/js/renderers/CSS3DRenderer.js) by [Satoru Kimura](https://github.com/gyohk) @@ -871,7 +937,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](threejs/three-renderpass.d.ts) [three.js (RenderPass.js)](https://github.com/mrdoob/three.js/blob/r68/examples/js/postprocessing/RenderPass.js) by [Satoru Kimura](https://github.com/gyohk) * [:link:](threejs/three-shaderpass.d.ts) [three.js (ShaderPass.js)](https://github.com/mrdoob/three.js/blob/r68/examples/js/postprocessing/ShaderPass.js) by [Satoru Kimura](https://github.com/gyohk) * [:link:](threejs/three-trackballcontrols.d.ts) [three.js (TrackballControls.js)](https://github.com/mrdoob/three.js/blob/master/examples/js/controls/TrackballControls.js) by [Satoru Kimura](https://github.com/gyohk) -* [:link:](threejs/three.d.ts) [three.js r70](http://mrdoob.github.com/three.js) by [Kon](http://phyzkit.net), [Satoru Kimura](https://github.com/gyohk) +* [:link:](threejs/three.d.ts) [three.js r71](http://mrdoob.github.com/three.js) by [Kon](http://phyzkit.net), [Satoru Kimura](https://github.com/gyohk) * [:link:](through/through.d.ts) [through](https://github.com/dominictarr/through) by [Andrew Gaspar](https://github.com/AndrewGaspar) * [:link:](through2/through2.d.ts) [through2 v](https://github.com/rvagg/through2) by [Bart van der Schoor](https://github.com/Bartvds), [jedmao](https://github.com/jedmao) * [:link:](timelinejs/timelinejs.d.ts) [timelinejs](https://github.com/NUKnightLab/TimelineJS) by [Roland Zwaga](https://github.com/rolandzwaga) @@ -885,6 +951,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](sencha_touch/SenchaTouch.d.ts) [Touch](http://www.sencha.com/products/touch) by [Brian Kotek](https://github.com/brian428) * [:link:](traceback/traceback.d.ts) [Traceback](http://github.com/iriscouch/traceback) by [Michael Zabka](https://github.com/misak113) * [:link:](trunk8/trunk8.d.ts) [trunk8](https://github.com/rviscomi/trunk8) by [Blake Niemyjski](https://github.com/niemyjski) +* [:link:](tsmonad/tsmonad.d.ts) [TsMonad](https://github.com/cbowdon/TsMonad) by [Chris Bowdon](https://github.com/cbowdon) * [:link:](tspromise/tspromise.d.ts) [tspromise](https://github.com/soywiz/tspromise) by [Carlos Ballesteros Velasco](https://github.com/soywiz) * [:link:](tween.js/tween.js.d.ts) [tween.js r12](https://github.com/sole/tween.js) by [sunetos](https://github.com/sunetos), [jzarnikov](https://github.com/jzarnikov) * [:link:](tweenjs/tweenjs.d.ts) [TweenJS](http://www.createjs.com/#!/TweenJS) by [Pedro Ferreira](https://bitbucket.org/drk4), [Chris Smith](https://github.com/evilangelist) @@ -892,6 +959,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](twitter/twitter.d.ts) [Twitter for Websites](https://dev.twitter.com/web) by [Chitoku](https://github.com/chitoku-k) * [:link:](jquery.bootstrap.wizard/jquery.bootstrap.wizard.d.ts) [twitter-bootstrap-wizard](https://github.com/VinceG/twitter-bootstrap-wizard) by [Blake Niemyjski](https://github.com/niemyjski) * [:link:](twix/twix.d.ts) [twix.js](https://github.com/icambron/twix.js) by [j3ko](https://github.com/j3ko) +* [:link:](type-check/type-check.d.ts) [type-check](https://github.com/gkz/type-check) by [Hans Windhoff](https://github.com/hansrwindhoff) * [:link:](type-detect/type-detect.d.ts) [type-detect](https://github.com/chaijs/type-detect) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](type-name/type-name.d.ts) [type-name](https://github.com/twada/type-name) by [OKUNOKENTARO](https://github.com/armorik83) * [:link:](typeahead/typeahead.d.ts) [typeahead.js](http://twitter.github.io/typeahead.js) by [Ivaylo Gochkov](https://github.com/igochkov), [Gidon Junge](https://github.com/gjunge) @@ -902,13 +970,16 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](underscore/underscore.d.ts) [Underscore](http://underscorejs.org) by [Boris Yankov](https://github.com/borisyankov), [Josh Baldwin](https://github.com/jbaldwin) * [:link:](underscore-ko/underscore-ko.d.ts) [Underscore-ko 1.2.2 with underscore](https://github.com/kamranayub/UnderscoreKO) by [Maurits Elbers](https://github.com/MagicMau) * [:link:](underscore.string/underscore.string.d.ts) [underscore.string](https://github.com/epeli/underscore.string) by [Ry Racherbaumer](http://github.com/rygine) +* [:link:](jquery.uniform/jquery.uniform.d.ts) [Uniform.js](https://github.com/pixelmatrix/uniform) by [flyfishMT](https://github.com/flyfishMT) * [:link:](uniq/uniq.d.ts) [uniq](https://www.npmjs.com/package/uniq) by [Hans Windhoff](https://github.com/hansrwindhoff) * [:link:](universal-analytics/universal-analytics.d.ts) [universal-analytics](https://github.com/peaksandpies/universal-analytics) by [Bart van der Schoor](https://github.com/Bartvds) +* [:link:](unorm/unorm.d.ts) [unorm](https://github.com/walling/unorm) by [Christopher Brown](https://github.com/chbrown) * [:link:](update-notifier/update-notifier.d.ts) [update-notifier](https://github.com/yeoman/update-notifier) by [vvakame](https://github.com/vvakame) * [:link:](uri-templates/uri-templates.d.ts) [uri-templates](https://github.com/geraintluff/uri-templates) by [Bart van der Schoor](https://github.com/Bartvds) -* [:link:](urijs/URI.d.ts) [URI.js](https://github.com/medialize/URI.js) by [RodneyJT](https://github.com/RodneyJT) +* [:link:](urijs/URIjs.d.ts) [URI.js](https://github.com/medialize/URI.js) by [RodneyJT](https://github.com/RodneyJT), [Brian Surowiec](https://github.com/xt0rted) * [:link:](js-url/js-url.d.ts) [url](https://github.com/websanova/js-url) by [MIZUNE Pine](https://github.com/pine613) * [:link:](urlrouter/urlrouter.d.ts) [urlrouter](https://github.com/fengmk2/urlrouter) by [soywiz](https://github.com/soywiz) +* [:link:](urlsafe-base64/urlsafe-base64.d.ts) [urlsafe-base64](https://github.com/RGBboy/urlsafe-base64) by [Tanguy Krotoff](https://github.com/tkrotoff) * [:link:](UUID/UUID.d.ts) [UUID.js core](https://github.com/LiosK/UUID.js) by [Jason Jarrett](https://github.com/staxmanade) * [:link:](valerie/valerie.d.ts) [valerie](https://github.com/davewatts/valerie) by [Howard Richards](https://github.com/conficient) * [:link:](validator/validator.d.ts) [validator.js](https://github.com/chriso/validator.js) by [tgfjt](https://github.com/tgfjt) @@ -921,6 +992,8 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](vinyl/vinyl.d.ts) [vinyl](https://github.com/wearefractal/vinyl) by [vvakame](https://github.com/vvakame), [jedmao](https://github.com/jedmao) * [:link:](vinyl-fs/vinyl-fs.d.ts) [vinyl-fs](https://github.com/wearefractal/vinyl-fs) by [vvakame](https://github.com/vvakame) * [:link:](vinyl-source-stream/vinyl-source-stream.d.ts) [vinyl-source-stream](https://github.com/hughsk/vinyl-source-stream) by [Asana](https://asana.com) +* [:link:](virtual-dom/virtual-dom.d.ts) [virtual-dom](https://github.com/Matt-Esch/virtual-dom) by [Christopher Brown](https://github.com/chbrown) +* [:link:](vortex-web-client/vortex-web-client.d.ts) [Vortex Web 1.2.0p1](http://www.prismtech.com/vortex/vortex-web) by [Stefan Profanter](https://github.com/Pro) * [:link:](vue/vue.d.ts) [vuejs](https://github.com/yyx990803/vue) by [odangosan](https://github.com/odangosan) * [:link:](watch/watch.d.ts) [watch](https://github.com/mikeal/watch) by [Carlos Ballesteros Velasco](https://github.com/soywiz) * [:link:](jquery.watermark/jquery.watermark.d.ts) [Watermark plugin for jQuery](http://jquery-watermark.googlecode.com) by [Anwar Javed](https://github.com/anwarjaved) @@ -947,7 +1020,10 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](ws/ws.d.ts) [ws](https://github.com/einaros/ws) by [Paul Loyd](https://github.com/loyd) * [:link:](x-editable/x-editable.d.ts) [X-Editable](http://vitalets.github.io/x-editable/index.html) by [Chris Kirby](https://github.com/sirkirby) * [:link:](x2js/xml2json.d.ts) [x2js](https://code.google.com/p/x2js) by [Horiuchi_H](https://github.com/horiuchi) +* [:link:](xdate/xdate.d.ts) [XDate](http://arshaw.com/xdate) by [yamada28go](https://github.com/yamada28go) * [:link:](jsfl/xJSFL.d.ts) [xJSFL](http://www.xjsfl.com) by [soywiz](https://github.com/soywiz) +* [:link:](xlsx/xlsx.d.ts) [xlsx](https://github.com/SheetJS/js-xlsx) by [themauveavenger](https://github.com/themauveavenger) +* [:link:](xmlbuilder/xmlbuilder.d.ts) [xmlbuilder](https://github.com/oozcitak/xmlbuilder-js) by [Wallymathieu](http://github.com/wallymathieu) * [:link:](xpath/xpath.d.ts) [xpath](https://github.com/goto100/xpath) by [Andrew Bradley](https://github.com/cspotcode) * [:link:](xregexp/xregexp.d.ts) [XRegExp](http://xregexp.com) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](xsockets/XSockets.d.ts) [XSockets.NET](http://xsockets.net) by [Jeffery Grajkowski](https://github.com/pushplay) @@ -966,5 +1042,6 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](zip.js/zip.js.d.ts) [zip.js 2.x](https://github.com/gildas-lormeau/zip.js) by [Louis Grignon](https://github.com/lgrignon) * [:link:](scroller/easyscroller.d.ts) [Zynga EasyScroller](https://github.com/zynga/scroller) by [Boris Yankov](https://github.com/borisyankov) * [:link:](scroller/scroller.d.ts) [Zynga Scroller](https://github.com/zynga/scroller) by [Boris Yankov](https://github.com/borisyankov) +* [:link:](zynga-scroller/zynga-scroller.d.ts) [Zynga Scroller](http://zynga.github.com/scroller) by [Marcelo Haskell Camargo](https://github.com/haskellcamargo) * [:link:](viewporter/viewporter.d.ts) [Zynga Viewporter](https://github.com/zynga/viewporter) by [Boris Yankov](https://github.com/borisyankov) From 9a7fd63e89244da016ca14f4522b60714a445094 Mon Sep 17 00:00:00 2001 From: Craig Brett Date: Tue, 23 Jun 2015 14:47:50 +0100 Subject: [PATCH 0146/1358] Handling case sensativity --- .../backbone-associations-tests.ts | 0 .../backbone-associations-tests.ts.tscparams | 0 .../backbone-associations.d.ts | 0 .../backbone-associations.d.ts.tscparams | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename {Backbone-Associations => backbone-associations}/backbone-associations-tests.ts (100%) rename {Backbone-Associations => backbone-associations}/backbone-associations-tests.ts.tscparams (100%) rename {Backbone-Associations => backbone-associations}/backbone-associations.d.ts (100%) rename {Backbone-Associations => backbone-associations}/backbone-associations.d.ts.tscparams (100%) diff --git a/Backbone-Associations/backbone-associations-tests.ts b/backbone-associations/backbone-associations-tests.ts similarity index 100% rename from Backbone-Associations/backbone-associations-tests.ts rename to backbone-associations/backbone-associations-tests.ts diff --git a/Backbone-Associations/backbone-associations-tests.ts.tscparams b/backbone-associations/backbone-associations-tests.ts.tscparams similarity index 100% rename from Backbone-Associations/backbone-associations-tests.ts.tscparams rename to backbone-associations/backbone-associations-tests.ts.tscparams diff --git a/Backbone-Associations/backbone-associations.d.ts b/backbone-associations/backbone-associations.d.ts similarity index 100% rename from Backbone-Associations/backbone-associations.d.ts rename to backbone-associations/backbone-associations.d.ts diff --git a/Backbone-Associations/backbone-associations.d.ts.tscparams b/backbone-associations/backbone-associations.d.ts.tscparams similarity index 100% rename from Backbone-Associations/backbone-associations.d.ts.tscparams rename to backbone-associations/backbone-associations.d.ts.tscparams From 2d07596b6f407239307f1292b4a2c63abfda653e Mon Sep 17 00:00:00 2001 From: Arseniy Maximov Date: Tue, 23 Jun 2015 17:45:29 +0300 Subject: [PATCH 0147/1358] Create declaration file for Polyline --- polyline/polyline-tests.ts | 16 ++++++++++++++++ polyline/polyline.d.ts | 22 ++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 polyline/polyline-tests.ts create mode 100644 polyline/polyline.d.ts diff --git a/polyline/polyline-tests.ts b/polyline/polyline-tests.ts new file mode 100644 index 0000000000..888d15f91a --- /dev/null +++ b/polyline/polyline-tests.ts @@ -0,0 +1,16 @@ +/// + +// returns an array of lat, lon pairs +polyline.decode('_p~iF~ps|U_ulLnnqC_mqNvxq`@'); + +// returns a string-encoded polyline +polyline.encode([[38.5, -120.2], [40.7, -120.95], [43.252, -126.453]]); + +// returns a string-encoded polyline from a GeoJSON LineString +polyline.fromGeoJSON({ "type": "Feature", + "geometry": { + "type": "LineString", + "coordinates": [[-120.2, 38.5], [-120.95, 40.7], [-126.453, 43.252]] + }, + "properties": {} +}); \ No newline at end of file diff --git a/polyline/polyline.d.ts b/polyline/polyline.d.ts new file mode 100644 index 0000000000..5663fac491 --- /dev/null +++ b/polyline/polyline.d.ts @@ -0,0 +1,22 @@ +// Type definitions for Polyline 0.1.0 +// Project: https://github.com/mapbox/polyline +// Definitions by: Arseniy Maximov +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +interface NumberArray { + [index: number]: number; +} + +interface Polyline { + decode(string: string, precision?: number): NumberArray[]; + encode(coordinate: NumberArray[], precision?: number): string; + fromGeoJSON(geojson: GeoJSON.GeoJsonObject, precision?: number): string; +} + +declare var polyline: Polyline; + +declare module "polyline" { + export = polyline; +} \ No newline at end of file From b56e56736a54393e3ff3c08d9cebd0d697f8bd10 Mon Sep 17 00:00:00 2001 From: Arseniy Maximov Date: Tue, 23 Jun 2015 18:36:36 +0300 Subject: [PATCH 0148/1358] we don't need NumberArray, omg. --- polyline/polyline.d.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/polyline/polyline.d.ts b/polyline/polyline.d.ts index 5663fac491..0f220e1d30 100644 --- a/polyline/polyline.d.ts +++ b/polyline/polyline.d.ts @@ -5,13 +5,9 @@ /// -interface NumberArray { - [index: number]: number; -} - interface Polyline { - decode(string: string, precision?: number): NumberArray[]; - encode(coordinate: NumberArray[], precision?: number): string; + decode(string: string, precision?: number): number[][]; + encode(coordinate: number[][], precision?: number): string; fromGeoJSON(geojson: GeoJSON.GeoJsonObject, precision?: number): string; } From 8833ceece1ed48b36b00b53ed7d66acc8aedfde5 Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Tue, 23 Jun 2015 09:42:37 -0700 Subject: [PATCH 0149/1358] Combine internal/external React .d.ts files and prepare for TS JSX support --- react/react-addons-global.d.ts | 2 +- react/react-global.d.ts | 781 --------------------------------- react/react-jsx.d.ts | 147 +++++++ react/react.d.ts | 12 +- 4 files changed, 158 insertions(+), 784 deletions(-) delete mode 100644 react/react-global.d.ts create mode 100644 react/react-jsx.d.ts diff --git a/react/react-addons-global.d.ts b/react/react-addons-global.d.ts index 508ae05225..ed6096fa6f 100644 --- a/react/react-addons-global.d.ts +++ b/react/react-addons-global.d.ts @@ -2,7 +2,7 @@ // Project: http://facebook.github.io/react/ // Definitions by: Asana , AssureSign // Definitions: https://github.com/borisyankov/DefinitelyTyped -/// +/// declare module React { // diff --git a/react/react-global.d.ts b/react/react-global.d.ts deleted file mode 100644 index 5a4893862f..0000000000 --- a/react/react-global.d.ts +++ /dev/null @@ -1,781 +0,0 @@ -// Type definitions for React v0.13.1 (internal module) -// Project: http://facebook.github.io/react/ -// Definitions by: Asana , AssureSign -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -declare module React { - // - // React Elements - // ---------------------------------------------------------------------- - - type ReactType = ComponentClass | string; - - interface ReactElement

    { - type: string | ComponentClass

    ; - props: P; - key: string | number; - ref: string | ((component: Component) => any); - } - - interface ClassicElement

    extends ReactElement

    { - type: string | ClassicComponentClass

    ; - ref: string | ((component: ClassicComponent) => any); - } - - interface DOMElement

    extends ClassicElement

    { - type: string; - ref: string | ((component: DOMComponent

    ) => any); - } - - type HTMLElement = DOMElement; - type SVGElement = DOMElement; - - // - // Factories - // ---------------------------------------------------------------------- - - interface Factory

    { - (props?: P, ...children: ReactNode[]): ReactElement

    ; - } - - interface ClassicFactory

    extends Factory

    { - (props?: P, ...children: ReactNode[]): ClassicElement

    ; - } - - interface DOMFactory

    extends ClassicFactory

    { - (props?: P, ...children: ReactNode[]): DOMElement

    ; - } - - type HTMLFactory = DOMFactory; - type SVGFactory = DOMFactory; - - // - // React Nodes - // http://facebook.github.io/react/docs/glossary.html - // ---------------------------------------------------------------------- - - type ReactText = string | number; - type ReactChild = ReactElement | ReactText; - - // Should be Array but type aliases cannot be recursive - type ReactFragment = {} | Array; - type ReactNode = ReactChild | ReactFragment | boolean; - - // - // Top Level API - // ---------------------------------------------------------------------- - - function createClass(spec: ComponentSpec): ClassicComponentClass

    ; - - function createFactory

    (type: string): DOMFactory

    ; - function createFactory

    (type: ClassicComponentClass

    | string): ClassicFactory

    ; - function createFactory

    (type: ComponentClass

    ): Factory

    ; - - function createElement

    ( - type: string, - props?: P, - ...children: ReactNode[]): DOMElement

    ; - function createElement

    ( - type: ClassicComponentClass

    | string, - props?: P, - ...children: ReactNode[]): ClassicElement

    ; - function createElement

    ( - type: ComponentClass

    , - props?: P, - ...children: ReactNode[]): ReactElement

    ; - - function cloneElement

    ( - element: DOMElement

    , - props?: P, - ...children: ReactNode[]): DOMElement

    ; - function cloneElement

    ( - element: ClassicElement

    , - props?: P, - ...children: ReactNode[]): ClassicElement

    ; - function cloneElement

    ( - element: ReactElement

    , - props?: P, - ...children: ReactNode[]): ReactElement

    ; - - function render

    ( - element: DOMElement

    , - container: Element, - callback?: () => any): DOMComponent

    ; - function render( - element: ClassicElement

    , - container: Element, - callback?: () => any): ClassicComponent; - function render( - element: ReactElement

    , - container: Element, - callback?: () => any): Component; - - function unmountComponentAtNode(container: Element): boolean; - function renderToString(element: ReactElement): string; - function renderToStaticMarkup(element: ReactElement): string; - function isValidElement(object: {}): boolean; - function initializeTouchEvents(shouldUseTouch: boolean): void; - - function findDOMNode( - componentOrElement: Component | Element): TElement; - function findDOMNode( - componentOrElement: Component | Element): Element; - - var DOM: ReactDOM; - var PropTypes: ReactPropTypes; - var Children: ReactChildren; - - // - // Component API - // ---------------------------------------------------------------------- - - // Base component for plain JS classes - class Component implements ComponentLifecycle { - constructor(props?: P, context?: any); - setState(f: (prevState: S, props: P) => S, callback?: () => any): void; - setState(state: S, callback?: () => any): void; - forceUpdate(): void; - props: P; - state: S; - context: any; - refs: { - [key: string]: Component - }; - } - - interface ClassicComponent extends Component { - replaceState(nextState: S, callback?: () => any): void; - getDOMNode(): TElement; - getDOMNode(): Element; - isMounted(): boolean; - getInitialState?(): S; - setProps(nextProps: P, callback?: () => any): void; - replaceProps(nextProps: P, callback?: () => any): void; - } - - interface DOMComponent

    extends ClassicComponent { - tagName: string; - } - - type HTMLComponent = DOMComponent; - type SVGComponent = DOMComponent; - - interface ChildContextProvider { - getChildContext(): CC; - } - - // - // Class Interfaces - // ---------------------------------------------------------------------- - - interface ComponentClass

    { - new(props?: P, context?: any): Component; - propTypes?: ValidationMap

    ; - contextTypes?: ValidationMap; - childContextTypes?: ValidationMap; - defaultProps?: P; - } - - interface ClassicComponentClass

    extends ComponentClass

    { - new(props?: P, context?: any): ClassicComponent; - getDefaultProps?(): P; - displayName?: string; - } - - // - // Component Specs and Lifecycle - // ---------------------------------------------------------------------- - - interface ComponentLifecycle { - componentWillMount?(): void; - componentDidMount?(): void; - componentWillReceiveProps?(nextProps: P, nextContext: any): void; - shouldComponentUpdate?(nextProps: P, nextState: S, nextContext: any): boolean; - componentWillUpdate?(nextProps: P, nextState: S, nextContext: any): void; - componentDidUpdate?(prevProps: P, prevState: S, prevContext: any): void; - componentWillUnmount?(): void; - } - - interface Mixin extends ComponentLifecycle { - mixins?: Mixin; - statics?: { - [key: string]: any; - }; - - displayName?: string; - propTypes?: ValidationMap; - contextTypes?: ValidationMap; - childContextTypes?: ValidationMap - - getDefaultProps?(): P; - getInitialState?(): S; - } - - interface ComponentSpec extends Mixin { - render(): ReactElement; - } - - // - // Event System - // ---------------------------------------------------------------------- - - interface SyntheticEvent { - bubbles: boolean; - cancelable: boolean; - currentTarget: EventTarget; - defaultPrevented: boolean; - eventPhase: number; - isTrusted: boolean; - nativeEvent: Event; - preventDefault(): void; - stopPropagation(): void; - target: EventTarget; - timeStamp: Date; - type: string; - } - - interface DragEvent extends SyntheticEvent { - dataTransfer: DataTransfer; - } - - interface ClipboardEvent extends SyntheticEvent { - clipboardData: DataTransfer; - } - - interface KeyboardEvent extends SyntheticEvent { - altKey: boolean; - charCode: number; - ctrlKey: boolean; - getModifierState(key: string): boolean; - key: string; - keyCode: number; - locale: string; - location: number; - metaKey: boolean; - repeat: boolean; - shiftKey: boolean; - which: number; - } - - interface FocusEvent extends SyntheticEvent { - relatedTarget: EventTarget; - } - - interface FormEvent extends SyntheticEvent { - } - - interface MouseEvent extends SyntheticEvent { - altKey: boolean; - button: number; - buttons: number; - clientX: number; - clientY: number; - ctrlKey: boolean; - getModifierState(key: string): boolean; - metaKey: boolean; - pageX: number; - pageY: number; - relatedTarget: EventTarget; - screenX: number; - screenY: number; - shiftKey: boolean; - } - - interface TouchEvent extends SyntheticEvent { - altKey: boolean; - changedTouches: TouchList; - ctrlKey: boolean; - getModifierState(key: string): boolean; - metaKey: boolean; - shiftKey: boolean; - targetTouches: TouchList; - touches: TouchList; - } - - interface UIEvent extends SyntheticEvent { - detail: number; - view: AbstractView; - } - - interface WheelEvent extends SyntheticEvent { - deltaMode: number; - deltaX: number; - deltaY: number; - deltaZ: number; - } - - // - // Event Handler Types - // ---------------------------------------------------------------------- - - interface EventHandler { - (event: E): void; - } - - interface DragEventHandler extends EventHandler {} - interface ClipboardEventHandler extends EventHandler {} - interface KeyboardEventHandler extends EventHandler {} - interface FocusEventHandler extends EventHandler {} - interface FormEventHandler extends EventHandler {} - interface MouseEventHandler extends EventHandler {} - interface TouchEventHandler extends EventHandler {} - interface UIEventHandler extends EventHandler {} - interface WheelEventHandler extends EventHandler {} - - // - // Props / DOM Attributes - // ---------------------------------------------------------------------- - - interface Props { - children?: ReactNode; - key?: string | number; - ref?: string | ((component: T) => any); - } - - interface DOMAttributes extends Props> { - onCopy?: ClipboardEventHandler; - onCut?: ClipboardEventHandler; - onPaste?: ClipboardEventHandler; - onKeyDown?: KeyboardEventHandler; - onKeyPress?: KeyboardEventHandler; - onKeyUp?: KeyboardEventHandler; - onFocus?: FocusEventHandler; - onBlur?: FocusEventHandler; - onChange?: FormEventHandler; - onInput?: FormEventHandler; - onSubmit?: FormEventHandler; - onClick?: MouseEventHandler; - onDoubleClick?: MouseEventHandler; - onDrag?: DragEventHandler; - onDragEnd?: DragEventHandler; - onDragEnter?: DragEventHandler; - onDragExit?: DragEventHandler; - onDragLeave?: DragEventHandler; - onDragOver?: DragEventHandler; - onDragStart?: DragEventHandler; - onDrop?: DragEventHandler; - onMouseDown?: MouseEventHandler; - onMouseEnter?: MouseEventHandler; - onMouseLeave?: MouseEventHandler; - onMouseMove?: MouseEventHandler; - onMouseOut?: MouseEventHandler; - onMouseOver?: MouseEventHandler; - onMouseUp?: MouseEventHandler; - onTouchCancel?: TouchEventHandler; - onTouchEnd?: TouchEventHandler; - onTouchMove?: TouchEventHandler; - onTouchStart?: TouchEventHandler; - onScroll?: UIEventHandler; - onWheel?: WheelEventHandler; - - dangerouslySetInnerHTML?: { - __html: string; - }; - } - - // This interface is not complete. Only properties accepting - // unitless numbers are listed here (see CSSProperty.js in React) - interface CSSProperties { - boxFlex?: number; - boxFlexGroup?: number; - columnCount?: number; - flex?: number | string; - flexGrow?: number; - flexShrink?: number; - fontWeight?: number | string; - lineClamp?: number; - lineHeight?: number | string; - opacity?: number; - order?: number; - orphans?: number; - widows?: number; - zIndex?: number; - zoom?: number; - - // SVG-related properties - fillOpacity?: number; - strokeOpacity?: number; - strokeWidth?: number; - } - - interface HTMLAttributes extends DOMAttributes { - ref?: string | ((component: HTMLComponent) => void); - - accept?: string; - acceptCharset?: string; - accessKey?: string; - action?: string; - allowFullScreen?: boolean; - allowTransparency?: boolean; - alt?: string; - async?: boolean; - autoComplete?: boolean; - autoFocus?: boolean; - autoPlay?: boolean; - cellPadding?: number | string; - cellSpacing?: number | string; - charSet?: string; - checked?: boolean; - classID?: string; - className?: string; - cols?: number; - colSpan?: number; - content?: string; - contentEditable?: boolean; - contextMenu?: string; - controls?: any; - coords?: string; - crossOrigin?: string; - data?: string; - dateTime?: string; - defer?: boolean; - dir?: string; - disabled?: boolean; - download?: any; - draggable?: boolean; - encType?: string; - form?: string; - formAction?: string; - formEncType?: string; - formMethod?: string; - formNoValidate?: boolean; - formTarget?: string; - frameBorder?: number | string; - headers?: string; - height?: number | string; - hidden?: boolean; - high?: number; - href?: string; - hrefLang?: string; - htmlFor?: string; - httpEquiv?: string; - icon?: string; - id?: string; - label?: string; - lang?: string; - list?: string; - loop?: boolean; - low?: number; - manifest?: string; - marginHeight?: number; - marginWidth?: number; - max?: number | string; - maxLength?: number; - media?: string; - mediaGroup?: string; - method?: string; - min?: number | string; - multiple?: boolean; - muted?: boolean; - name?: string; - noValidate?: boolean; - open?: boolean; - optimum?: number; - pattern?: string; - placeholder?: string; - poster?: string; - preload?: string; - radioGroup?: string; - readOnly?: boolean; - rel?: string; - required?: boolean; - role?: string; - rows?: number; - rowSpan?: number; - sandbox?: string; - scope?: string; - scoped?: boolean; - scrolling?: string; - seamless?: boolean; - selected?: boolean; - shape?: string; - size?: number; - sizes?: string; - span?: number; - spellCheck?: boolean; - src?: string; - srcDoc?: string; - srcSet?: string; - start?: number; - step?: number | string; - style?: CSSProperties; - tabIndex?: number; - target?: string; - title?: string; - type?: string; - useMap?: string; - value?: string; - width?: number | string; - wmode?: string; - - // Non-standard Attributes - autoCapitalize?: boolean; - autoCorrect?: boolean; - property?: string; - itemProp?: string; - itemScope?: boolean; - itemType?: string; - unselectable?: boolean; - } - - interface SVGAttributes extends DOMAttributes { - ref?: string | ((component: SVGComponent) => void); - - cx?: number | string; - cy?: number | string; - d?: string; - dx?: number | string; - dy?: number | string; - fill?: string; - fillOpacity?: number | string; - fontFamily?: string; - fontSize?: number | string; - fx?: number | string; - fy?: number | string; - gradientTransform?: string; - gradientUnits?: string; - markerEnd?: string; - markerMid?: string; - markerStart?: string; - offset?: number | string; - opacity?: number | string; - patternContentUnits?: string; - patternUnits?: string; - points?: string; - preserveAspectRatio?: string; - r?: number | string; - rx?: number | string; - ry?: number | string; - spreadMethod?: string; - stopColor?: string; - stopOpacity?: number | string; - stroke?: string; - strokeDasharray?: string; - strokeLinecap?: string; - strokeOpacity?: number | string; - strokeWidth?: number | string; - textAnchor?: string; - transform?: string; - version?: string; - viewBox?: string; - x1?: number | string; - x2?: number | string; - x?: number | string; - y1?: number | string; - y2?: number | string - y?: number | string; - } - - // - // React.DOM - // ---------------------------------------------------------------------- - - interface ReactDOM { - // HTML - a: HTMLFactory; - abbr: HTMLFactory; - address: HTMLFactory; - area: HTMLFactory; - article: HTMLFactory; - aside: HTMLFactory; - audio: HTMLFactory; - b: HTMLFactory; - base: HTMLFactory; - bdi: HTMLFactory; - bdo: HTMLFactory; - big: HTMLFactory; - blockquote: HTMLFactory; - body: HTMLFactory; - br: HTMLFactory; - button: HTMLFactory; - canvas: HTMLFactory; - caption: HTMLFactory; - cite: HTMLFactory; - code: HTMLFactory; - col: HTMLFactory; - colgroup: HTMLFactory; - data: HTMLFactory; - datalist: HTMLFactory; - dd: HTMLFactory; - del: HTMLFactory; - details: HTMLFactory; - dfn: HTMLFactory; - dialog: HTMLFactory; - div: HTMLFactory; - dl: HTMLFactory; - dt: HTMLFactory; - em: HTMLFactory; - embed: HTMLFactory; - fieldset: HTMLFactory; - figcaption: HTMLFactory; - figure: HTMLFactory; - footer: HTMLFactory; - form: HTMLFactory; - h1: HTMLFactory; - h2: HTMLFactory; - h3: HTMLFactory; - h4: HTMLFactory; - h5: HTMLFactory; - h6: HTMLFactory; - head: HTMLFactory; - header: HTMLFactory; - hr: HTMLFactory; - html: HTMLFactory; - i: HTMLFactory; - iframe: HTMLFactory; - img: HTMLFactory; - input: HTMLFactory; - ins: HTMLFactory; - kbd: HTMLFactory; - keygen: HTMLFactory; - label: HTMLFactory; - legend: HTMLFactory; - li: HTMLFactory; - link: HTMLFactory; - main: HTMLFactory; - map: HTMLFactory; - mark: HTMLFactory; - menu: HTMLFactory; - menuitem: HTMLFactory; - meta: HTMLFactory; - meter: HTMLFactory; - nav: HTMLFactory; - noscript: HTMLFactory; - object: HTMLFactory; - ol: HTMLFactory; - optgroup: HTMLFactory; - option: HTMLFactory; - output: HTMLFactory; - p: HTMLFactory; - param: HTMLFactory; - picture: HTMLFactory; - pre: HTMLFactory; - progress: HTMLFactory; - q: HTMLFactory; - rp: HTMLFactory; - rt: HTMLFactory; - ruby: HTMLFactory; - s: HTMLFactory; - samp: HTMLFactory; - script: HTMLFactory; - section: HTMLFactory; - select: HTMLFactory; - small: HTMLFactory; - source: HTMLFactory; - span: HTMLFactory; - strong: HTMLFactory; - style: HTMLFactory; - sub: HTMLFactory; - summary: HTMLFactory; - sup: HTMLFactory; - table: HTMLFactory; - tbody: HTMLFactory; - td: HTMLFactory; - textarea: HTMLFactory; - tfoot: HTMLFactory; - th: HTMLFactory; - thead: HTMLFactory; - time: HTMLFactory; - title: HTMLFactory; - tr: HTMLFactory; - track: HTMLFactory; - u: HTMLFactory; - ul: HTMLFactory; - "var": HTMLFactory; - video: HTMLFactory; - wbr: HTMLFactory; - - // SVG - circle: SVGFactory; - defs: SVGFactory; - ellipse: SVGFactory; - g: SVGFactory; - line: SVGFactory; - linearGradient: SVGFactory; - mask: SVGFactory; - path: SVGFactory; - pattern: SVGFactory; - polygon: SVGFactory; - polyline: SVGFactory; - radialGradient: SVGFactory; - rect: SVGFactory; - stop: SVGFactory; - svg: SVGFactory; - text: SVGFactory; - tspan: SVGFactory; - } - - // - // React.PropTypes - // ---------------------------------------------------------------------- - - interface Validator { - (object: T, key: string, componentName: string): Error; - } - - interface Requireable extends Validator { - isRequired: Validator; - } - - interface ValidationMap { - [key: string]: Validator; - } - - interface ReactPropTypes { - any: Requireable; - array: Requireable; - bool: Requireable; - func: Requireable; - number: Requireable; - object: Requireable; - string: Requireable; - node: Requireable; - element: Requireable; - instanceOf(expectedClass: {}): Requireable; - oneOf(types: any[]): Requireable; - oneOfType(types: Validator[]): Requireable; - arrayOf(type: Validator): Requireable; - objectOf(type: Validator): Requireable; - shape(type: ValidationMap): Requireable; - } - - // - // React.Children - // ---------------------------------------------------------------------- - - interface ReactChildren { - map(children: ReactNode, fn: (child: ReactChild) => T): { [key:string]: T }; - forEach(children: ReactNode, fn: (child: ReactChild) => any): void; - count(children: ReactNode): number; - only(children: ReactNode): ReactChild; - } - - // - // Browser Interfaces - // https://github.com/nikeee/2048-typescript/blob/master/2048/js/touch.d.ts - // ---------------------------------------------------------------------- - - interface AbstractView { - styleMedia: StyleMedia; - document: Document; - } - - interface Touch { - identifier: number; - target: EventTarget; - screenX: number; - screenY: number; - clientX: number; - clientY: number; - pageX: number; - pageY: number; - } - - interface TouchList { - [index: number]: Touch; - length: number; - item(index: number): Touch; - identifiedTouch(identifier: number): Touch; - } -} - diff --git a/react/react-jsx.d.ts b/react/react-jsx.d.ts new file mode 100644 index 0000000000..25070734f1 --- /dev/null +++ b/react/react-jsx.d.ts @@ -0,0 +1,147 @@ +// Type definitions for React v0.13.1 (JSX support) +// Project: http://facebook.github.io/react/ +// Definitions by: Asana , AssureSign , Microsoft +// Definitions: https://github.com/borisyankov/DefinitelyTyped +/// + +declare module JSX { + interface Element extends React.ReactElement { } + interface ElementClass extends React.Component { } + interface ElementAttributesProperty { props: {}; } + + interface IntrinsicElements { + // HTML + a: React.HTMLAttributes; + abbr: React.HTMLAttributes; + address: React.HTMLAttributes; + area: React.HTMLAttributes; + article: React.HTMLAttributes; + aside: React.HTMLAttributes; + audio: React.HTMLAttributes; + b: React.HTMLAttributes; + base: React.HTMLAttributes; + bdi: React.HTMLAttributes; + bdo: React.HTMLAttributes; + big: React.HTMLAttributes; + blockquote: React.HTMLAttributes; + body: React.HTMLAttributes; + br: React.HTMLAttributes; + button: React.HTMLAttributes; + canvas: React.HTMLAttributes; + caption: React.HTMLAttributes; + cite: React.HTMLAttributes; + code: React.HTMLAttributes; + col: React.HTMLAttributes; + colgroup: React.HTMLAttributes; + data: React.HTMLAttributes; + datalist: React.HTMLAttributes; + dd: React.HTMLAttributes; + del: React.HTMLAttributes; + details: React.HTMLAttributes; + dfn: React.HTMLAttributes; + dialog: React.HTMLAttributes; + div: React.HTMLAttributes; + dl: React.HTMLAttributes; + dt: React.HTMLAttributes; + em: React.HTMLAttributes; + embed: React.HTMLAttributes; + fieldset: React.HTMLAttributes; + figcaption: React.HTMLAttributes; + figure: React.HTMLAttributes; + footer: React.HTMLAttributes; + form: React.HTMLAttributes; + h1: React.HTMLAttributes; + h2: React.HTMLAttributes; + h3: React.HTMLAttributes; + h4: React.HTMLAttributes; + h5: React.HTMLAttributes; + h6: React.HTMLAttributes; + head: React.HTMLAttributes; + header: React.HTMLAttributes; + hr: React.HTMLAttributes; + html: React.HTMLAttributes; + i: React.HTMLAttributes; + iframe: React.HTMLAttributes; + img: React.HTMLAttributes; + input: React.HTMLAttributes; + ins: React.HTMLAttributes; + kbd: React.HTMLAttributes; + keygen: React.HTMLAttributes; + label: React.HTMLAttributes; + legend: React.HTMLAttributes; + li: React.HTMLAttributes; + link: React.HTMLAttributes; + main: React.HTMLAttributes; + map: React.HTMLAttributes; + mark: React.HTMLAttributes; + menu: React.HTMLAttributes; + menuitem: React.HTMLAttributes; + meta: React.HTMLAttributes; + meter: React.HTMLAttributes; + nav: React.HTMLAttributes; + noscript: React.HTMLAttributes; + object: React.HTMLAttributes; + ol: React.HTMLAttributes; + optgroup: React.HTMLAttributes; + option: React.HTMLAttributes; + output: React.HTMLAttributes; + p: React.HTMLAttributes; + param: React.HTMLAttributes; + picture: React.HTMLAttributes; + pre: React.HTMLAttributes; + progress: React.HTMLAttributes; + q: React.HTMLAttributes; + rp: React.HTMLAttributes; + rt: React.HTMLAttributes; + ruby: React.HTMLAttributes; + s: React.HTMLAttributes; + samp: React.HTMLAttributes; + script: React.HTMLAttributes; + section: React.HTMLAttributes; + select: React.HTMLAttributes; + small: React.HTMLAttributes; + source: React.HTMLAttributes; + span: React.HTMLAttributes; + strong: React.HTMLAttributes; + style: React.HTMLAttributes; + sub: React.HTMLAttributes; + summary: React.HTMLAttributes; + sup: React.HTMLAttributes; + table: React.HTMLAttributes; + tbody: React.HTMLAttributes; + td: React.HTMLAttributes; + textarea: React.HTMLAttributes; + tfoot: React.HTMLAttributes; + th: React.HTMLAttributes; + thead: React.HTMLAttributes; + time: React.HTMLAttributes; + title: React.HTMLAttributes; + tr: React.HTMLAttributes; + track: React.HTMLAttributes; + u: React.HTMLAttributes; + ul: React.HTMLAttributes; + "var": React.HTMLAttributes; + video: React.HTMLAttributes; + wbr: React.HTMLAttributes; + + // SVG + svg: React.SVGElementAttributes; + + circle: React.SVGAttributes; + defs: React.SVGAttributes; + ellipse: React.SVGAttributes; + g: React.SVGAttributes; + line: React.SVGAttributes; + linearGradient: React.SVGAttributes; + mask: React.SVGAttributes; + path: React.SVGAttributes; + pattern: React.SVGAttributes; + polygon: React.SVGAttributes; + polyline: React.SVGAttributes; + radialGradient: React.SVGAttributes; + rect: React.SVGAttributes; + stop: React.SVGAttributes; + text: React.SVGAttributes; + tspan: React.SVGAttributes; + } +} diff --git a/react/react.d.ts b/react/react.d.ts index 0b202f20e8..b23a8240ea 100644 --- a/react/react.d.ts +++ b/react/react.d.ts @@ -1,9 +1,9 @@ -// Type definitions for React v0.13.1 (external module) +// Type definitions for React v0.13.1 (internal and external module) // Project: http://facebook.github.io/react/ // Definitions by: Asana , AssureSign // Definitions: https://github.com/borisyankov/DefinitelyTyped -declare module "react" { +declare module React { // // React Elements // ---------------------------------------------------------------------- @@ -518,6 +518,11 @@ declare module "react" { unselectable?: boolean; } + interface SVGElementAttributes extends HTMLAttributes { + viewBox?: string; + preserveAspectRatio?: string; + } + interface SVGAttributes extends DOMAttributes { ref?: string | ((component: SVGComponent) => void); @@ -779,3 +784,6 @@ declare module "react" { } } +declare module "react" { + export = React; +} From 95ddb113e8111ff5ad5af31778e2ccf302c1e1df Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 23 Jun 2015 19:16:35 +0200 Subject: [PATCH 0150/1358] added eqjs definitions --- eqjs/eqjs.d.ts | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 eqjs/eqjs.d.ts diff --git a/eqjs/eqjs.d.ts b/eqjs/eqjs.d.ts new file mode 100644 index 0000000000..b9a39856ec --- /dev/null +++ b/eqjs/eqjs.d.ts @@ -0,0 +1,66 @@ +// Type definitions for eq.js +// Project: https://github.com/Snugug/eq.js +// Definitions by: Stephen Lautier +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare var eqjs: eqjs.EqjsStatic; + + // Support AMD require +declare module 'eqjs' { + export = eqjs; +} + +declare module eqjs { + + interface EqjsStatic { + + /** + * List of all nodes. + */ + nodes: EqjsNodesTable; + + /** + * Number of nodes in eqjs.nodes. + */ + nodesLength: number; + + /** + * Runs through all nodes and finds their widths and points + * @param nodes + * @param callback function to use as a callback once query and nodeWrites have finished + */ + query(nodes: HTMLElement[]|JQuery, callback?: Function): void; + + /** + * Refreshes the list of nodes for eqjs to work with + */ + refreshNodes(): void; + + /** + * Sorts a simple object (key: value) by value and returns a sorted object. + * @param obj e.g. "small: 380, medium: 490, large: 600" + * @returns {} + */ + sortObj(obj: string): EqjsKeyValuePair; + + /** + * Runs through all nodes and writes their eq status. + * @param nodes An array or NodeList of nodes to query + * @returns {} + */ + nodeWrites(nodes?: HTMLElement[]|JQuery); + } + + interface EqjsKeyValuePair { + key: string; + value: number; + } + + interface EqjsNodesTable { + [key: string]: HTMLElement; + } + +} + +// Support jQuery selectors. +interface JQuery { } \ No newline at end of file From 432d6563a69fa1a71e3305394dbc629d7cfd95d5 Mon Sep 17 00:00:00 2001 From: Darryl Pogue Date: Tue, 23 Jun 2015 10:23:54 -0700 Subject: [PATCH 0151/1358] Update angular-translate to return module name. --- angular-translate/angular-translate.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/angular-translate/angular-translate.d.ts b/angular-translate/angular-translate.d.ts index 87a75439b2..1abb13ae81 100644 --- a/angular-translate/angular-translate.d.ts +++ b/angular-translate/angular-translate.d.ts @@ -5,6 +5,11 @@ /// +declare module "angular-translate" { + var _: string; + export = _; +} + declare module angular.translate { interface ITranslationTable { From 75e849a4e07d17f44e15f00d2d251260b352df53 Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Tue, 23 Jun 2015 11:30:21 -0700 Subject: [PATCH 0152/1358] Add Microsoft attribute URL --- react/react-jsx.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/react/react-jsx.d.ts b/react/react-jsx.d.ts index 25070734f1..26ee4b2201 100644 --- a/react/react-jsx.d.ts +++ b/react/react-jsx.d.ts @@ -1,6 +1,6 @@ // Type definitions for React v0.13.1 (JSX support) // Project: http://facebook.github.io/react/ -// Definitions by: Asana , AssureSign , Microsoft +// Definitions by: Asana , AssureSign , Microsoft // Definitions: https://github.com/borisyankov/DefinitelyTyped /// From ab1501ff39245a2193ce00ada980170321404ce3 Mon Sep 17 00:00:00 2001 From: slozier Date: Tue, 23 Jun 2015 15:57:21 -0400 Subject: [PATCH 0153/1358] Make getRenderedRange arguments optional The getRenderedRange arguments are optional. https://github.com/mleibman/SlickGrid/wiki/Slick.Grid#getRenderedRange --- slickgrid/SlickGrid.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slickgrid/SlickGrid.d.ts b/slickgrid/SlickGrid.d.ts index 904e4f1271..cfdd3c690a 100644 --- a/slickgrid/SlickGrid.d.ts +++ b/slickgrid/SlickGrid.d.ts @@ -1172,7 +1172,7 @@ declare module Slick { public updateCell(row: number, cell: number): void; public updateRow(row: number): void; public getViewport(viewportTop?: number, viewportLeft?: number): Viewport; - public getRenderedRange(viewportTop: number, viewportLeft: number): Viewport; + public getRenderedRange(viewportTop?: number, viewportLeft?: number): Viewport; public resizeCanvas(): void; public updateRowCount(): void; public scrollRowIntoView(row: number, doPaging: boolean): void; From f7803b5aac1e082f2555dac477016629cc394693 Mon Sep 17 00:00:00 2001 From: David Lipowicz Date: Tue, 23 Jun 2015 14:30:08 -0700 Subject: [PATCH 0154/1358] Made a few small changes to address merge feedback. --- sigmajs/sigmajs.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sigmajs/sigmajs.d.ts b/sigmajs/sigmajs.d.ts index 985686ad45..fbc9bf45dd 100644 --- a/sigmajs/sigmajs.d.ts +++ b/sigmajs/sigmajs.d.ts @@ -21,9 +21,9 @@ declare module SigmaJs{ } interface Canvas { - edges: {[renderType: string]: Function}; - labels: {[renderType: string]: Function}; - nodes: {[renderType: string]: Function}; + edges: {[renderType: string]: (edge: Edge, source: Node, target: Node, ...a:any[]) => void}; + labels: {[renderType: string]: (node: Node, ...a:any[]) => void}; + nodes: {[renderType: string]: (node: Node, ...a:any[]) => void}; } interface Classes { From 78aab4f0cb9001f86fae64f284276ab783912135 Mon Sep 17 00:00:00 2001 From: "stephen.lautier" Date: Wed, 24 Jun 2015 01:14:36 +0200 Subject: [PATCH 0155/1358] added tests + several refinements --- eqjs/eqjs.d.ts | 13 +++++++------ eqjs/eqjs.tests.ts | 28 ++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 6 deletions(-) create mode 100644 eqjs/eqjs.tests.ts diff --git a/eqjs/eqjs.d.ts b/eqjs/eqjs.d.ts index b9a39856ec..9ff2d34683 100644 --- a/eqjs/eqjs.d.ts +++ b/eqjs/eqjs.d.ts @@ -5,12 +5,13 @@ declare var eqjs: eqjs.EqjsStatic; - // Support AMD require +// Support AMD require declare module 'eqjs' { export = eqjs; } declare module eqjs { + type AvailableElementType = HTMLElement|HTMLElement[]|NodeList|JQuery; interface EqjsStatic { @@ -29,7 +30,7 @@ declare module eqjs { * @param nodes * @param callback function to use as a callback once query and nodeWrites have finished */ - query(nodes: HTMLElement[]|JQuery, callback?: Function): void; + query(nodes: AvailableElementType, callback?: Function): void; /** * Refreshes the list of nodes for eqjs to work with @@ -41,14 +42,14 @@ declare module eqjs { * @param obj e.g. "small: 380, medium: 490, large: 600" * @returns {} */ - sortObj(obj: string): EqjsKeyValuePair; + sortObj(obj: string): EqjsKeyValuePair[]; /** * Runs through all nodes and writes their eq status. * @param nodes An array or NodeList of nodes to query * @returns {} */ - nodeWrites(nodes?: HTMLElement[]|JQuery); + nodeWrites(nodes?: AvailableElementType): void; } interface EqjsKeyValuePair { @@ -57,9 +58,9 @@ declare module eqjs { } interface EqjsNodesTable { - [key: string]: HTMLElement; + [index: number]: HTMLElement; } - + } // Support jQuery selectors. diff --git a/eqjs/eqjs.tests.ts b/eqjs/eqjs.tests.ts new file mode 100644 index 0000000000..1113604f22 --- /dev/null +++ b/eqjs/eqjs.tests.ts @@ -0,0 +1,28 @@ +/// +/// + +var nodes = document.getElementsByClassName(".test-container"); +var node = document.getElementById("#test-container"); +var $nodes = $(".selector"); + +eqjs.query(node); +eqjs.query(node, () => { }); +eqjs.query(nodes); +eqjs.query($nodes); + +var nodesCount: number = eqjs.nodesLength; + +eqjs.refreshNodes(); + +eqjs.nodeWrites(); +eqjs.nodeWrites(node); +eqjs.nodeWrites(nodes); +eqjs.nodeWrites($nodes); + +var sortMap = eqjs.sortObj("small: 380, medium: 490, large: 600"); +var sortFirstKey = sortMap[0].key; +var sortFirstValue = sortMap[0].value; + +var nodesMap = eqjs.nodes; + +var ele: HTMLElement = nodesMap[1]; From 16fc716b851e3b841c6fde1d9397c3ff146eff8c Mon Sep 17 00:00:00 2001 From: sourcebits-robertbiggs Date: Tue, 23 Jun 2015 16:35:02 -0700 Subject: [PATCH 0156/1358] Added declaration file and tests for ChUI. This declaration file is for chui at https://www.npmjs.com/package/chui --- chui/chui-tests.ts | 97 ++++ chui/chui.d.ts | 1262 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 1359 insertions(+) create mode 100644 chui/chui-tests.ts create mode 100644 chui/chui.d.ts diff --git a/chui/chui-tests.ts b/chui/chui-tests.ts new file mode 100644 index 0000000000..60cbe5afd6 --- /dev/null +++ b/chui/chui-tests.ts @@ -0,0 +1,97 @@ +/// +/// + +$(function() { + + /** + * Test static methods: + */ + var concatenatedText = $.concat("This", "is", "text", "to", "contatenate."); + $.forEach([1,2,3], function(ctx) { + return ctx; + }); + $.forEach([1,2,3], function(ctx, idx) { + return idx; + }); + + var isiPhone = $.isiPhone; + var isAndroid = $.isAndroid; + var isWinPhone = $.isWinPhone; + + $('li').on($.eventStart, function(){ + return; + }); + $('li').on($.eventEnd, function(){ + return; + }); + $('li').on($.eventMove, function(){ + return; + }); + $('li').on($.eventCancel, function(){ + return; + }); + + var browserVersion = $.browserVersion(); + $.UIHideNavBar(); + $.UIShowNavBar(); + $.UIGoToArticle("#main"); + $.UIGoBack(); + $.UIGoBackToArticle("#main"); + $.UIBlock(); + $.UIBlock(.5); + $.UIUnblock(); + $.UIPopup({id: "myPopup", message: 'Hello!!!'}); + $.UIPopup({message: 'Hello!!!', title: "Whatever", callback: $.noop}); + $.UIPopup({message: 'Hello!!!', cancleButton: "Forget It!", continueButton: "OK"}); + $.UIPopover({id: "myPopover"}); + $.UIPopover({callback: function() {}}); + $.UIPopover({title: "Whatever"}); + $.UIPopover({id: "myPopover", callback: function() {}, title: "Whatever"}); + $.UIPopoverClose(); + $.UICreateSegmented({id: "mySegmentedControl", labels : ['first','second','third'], selected: 0, className: "special"}); + $.UIPaging(); + $.UISheet({id: "mySheet", listClass: "specialList", background: 'red', handle: false}); + $.UIShowSheet("#mySheet"); + $.UIHideSheet(); + $.UISlideout({position: "right", dynamic: false, callback: $.noop}); + var myStepper = $('#myStepper'); + $.UIResetStepper(myStepper); + $.UICreateSwitch({id: "mySwitch", value: 5, checked: "true", callback: $.noop}); + $.UITabbar({tabs: 3, labels: ["one", "two", "three"], selected: 2}); + $.UISearch({articleId: "#main", placehold: "Looking?", results: 10}); + var carouselPanels = $('li'); + $.UISetupCarousel({target: "#carousel", panels: carouselPanels}); + $.UIBindData(); + $.UIBindData("#myBoundData"); + $.UIUnBindData(); + $.UIUnBindData("#myBoundData"); + + /** + * Test plugin methods: + */ + $("li").forEach(function(ctx, idx) { + console.log(ctx.nodeName + ": " + idx); + }); + $('li').iz(".selected").hide(); + $('li').iznt(".selected").show(); + $('li').haz("span").hide(); + $('li').haznt("span").show(); + $('li').hazClass(".selected").hide(); + $('li').hazntClass(".selected").show(); + $('li').hazAttr("disabled").hide(); + $('li').hazntAttr("disabled").show(); + $('#main').bind("singletap", function() { + return; + }); + $('#main').UICenter(); + $('#main').UIBusy({size: "120px", color: "red", duration: "5000ms"}); + $('#myPopup').UIPopupClose(); + $('#mySegementedControl').UISegmented({selected: 2, callback: $.noop}); + $("#panelToggler").UIPanelToggle("#togglePanels", $.noop); + $('#editList').UIEditList({callback: $.noop, deletable: false, movable: true}); + $('#mySelectList').UISelectList(); + $('#myStepper').UIStepper({start: 1, end: 10, defautValue: 5}); + $('#mySwitch').UISwitch(); + $('#myRangeControl').UIRange(); + +}); \ No newline at end of file diff --git a/chui/chui.d.ts b/chui/chui.d.ts new file mode 100644 index 0000000000..3b8fe70c27 --- /dev/null +++ b/chui/chui.d.ts @@ -0,0 +1,1262 @@ + +// Type definitions for chui v3.8.9 +// Project: https://github.com/chocolatechipui/chocolatechip-ui +// Definitions by: Robert Biggs +// Definitions: https://github.com/borisyankov/DefinitelyTyped +/** + These TypeScript delcarations for ChocolateChip-UI contain interfaces for both jQuery and ChocolateChipJS. Depending on which library you are using, you will get the type interfaces appropriate for it. +*/ +/** + * Interface for ChocolateChipJS. + */ +interface ChocolateChipStatic extends ChuiDetectors { + /** + * This method will concatenate strings or values as a cleaner alternative to using the '+' operator. + * + * @param string or number A comma separated series of strings to concatenate. + * @return string + */ + concat(...string: string[]): string; + + + /** + * This function replicates normal array iteration with the context first, followed by the index. + * Usage: $.forEach([1,2,3], function(ctx, idx) { console.log(ctx + "is: " + (idx + 1)) }); + * + * @param obj An array-like object. This will usually be an array of HTML elements. + * @param callback A callback to execute with each iteration of the object. + * @param args Any extra arguments you wish to pass. + * @return void + */ + forEach(obj: T[], callback: (ctx: T, idx?: number) => any, args?: any): any; + + /** + * Alias for cross-platform events: pointerdown, MSPointerDown, touchstart and mousedown. + */ + eventStart: ChUIEventInterface; + + /** + * Alias for cross-platform events: pointerup, MSPointerUp, touchend and mouseup. + */ + eventEnd: ChUIEventInterface; + + /** + * Alias for cross-platform events: pointermove, MSPointerMove, touchmove and mousemove. + */ + eventMove: ChUIEventInterface; + + /** + * Alias for cross-platform events: pointercancel, MSPointerCancel, touchcancel and mouseout. + */ + eventCancel: ChUIEventInterface; + + + /** + * Return the version of the current browser. + * + * @return string The current browser version. + */ + browserVersion(): number; + + /** + * Hide the navigation bar, raising up the content below it. + */ + UIHideNavBar(): void; + + /** + * If the navigation bar is hidden, show it, pushing down the content to make room. + */ + UIShowNavBar(): void; + + /** + * Determine whether navigation is in progress or not. + */ + isNavigating: boolean; + + /** + * Navigate to the article indicated by the provided destination ID. This enters the destination into the navigation history array. + * + * param destination An id for the article to navigate to. + */ + UIGoToArticle(destination: string): void; + + /** + * Go back to the previous article from whence you came. This resets the navigation history array. + */ + UIGoBack(): void; + + /** + * Go back to the article indicated by the provided ID. This is for non-linear back navigation. This will reset the navigation history array to match the current state. + */ + UIGoBackToArticle(articleID: string): void; + + /** + * Display a transparent screen over the UI. This takes an optional, decimal-based number for opacity: .5 for 50%. + * + * @param opacity The percentage of opacity for the screen. + */ + UIBlock(opacity?: number): void; + + /** + * Remove the transparent screen covering the UI. + */ + UIUnblock(): void; + + /** + * Create and show a Popup with title and message. Possible options: {id: "#myPopup", title: "My Popup", + * message: "Woohoo!", cancelButton: "Forget It!", contiueButton: "Whatever", callback: function() {console.log('Blah!');}, empty: false }. + * + * param options UIPopupOptions + */ + UIPopup(options: UIPopupOptions): void; + + /** + * Create and show a Popover. Options: {id: "#myPopover", title: "Whatever", callback: function() {console.log('Blah!');}}. + * + * param options UIPopoverOptions + */ + UIPopover(options: UIPopoverOptions): void; + + /** + * Close any currently visible popovers. + */ + UIPopoverClose(): void; + + /** + * Create a segmented control: {id: "mySegments", className: "seggie", labels: ["one", "two","three"], selected: 1} + * + * param: options UICreateSegmentedOptions + */ + UICreateSegmented(options: UICreateSegmentedOptions): ChocolateChipElementArray; + + /** + * Initialize a horiontal or vertical paging control. This uses a segmented control in the navigation bar with a class + * like "segmented paging horizontal" or "segmented paging vertical". It uses a single article with multiple sections to paginate. + */ + UIPaging(): void; + + /** + * Creates a sheet. Minimum option is an id: {id : 'starTrek', listClass :'enterprise', background: 'transparent', handle: false } + */ + UISheet(options: UISheetOptions): void; + + /** + * Show a sheet by passing this its ID. + */ + UIShowSheet(id?: string): void; + + /** + * Hide any currently displayed sheets. + */ + UIHideSheet(): void; + + /** + * The body tag wrapped and ready to use: $.body.css('background-color','orange') + */ + body: ChocolateChipElementArray; + + /** + * An array of the navigation history. Do not manipulate this. For examination only. This is used by navigation lists, etc. + */ + UINavigationHistory: string[]; + + /** + * Creates and initializes a slide out menu. Possible options: {dynamic: true, callback: function() { alert("Woohoo!");}} + */ + UISlideout: UISlideoutInterface; + + /** + * Reset the value of the stepper to its defaults at initialization. Pass it a reference to the stepper to reset. It takes a stepper element: $("#myStepper"). + * + * @param stepper A stepper to reset. + */ + UIResetStepper(stepper: ChocolateChipElementArray): void; + + /** + * Create a switch control. Possible options: { id: '#myId', name: 'fruit.mango', state: 'on', value: 'Mango', checked: 'on', style: 'traditional', callback: function() { alert('hi');}} + */ + UICreateSwitch(options: UICreateSwitchOptions): void; + + /** + * Creates a tabbar. On iOS this is at the bottom of the screen. On Android and Windows, it is at the top. + * Options: {id: 'mySpecialTabbar', tabs: 4, labels: ["Refresh", "Add", "Info", "Downloads", "Favorite"], icons: ["refresh", "add", "info", "downloads", "favorite"], selected: 2 } + */ + UITabbar(options: UITabbarOptions): void; + + /** + * Create a search bar for an article. Options: { articleId: '#products', id: 'productSearch', placeholder: 'Find a product', results: 5 } + */ + UISearch(options: UISearchOptions): void; + + /** + * Create and initialize a swipable carousel. Options: {target : '#myCarousel', panels: ['

    stuff

    ','

    more

    '], loop: true, pagination: true } + */ + UISetupCarousel(options: UISetupCarouselOptions): void; + + /** + * Bind the values of data-models to elements with data-controllers:

    . + * You can bind a single model to its controller by providing its name as the argument: $.UIBindData('input-value'); + * + * @param controller A string indicating the controller whose value a model is bound to. + */ + UIBindData(controller?: string): void; + + /** + * Unbind the values of data-models from their data-controllers. + * If you provide a controller name as the argument, only that controller will be unbound. + * + * @param controller A controller to unbind. + */ + UIUnBindData(controller?: string): void; + +} + +/** + * Interface for ChocolateChipJS Element Array. + */ +interface ChocolateChipElementArray { + + /** + * Iterate over an Array object, executing a function for each matched element. + */ + + forEach(func: (ctx: any, idx: number) => void): void; + + /** + * Check the current matched set of elements against a selector or element and return it + * if it matches the given arguments. + * + * @param selector A string containing a selector expression to match elements against. + */ + iz(selector: string): ChocolateChipElementArray; + + /** + * Check the current matched set of elements against a selector or element and return it + * if it matches the given arguments. + * + * @param elements One or more elements to match the current set of elements against. + */ + iz(element: any): ChocolateChipElementArray; + + /** + * Check the current matched set of elements against a selector or element and return it + * if it does not match the given arguments. + * + * @param selector A string containing a selector expression to match elements against. + */ + iznt(selector: string): ChocolateChipElementArray; + + /** + * Check the current matched set of elements against a selector or element and return it + * if it does not match the given arguments. + * + * @param elements One or more elements to match the current set of elements against. + */ + iznt(element: any): ChocolateChipElementArray; + + /** + * Reduce the set of matched elements to those that have a descendant that matches the selector or DOM element. + * + * @param selector A string containing a selector expression to match elements against. + */ + haz(selector: string): ChocolateChipElementArray; + /** + * Reduce the set of matched elements to those that have a descendant that matches the selector or DOM element. + * + * @param element A DOM element to match elements against. + */ + haz(element: Element): ChocolateChipElementArray; + + /** + * Reduce the set of matched elements to those that have a descendant that does not match the selector or DOM element. + * + * @param selector A string containing a selector expression to match elements against. + */ + haznt(selector: string): ChocolateChipElementArray; + /** + * Reduce the set of matched elements to those that have a descendant that does not match the selector or DOM element. + * + * @param element A DOM element to match elements against. + */ + haznt(element: Element): ChocolateChipElementArray; + + /** + * Return any of the matched elements that have the given class. + * + * @param className The class name to search for. + */ + hazClass(className: string): ChocolateChipElementArray; + + /** + * Return any of the matched elements that do not have the given class. + * + * @param className The class name to search for. + */ + hazntClass(className: string): ChocolateChipElementArray; + + + /** + * Return any of the matched elements that have the given attribute. + * + * @param className The class name to search for. + */ + hazAttr(attributeName: string): ChocolateChipElementArray; + + /** + * Return any of the matched elements that do not have the given attribute. + * + * @param className The class name to search for. + */ + hazntAttr(attributeName: string): ChocolateChipElementArray; + + /** + * Attach a handler to an event for the elements. + * + * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. + * @param handler A function to execute each time the event is triggered. + * @param useCapture Setting the third argument to true will trigger event bubbling. The default is false. + */ + bind(eventType: string | ChUIEventInterface, handler: (eventObject: Event) => any, useCapture?: boolean): ChocolateChipStatic; + + /** + * Remove a handler for an event from the elements. + * + * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. + * @param handler A function to execute each time the event is triggered. + * @param useCapture Setting the third argument to true will trigger event bubbling. The default is false. + */ + unbind(eventType: string | ChUIEventInterface, handler?: (eventObject: Event) => any, useCapture?: boolean): ChocolateChipStatic; + + /** + * Add a delegated event to listen for the provided event on the descendant elements. + * + * @param selector A string defining the descendant elements to listen on for the designated event. + * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. + * @param handler A function to execute each time the event is triggered. The keyword "this" will refer + * to the element receiving the event. + * @param useCapture Setting the third argument to true will trigger event bubbling. The default is false. + */ + delegate(selector: any, eventType: string | ChUIEventInterface, handler: (eventObject: Event) => any, useCapture?: boolean): ChocolateChipStatic; + + /** + * Add a delegated event to listen for the provided event on the descendant elements. + * + * @param selector A string defining the descendant elements are listening for the event. + * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. + * @param handler A function handler assigned to this event. + * @param useCapture Setting the third argument to true will trigger event bubbling. The default is false. + */ + undelegate(selector: any, eventType: string | ChUIEventInterface, handler: (eventObject: Event) => any, useCapture?: boolean): ChocolateChipStatic; + + /** + * Add a handler to an event for elements. If a selector is provided as the second argument, this implements a delegated event. + * + * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. + * @param selector A string defining the descendant elements are listening for the event. + * @param handler A function handler assigned to this event. + * @param useCapture Setting the third argument to true will trigger event bubbling. The default is false. + */ + on( eventType: string | ChUIEventInterface, selector: any, handler?: (eventObject: Event) => any, capturePhase?: boolean): ChocolateChipStatic; + + /** + * Remove a handler for an event from the elements. If the second argument is a selector, it tries to undelegate the event. + * If no arugments are provided, it removes all events from the element(s). + * + * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. + * @param selector A string defining the descendant elements are listening for the event. + * @param handler A function handler assigned to this event. + * @param useCapture Setting the third argument to true will trigger event bubbling. The default is false. + */ + off( eventType?: string | ChUIEventInterface, selector?: any, handler?: (eventObject: Event) => any, capturePhase?: boolean): ChocolateChipStatic; + + /** + * + */ + trigger(eventType: string | ChUIEventInterface): void; + + /** + * Center an element to the screen. + */ + UICenter(): void; + + /** + * Display a busy indicator. Posible options: {size: "100px", color: "#ff0000", position: "align-flush", duration: "2s"}. + * + * @param size The size as a string with length identifier: "40px". + * @param color The color for the busy indicator: "#ff0000". + * @param position Optional positioning, such as "align-flush". + * @param duration The time for the busy indicator to display: "500ms". + */ + UIBusy(options: UIBusyOptions): void; + + /** + * Close the currently displayed Popup. This is executed on the popup: $('#myPopup').UIPopupClose(). + */ + UIPopupClose(): void; + + /** + * Initialize a segmented control. Options: {selected: 2, callback: function() {console.log('Blah');}} + */ + UISegmented(options: UISegmentedOptions): void; + + /** + * This method allows the user to use a segmented control to toggle a set of panels. It is executed on the segmented control. + * The options id is the contain of the panels. The options callback is to execute when the user toggles a panel. + */ + UIPanelToggle(panelsContainer: string, callback: () => any): void; + + /** + * Make a list editable. This can be enabling changing the order of list items, or deleting them, or both. Options: {editLabel: "Edit", doneLabel: "Done", + * deleteLabel: "Delete", callback: function() {alert('Bye bye!');}, deletable: true, movable: true}. + */ + UIEditList(options: UIEditListOptions): void; + + /** + * Convert a simple list into a selection list. This converts the list into a radio button group, meaning only one can be selected at any time. + * You can name the radios buttons using the options name. Options: {name: "selectedNamesGroup", selected: 2, callback: function() {alert('hi');}} + */ + UISelectList(): void; + + /** + * Create a stepper control by executing it on a span with the class "stepper". Possible options: {start: 0, end: 10, defaultValue: 3}. + */ + UIStepper(options: UIStepperOptions): void; + + /** + * Initialize any existing switch controls: $('.switch').UISwitch(); + */ + UISwitch(): void; + + /** + * Execute this on a range control to initialize it. + */ + UIRange(): void; +} + +/** + * Interface for jQuery + */ + +interface JQueryStatic extends ChuiDetectors { + /** + * This method will concatenate strings or values as a cleaner alternative to using the '+' operator. + * + * @param string or number A comma separated series of strings to concatenate. + * @return string + */ + concat(...string: string[]): string; + + /** + * This function replicates normal array iteration with the context first, followed by the index. + * Usage: $.forEach([1,2,3], function(ctx, idx) { console.log(ctx + "is: " + (idx + 1)) }); + * + * @param obj An array-like object. This will usually be an array of HTML elements. + * @param callback A callback to execute with each iteration of the object. + * @param args Any extra arguments you wish to pass. + * @return void + */ + forEach(obj: T[], callback: (ctx: T, idx?: number) => any, args?: any): any; + + /** + * Alias for cross-platform events: pointerdown, MSPointerDown, touchstart and mousedown. + */ + eventStart: ChUIEventInterface; + + /** + * Alias for cross-platform events: pointerup, MSPointerUp, touchend and mouseup. + */ + eventEnd: ChUIEventInterface; + + /** + * Alias for cross-platform events: pointermove, MSPointerMove, touchmove and mousemove. + */ + eventMove: ChUIEventInterface; + + /** + * Alias for cross-platform events: pointercancel, MSPointerCancel, touchcancel and mouseout. + */ + eventCancel: ChUIEventInterface; + + /** + * Return the version of the current browser. + */ + browserVersion(): number; + + /** + * Hide the navigation bar, raising up the content below it. + */ + UIHideNavBar(): void; + + /** + * If the navigation bar is hidden, show it, pushing down the content to make room. + */ + UIShowNavBar(): void; + + /** + * Determine whether navigation is in progress or not. + */ + isNavigating: boolean; + + /** + * Navigate to the article indicated by the provided destination ID. This enters the destination into the navigation history array. + * + * param destination An id for the article to navigate to. + */ + UIGoToArticle(destination: string): void; + + /** + * Go back to the previous article from whence you came. This resets the navigation history array. + */ + UIGoBack(): void; + + /** + * Go back to the article indicated by the provided ID. This is for non-linear back navigation. This will reset the navigation history array to match the current state. + */ + UIGoBackToArticle(articleID: string): void; + + /** + * Display a transparent screen over the UI. This takes an optional, decimal-based number for opacity: .5 for 50%. + * + * @param opacity The percentage of opacity for the screen. + */ + UIBlock(opacity?: number): void; + + /** + * Remove the transparent screen covering the UI. + */ + UIUnblock(): void; + + /** + * Create and show a Popup with title and message. Possible options: {id: "#myPopup", title: "My Popup", + * message: "Woohoo!", cancelButton: "Forget It!", contiueButton: "Whatever", callback: function() {console.log('Blah!');}, empty: false }. + * + * param options UIPopupOptions + */ + UIPopup(options: UIPopupOptions): void; + + /** + * Create and show a Popover. Options: {id: "#myPopover", title: "Whatever", callback: function() {console.log('Blah!');}}. + * + * param options UIPopoverOptions + */ + UIPopover(options: UIPopoverOptions): void; + + /** + * Close any currently visible popovers. + */ + UIPopoverClose(): void; + + /** + * Create a segmented control: {id: "mySegments", className: "seggie", labels: ["one", "two","three"], selected: 1} + * + * param: options UICreateSegmentedOptions + */ + UICreateSegmented(options: UICreateSegmentedOptions): JQuery; + + /** + * Initialize a horiontal or vertical paging control. This uses a segmented control in the navigation bar with a class + * like "segmented paging horizontal" or "segmented paging vertical". It uses a single article with multiple sections to paginate. + */ + UIPaging(): void; + + /** + * Creates a sheet. Minimum option is an id: {id : 'starTrek', listClass :'enterprise', background: 'transparent', handle: false } + */ + UISheet(options: UISheetOptions): void; + + /** + * Show a sheet by passing this its ID. + */ + UIShowSheet(id: string): void; + + /** + * Hide any currently displayed sheets. + */ + UIHideSheet(): void; + + /** + * The body tag wrapped and ready to use: $.body.css('background-color','orange') + */ + body: JQuery; + + /** + * An array of the navigation history. Do not manipulate this. For examination only. This is used by navigation lists, etc. + */ + UINavigationHistory: string[]; + + /** + * Creates and initializes a slide out menu. Possible options: {dynamic: true, callback: function() { alert("Woohoo!");}} + */ + UISlideout: UISlideoutInterface; + + /** + * Reset the value of the stepper to its defaults at initialization. Pass it a reference to the stepper to reset. + */ + UIResetStepper(stepper: JQuery): void; + + /** + * Create a switch control. Possible options: { id: '#myId', name: 'fruit.mango', state: 'on', value: 'Mango', checked: 'on', style: 'traditional', callback: function() { alert('hi');}} + */ + UICreateSwitch(options: UICreateSwitchOptions): void; + + /** + * Creates a tabbar. On iOS this is at the bottom of the screen. On Android and Windows, it is at the top. + * Options: {id: 'mySpecialTabbar', tabs: 4, labels: ["Refresh", "Add", "Info", "Downloads", "Favorite"], icons: ["refresh", "add", "info", "downloads", "favorite"], selected: 2 } + */ + UITabbar(options: UITabbarOptions): void; + + /** + * Create a search bar for an article. Options: { articleId: '#products', id: 'productSearch', placeholder: 'Find a product', results: 5 } + */ + UISearch(options: UISearchOptions): void; + + /** + * Create and initialize a swipable carousel. Options: {target : '#myCarousel', panels: ['

    stuff

    ','

    more

    '], loop: true, pagination: true } + */ + UISetupCarousel(options: UISetupCarouselOptions): void; + + /** + * Bind the values of data-models to elements with data-controllers:

    . + * You can bind a single model to its controller by providing its name as the argument: $.UIBindData('input-value'); + * + * @param controller A string indicating the controller whose value a model is bound to. + */ + UIBindData(controller?: string): void; + + /** + * Unbind the values of data-models from their data-controllers. + * If you provide a controller name as the argument, only that controller will be unbound. + * + * @param controller A controller to unbind. + */ + UIUnBindData(controller?: string): void; + +} + +/** + * Interface for jQuery + */ +interface JQuery { + + /** + * Iterate over an Array object, executing a function for each matched element. + */ + //forEach(func: (ctx: any, idx: number) => void, JQuery: any): void; + forEach(callback: (ctx: Element, idx: number) => any): JQuery; + + /** + * Check the current matched set of elements against a selector or element and return it + * if it matches the given arguments. + * + * @param selector A string containing a selector expression to match elements against. + */ + iz(selector: string): JQuery; + + /** + * Check the current matched set of elements against a selector or element and return it + * if it matches the given arguments. + * + * @param elements One or more elements to match the current set of elements against. + */ + iz(element: any): JQuery; + + /** + * Check the current matched set of elements against a selector or element and return it + * if it does not match the given arguments. + * + * @param selector A string containing a selector expression to match elements against. + */ + iznt(selector: string): JQuery; + + /** + * Check the current matched set of elements against a selector or element and return it + * if it does not match the given arguments. + * + * @param elements One or more elements to match the current set of elements against. + */ + iznt(element: any): JQuery; + + /** + * Reduce the set of matched elements to those that have a descendant that matches the selector or DOM element. + * + * @param selector A string containing a selector expression to match elements against. + */ + haz(selector: string): JQuery; + /** + * Reduce the set of matched elements to those that have a descendant that matches the selector or DOM element. + * + * @param contained A DOM element to match elements against. + */ + haz(contained: Element): JQuery; + + /** + * Reduce the set of matched elements to those that have a descendant that does not match the selector or DOM element. + * + * @param selector A string containing a selector expression to match elements against. + */ + haznt(selector: string): JQuery; + /** + * Reduce the set of matched elements to those that have a descendant that does not match the selector or DOM element. + * + * @param contained A DOM element to match elements against. + */ + haznt(contained: Element): JQuery; + + /** + * Return any of the matched elements that have the given class. + * + * @param className The class name to search for. + */ + hazClass(className: string): JQuery; + + /** + * Return any of the matched elements that do not have the given class. + * + * @param className The class name to search for. + */ + hazntClass(className: string): JQuery; + + + /** + * Return any of the matched elements that have the given attribute. + * + * @param className The class name to search for. + */ + hazAttr(attributeName: string): JQuery; + + /** + * Return any of the matched elements that do not have the given attribute. + * + * @param className The class name to search for. + */ + hazntAttr(attributeName: string): JQuery; + + /** + * Center an element to the screen. + */ + UICenter(): void; + + /** + * Display a busy indicator. Posible options: {size: "100px", color: "#ff0000", position: "align-flush", duration: "2s"}. + * + * @param size The size as a string with length identifier: "40px". + * @param color The color for the busy indicator: "#ff0000". + * @param position Optional positioning, such as "align-flush". + * @param duration The time for the busy indicator to display: "500ms". + */ + UIBusy(options: UIBusyOptions): void; + + /** + * Close the currently displayed Popup. This is executed on the popup: $('#myPopup').UIPopupClose(). + */ + UIPopupClose(): void; + + /** + * Initialize a segmented control. Options: {selected: 2, callback: function() {console.log('Blah');}} + */ + UISegmented(options: UISegmentedOptions): void; + + /** + * This method allows the user to use a segmented control to toggle a set of panels. It is executed on the segmented control. + * The options id is the contain of the panels. The options callback is to execute when the user toggles a panel. + */ + UIPanelToggle(panelsContainer: string, callback: () => any): void; + + /** + * Make a list editable. This can be enabling changing the order of list items, or deleting them, or both. Options: {editLabel: "Edit", doneLabel: "Done", + * deleteLabel: "Delete", callback: function() {alert('Bye bye!');}, deletable: true, movable: true}. + */ + UIEditList(options: UIEditListOptions): void; + + /** + * Convert a simple list into a selection list. This converts the list into a radio button group, meaning only one can be selected at any time. + * You can name the radios buttons using the options name. Options: {name: "selectedNamesGroup", selected: 2, callback: function() {alert('hi');}} + */ + UISelectList(): void; + + /** + * Create a stepper control by executing it on a span with the class "stepper". Possible options: {start: 0, end: 10, defaultValue: 3}. + */ + UIStepper(options: UIStepperOptions): void; + + /** + * Initialize any existing switch controls: $('.switch').UISwitch(); + */ + UISwitch(): void; + + /** + * Execute this on a range control to initialize it. + */ + UIRange(): void; + + + /** + * Attach a handler to an event for the elements. + * + * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + */ + bind(eventType: string | ChUIEventInterface, eventData: any, handler: (eventObject: JQueryEventObject) => any): JQuery; + /** + * Attach a handler to an event for the elements. + * + * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. + * @param handler A function to execute each time the event is triggered. + */ + bind(eventType: string | ChUIEventInterface, handler: (eventObject: JQueryEventObject) => any): JQuery; + /** + * Attach a handler to an event for the elements. + * + * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. + * @param eventData An object containing data that will be passed to the event handler. + * @param preventBubble Setting the third argument to false will attach a function that prevents the default action from occurring and stops the event from bubbling. The default is true. + */ + bind(eventType: string | ChUIEventInterface, eventData: any, preventBubble: boolean): JQuery; + /** + * Attach a handler to an event for the elements. + * + * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. + * @param preventBubble Setting the third argument to false will attach a function that prevents the default action from occurring and stops the event from bubbling. The default is true. + */ + bind(eventType: string | ChUIEventInterface, preventBubble: boolean): JQuery; + + + delegate(selector: any, eventType: string | ChUIEventInterface, handler: (eventObject: JQueryEventObject) => any): JQuery; + delegate(selector: any, eventType: string | ChUIEventInterface, eventData: any, handler: (eventObject: JQueryEventObject) => any): JQuery; + + /** + * Remove an event handler. + * + * @param events One or more space-separated event types and optional namespaces, or just namespaces, such as "click", "keydown.myPlugin", or ".myPlugin". + * @param selector A selector which should match the one originally passed to .on() when attaching event handlers. + * @param handler A handler function previously attached for the event(s), or the special value false. + */ + off(events: string | ChUIEventInterface, selector?: string, handler?: (eventObject: JQueryEventObject) => any): JQuery; + /** + * Remove an event handler. + * + * @param events One or more space-separated event types and optional namespaces, or just namespaces, such as "click", "keydown.myPlugin", or ".myPlugin". + * @param handler A handler function previously attached for the event(s), or the special value false. + */ + off(events: string | ChUIEventInterface, handler: (eventObject: JQueryEventObject) => any): JQuery; + + /** + * Attach an event handler function for one or more events to the selected elements. + * + * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. Rest parameter args is for optional parameters passed to jQuery.trigger(). Note that the actual parameters on the event handler function must be marked as optional (? syntax). + */ + on(events: string | ChUIEventInterface, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; + /** + * Attach an event handler function for one or more events to the selected elements. + * + * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: string | ChUIEventInterface, data : any, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; + /** + * Attach an event handler function for one or more events to the selected elements. + * + * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: string | ChUIEventInterface, selector: string, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery; + /** + * Attach an event handler function for one or more events to the selected elements. + * + * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: string | ChUIEventInterface, selector: string, data: any, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery; + + /** + * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. + * + * @param events A string containing one or more JavaScript event types, such as "click" or "submit," or custom event names. + * @param handler A function to execute at the time the event is triggered. + */ + one(events: string | ChUIEventInterface, handler: (eventObject: JQueryEventObject) => any): JQuery; + /** + * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. + * + * @param events A string containing one or more JavaScript event types, such as "click" or "submit," or custom event names. + * @param data An object containing data that will be passed to the event handler. + * @param handler A function to execute at the time the event is triggered. + */ + one(events: string | ChUIEventInterface, data: Object, handler: (eventObject: JQueryEventObject) => any): JQuery; + + /** + * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. + * + * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + one(events: string | ChUIEventInterface, selector: string, handler: (eventObject: JQueryEventObject) => any): JQuery; + /** + * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. + * + * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + one(events: string | ChUIEventInterface, selector: string, data: any, handler: (eventObject: JQueryEventObject) => any): JQuery; + + /** + * Execute all handlers and behaviors attached to the matched elements for the given event type. + * + * @param eventType A string containing a JavaScript event type, such as click or submit. + * @param extraParameters Additional parameters to pass along to the event handler. + */ + trigger(eventType: string | ChUIEventInterface, extraParameters?: any[]|Object): JQuery; + + /** + * Execute all handlers attached to an element for an event. + * + * @param eventType A string containing a JavaScript event type, such as click or submit. + * @param extraParameters An array of additional parameters to pass along to the event handler. + */ + triggerHandler(eventType: string | ChUIEventInterface, ...extraParameters: any[]): Object; + + /** + * Remove a previously-attached event handler from the elements. + * + * @param eventType A string containing a JavaScript event type, such as click or submit. + * @param handler The function that is to be no longer executed. + */ + unbind(eventType?: string | ChUIEventInterface, handler?: (eventObject: JQueryEventObject) => any): JQuery; + /** + * Remove a previously-attached event handler from the elements. + * + * @param eventType A string containing a JavaScript event type, such as click or submit. + * @param fls Unbinds the corresponding 'return false' function that was bound using .bind( eventType, false ). + */ + unbind(eventType: string | ChUIEventInterface, fls: boolean): JQuery; + + /** + * Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements. + * + * @param selector A selector which will be used to filter the event results. + * @param eventType A string containing a JavaScript event type, such as "click" or "keydown" + * @param handler A function to execute at the time the event is triggered. + */ + undelegate(selector: string | ChUIEventInterface, eventType: string, handler?: (eventObject: JQueryEventObject) => any): JQuery; + /** + * Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements. + * + * @param selector A selector which will be used to filter the event results. + * @param events An object of one or more event types and previously bound functions to unbind from them. + */ + undelegate(selector: string | ChUIEventInterface, events: Object): JQuery; +} + +interface UISetupCarouselOptions { + target: string; + panels: HTMLElement[] | JQuery; + loop?: boolean; + pagination?: boolean; +} + +interface UISearchOptions { + articleId?: string; + id?: string; + placeholder?: string; + results?: number; +} + +interface UITabbarOptions { + id?: string; + tabs: number; + labels: string[]; + icons?: string[]; + selected?: number; +} + +interface UICreateSwitchOptions { + id?: string; + name?: string; + state?: string; + value?: string | number; + checked?: string; + style?: string; + callback?: () => any; +} + +/** + * Interface for UISlideout. + */ +interface UISlideoutInterface { + /** + * Creates and initializes a slide out menu. Possible options: {dynamic: true, callback: function() { alert("Woohoo!");}} + */ + (options: UISlideoutOptions): void; + + /** + * Populates a slideout menu. + */ + populate(array: Object[]): void; +} + +interface UIStepperOptions { + start: number; + end: number; + defaultValue?: number; +} + +interface ChUIEventInterface { + eventStart: string; + eventEnd: string; + eventMove: string; + eventCancel: string; +} + +interface UIBusyOptions { + size?: string; + color?: string; + position?: string | boolean; + duration?: string; +} + +interface UIPopupOptions { + id?: string; + title?: string; + message?: string; + cancelButton?: string; + continueButton?: string; + callback?: Function; + empty?: boolean; +} + +interface UIPopoverOptions { + id?: string; + callback?: Function; + title?: string; +} + +interface UICreateSegmentedOptions { + id?: string; + className?: string; + labels?: string[]; + selected?: number +} + +interface UISegmentedOptions { + selected?: number; + callback?: Function; +} + +interface UIEditListOptions { + editLabel?: string; + doneLabel?: string; + deleteLabel?: string; + callback?: Function; + deletable?: boolean; + movable?: boolean; +} + +interface UISelectListOptions { + name?: string; + selected?: number; + callback?: Function; +} + +interface UISheetOptions { + id?: string; + listClass?: string; + background?: string; + handle?: boolean; +} + +interface UISlideoutOptions { + dynamic?: boolean; + callback?: Function; + position?: string; +} + + +/** + * The interface used to construct jQuery events (with $.Event). It is + * defined separately instead of inline in JQueryStatic to allow + * overriding the construction function with specific strings + * returning specific event objects. + */ +interface JQueryEventConstructor { + (name: string, eventProperties?: any): JQueryEventObject; + new (name: string, eventProperties?: any): JQueryEventObject; +} + +interface JQueryEventInterface { + Event: JQueryEventConstructor; +} + +/** + * Interface of the JQuery extension of the W3C event object + */ +interface BaseJQueryEventObject extends Event { + +} +interface JQueryEventObject extends BaseJQueryEventObject, JQueryInputEventObject, JQueryMouseEventObject, JQueryKeyEventObject { +} + +/** + * Interface of the JQuery extension of the W3C event object + */ +interface BaseJQueryEventObject extends Event { + +} + +interface JQueryInputEventObject extends BaseJQueryEventObject { + +} + +interface JQueryMouseEventObject extends JQueryInputEventObject { + +} + +interface JQueryKeyEventObject extends JQueryInputEventObject { + +} + +interface JQueryEventObject extends BaseJQueryEventObject, JQueryInputEventObject, JQueryMouseEventObject, JQueryKeyEventObject { +} + +/** + * Interface for detectors. + */ + interface ChuiDetectors { + + /** + * Whether device is iPhone. + */ + isiPhone: boolean; + + /** + * Whether device is iPad. + */ + isiPad: boolean; + + /** + * Whether device is iPod. + */ + isiPod: boolean; + + /** + * Whether OS is iOS. + */ + isiOS: boolean; + + /** + * Whether OS is Android + */ + isAndroid: boolean; + + /** + * Whether OS is WebOS. + */ + isWebOS: boolean; + + /** + * Whether OS is Blackberry. + */ + isBlackberry: boolean; + + /** + * Whether OS supports touch events. + */ + isTouchEnabled: boolean; + + /** + * Whether there is a network connection. + */ + isOnline: boolean; + + /** + * Whether app is running in stanalone mode. + */ + isStandalone: boolean; + + /** + * Whether OS i iOS 7. + */ + isiOS7: boolean; + + /** + * Whether OS i iOS 7. + */ + isiOS8: boolean; + + /** + * Whether OS i iOS 7. + */ + isiOS9: boolean; + + /** + * Whether OS is Windows. + */ + isWin: boolean; + + /** + * Whether device is Windows Phone. + */ + isWinPhone: boolean; + + /** + * Whether browser is IE10. + */ + isIE10: boolean; + + /** + * Whether browser is IE11. + */ + isIE11: boolean; + /** + * Whether browser is Microsoft Edge or not. + */ + isIEEdge: boolean; + + /** + * Whether browser is Webkit based. + */ + isWebkit: boolean; + + /** + * Whether browser is running on mobile device. + */ + isMobile: boolean; + + /** + * Whether browser is running on desktop. + */ + isDesktop: boolean; + + /** + * Whether browser is Safari. + */ + isSafari: boolean; + + /** + * Whether browser is Chrome. + */ + isChrome: boolean; + + /** + * Is native Android browser (not mobile Chrome). + */ + isNativeAndroid: boolean; + + /** + * Whether screen is at least 960 pixels wide. + */ + isWideScreen: boolean; + + /** + * Whether screen is at least 960 pixels wide and in portrait orientation. + */ + isWideScreenPortrait: boolean; + } \ No newline at end of file From 064c4ac050b6ed78cd4bebcb3ea63eee8a42087b Mon Sep 17 00:00:00 2001 From: sourcebits-robertbiggs Date: Tue, 23 Jun 2015 16:40:06 -0700 Subject: [PATCH 0157/1358] Fixed syntax error. --- chui/chui.d.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/chui/chui.d.ts b/chui/chui.d.ts index 3b8fe70c27..614b9bb8bb 100644 --- a/chui/chui.d.ts +++ b/chui/chui.d.ts @@ -1,5 +1,4 @@ - -// Type definitions for chui v3.8.9 +// Type definitions for chui v3.8.10 // Project: https://github.com/chocolatechipui/chocolatechip-ui // Definitions by: Robert Biggs // Definitions: https://github.com/borisyankov/DefinitelyTyped From 48c7e15a9ff9cce45bb87e5a118d943d467d7eef Mon Sep 17 00:00:00 2001 From: "stephen.lautier" Date: Wed, 24 Jun 2015 01:45:21 +0200 Subject: [PATCH 0158/1358] renamed module from eqjs to eq due to unit tests failing error TS2300: Duplicate identifier 'eqjs' --- eqjs/eqjs.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eqjs/eqjs.d.ts b/eqjs/eqjs.d.ts index 9ff2d34683..198fee0f90 100644 --- a/eqjs/eqjs.d.ts +++ b/eqjs/eqjs.d.ts @@ -3,14 +3,14 @@ // Definitions by: Stephen Lautier // Definitions: https://github.com/borisyankov/DefinitelyTyped -declare var eqjs: eqjs.EqjsStatic; +declare var eqjs: eq.EqjsStatic; // Support AMD require declare module 'eqjs' { export = eqjs; } -declare module eqjs { +declare module eq { type AvailableElementType = HTMLElement|HTMLElement[]|NodeList|JQuery; interface EqjsStatic { From eff6f5ec54ec73d7b9ad2cc2f7af7495958a12ee Mon Sep 17 00:00:00 2001 From: Trevor Baron Date: Tue, 23 Jun 2015 20:48:31 -0400 Subject: [PATCH 0159/1358] change fromEvent to allow element of any type this function can take a wide range of types for element as seen from docs: https://github.com/Reactive-Extensions/RxJS/blob/master/doc/api/core/operators/fromevent.md "element (Any): The DOMElement, NodeList, jQuery element, Zepto Element, Angular element, Ember.js element or EventEmitter to attach a listener. For Backbone.Marionette this would be the application or an EventAggregator object." --- rx/rx.async-lite.d.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/rx/rx.async-lite.d.ts b/rx/rx.async-lite.d.ts index f86dc326f3..94eb398007 100644 --- a/rx/rx.async-lite.d.ts +++ b/rx/rx.async-lite.d.ts @@ -65,8 +65,7 @@ declare module Rx { (func: Function, context?: any): (...args: any[]) => Observable; }; - fromEvent(element: NodeList, eventName: string, selector?: (arguments: any[]) => T): Observable; - fromEvent(element: Node, eventName: string, selector?: (arguments: any[]) => T): Observable; + fromEvent(element: any, eventName: string, selector?: (arguments: any[]) => T): Observable; fromEventPattern(addHandler: (handler: Function) => void, removeHandler: (handler: Function) => void, selector?: (arguments: any[])=>T): Observable; } } From 1740c40614e1c9480a801c9aba69c4a032b4208d Mon Sep 17 00:00:00 2001 From: Gildor Date: Tue, 23 Jun 2015 18:03:16 -0700 Subject: [PATCH 0160/1358] fix d3 bisector type signature --- d3/d3.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/d3/d3.d.ts b/d3/d3.d.ts index be329db811..e6e1941c94 100644 --- a/d3/d3.d.ts +++ b/d3/d3.d.ts @@ -1090,8 +1090,8 @@ declare module d3 { export function bisectRight(array: T[], x: T, lo?: number, hi?: number): number; export function bisector(accessor: (x: T) => U): { - left: (array: T[], x: T, lo?: number, hi?: number) => number; - right: (array: T[], x: T, lo?: number, hi?: number) => number; + left: (array: T[], x: U, lo?: number, hi?: number) => number; + right: (array: T[], x: U, lo?: number, hi?: number) => number; } export function bisector(comparator: (a: T, b: U) => number): { From a14d724826174d1669d4df04c80f4838b7e71fdf Mon Sep 17 00:00:00 2001 From: itokentr Date: Wed, 24 Jun 2015 15:32:49 +0900 Subject: [PATCH 0161/1358] glob: Update to 5.0.10 --- glob/glob.d.ts | 123 ++++++++++++++++++++++++++++++++----------------- 1 file changed, 82 insertions(+), 41 deletions(-) diff --git a/glob/glob.d.ts b/glob/glob.d.ts index a15417f72c..6e97143758 100644 --- a/glob/glob.d.ts +++ b/glob/glob.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Glob +// Type definitions for Glob 5.0.10 // Project: https://github.com/isaacs/node-glob // Definitions by: vvakame // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -9,63 +9,104 @@ declare module "glob" { import events = require("events"); + import fs = require('fs'); import minimatch = require("minimatch"); - function G(pattern:string, cb:(err:Error, matches:string[])=>void):void; - - function G(pattern:string, options:G.IOptions, cb:(err:Error, matches:string[])=>void):void; + function G(pattern: string, cb: (err: Error, matches: string[]) => void): void; + function G(pattern: string, options: G.IOptions, cb: (err: Error, matches: string[]) => void): void; module G { - function sync(pattern:string, options?:IOptions):string[]; + function sync(pattern: string, options?: IOptions): string[]; - var Glob:IGlobStatic; + function hasMagic(pattern: string, options?: IOptions): boolean; + + var Glob: IGlobStatic; + var GlobSync: IGlobSyncStatic; interface IOptions extends minimatch.IOptions { cwd?: string; - sync?: boolean; + root?: string; + dot?: boolean; nomount?: boolean; - matchBase?:any; - noglobstar?:any; + mark?: boolean; + nosort?: boolean; + stat?: boolean; + silent?: boolean; strict?: boolean; - dot?:boolean; - mark?:boolean; - nounique?:boolean; - nonull?:boolean; - nosort?:boolean; - nocase?:boolean; - stat?:boolean; - debug?:boolean; - globDebug?:boolean; - silent?:boolean; + cache?: { [path: string]: any /* boolean | string | string[] */ }; + statCache?: { [path: string]: fs.Stats }; + symlinks?: any; + sync?: boolean; + nounique?: boolean; + nonull?: boolean; + debug?: boolean; + nobrace?: boolean; + noglobstar?: boolean; + noext?: boolean; + nocase?: boolean; + matchBase?: any; + nodir?: boolean; + ignore?: any; /* string | string[] */ + follow?: boolean; + realpath?: boolean; + nonegate?: boolean; + nocomment?: boolean; + + /** Deprecated. */ + globDebug?: boolean; } interface IGlobStatic extends events.EventEmitter { - new (pattern:string, cb?:(err:Error, matches:string[])=>void):IGlob; - new (pattern:string, options:any, cb?:(err:Error, matches:string[])=>void):IGlob; + new (pattern: string, cb?: (err: Error, matches: string[]) => void): IGlob; + new (pattern: string, options: IOptions, cb?: (err: Error, matches: string[]) => void): IGlob; + prototype: IGlob; } - interface IGlob { - EOF:any; - paused:boolean; - maxDepth:number; - maxLength:number; - cache:any; - statCache:any; - changedCwd:boolean; - cwd: string; - root: string; - error: any; - aborted: boolean; - minimatch: minimatch.IMinimatch; - matches:string[]; + interface IGlobSyncStatic { + new (pattern: string, options?: IOptions): IGlobBase + prototype: IGlobBase; + } - log(...args:any[]):void; - abort():void; - pause():void; - resume():void; - emitMatch(m:any):void; + interface IGlobBase { + minimatch: minimatch.IMinimatch; + options: IOptions; + aborted: boolean; + cache: { [path: string]: any /* boolean | string | string[] */ }; + statCache: { [path: string]: fs.Stats }; + symlinks: { [path: string]: boolean }; + realpathCache: { [path: string]: string }; + found: string[]; + } + + interface IGlob extends IGlobBase, events.EventEmitter { + pause(): void; + resume(): void; + abort(): void; + + /** Deprecated. */ + EOF: any; + /** Deprecated. */ + paused: boolean; + /** Deprecated. */ + maxDepth: number; + /** Deprecated. */ + maxLength: number; + /** Deprecated. */ + changedCwd: boolean; + /** Deprecated. */ + cwd: string; + /** Deprecated. */ + root: string; + /** Deprecated. */ + error: any; + /** Deprecated. */ + matches: string[]; + /** Deprecated. */ + log(...args: any[]): void; + /** Deprecated. */ + emitMatch(m: any): void; } } -export = G; + export = G; } From 53b3ea17dbef2e6ba4567a56f30a1ba7bc709948 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 24 Jun 2015 09:46:13 +0200 Subject: [PATCH 0162/1358] renamed eqjs to eq.js to match bower name as per review changes --- eqjs/eqjs.d.ts => eq.js/eq.js.d.ts | 0 eqjs/eqjs.tests.ts => eq.js/eq.js.tests.ts | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename eqjs/eqjs.d.ts => eq.js/eq.js.d.ts (100%) rename eqjs/eqjs.tests.ts => eq.js/eq.js.tests.ts (100%) diff --git a/eqjs/eqjs.d.ts b/eq.js/eq.js.d.ts similarity index 100% rename from eqjs/eqjs.d.ts rename to eq.js/eq.js.d.ts diff --git a/eqjs/eqjs.tests.ts b/eq.js/eq.js.tests.ts similarity index 100% rename from eqjs/eqjs.tests.ts rename to eq.js/eq.js.tests.ts From 9a5e66cbe6729f2d0d3e167448b7c0980fe2ce20 Mon Sep 17 00:00:00 2001 From: vojtechhabarta Date: Wed, 24 Jun 2015 15:42:18 +0200 Subject: [PATCH 0163/1358] added definition for tabtab node module --- tabtab/tabtab-tests.ts | 31 ++++++++++++++ tabtab/tabtab.d.ts | 91 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 122 insertions(+) create mode 100644 tabtab/tabtab-tests.ts create mode 100644 tabtab/tabtab.d.ts diff --git a/tabtab/tabtab-tests.ts b/tabtab/tabtab-tests.ts new file mode 100644 index 0000000000..3204b7a05f --- /dev/null +++ b/tabtab/tabtab-tests.ts @@ -0,0 +1,31 @@ + +/// +/// + +import tabtab = require('tabtab'); +import child_process = require('child_process'); +import string_decoder = require('string_decoder'); + +if (process.argv.slice(2)[0] === 'completion') { + tabtab.complete('pkgname', function(err, data) { + if (err || !data) return; + if (/^--\w?/.test(data.last)) return tabtab.log(['help', 'version'], data, '--'); + if (/^-\w?/.test(data.last)) return tabtab.log(['n', 'o', 'd', 'e'], data, '-'); + tabtab.log(['list', 'of', 'commands'], data); + + child_process.exec('rake -H', function(err, stdout, stderr) { + if (err) return; + var decoder = new string_decoder.StringDecoder('utf8'); + var parsed = tabtab.parseOut(decoder.write(stdout)); + if (/^--\w?/.test(data.last)) return tabtab.log(parsed.longs, data, '--'); + if (/^-\w?/.test(data.last)) return tabtab.log(parsed.shorts, data, '-'); + }); + + child_process.exec('cake', function(err, stdout, stderr) { + if (err) return; + var decoder = new string_decoder.StringDecoder('utf8'); + var tasks = tabtab.parseTasks(decoder.write(stdout), 'cake'); + tabtab.log(tasks, data); + }); + }); +} diff --git a/tabtab/tabtab.d.ts b/tabtab/tabtab.d.ts new file mode 100644 index 0000000000..a744904acc --- /dev/null +++ b/tabtab/tabtab.d.ts @@ -0,0 +1,91 @@ +// Type definitions for tabtab 0.0.4 +// Project: https://github.com/mklabs/node-tabtab +// Definitions by: Vojtěch Habarta +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "tabtab" { + + /** + * Main completion method, has support for installation and actual completion. + * @param name Name of the command to complete. + * @param cb Get called when a tab-completion command happens. + */ + export function complete(name: string, cb: CallBack): void; + + /** + * Main completion method, has support for installation and actual completion. + * @param name Name of the command to complete. + * @param completer Name of the command to call on completion. + * @param cb Get called when a tab-completion command happens. + */ + export function complete(name: string, completer: string, cb: CallBack): void; + + /** + * Simple helper function to know if the script is run in the context of a completion command. + */ + export function isComplete(): boolean; + + /** + * Helper to return the list of short and long options, parsed from the usual --help output of a command (cake/rake -H, vagrant, commander -h, optimist.help(), ...). + */ + export function parseOut(str: string): { shorts: string[]; longs: string[] }; + + /** + * Same purpose as parseOut, but for parsing tasks from an help command (cake/rake -T, vagrant, etc.). + */ + export function parseTasks(str: string, prefix: string, reg?: RegExp|string): string[]; + + /** + * Helper to return completion output and log to standard output. + * @param values Array of values to complete against. + * @param data The data object returned by the complete callback, used mainly to filter results accordingly upon the text that is supplied by the user. + * @param prefix A prefix to add to the completion results, useful for options to add dashes (eg. - or --). + */ + export function log(values: string[], data: Data, prefix?: string): void; + + interface CallBack { + (error?: Error, data?: Data, text?: string): any; + } + + /** + * Holds interesting values to drive the output of the completion. + */ + interface Data { + + /** + * full command being completed + */ + line: string; + + /** + * number of words + */ + words: number; + + /** + * cursor position + */ + point: number; + + /** + * tabing in the middle of a word: foo bar baz bar foobarrrrrrr + */ + partial: string; + + /** + * last word of the line + */ + last: string; + + /** + * last partial of the line + */ + lastPartial: string; + + /** + * the previous word + */ + prev: string; + } + +} From 1ad082faf4e6211484cc79275c7ca15ae684125f Mon Sep 17 00:00:00 2001 From: Peter Kooijmans Date: Wed, 24 Jun 2015 15:51:37 +0200 Subject: [PATCH 0164/1358] Update long.js typing to version 2.2.5. --- long/long-tests.ts | 87 +++++++++++++++++++++------ long/long.d.ts | 142 +++++++++++++++++++++------------------------ 2 files changed, 135 insertions(+), 94 deletions(-) diff --git a/long/long-tests.ts b/long/long-tests.ts index c1a05f576b..928cc94530 100644 --- a/long/long-tests.ts +++ b/long/long-tests.ts @@ -1,68 +1,117 @@ /// -// --- commonjs --- import Long = require("long"); -// --- browser --- -//var Long = dcodeIO.Long; -var val:dcodeIO.Long; -var n:number; -var b:boolean; -var s:string; +var val: Long; +var n: number = 42; +var b: boolean = true; +var s: string = "1337"; +val = new Long(0xFFFFFFFF, 0x7FFFFFFF, true); val = new Long(0xFFFFFFFF, 0x7FFFFFFF); +val = new Long(0xFFFFFFFF); -val = Long.from28Bits(0xFFFFFFF, 0xFFFFFFF, 0xFF); - -val = Long.fromInt(-1, true); n = val.low; n = val.high; b = val.unsigned; -s = val.toString(); val = val.add(val); +val = val.add(n); +val = val.add(s); + val = val.and(val); -val = val.clone(); +val = val.and(n); +val = val.and(s); + n = val.compare(val); +n = val.compare(n); +n = val.compare(s); + val = val.div(val); +val = val.div(n); +val = val.div(s); + b = val.equals(val); +b = val.equals(n); +b = val.equals(s); + n = val.getHighBits(); n = val.getHighBitsUnsigned(); n = val.getLowBits(); n = val.getLowBitsUnsigned(); n = val.getNumBitsAbs(); + b = val.greaterThan(val); +b = val.greaterThan(n); +b = val.greaterThan(s); + b = val.greaterThanOrEqual(val); +b = val.greaterThanOrEqual(n); +b = val.greaterThanOrEqual(s); + b = val.isEven(); b = val.isNegative(); b = val.isOdd(); +b = val.isPositive(); b = val.isZero(); + b = val.lessThan(val); +b = val.lessThan(n); +b = val.lessThan(s); + b = val.lessThanOrEqual(val); +b = val.lessThanOrEqual(n); +b = val.lessThanOrEqual(s); + val = val.modulo(val); +val = val.modulo(n); +val = val.modulo(s); + val = val.multiply(val); +val = val.multiply(n); +val = val.multiply(s); + val = val.negate(); val = val.not(); + b = val.notEquals(val); +b = val.notEquals(n); +b = val.notEquals(s); + val = val.or(val); +val = val.or(n); +val = val.or(s); + val = val.shiftLeft(2); +val = val.shiftLeft(val); + val = val.shiftRight(1); +val = val.shiftRight(val); + val = val.shiftRightUnsigned(1); +val = val.shiftRightUnsigned(val); + val = val.subtract(val); +val = val.subtract(n); +val = val.subtract(s); + n = val.toInt(); n = val.toNumber(); val = val.toSigned(); -val = val.toUnsigned(); -val = val.xor(val); -val = Long.MAX_SIGNED_VALUE; +s = val.toString(); +s = val.toString(n); + +val = val.toUnsigned(); + +val = val.xor(val); +val = val.xor(n); +val = val.xor(s); + val = Long.MAX_UNSIGNED_VALUE; val = Long.MAX_VALUE; -val = Long.MIN_SIGNED_VALUE; -val = Long.MIN_UNSIGNED_VALUE; val = Long.MIN_VALUE; val = Long.NEG_ONE; val = Long.ONE; +val = Long.UZERO; val = Long.ZERO; - - diff --git a/long/long.d.ts b/long/long.d.ts index 3d6554017e..5c3704a816 100644 --- a/long/long.d.ts +++ b/long/long.d.ts @@ -1,80 +1,72 @@ -// Type definitions for Long.js 1.1.2 +// Type definitions for Long.js v2.2.5 // Project: https://github.com/dcodeIO/Long.js -// Definitions by: Toshihide Hara +// Definitions by: Peter Kooijmans // Definitions: https://github.com/borisyankov/DefinitelyTyped -declare module dcodeIO { - - interface LongStatic { - new(low:number, high:number, unsigned?:boolean):Long; - - MAX_SIGNED_VALUE:Long; - MAX_UNSIGNED_VALUE:Long; - MAX_VALUE:Long; - MIN_SIGNED_VALUE:Long; - MIN_UNSIGNED_VALUE:Long; - MIN_VALUE:Long; - NEG_ONE:Long; - ONE:Long; - ZERO:Long; - - from28Bits(part0:number, part1:number, part2:number, unsigned?:boolean):Long; - fromBits(lowBits:number, highBits:number, unsigned?:boolean):Long; - fromInt(value:number, unsigned?:boolean):Long; - fromNumber(value:number, unsigned?:boolean):Long; - fromString(str:string, unsigned?:boolean, radix?:number):Long; - fromString(str:string, unsigned?:number, radix?:number):Long; - fromString(str:string, unsigned?:any, radix?:number):Long; - } - - interface Long { - high:number; - low:number; - unsigned:boolean; - - add(other:Long):Long; - and(other:Long):Long; - clone():Long; - compare(other:Long):number; - div(other:Long):Long; - equals(other:Long):boolean; - getHighBits():number; - getHighBitsUnsigned():number; - getLowBits():number; - getLowBitsUnsigned():number; - getNumBitsAbs():number; - greaterThan(other:Long):boolean; - greaterThanOrEqual(other:Long):boolean; - isEven():boolean; - isNegative():boolean; - isOdd():boolean; - isZero():boolean; - lessThan(other:Long):boolean; - lessThanOrEqual(other:Long):boolean; - modulo(other:Long):Long; - multiply(other:Long):Long; - negate():Long; - not():Long; - notEquals(other:Long):boolean; - or(other:Long):Long; - shiftLeft(numBits:number):Long; - shiftRight(numBits:number):Long; - shiftRightUnsigned(numBits:number):Long; - subtract(other:Long):Long; - toInt():number; - toNumber():number; - toSigned():Long; - toString(radix?:number):string; - toUnsigned():Long; - xor(other:Long):Long; - } - - // for browser - export var Long:LongStatic; -} - -// for node, commonjs declare module "long" { - var Long:dcodeIO.LongStatic; - export = Long; + + module Long { + export var MAX_UNSIGNED_VALUE: Long; + export var MAX_VALUE: Long; + export var MIN_VALUE: Long; + export var NEG_ONE: Long; + export var ONE: Long; + export var UONE: Long; + export var UZERO: Long; + export var ZERO: Long; + + export function fromBits(lowBits: number, highBits: number, unsigned?: boolean): Long; + export function fromInt(value: number, unsigned?: boolean): Long; + export function fromNumber(value: number, unsigned?: boolean): Long; + export function fromString(str: string, unsigned?: boolean | number, radix?: number): Long; + export function fromValue(val: Long | number | string): Long; + + export function isLong(obj: any): boolean; + } + + class Long { + high: number; + low: number; + unsigned :boolean; + + constructor(low: number, high?: number, unsigned?:boolean); + + add(other: Long | number | string): Long; + and(other: Long | number | string): Long; + compare(other: Long | number | string): number; + div(divisor: Long | number | string): Long; + equals(other: Long | number | string): boolean; + getHighBits(): number; + getHighBitsUnsigned(): number; + getLowBits(): number; + getLowBitsUnsigned(): number; + getNumBitsAbs(): number; + greaterThan(other: Long | number | string): boolean; + greaterThanOrEqual(other: Long | number | string): boolean; + isEven(): boolean; + isNegative(): boolean; + isOdd(): boolean; + isPositive(): boolean; + isZero(): boolean; + lessThan(other: Long | number | string): boolean; + lessThanOrEqual(other: Long | number | string): boolean; + modulo(divisor: Long | number | string): Long; + multiply(multiplier: Long | number | string): Long; + negate(): Long; + not(): Long; + notEquals(other: Long | number | string): boolean; + or(other: Long | number | string): Long; + shiftLeft(numBits: number | Long): Long; + shiftRight(numBits: number | Long): Long; + shiftRightUnsigned(numBits: number | Long): Long; + subtract(other: Long | number | string): Long; + toInt(): number; + toNumber(): number; + toSigned(): Long; + toString(radix?: number): string; + toUnsigned(): Long; + xor(other: Long | number | string): Long; + } + + export = Long; } From a3900b896f7b3361b79f9b503224777619907d53 Mon Sep 17 00:00:00 2001 From: itokentr Date: Wed, 24 Jun 2015 15:32:59 +0900 Subject: [PATCH 0165/1358] minimatch: Update to v2.0.8 --- minimatch/minimatch-tests.ts | 2 +- minimatch/minimatch.d.ts | 71 ++++++++++++++++++++++-------------- 2 files changed, 45 insertions(+), 28 deletions(-) diff --git a/minimatch/minimatch-tests.ts b/minimatch/minimatch-tests.ts index 382a2c0a8f..38c699e0f0 100644 --- a/minimatch/minimatch-tests.ts +++ b/minimatch/minimatch-tests.ts @@ -12,7 +12,7 @@ var r = m.makeRe(); var f = ["test.ts"]; mm.match(f, pattern, options); -mm.filter('foo')('bar'); +f.filter(mm.filter(pattern, options)); var s: string = "hello"; var b: boolean = mm(s, pattern, options); diff --git a/minimatch/minimatch.d.ts b/minimatch/minimatch.d.ts index 697f9e21fc..a79c6ff114 100644 --- a/minimatch/minimatch.d.ts +++ b/minimatch/minimatch.d.ts @@ -1,47 +1,64 @@ -// Type definitions for Minimatch 1.0.0 +// Type definitions for Minimatch 2.0.8 // Project: https://github.com/isaacs/minimatch // Definitions by: vvakame // Definitions: https://github.com/borisyankov/DefinitelyTyped declare module "minimatch" { - function M(target:string, pattern:string, options?:M.IOptions): boolean; + function M(target: string, pattern: string, options?: M.IOptions): boolean; module M { - function match(filenames:string[], pattern:string, options?:IOptions):string[]; - function filter(pattern:string, options?:IOptions): (target: string) => boolean; - - var Minimatch:IMinimatchStatic; + function match(list: string[], pattern: string, options?: IOptions): string[]; + function filter(pattern: string, options?: IOptions): (element: string, indexed: number, array: string[]) => boolean; + function makeRe(pattern: string, options?: IOptions): RegExp; + var Minimatch: IMinimatchStatic; + interface IOptions { - debug?:boolean; - nobrace?:boolean; - noglobstar?:boolean; - dot?:boolean; - noext?:boolean; - nocase?:boolean; - nonull?:boolean; - matchBase?:boolean; - nocomment?:boolean; - nonegate?:boolean; - flipNegate?:boolean; + debug?: boolean; + nobrace?: boolean; + noglobstar?: boolean; + dot?: boolean; + noext?: boolean; + nocase?: boolean; + nonull?: boolean; + matchBase?: boolean; + nocomment?: boolean; + nonegate?: boolean; + flipNegate?: boolean; } interface IMinimatchStatic { - new (pattern:string, options?:IOptions):IMinimatch; + new (pattern: string, options?: IOptions): IMinimatch; + prototype: IMinimatch; } interface IMinimatch { - debug():void; - make():void; - parseNegate():void; - braceExpand(pattern:string, options:IOptions):void; - parse(pattern:string, isSub?:boolean):void; - makeRe():RegExp; // regexp or boolean - match(file:string):boolean; - matchOne(files:string[], pattern:string[], partial:any):boolean; + pattern: string; + options: IOptions; + /** 2-dimensional array of regexp or string expressions. */ + set: any[][]; // (RegExp | string)[][] + regexp: RegExp; + negate: boolean; + comment: boolean; + empty: boolean; + + makeRe(): RegExp; // regexp or boolean + match(fname: string): boolean; + matchOne(files: string[], pattern: string[], partial: boolean): boolean; + + /** Deprecated. For internal use. */ + debug(): void; + /** Deprecated. For internal use. */ + make(): void; + /** Deprecated. For internal use. */ + parseNegate(): void; + /** Deprecated. For internal use. */ + braceExpand(pattern: string, options: IOptions): void; + /** Deprecated. For internal use. */ + parse(pattern: string, isSub?: boolean): void; } } -export = M; + export = M; } From 159edfacefca154b92f9a5c623538b4c95e81c28 Mon Sep 17 00:00:00 2001 From: Shearerbeard Date: Wed, 17 Jun 2015 19:36:40 -0600 Subject: [PATCH 0166/1358] typings for altjs flux library --- alt/alt.d.ts | 158 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 158 insertions(+) create mode 100644 alt/alt.d.ts diff --git a/alt/alt.d.ts b/alt/alt.d.ts new file mode 100644 index 0000000000..15bbc8e8e0 --- /dev/null +++ b/alt/alt.d.ts @@ -0,0 +1,158 @@ +// Type definitions for Alt 0.16.7 +// Project: https://github.com/goatslacker/alt +// Definitions by: Michael Shearer +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +/// + + +declare module AltJS { + + export interface StoreModel { + bindActions?( ...actions:Array); + exportPublicMethods?(exportConfig:M):void; + getState?():S; + exportAsync?(source:Source); + waitFor?(store:AltStore):void; + } + + export type Source = {[name:string]:() => SourceModel}; + + export interface SourceModel { + local( ...args:Array); + remote( ...args:Array); + shouldFetch?(state:Object, ...args:Array); + loading: ( ...args:Array) => void; + success:( ...args:Array) => void; + error:( ...args:Array) => void; + interceptResponse?(response:Object, action:AltJS.Action, ...args:Array); + } + + export interface AltStore { + getState():S; + listen(handler:(state:S) => any):() => void; + unlisten(handler:(state:S) => any):void; + emitChange():void; + getEventEmitter():EventEmitter3.EventEmitter; + } + + export enum lifeCycleEvents { + bootstrap, + snapshot, + init, + rollback, + error + } + + export type Actions = {[action:string]:Action}; + + export interface Action { + (T); + defer(data:any):void; + } + + export interface ActionsClass { + generateActions?( ...action:Array); + dispatch( ...payload:Array); + actions?:Actions; + } +} + +declare module "alt/utils/chromeDebug" { + function chromeDebug(alt:any):void; + export = chromeDebug; +} + +declare module "alt/AltContainer" { + + import * as React from "react"; + + interface ContainerProps { + store:AltJS.AltStore + } + + class AltContainer extends React.Component { + } + + export = AltContainer; +} + +declare module "alt" { + + import {Dispatcher} from "flux"; + + type StateTransform = (store:StoreModel) => AltJS.AltStore; + + interface AltConfig { + dispatcher?:Dispatcher; + serialize?:(data:Object) => string; + deserialize?:(serialized:string) => Object; + storeTransforms?:Array; + batchingFunction?:(callback:( ...data:Array) => any) => void; + } + + class Alt { + constructor(config?:AltConfig); + actions:AltJS.Actions; + bootstrap(data:string); + takeSnapshot( ...storeNames:Array):string; + flush():Object; + recycle( ...store:Array>); + rollback(); + dispatch(action?:AltJS.Action, data?:Object, details?:any); + addActions(actionsName:string, actions:AltJS.ActionsClass); + addStore(name:string, store:StoreModel, saveStore?:boolean); + getStore(name:string):AltJS.AltStore; + getActions(actionsName:string):AltJS.Actions; + createAction(name:string, implementation:AltJS.ActionsClass):AltJS.Action; + createAction(name:string, implementation:AltJS.ActionsClass, ...args:Array):AltJS.Action; + createActions(ActionsClass: ActionsClassConstructor, exportObj?: Object):T; + createActions(ActionsClass: ActionsClassConstructor, exportObj?: Object, ...constructorArgs:Array):T; + generateActions( ...action:Array):T; + createStore(store:StoreModel, name?:string):AltJS.AltStore; + } + + type ActionsClassConstructor = new (alt:Alt) => AltJS.ActionsClass; + + type ActionHandler = ( ...data:Array) => any; + type ExportConfig = {[key:string]:( ...args:Array) => any}; + + interface StoreReduce { + action:any; + data: any; + } + + interface StoreModel extends AltJS.StoreModel { + setState?(currentState:Object, nextState:Object):Object; + getState?():S; + onSerialize?(data:any):void; + onDeserialize?(data:any):void; + on?(event:AltJS.lifeCycleEvents, callback:() => any):void; + bindActions?(action:AltJS.Action, method:ActionHandler):void; + bindListeners?(config:{string: AltJS.Action | AltJS.Actions}); + waitFor?(dispatcherSource:any):void; + exportPublicMethods?(exportConfig:ExportConfig):void; + getInstance?():AltJS.AltStore; + emitChange?():void; + dispatcher?:Dispatcher; + alt?:Alt; + displayName?:string; + otherwise?(data:any, action:AltJS.Action); + reduce?(state:any, config:StoreReduce):Object; + preventDefault?(); + observe?(alt:Alt):any; + registerAsync?(datasource:AltJS.Source); + beforeEach?(payload:Object, state:Object); + afterEach?(payload:Object, state:Object); + unlisten?(); + } + + type StoreModelConstructor = (alt:Alt) => StoreModel; + + interface AltFactory { + new(config?:AltConfig):Alt; + } + + export = Alt; +} From bfd9f256783c15000d5a3e957ef06323650ea8db Mon Sep 17 00:00:00 2001 From: Shearerbeard Date: Wed, 24 Jun 2015 08:59:31 -0600 Subject: [PATCH 0167/1358] committing revisions to keep in sync with alt 0.16.10/0.17.0 --- alt/alt.d.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/alt/alt.d.ts b/alt/alt.d.ts index 15bbc8e8e0..7f74b069e0 100644 --- a/alt/alt.d.ts +++ b/alt/alt.d.ts @@ -1,10 +1,9 @@ -// Type definitions for Alt 0.16.7 +// Type definitions for Alt 0.16.10 // Project: https://github.com/goatslacker/alt // Definitions by: Michael Shearer // Definitions: https://github.com/borisyankov/DefinitelyTyped /// -/// declare module AltJS { @@ -34,7 +33,6 @@ declare module AltJS { listen(handler:(state:S) => any):() => void; unlisten(handler:(state:S) => any):void; emitChange():void; - getEventEmitter():EventEmitter3.EventEmitter; } export enum lifeCycleEvents { @@ -74,7 +72,7 @@ declare module "alt/AltContainer" { class AltContainer extends React.Component { } - + export = AltContainer; } From 458b73bddd5bd6306390b312dfc02bd17360b46d Mon Sep 17 00:00:00 2001 From: Christopher Glantschnig Date: Wed, 24 Jun 2015 20:37:49 +0200 Subject: [PATCH 0168/1358] added definitions for request-promise --- request-promise/request-promise.d.ts | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 request-promise/request-promise.d.ts diff --git a/request-promise/request-promise.d.ts b/request-promise/request-promise.d.ts new file mode 100644 index 0000000000..b2a6f2da2b --- /dev/null +++ b/request-promise/request-promise.d.ts @@ -0,0 +1,28 @@ +// Type definitions for request-promise (v0.4.2) +// Definitions by: Christopher Glantschnig + +/// +/// +/// +/// + +declare module 'request-promise' { + import request = require('request'); + import stream = require('stream'); + import http = require('http'); + import FormData = require('form-data'); + + export = RequestPromiseAPI; + + function RequestPromiseAPI(uri: string, options?: RequestPromiseAPI.Options): Promise; + function RequestPromiseAPI(uri: string): Promise; + function RequestPromiseAPI(options: RequestPromiseAPI.Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): request.Request; + + module RequestPromiseAPI { + export interface Options extends request.Options { + simple?: boolean; + transform?: (body: any, response: http.IncomingMessage) => number; + resolveWithFullResponse?: boolean; + } + } +} From a619d54c4fb4b0dde0d578f071a719c1ddf196d9 Mon Sep 17 00:00:00 2001 From: Christopher Glantschnig Date: Wed, 24 Jun 2015 20:57:15 +0200 Subject: [PATCH 0169/1358] added tests and updated header according to contribution guidelines --- request-promise/request-promise-tests.ts | 17 +++++++++++++++++ request-promise/request-promise.d.ts | 9 +++++---- 2 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 request-promise/request-promise-tests.ts diff --git a/request-promise/request-promise-tests.ts b/request-promise/request-promise-tests.ts new file mode 100644 index 0000000000..41a5eb80d3 --- /dev/null +++ b/request-promise/request-promise-tests.ts @@ -0,0 +1,17 @@ +/// + +import rp = require('request-promise'); + +rp('http://www.google.com') + .then(console.dir) + .catch(console.error); + +var options: rp.Options = { + uri : 'http://posttestserver.com/post.php', + method : 'POST' +}; + +rp(options) + .then(console.dir) + .catch(console.error); + diff --git a/request-promise/request-promise.d.ts b/request-promise/request-promise.d.ts index b2a6f2da2b..bdc2764a2d 100644 --- a/request-promise/request-promise.d.ts +++ b/request-promise/request-promise.d.ts @@ -1,5 +1,7 @@ -// Type definitions for request-promise (v0.4.2) -// Definitions by: Christopher Glantschnig +// Type definitions for request-promise v0.4.2 +// Project: https://www.npmjs.com/package/request-promise +// Definitions by: Christopher Glantschnig +// Definitions: https://github.com/borisyankov/DefinitelyTyped /// /// @@ -14,9 +16,8 @@ declare module 'request-promise' { export = RequestPromiseAPI; - function RequestPromiseAPI(uri: string, options?: RequestPromiseAPI.Options): Promise; + function RequestPromiseAPI(options: RequestPromiseAPI.Options): request.Request; function RequestPromiseAPI(uri: string): Promise; - function RequestPromiseAPI(options: RequestPromiseAPI.Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): request.Request; module RequestPromiseAPI { export interface Options extends request.Options { From d0e842e2f96893b86a2ea2d1e0a4dc504379cd69 Mon Sep 17 00:00:00 2001 From: Marc Sallin Date: Thu, 25 Jun 2015 00:21:40 +0200 Subject: [PATCH 0170/1358] Q: Support for the Q.noConflict() method. --- q/Q.d.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/q/Q.d.ts b/q/Q.d.ts index 2a239dc18e..8453d5e73d 100644 --- a/q/Q.d.ts +++ b/q/Q.d.ts @@ -316,6 +316,13 @@ declare module Q { * Calling resolve with a non-promise value causes promise to be fulfilled with that value. */ export function resolve(object: T): Promise; + + /** + * Resets the global "Q" variable to the value it has before Q was loaded. + * This will either be undefined if there was no version or the version of Q which was already loaded before. + * @returns { The last version of Q. } + */ + export function noConflict(): typeof Q; } declare module "q" { From 39293fc55d77b5089cf1bdc57b61d9c8a975975a Mon Sep 17 00:00:00 2001 From: shaban Date: Thu, 25 Jun 2015 01:48:44 +0200 Subject: [PATCH 0171/1358] Update ace.d.ts Add isClean and markClean methods. Reference https://github.com/ajaxorg/ace/issues/324 --- ace/ace.d.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ace/ace.d.ts b/ace/ace.d.ts index 4758b59e96..f0668da3c4 100644 --- a/ace/ace.d.ts +++ b/ace/ace.d.ts @@ -2609,6 +2609,16 @@ declare module AceAjax { * Returns `true` if there are redo operations left to perform. **/ hasRedo(): boolean; + + /** + * Returns `true` if the dirty counter is 0 + **/ + isClean(): boolean; + + /** + * Sets dirty counter to 0 + **/ + markClean(): void; } var UndoManager: { From 78b83e0c238c7da99d4ac88994f877d2d718a181 Mon Sep 17 00:00:00 2001 From: heycalmdown Date: Thu, 25 Jun 2015 09:12:31 +0900 Subject: [PATCH 0172/1358] lodash: Add _.matchesProperty style to _.find --- lodash/lodash-tests.ts | 10 +-- lodash/lodash.d.ts | 171 +++++++++++++---------------------------- 2 files changed, 58 insertions(+), 123 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 633c4ed0d4..193f87c08c 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -403,15 +403,13 @@ result = _([1, 2, 3, 4, 5, 6]).select(function (num) { return num % 2 result = _(foodsCombined).select('organic').value(); result = _(foodsCombined).select({ 'type': 'fruit' }).value(); -result = _.find([1, 2, 3, 4], function (num) { - return num % 2 == 0; -}); +result = _.find([1, 2, 3, 4], num => num % 2 == 0); result = _.find(foodsCombined, { 'type': 'vegetable' }); +result = _.find(foodsCombined, 'type', 'vegetable'); result = _.find(foodsCombined, 'organic'); -result = _([1, 2, 3, 4]).find(function (num) { - return num % 2 == 0; -}); +result = _([1, 2, 3, 4]).find(num => num % 2 == 0); result = _(foodsCombined).find({ 'type': 'vegetable' }); +result = _(foodsCombined).find('type', 'vegetable'); result = _(foodsCombined).find('organic'); result = _.detect([1, 2, 3, 4], function (num) { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 9cb55485d9..faf921c57c 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -2710,15 +2710,19 @@ declare module _ { //_.find interface LoDashStatic { /** - * Iterates over elements of a collection, returning the first element that the callback - * returns truey for. The callback is bound to thisArg and invoked with three arguments; - * (value, index|key, collection). + * Iterates over elements of collection, returning the first element predicate returns + * truthy for. The predicate is bound to thisArg and invoked with three arguments: + * (value, index|key, collection). * - * If a property name is provided for callback the created "_.pluck" style callback will - * return the property value of the given element. + * If a property name is provided for predicate the created _.property style callback + * returns the property value of the given element. * - * If an object is provided for callback the created "_.where" style callback will return + * If a value is also provided for thisArg the created _.matchesProperty style callback + * returns true for elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns * true for elements that have the properties of the given object, else false. + * * @param collection Searches for a value in this list. * @param callback The function called per iteration. * @param thisArg The this binding of callback. @@ -2728,6 +2732,10 @@ declare module _ { collection: Array, callback: ListIterator, thisArg?: any): T; + detect( + collection: Array, + callback: ListIterator, + thisArg?: any): T; /** * @see _.find @@ -2736,6 +2744,10 @@ declare module _ { collection: List, callback: ListIterator, thisArg?: any): T; + detect( + collection: List, + callback: ListIterator, + thisArg?: any): T; /** * @see _.find @@ -2744,74 +2756,6 @@ declare module _ { collection: Dictionary, callback: DictionaryIterator, thisArg?: any): T; - - /** - * @see _.find - * @param _.pluck style callback - **/ - find( - collection: Array, - whereValue: W): T; - - /** - * @see _.find - * @param _.pluck style callback - **/ - find( - collection: List, - whereValue: W): T; - - /** - * @see _.find - * @param _.pluck style callback - **/ - find( - collection: Dictionary, - whereValue: W): T; - - /** - * @see _.find - * @param _.where style callback - **/ - find( - collection: Array, - pluckValue: string): T; - - /** - * @see _.find - * @param _.where style callback - **/ - find( - collection: List, - pluckValue: string): T; - - /** - * @see _.find - * @param _.where style callback - **/ - find( - collection: Dictionary, - pluckValue: string): T; - - /** - * @see _.find - **/ - detect( - collection: Array, - callback: ListIterator, - thisArg?: any): T; - - /** - * @see _.find - **/ - detect( - collection: List, - callback: ListIterator, - thisArg?: any): T; - - /** - * @see _.find - **/ detect( collection: Dictionary, callback: DictionaryIterator, @@ -2819,50 +2763,37 @@ declare module _ { /** * @see _.find - * @param _.pluck style callback + * @param _.matches style callback **/ + find( + collection: Array|List|Dictionary, + whereValue: W): T; detect( - collection: Array, + collection: Array|List|Dictionary, whereValue: W): T; /** * @see _.find - * @param _.pluck style callback - **/ - detect( - collection: List, - whereValue: W): T; - - /** - * @see _.find - * @param _.pluck style callback - **/ - detect( - collection: Dictionary, - whereValue: W): T; - - /** - * @see _.find - * @param _.where style callback + * @param _.matchesProperty style callback **/ + find( + collection: Array|List|Dictionary, + path: string, + srcValue: any): T; detect( - collection: Array, + collection: Array|List|Dictionary, + path: string, + srcValue: any): T; + + /** + * @see _.find + * @param _.property style callback + **/ + find( + collection: Array|List|Dictionary, pluckValue: string): T; - - /** - * @see _.find - * @param _.where style callback - **/ detect( - collection: List, - pluckValue: string): T; - - /** - * @see _.find - * @param _.where style callback - **/ - detect( - collection: Dictionary, + collection: Array|List|Dictionary, pluckValue: string): T; /** @@ -2891,7 +2822,7 @@ declare module _ { /** * @see _.find - * @param _.pluck style callback + * @param _.matches style callback **/ findWhere( collection: Array, @@ -2899,7 +2830,7 @@ declare module _ { /** * @see _.find - * @param _.pluck style callback + * @param _.matches style callback **/ findWhere( collection: List, @@ -2907,7 +2838,7 @@ declare module _ { /** * @see _.find - * @param _.pluck style callback + * @param _.matches style callback **/ findWhere( collection: Dictionary, @@ -2915,7 +2846,7 @@ declare module _ { /** * @see _.find - * @param _.where style callback + * @param _.property style callback **/ findWhere( collection: Array, @@ -2923,7 +2854,7 @@ declare module _ { /** * @see _.find - * @param _.where style callback + * @param _.property style callback **/ findWhere( collection: List, @@ -2931,7 +2862,7 @@ declare module _ { /** * @see _.find - * @param _.where style callback + * @param _.property style callback **/ findWhere( collection: Dictionary, @@ -2947,14 +2878,20 @@ declare module _ { thisArg?: any): T; /** * @see _.find - * @param _.where style callback + * @param _.matches style callback */ find( whereValue: W): T; - /** * @see _.find - * @param _.where style callback + * @param _.matchesProperty style callback + */ + find( + path: string, + srcValue: any): T; + /** + * @see _.find + * @param _.property style callback */ find( pluckValue: string): T; From 661e01689612eeb784e931e4f5274d4ea5d588b7 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 25 Jun 2015 10:17:24 +0300 Subject: [PATCH 0173/1358] Update for karma-jasmine 0.3.3+ --- karma-jasmine/karma-jasmine-tests.ts | 4 ++-- karma-jasmine/karma-jasmine.d.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/karma-jasmine/karma-jasmine-tests.ts b/karma-jasmine/karma-jasmine-tests.ts index 6e7a8db9fa..19e5436129 100644 --- a/karma-jasmine/karma-jasmine-tests.ts +++ b/karma-jasmine/karma-jasmine-tests.ts @@ -1,7 +1,7 @@ /// -ddescribe("A suite", () => { - iit("contains spec with an expectation", () => { +fdescribe("A suite", () => { + fit("contains spec with an expectation", () => { expect(true).toBe(true); }); }); diff --git a/karma-jasmine/karma-jasmine.d.ts b/karma-jasmine/karma-jasmine.d.ts index e4cdc5a816..6f61ca26e8 100644 --- a/karma-jasmine/karma-jasmine.d.ts +++ b/karma-jasmine/karma-jasmine.d.ts @@ -5,5 +5,5 @@ /// -declare function ddescribe(description: string, specDefinitions: () => void): void; -declare function iit(expectation: string, assertion: () => void): void; +declare function fdescribe(description: string, specDefinitions: () => void): void; +declare function fit(expectation: string, assertion: () => void): void; From dbd0c4066421c223535ec003e564a02b7f3b8367 Mon Sep 17 00:00:00 2001 From: woutergd Date: Thu, 25 Jun 2015 15:29:26 +0200 Subject: [PATCH 0174/1358] Added animation and default controls --- openlayers3/openlayers3.d.ts | 193 +++++++++++++++++++++++++++++++++++ 1 file changed, 193 insertions(+) diff --git a/openlayers3/openlayers3.d.ts b/openlayers3/openlayers3.d.ts index d89c65ecca..7703a2d5ea 100644 --- a/openlayers3/openlayers3.d.ts +++ b/openlayers3/openlayers3.d.ts @@ -1413,13 +1413,206 @@ declare module ol { } // NAMESPACES + + /** + * The animation static methods are designed to be used with the ol.Map#beforeRender method. + */ module animation { + + /** + * Generate an animated transition that will "bounce" the resolution as it approaches the final value. + * @param options Bounce options. + */ + //TODO: return ol.PreRenderFunction + function bounce(options: AnimationBounceOptions): any; + interface AnimationBounceOptions { + + /** + * The resolution to start the bounce from, typically map.getView().getResolution(). + */ + resolution: number; + + /** + * The start time of the animation. Default is immediately. + */ + start?: number; + + /** + * The duration of the animation in milliseconds. Default is 1000. + */ + duration?: number; + + /** + * The easing function to use. Can be an ol.easing or a custom function. Default is ol.easing.upAndDown. + */ + // TODO: Check if it is an ol.easing function + easing: () => void; + } + + /** + * Generate an animated transition while updating the view center. + * @param options Pan options. + */ + //TODO: return ol.PreRenderFunction + function pan(options: AnimationPanOptions): any; + interface AnimationPanOptions { + + /** + * The resolution to start the bounce from, typically map.getView().getResolution(). + */ + source: ol.Coordinate; + + /** + * The start time of the animation. Default is immediately. + */ + start?: number; + + /** + * The duration of the animation in milliseconds. Default is 1000. + */ + duration?: number; + + /** + * The easing function to use. Can be an ol.easing or a custom function. Default is ol.easing.upAndDown. + */ + // TODO: Check if it is an ol.easing function + easing: () => void; + } + + /** + * Generate an animated transition while updating the view rotation. + * @param options Rotate options. + */ + //TODO: return ol.PreRenderFunction + function rotate(options: AnimationRotateOptions): any; + interface AnimationRotateOptions { + + /** + * The rotation value (in radians) to begin rotating from, typically map.getView().getRotation(). If undefined then 0 is assumed. + */ + rotation?: number; + + /** + * The rotation center/anchor. The map rotates around the center of the view if unspecified. + */ + anchor?: ol.Coordinate; + + /** + * The start time of the animation. Default is immediately. + */ + start?: number; + + /** + * The duration of the animation in milliseconds. Default is 1000. + */ + duration?: number; + + /** + * The easing function to use. Can be an ol.easing or a custom function. Default is ol.easing.upAndDown. + */ + // TODO: Check if it is an ol.easing function + easing: () => void; + } + + /** + * Generate an animated transition while updating the view resolution. + * @param options Zoom options. + */ + function pan(options: AnimationZoomOptions): any; + interface AnimationZoomOptions { + + /** + * The resolution to begin zooming from, typically map.getView().getResolution(). + */ + resolution: number; + + /** + * The start time of the animation. Default is immediately. + */ + start?: number; + + /** + * The duration of the animation in milliseconds. Default is 1000. + */ + duration?: number; + + /** + * The easing function to use. Can be an ol.easing or a custom function. Default is ol.easing.upAndDown. + */ + // TODO: Check if it is an ol.easing function + easing: () => void; + } } + /** + * Return the color as an array. This function maintains a cache of calculated arrays which means the result should not be modified. + */ module color { + + /** + * Return the color as an array. This function maintains a cache of calculated arrays which means the result should not be modified. + * @param color Color. + */ + function asArray(color: ol.Color): ol.Color; + function asArray(color: string): ol.Color; + + /** + * Return the color as an rgba string. + * @param color Color. + */ + function asString(color: ol.Color): string; + function asString(color: string): string; } module control { + + /** + * Set of controls included in maps by default. Unless configured otherwise, this returns a collection containing an instance of each of the following controls: ol.control.Zoom, ol.control.Rotate, ol.control.Attribution + * @param options Defaults options + * @returns Control.s + */ + function defaults(opt_options: ControlDefaultsOptions): ol.Collection; + interface ControlDefaultsOptions { + + /** + * Attribution. Default is true. + */ + attribution?: boolean; + + /** + * Attribution options. + */ + //TODO: Replace with olx.control.AttributionOptions + attributionOptions?: any; + + /** + * Rotate. Default is true; + */ + rotate?: boolean; + + /** + * Rotate options + */ + //TODO: Replace with olx.control.RotateOptions + rotateOptions?: any; + + /** + * Zoom. Default is true + */ + zoom?: boolean; + + /** + * + */ + //TODO: Replace with olx.control.ZoomOptions + zoomOptions?: any; + } + + /** + * Units for the scale line. Supported values are 'degrees', 'imperial', 'nautical', 'metric', 'us'. + */ + interface ScaleLineUnits extends String { } + class Attribution { } From 986e1ea0cbc079999f5941ee7660c29a0b1bfc63 Mon Sep 17 00:00:00 2001 From: mariusfilipowski Date: Thu, 25 Jun 2015 16:08:48 +0200 Subject: [PATCH 0175/1358] Support for Deactivating Compiler Option "Allow implicit any" --- amplifyjs/amplifyjs.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/amplifyjs/amplifyjs.d.ts b/amplifyjs/amplifyjs.d.ts index 364845f3c4..30e8272943 100644 --- a/amplifyjs/amplifyjs.d.ts +++ b/amplifyjs/amplifyjs.d.ts @@ -50,7 +50,7 @@ interface amplifyRequest { * success (optional): Function to invoke on success. * error (optional): Function to invoke on error. */ - (settings: amplifyRequestSettings); + (settings: amplifyRequestSettings): any; /*** * Define a resource. From f06b7f6d022ce286e6438019fbb1100e04f585ba Mon Sep 17 00:00:00 2001 From: woutergd Date: Thu, 25 Jun 2015 17:28:10 +0200 Subject: [PATCH 0176/1358] Added ol.layer.* definitions --- openlayers3/openlayers3.d.ts | 467 ++++++++++++++++++++++++++++++++++- 1 file changed, 459 insertions(+), 8 deletions(-) diff --git a/openlayers3/openlayers3.d.ts b/openlayers3/openlayers3.d.ts index 7703a2d5ea..9f06166dab 100644 --- a/openlayers3/openlayers3.d.ts +++ b/openlayers3/openlayers3.d.ts @@ -1843,26 +1843,477 @@ declare module ol { module layer { - class Base { + /** + * Abstract base class; normally only used for creating subclasses and not instantiated in apps. Note that with ol.layer.Base and all its subclasses, any property set in the options is set as a ol.Object property on the layer object, so is observable, and has get/set accessors. + */ + class Base extends ol.Object { + + /** + * @constructor + * @param options Layer options. + */ + constructor(options?: BaseOptions); + + /** + * Return the brightness of the layer. + * @returns The brightness of the layer. + */ + getBrightness(): number; + + /** + * Return the contrast of the layer. + * @returns The contrast of the layer. + */ + getContrast(): number; + + /** + * Return the extent of the layer or undefined if it will be visible regardless of extent. + * @returns The layer extent. + */ + getExtent(): ol.Extent; + + /** + * Return the hue of the layer. + * @returns The hue of the layer + */ + getHue(): number; + + /** + * Return the maximum resolution of the layer. + * @returns The maximum resolution of the layer + */ + getMaxResolution(): number; + + /** + * Return the minimum resolution of the layer. + * @returns The minimum resolution of the layer. + */ + getMinResolution(): number; + + /** + * Return the opacity of the layer (between 0 and 1). + * @returns The opacity of the layer. + */ + getOpacity(): number; + + /** + * Return the saturation of the layer. + * @returns The saturation of the layer. + */ + getSaturation(): number; + + /** + * Return the visibility of the layer (true or false). + * The visibility of the layer + */ + getVisible(): boolean; + + /** + * Adjust the layer brightness. A value of -1 will render the layer completely black. A value of 0 will leave the brightness unchanged. A value of 1 will render the layer completely white. Other values are linear multipliers on the effect (values are clamped between -1 and 1). + * @param brightness The brightness of the layer + */ + setBrightness(brigthness: number): void; + + /** + * Adjust the layer contrast. A value of 0 will render the layer completely grey. A value of 1 will leave the contrast unchanged. Other values are linear multipliers on the effect (and values over 1 are permitted). + * @param contrast The contrast of the layer + */ + setContrast(contrast: number): void; + + /** + * Set the extent at which the layer is visible. If undefined, the layer will be visible at all extents. + * @param extent The extent of the layer + */ + setExtent(extent?: ol.Extent): void; + + /** + * Apply a hue-rotation to the layer. A value of 0 will leave the hue unchanged. Other values are radians around the color circle. + * @param hue The hue of the layer + */ + setHue(hue: number): void; + + /** + * Set the maximum resolution at which the layer is visible. + * @param maxResolution The maximum resolution of the layer. + */ + setMaxResolution(maxResolution: number): void; + + /** + * Set the minimum resolution at which the layer is visible. + * @param minResolution The minimum resolution of the layer. + */ + setMinResolution(minResolution: number): void; + + /** + * Set the opacity of the layer, allowed values range from 0 to 1. + * @param opactity The opacity of the layer. + */ + setOpacity(opacity: number): void; + + /** + * Adjust layer saturation. A value of 0 will render the layer completely unsaturated. A value of 1 will leave the saturation unchanged. Other values are linear multipliers of the effect (and values over 1 are permitted). + * @param saturation The saturation of the layer. + */ + setSaturation(saturation: number): void; + + /** + * Set the visibility of the layer (true or false). + * @param visible The visibility of the layer. + */ + setVisible(visible: boolean): void; } - class Group { + /** + * A ol.Collection of layers that are handled together. + */ + class Group extends ol.layer.Base { + + /** + * @constructor + * @param options Layer options. + */ + constructor(options?: GroupOptions); + + /** + * Returns the collection of layers in this group. + * @returns Collection of layers that are part of this group. + */ + getLayers(): ol.Collection; + + /** + * Set the collection of layers in this group. + * @param layers Collection of layers that are part of this group. + */ + setLayers(layers: ol.Collection): void; } - class Heatmap { + /** + * Layer for rendering vector data as a heatmap. Note that any property set in the options is set as a ol.Object property on the layer object; for example, setting title: 'My Title' in the options means that title is observable, and has get/set accessors. + */ + class Heatmap extends ol.layer.Vector { + + /** + * @constructor + * @param options Options + */ + constructor(options?: HeatmapOptions); + + /** + * Return the blur size in pixels. + * @returns Blur size in pixels + */ + getBlur(): number; + + /** + * Return the gradient colors as array of strings. + * @returns Colors + */ + getGradient(): Array; + + /** + * Return the size of the radius in pixels. + * @returns Radius size in pixel + */ + getRadius(): number; + + /** + * Set the blur size in pixels. + * @param blur Blur size in pixels + */ + setBlur(blur: number): void; + + /** + * Set the gradient colors as array of strings. + * @param colors Gradient + */ + setGradient(colors: Array): void; + + /** + * Set the size of the radius in pixels. + * @param radius Radius size in pixels + */ + setRadius(radius: number): void; } - class Image { + /** + * Server-rendered images that are available for arbitrary extents and resolutions. Note that any property set in the options is set as a ol.Object property on the layer object; for example, setting title: 'My Title' in the options means that title is observable, and has get/set accessors. + */ + class Image extends ol.layer.Layer { + + /** + * @constructor + * @param options Layer options + */ + constructor(options?: ImageOptions); + + /** + * Return the associated source of the image layer. + * @returns Source. + */ + getSource(): ol.source.Image; } - class Layer { + /** + * Abstract base class; normally only used for creating subclasses and not instantiated in apps. A visual representation of raster or vector map data. Layers group together those properties that pertain to how the data is to be displayed, irrespective of the source of that data. + */ + class Layer extends ol.layer.Base { + + /** + * @constructor + * @param options Layer options + */ + constructor(options?: LayerOptions); + + /** + * Get the layer source. + * @returns The layer source (or null if not yet set) + */ + getSource(): ol.source.Source; + + /** + * Set the layer source. + * @param source The layer source. + */ + setSource(source: ol.source.Source): void; + } + + /** + * For layer sources that provide pre-rendered, tiled images in grids that are organized by zoom levels for specific resolutions. Note that any property set in the options is set as a ol.Object property on the layer object; for example, setting title: 'My Title' in the options means that title is observable, and has get/set accessors. + */ + class Tile extends ol.layer.Layer { + + /** + * @constructor + * @param options Tile layer options. + */ + constructor(options?: TileOptions); + + /** + * Return the level as number to which we will preload tiles up to. + * @retruns The level to preload tiled up to. + */ + getPreload(): number; + + /** + * Return the associated tilesource of the layer. + * @returns Source + */ + getSource(): ol.source.Tile; + + /** + * Whether we use interim tiles on error. + * @returns Use interim tiles on error. + */ + getUseInterimTilesOnError(): boolean; + + /** + * Set the level as number to which we will preload tiles up to. + * @param preload The level to preload tiled up to + */ + setPreload(preload: number): void; + + /** + * Set whether we use interim tiles on error. + * @param useInterimTilesOnError Use interim tiles on error. + */ + setUseInterimTilesOnError(useInterimTilesOnError: boolean): void; } - class Tile { - constructor(options: any); + /** + * Vector data that is rendered client-side. Note that any property set in the options is set as a ol.Object property on the layer object; for example, setting title: 'My Title' in the options means that title is observable, and has get/set accessors. + */ + class Vector extends ol.layer.Layer { + + /** + * @constructor + * @param options Options + */ + constructor(options?: VectorOptions); + + /** + * Return the associated vectorsource of the layer. + * @returns Source. + */ + getSource(): ol.source.Vector; + + /** + * Get the style for features. This returns whatever was passed to the style option at construction or to the setStyle method. + */ + // TODO: Replace returntype any with ol.style.StyleFunction + getStyle(): ol.style.Style | Array | any; + + /** + * Get the style function. + * @returns Layer style function + */ + // TODO: Replace returntype any with ol.style.StyleFunction + getStyleFunction(): any; + + /** + * Set the style for features. This can be a single style object, an array of styles, or a function that takes a feature and resolution and returns an array of styles. If it is undefined the default style is used. If it is null the layer has no style (a null style), so only features that have their own styles will be rendered in the layer. See ol.style for information on the default style. + */ + setStyle(); + + /** + * Set the style for features. This can be a single style object, an array of styles, or a function that takes a feature and resolution and returns an array of styles. If it is undefined the default style is used. If it is null the layer has no style (a null style), so only features that have their own styles will be rendered in the layer. See ol.style for information on the default style. + * @param layer Layer style + */ + setStyle(style: ol.style.Style); + + /** + * Set the style for features. This can be a single style object, an array of styles, or a function that takes a feature and resolution and returns an array of styles. If it is undefined the default style is used. If it is null the layer has no style (a null style), so only features that have their own styles will be rendered in the layer. See ol.style for information on the default style. + * @param layer Layer style + */ + setStyle(style: Array); + + /** + * Set the style for features. This can be a single style object, an array of styles, or a function that takes a feature and resolution and returns an array of styles. If it is undefined the default style is used. If it is null the layer has no style (a null style), so only features that have their own styles will be rendered in the layer. See ol.style for information on the default style. + * @param Layer style + */ + // TODO: Replace 'any' with ol.style.StyleFunction + setStyle(style: any); } - class Vector { + interface BaseOptions { + + /** + * Brightness. Default is 0. + */ + brightness?: number; + + /** + * Contrast. Default is 1. + */ + contrast?: number; + + /** + * Hue. Default is 0. + */ + hue?: number; + + /** + * Opacity (0, 1). Default is 1. + */ + opacity?: number; + + /** + * Saturation. Default is 1. + */ + saturation?: number; + + /** + * Visibility. Default is true. + */ + visible?: boolean; + + /** + * The bounding extent for layer rendering. The layer will not be rendered outside of this extent. + */ + extent?: ol.Extent; + + /** + * The minimum resolution (inclusive) at which this layer will be visible. + */ + minResolution?: number; + + /** + * The maximum resolution (exclusive) below which this layer will be visible. + */ + maxResolution?: number; + } + + interface LayerOptions extends BaseOptions { + + /** + * The layer source (or null if not yet set). + */ + source?: ol.source.Source; + } + + interface GroupOptions extends BaseOptions { + + /** + * Child layers + */ + layers?: Array | ol.Collection; + } + + interface TileOptions extends LayerOptions { + + /** + * Preload. Load low-resolution tiles up to preload levels. By default preload is 0, which means no preloading. + */ + preload?: number; + + /** + * Source for this layer. + */ + source?: ol.source.Tile; + + /** + * Use interim tiles on error. Default is true. + */ + useInterimTilesOnError?: boolean; + } + + interface ImageOptions extends LayerOptions { + } + + interface VectorOptions extends LayerOptions { + + /** + * When set to true, feature batches will be recreated during animations. This means that no vectors will be shown clipped, but the setting will have a performance impact for large amounts of vector data. When set to false, batches will be recreated when no animation is active. Default is false. + */ + updateWhileAnimating?: boolean; + + /** + * When set to true, feature batches will be recreated during interactions. See also updateWhileInteracting. Default is false. + */ + updateWhileInteracting?: boolean; + + /** + * Render order. Function to be used when sorting features before rendering. By default features are drawn in the order that they are created. Use null to avoid the sort, but get an undefined draw order. + */ + // TODO: replace any with the expected function, unclear in documentation what the parameters are + renderOrder?: any; + + /** + * The buffer around the viewport extent used by the renderer when getting features from the vector source for the rendering or hit-detection. Recommended value: the size of the largest symbol, line width or label. Default is 100 pixels. + */ + renderBuffer?: number; + + /** + * Source. + */ + source?: ol.source.Vector; + + /** + * Layer style. See ol.style for default style which will be used if this is not defined. + */ + style?: ol.style.Style | Array | any; + } + + interface HeatmapOptions extends VectorOptions { + + /** + * The color gradient of the heatmap, specified as an array of CSS color strings. Default is ['#00f', '#0ff', '#0f0', '#ff0', '#f00']. + */ + gradient?: Array; + + /** + * Radius size in pixels. Default is 8. + */ + radius?: number; + + /** + * Blur size in pixels. Default is 15. + */ + blur?: number; + + /** + * Shadow size in pixels. Default is 250. + */ + shadow?: number; } } From 0673d97c2eb0956ed5fe833fdd3d99f91fb09284 Mon Sep 17 00:00:00 2001 From: woutergd Date: Thu, 25 Jun 2015 18:19:40 +0200 Subject: [PATCH 0177/1358] Resolve build errors --- openlayers3/openlayers3.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/openlayers3/openlayers3.d.ts b/openlayers3/openlayers3.d.ts index 9f06166dab..28050055d7 100644 --- a/openlayers3/openlayers3.d.ts +++ b/openlayers3/openlayers3.d.ts @@ -2152,26 +2152,26 @@ declare module ol { /** * Set the style for features. This can be a single style object, an array of styles, or a function that takes a feature and resolution and returns an array of styles. If it is undefined the default style is used. If it is null the layer has no style (a null style), so only features that have their own styles will be rendered in the layer. See ol.style for information on the default style. */ - setStyle(); + setStyle(): void; /** * Set the style for features. This can be a single style object, an array of styles, or a function that takes a feature and resolution and returns an array of styles. If it is undefined the default style is used. If it is null the layer has no style (a null style), so only features that have their own styles will be rendered in the layer. See ol.style for information on the default style. * @param layer Layer style */ - setStyle(style: ol.style.Style); + setStyle(style: ol.style.Style): void; /** * Set the style for features. This can be a single style object, an array of styles, or a function that takes a feature and resolution and returns an array of styles. If it is undefined the default style is used. If it is null the layer has no style (a null style), so only features that have their own styles will be rendered in the layer. See ol.style for information on the default style. * @param layer Layer style */ - setStyle(style: Array); + setStyle(style: Array): void; /** * Set the style for features. This can be a single style object, an array of styles, or a function that takes a feature and resolution and returns an array of styles. If it is undefined the default style is used. If it is null the layer has no style (a null style), so only features that have their own styles will be rendered in the layer. See ol.style for information on the default style. * @param Layer style */ // TODO: Replace 'any' with ol.style.StyleFunction - setStyle(style: any); + setStyle(style: any): void; } interface BaseOptions { From 9e69de89d1124ddf1a07874dc383fcbb2a0b64b2 Mon Sep 17 00:00:00 2001 From: Christopher Glantschnig Date: Thu, 25 Jun 2015 18:29:57 +0200 Subject: [PATCH 0178/1358] fixed return type according to the tests --- request-promise/request-promise.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/request-promise/request-promise.d.ts b/request-promise/request-promise.d.ts index bdc2764a2d..9cee53eee6 100644 --- a/request-promise/request-promise.d.ts +++ b/request-promise/request-promise.d.ts @@ -16,7 +16,7 @@ declare module 'request-promise' { export = RequestPromiseAPI; - function RequestPromiseAPI(options: RequestPromiseAPI.Options): request.Request; + function RequestPromiseAPI(options: RequestPromiseAPI.Options): Promise; function RequestPromiseAPI(uri: string): Promise; module RequestPromiseAPI { From 996fd283e0af7c4b50915c8284fcf5f8f83cc7b3 Mon Sep 17 00:00:00 2001 From: woutergd Date: Thu, 25 Jun 2015 19:00:25 +0200 Subject: [PATCH 0179/1358] Added ol.tilegrid.* definitions --- openlayers3/openlayers3.d.ts | 228 ++++++++++++++++++++++++++++++++++- 1 file changed, 226 insertions(+), 2 deletions(-) diff --git a/openlayers3/openlayers3.d.ts b/openlayers3/openlayers3.d.ts index 28050055d7..63ef200825 100644 --- a/openlayers3/openlayers3.d.ts +++ b/openlayers3/openlayers3.d.ts @@ -2549,13 +2549,237 @@ declare module ol { module tilegrid { + /** + * Base class for setting the grid pattern for sources accessing tiled-image servers. + */ class TileGrid { + + /** + * @constructor + * @param options Tile grid options + */ + constructor(options?: TileGridOptions); + + /** + * Creates a TileCoord transform function for use with this tile grid. Transforms the internal tile coordinates with bottom-left origin to the tile coordinates used by the ol.TileUrlFunction. The returned function expects an ol.TileCoord as first and an ol.proj.Projection as second argument and returns a transformed ol.TileCoord. + */ + // TODO: Check if this is correct, unclear in documentation + createTileCoordTransform(): any; + + /** + * Get the maximum zoom level for the grid. + * @returns Max zoom + */ + getMaxZoom(): number; + + /** + * Get the minimum zoom level for the grid. + * @returns Min zoom + */ + getMinZoom(): number; + + /** + * Get the origin for the grid at the given zoom level. + * @param z Z + * @returns Origin + */ + getOrigin(z: number): ol.Coordinate; + + /** + * Get the list of resolutions for the tile grid. + * @param z Z + * @returns Resolution + */ + getResolution(z: number): number; + + /** + * Get the list of resolutions for the tile grid. + * @returns Resolutions + */ + getResolutions(): Array; + + /** + * Get the tile coordinate for the given map coordinate and resolution. This method considers that coordinates that intersect tile boundaries should be assigned the higher tile coordinate. + * @param coordinate Coordinate + * @param resolution Resolution + * @param tileCoord Destination ol.TileCoord object. + * @returns Tile coordinate + */ + getTileCoordForCoordAndResolution(coordinate: ol.Coordinate, resolution: number, tileCoord?: ol.TileCoord): ol.TileCoord; + + /** + * Get a tile coordinate given a map coordinate and zoom level. + * @param coordinate Coordinate + * @param z Zoom level + * @param tileCoord Destination ol.TileCoord object + * @returns Tile coordinate + */ + getTileCoordForCoordAndZ(coordinate: ol.Coordinate, z: number, tileCoord?: ol.TileCoord): ol.TileCoord; + + /** + * Get the tile size for a zoom level. The type of the return value matches the tileSize or tileSizes that the tile grid was configured with. To always get an ol.Size, run the result through ol.size.toSize(). + * @param z Z + * @returns Tile size + */ + getTileSize(z: number): number | ol.Size; + } + interface TileGridOptions { + + /** + * Extent for the tile grid. No tiles outside this extent will be requested by ol.source.Tile sources. When no origin or origins are configured, the origin will be set to the bottom-left corner of the extent. When no sizes are configured, they will be calculated from the extent. + */ + extent?: ol.Extent; + + /** + * Minimum zoom. Default is 0. + */ + minZoom?: number; + + /** + * Origin, i.e. the bottom-left corner of the grid. Default is null. + */ + origin?: ol.Coordinate; + + /** + * Origins, i.e. the bottom-left corners of the grid for each zoom level. If given, the array length should match the length of the resolutions array, i.e. each resolution can have a different origin. + */ + origins?: Array; + + /** + * Resolutions. The array index of each resolution needs to match the zoom level. This means that even if a minZoom is configured, the resolutions array will have a length of maxZoom + 1. + */ + resolutions?: Array; + + /** + * Tile size. Default is [256, 256]. + */ + tileSize?: number | ol.Size; + + /** + * Tile sizes. If given, the array length should match the length of the resolutions array, i.e. each resolution can have a different tile size. + */ + tileSizes?: Array; } - class WMTS { + /** + * Set the grid pattern for sources accessing WMTS tiled-image servers. + */ + class WMTS extends TileGrid { + + /** + * @constructor + * @param options WMTS options + */ + constructor(options: WMTSOptions); + + /** + * Create a tile grid from a WMTS capabilities matrix set. + * @param matrixSet An object representing a matrixSet in the capabilities document. + * @param extent An optional extent to restrict the tile ranges the server provides. + * @returns WMTS tilegrid instance + */ + createFromCapabilitiesMatrixSet(matrixSet: any, extent: ol.Extent): ol.tilegrid.WMTS; + + /** + * Get the list of matrix identifiers. + * @returns MatrixIds + */ + getMatrixIds(): Array; + } + interface WMTSOptions { + + /** + * Extent for the tile grid. No tiles outside this extent will be requested by ol.source.WMTS sources. When no origin or origins are configured, the origin will be calculated from the extent. When no sizes are configured, they will be calculated from the extent. + */ + extent?: ol.Extent; + + /** + * Origin, i.e. the top-left corner of the grid. + */ + origin?: ol.Coordinate; + + /** + * Origins, i.e. the top-left corners of the grid for each zoom level. The length of this array needs to match the length of the resolutions array. + */ + origins?: Array; + + /** + * Resolutions. The array index of each resolution needs to match the zoom level. This means that even if a minZoom is configured, the resolutions array will have a length of maxZoom + 1 + */ + resolutions?: Array; + + /** + * matrix IDs. The length of this array needs to match the length of the resolutions array. + */ + matrixIds?: Array; + + /** + * Number of tile rows and columns of the grid for each zoom level. The values here are the TileMatrixWidth and TileMatrixHeight advertised in the GetCapabilities response of the WMTS, and define the grid's extent together with the origin. An extent can be configured in addition, and will further limit the extent for which tile requests are made by sources. + */ + sizes?: Array; + + /** + * Tile size. + */ + tileSize?: number | ol.Size; + + /** + * Tile sizes. The length of this array needs to match the length of the resolutions array. + */ + tileSizes?: Array; + + /** + * Number of tile columns that cover the grid's extent for each zoom level. Only required when used with a source that has wrapX set to true, and only when the grid's origin differs from the one of the projection's extent. The array length has to match the length of the resolutions array, i.e. each resolution will have a matching entry here. + */ + widths?: Array; } - class Zoomify { + /** + * Set the grid pattern for sources accessing Zoomify tiled-image servers. + */ + class Zoomify extends TileGrid { + + /** + * @constructor + * @param options Options + */ + constructor(options?: ZoomifyOptions); + } + interface ZoomifyOptions { + + /** + * Resolutions + */ + resolutions: Array; + } + + /** + * Creates a tile grid with a standard XYZ tiling scheme. + * @param options Tile grid options. + * @returns The grid instance + */ + function createXYZ(options: CreateXYZOptions): ol.tilegrid.TileGrid; + interface CreateXYZOptions { + + /** + * Extent for the tile grid. The origin for an XYZ tile grid is the top-left corner of the extent. The zero level of the grid is defined by the resolution at which one tile fits in the provided extent. If not provided, the extent of the EPSG:3857 projection is used. + */ + extent?: ol.Extent; + + /** + * Maximum zoom. The default is ol.DEFAULT_MAX_ZOOM. This determines the number of levels in the grid set. For example, a maxZoom of 21 means there are 22 levels in the grid set. + */ + maxZoom?: number; + + /** + * Minimum zoom. Default is 0. + */ + minZoom?: number; + + /** + * Tile size in pixels. Default is [256, 256]. + */ + tileSize?: number | ol.Size; } } From 293fa7a6529461ff0d8cc4e15d3f4c055c0ef4be Mon Sep 17 00:00:00 2001 From: woutergd Date: Thu, 25 Jun 2015 19:34:30 +0200 Subject: [PATCH 0180/1358] Moved all options definition typings into the olx-module as defined in the docs of openlayers --- openlayers3/openlayers3.d.ts | 1316 +++++++++++++++++----------------- 1 file changed, 676 insertions(+), 640 deletions(-) diff --git a/openlayers3/openlayers3.d.ts b/openlayers3/openlayers3.d.ts index 63ef200825..7b3b16c7be 100644 --- a/openlayers3/openlayers3.d.ts +++ b/openlayers3/openlayers3.d.ts @@ -3,6 +3,647 @@ // Definitions by: Wouter Goedhart // Definitions: https://github.com/borisyankov/DefinitelyTyped +declare module olx { + + interface AttributionOptions { + + /** HTML markup for this attribution. */ + html: string; + } + + interface DeviceOrientationOptions { + + /** + * Start tracking. Default is false. + */ + tracking?: boolean; + } + + interface FeatureOverlayOptions { + + /** + * Features + */ + // TODO: implement stylefunction + features?: Array | ol.Collection | any; + + /** + * Map + */ + map: ol.Map; + + /** + * Style + */ + style: ol.style.Style | Array; + } + + interface GeolocationOptions { + + /** + * Start Tracking. Default is false. + */ + tracking?: boolean; + + /** + * Tracking options. See http://www.w3.org/TR/geolocation-API/#position_options_interface. + */ + trackingOptions?: PositionOptions; + + /** + * The projection the position is reported in. + */ + projection?: ol.proj.ProjectionLike; + } + + interface GraticuleOptions { + + /** Reference to an ol.Map object. */ + map?: ol.Map; + + /** The maximum number of meridians and parallels from the center of the map. The default value is 100, which means that at most 200 meridians and 200 parallels will be displayed. The default value is appropriate for conformal projections like Spherical Mercator. If you increase the value more lines will be drawn and the drawing performance will decrease. */ + maxLines?: number; + + /** The stroke style to use for drawing the graticule. If not provided, the lines will be drawn with rgba(0,0,0,0.2), a not fully opaque black. */ + strokeStyle?: ol.style.Stroke; + + /** The target size of the graticule cells, in pixels. Default value is 100 pixels. */ + targetSize?: number; + } + + interface MapOptions { + + /** Controls initially added to the map. If not specified, ol.control.defaults() is used. */ + controls?: any; + + /** The ratio between physical pixels and device-independent pixels (dips) on the device. If undefined then it gets set by using window.devicePixelRatio. */ + pixelRatio?: number; + + /** Interactions that are initially added to the map. If not specified, ol.interaction.defaults() is used. */ + interactions?: any; + + /** The element to listen to keyboard events on. This determines when the KeyboardPan and KeyboardZoom interactions trigger. For example, if this option is set to document the keyboard interactions will always trigger. If this option is not specified, the element the library listens to keyboard events on is the map target (i.e. the user-provided div for the map). If this is not document the target element needs to be focused for key events to be emitted, requiring that the target element has a tabindex attribute. */ + keyboardEventTarget?: any; + + /** Layers. If this is not defined, a map with no layers will be rendered. Note that layers are rendered in the order supplied, so if you want, for example, a vector layer to appear on top of a tile layer, it must come after the tile layer. */ + layers?: Array + + /** When set to true, tiles will be loaded during animations. This may improve the user experience, but can also make animations stutter on devices with slow memory. Default is false. */ + loadTilesWhileAnimating?: boolean; + + /** When set to true, tiles will be loaded while interacting with the map. This may improve the user experience, but can also make map panning and zooming choppy on devices with slow memory. Default is false. */ + loadTilesWhileInteracting?: boolean; + + /** The map logo. A logo to be displayed on the map at all times. If a string is provided, it will be set as the image source of the logo. If an object is provided, the src property should be the URL for an image and the href property should be a URL for creating a link. To disable the map logo, set the option to false. By default, the OpenLayers 3 logo is shown. */ + logo?: any; + + /** Overlays initially added to the map. By default, no overlays are added. */ + overlays?: any; + + /** Renderer. By default, Canvas, DOM and WebGL renderers are tested for support in that order, and the first supported used. Specify a ol.RendererType here to use a specific renderer. Note that at present only the Canvas renderer supports vector data. */ + renderer?: any; + + /** The container for the map, either the element itself or the id of the element. If not specified at construction time, ol.Map#setTarget must be called for the map to be rendered. */ + target?: any; + + /** The map's view. No layer sources will be fetched unless this is specified at construction time or through ol.Map#setView. */ + view?: ViewOptions; + } + + interface OverlayOptions { + + /** + * The overlay element. + */ + element?: Element; + + /** + * Offsets in pixels used when positioning the overlay. The fist element in the array is the horizontal offset. A positive value shifts the overlay right. The second element in the array is the vertical offset. A positive value shifts the overlay down. Default is [0, 0]. + */ + offset?: Array; + + /** + * The overlay position in map projection. + */ + position?: ol.Coordinate; + + /** + * Defines how the overlay is actually positioned with respect to its position property. Possible values are 'bottom-left', 'bottom-center', 'bottom-right', 'center-left', 'center-center', 'center-right', 'top-left', 'top-center', and 'top-right'. Default is 'top-left'. + */ + positioning?: ol.OverlayPositioning; + + /** + * Whether event propagation to the map viewport should be stopped. Default is true. If true the overlay is placed in the same container as that of the controls (CSS class name ol-overlaycontainer-stopevent); if false it is placed in the container with CSS class name ol-overlaycontainer. + */ + stopEvent?: boolean; + + /** + * Whether the overlay is inserted first in the overlay container, or appended. Default is true. If the overlay is placed in the same container as that of the controls (see the stopEvent option) you will probably set insertFirst to true so the overlay is displayed below the controls. + */ + insertFirst?: boolean; + + /** + * If set to true the map is panned when calling setPosition, so that the overlay is entirely visible in the current viewport. The default is false. + */ + autoPan?: boolean; + + /** + * The options used to create a ol.animation.pan animation. This animation is only used when autoPan is enabled. By default the default options for ol.animation.pan are used. If set to null the panning is not animated. + */ + //TODO: replace with olx.animation.PanOptions + autoPanAnimation?: any; + + /** + * The margin (in pixels) between the overlay and the borders of the map when autopanning. The default is 20. + */ + autoPanMargin?: number; + } + + interface ViewOptions { + + /** The initial center for the view. The coordinate system for the center is specified with the projection option. Default is undefined, and layer sources will not be fetched if this is not set. */ + center?: ol.Coordinate; + + /** Rotation constraint. false means no constraint. true means no constraint, but snap to zero near zero. A number constrains the rotation to that number of values. For example, 4 will constrain the rotation to 0, 90, 180, and 270 degrees. The default is true. */ + constrainRotation?: boolean; + + /** Enable rotation. Default is true. If false a rotation constraint that always sets the rotation to zero is used. The constrainRotation option has no effect if enableRotation is false. */ + enableRotation?: boolean; + + /**The extent that constrains the center, in other words, center cannot be set outside this extent. Default is undefined. */ + extent?: ol.Extent; + + /** The maximum resolution used to determine the resolution constraint. It is used together with minResolution (or maxZoom) and zoomFactor. If unspecified it is calculated in such a way that the projection's validity extent fits in a 256x256 px tile. If the projection is Spherical Mercator (the default) then maxResolution defaults to 40075016.68557849 / 256 = 156543.03392804097. */ + maxResolution?: number; + + /** The minimum resolution used to determine the resolution constraint. It is used together with maxResolution (or minZoom) and zoomFactor. If unspecified it is calculated assuming 29 zoom levels (with a factor of 2). If the projection is Spherical Mercator (the default) then minResolution defaults to 40075016.68557849 / 256 / Math.pow(2, 28) = 0.0005831682455839253. */ + minResolution?: number; + + /** The maximum zoom level used to determine the resolution constraint. It is used together with minZoom (or maxResolution) and zoomFactor. Default is 28. Note that if minResolution is also provided, it is given precedence over maxZoom. */ + maxZoom?: number; + + /** The minimum zoom level used to determine the resolution constraint. It is used together with maxZoom (or minResolution) and zoomFactor. Default is 0. Note that if maxResolution is also provided, it is given precedence over minZoom. */ + minZoom?: number; + + /** The projection. Default is EPSG:3857 (Spherical Mercator). */ + projection?: ol.proj.ProjectionLike; + + /** The initial resolution for the view. The units are projection units per pixel (e.g. meters per pixel). An alternative to setting this is to set zoom. Default is undefined, and layer sources will not be fetched if neither this nor zoom are defined. */ + resolution?: number; + + /** Resolutions to determine the resolution constraint. If set the maxResolution, minResolution, minZoom, maxZoom, and zoomFactor options are ignored. */ + resolutions?: Array; + + /** The initial rotation for the view in radians (positive rotation clockwise). Default is 0. */ + rotation?: number; + + /** Only used if resolution is not defined. Zoom level used to calculate the initial resolution for the view. The initial resolution is determined using the ol.View#constrainResolution method. */ + zoom?: number; + + /** The zoom factor used to determine the resolution constraint. Default is 2. */ + zoomFactor?: number; + } + + module animation { + + interface BounceOptions { + + /** + * The resolution to start the bounce from, typically map.getView().getResolution(). + */ + resolution: number; + + /** + * The start time of the animation. Default is immediately. + */ + start?: number; + + /** + * The duration of the animation in milliseconds. Default is 1000. + */ + duration?: number; + + /** + * The easing function to use. Can be an ol.easing or a custom function. Default is ol.easing.upAndDown. + */ + // TODO: Check if it is an ol.easing function + easing: () => void; + } + + interface PanOptions { + + /** + * The resolution to start the bounce from, typically map.getView().getResolution(). + */ + source: ol.Coordinate; + + /** + * The start time of the animation. Default is immediately. + */ + start?: number; + + /** + * The duration of the animation in milliseconds. Default is 1000. + */ + duration?: number; + + /** + * The easing function to use. Can be an ol.easing or a custom function. Default is ol.easing.upAndDown. + */ + // TODO: Check if it is an ol.easing function + easing: () => void; + } + + interface RotateOptions { + + /** + * The rotation value (in radians) to begin rotating from, typically map.getView().getRotation(). If undefined then 0 is assumed. + */ + rotation?: number; + + /** + * The rotation center/anchor. The map rotates around the center of the view if unspecified. + */ + anchor?: ol.Coordinate; + + /** + * The start time of the animation. Default is immediately. + */ + start?: number; + + /** + * The duration of the animation in milliseconds. Default is 1000. + */ + duration?: number; + + /** + * The easing function to use. Can be an ol.easing or a custom function. Default is ol.easing.upAndDown. + */ + // TODO: Check if it is an ol.easing function + easing: () => void; + } + + interface ZoomOptions { + + /** + * The resolution to begin zooming from, typically map.getView().getResolution(). + */ + resolution: number; + + /** + * The start time of the animation. Default is immediately. + */ + start?: number; + + /** + * The duration of the animation in milliseconds. Default is 1000. + */ + duration?: number; + + /** + * The easing function to use. Can be an ol.easing or a custom function. Default is ol.easing.upAndDown. + */ + // TODO: Check if it is an ol.easing function + easing: () => void; + } + } + + module control { + + interface DefaultsOptions { + + /** + * Attribution. Default is true. + */ + attribution?: boolean; + + /** + * Attribution options. + */ + //TODO: Replace with olx.control.AttributionOptions + attributionOptions?: any; + + /** + * Rotate. Default is true; + */ + rotate?: boolean; + + /** + * Rotate options + */ + //TODO: Replace with olx.control.RotateOptions + rotateOptions?: any; + + /** + * Zoom. Default is true + */ + zoom?: boolean; + + /** + * + */ + //TODO: Replace with olx.control.ZoomOptions + zoomOptions?: any; + } + } + + module layer { + + interface BaseOptions { + + /** + * Brightness. Default is 0. + */ + brightness?: number; + + /** + * Contrast. Default is 1. + */ + contrast?: number; + + /** + * Hue. Default is 0. + */ + hue?: number; + + /** + * Opacity (0, 1). Default is 1. + */ + opacity?: number; + + /** + * Saturation. Default is 1. + */ + saturation?: number; + + /** + * Visibility. Default is true. + */ + visible?: boolean; + + /** + * The bounding extent for layer rendering. The layer will not be rendered outside of this extent. + */ + extent?: ol.Extent; + + /** + * The minimum resolution (inclusive) at which this layer will be visible. + */ + minResolution?: number; + + /** + * The maximum resolution (exclusive) below which this layer will be visible. + */ + maxResolution?: number; + } + + interface GroupOptions extends BaseOptions { + + /** + * Child layers + */ + layers?: Array | ol.Collection; + } + + interface HeatmapOptions extends VectorOptions { + + /** + * The color gradient of the heatmap, specified as an array of CSS color strings. Default is ['#00f', '#0ff', '#0f0', '#ff0', '#f00']. + */ + gradient?: Array; + + /** + * Radius size in pixels. Default is 8. + */ + radius?: number; + + /** + * Blur size in pixels. Default is 15. + */ + blur?: number; + + /** + * Shadow size in pixels. Default is 250. + */ + shadow?: number; + } + + interface ImageOptions extends LayerOptions { + } + + interface LayerOptions extends BaseOptions { + + /** + * The layer source (or null if not yet set). + */ + source?: ol.source.Source; + } + + interface TileOptions extends LayerOptions { + + /** + * Preload. Load low-resolution tiles up to preload levels. By default preload is 0, which means no preloading. + */ + preload?: number; + + /** + * Source for this layer. + */ + source?: ol.source.Tile; + + /** + * Use interim tiles on error. Default is true. + */ + useInterimTilesOnError?: boolean; + } + + interface VectorOptions extends LayerOptions { + + /** + * When set to true, feature batches will be recreated during animations. This means that no vectors will be shown clipped, but the setting will have a performance impact for large amounts of vector data. When set to false, batches will be recreated when no animation is active. Default is false. + */ + updateWhileAnimating?: boolean; + + /** + * When set to true, feature batches will be recreated during interactions. See also updateWhileInteracting. Default is false. + */ + updateWhileInteracting?: boolean; + + /** + * Render order. Function to be used when sorting features before rendering. By default features are drawn in the order that they are created. Use null to avoid the sort, but get an undefined draw order. + */ + // TODO: replace any with the expected function, unclear in documentation what the parameters are + renderOrder?: any; + + /** + * The buffer around the viewport extent used by the renderer when getting features from the vector source for the rendering or hit-detection. Recommended value: the size of the largest symbol, line width or label. Default is 100 pixels. + */ + renderBuffer?: number; + + /** + * Source. + */ + source?: ol.source.Vector; + + /** + * Layer style. See ol.style for default style which will be used if this is not defined. + */ + style?: ol.style.Style | Array | any; + } + } + + module tilegrid { + + interface TileGridOptions { + + /** + * Extent for the tile grid. No tiles outside this extent will be requested by ol.source.Tile sources. When no origin or origins are configured, the origin will be set to the bottom-left corner of the extent. When no sizes are configured, they will be calculated from the extent. + */ + extent?: ol.Extent; + + /** + * Minimum zoom. Default is 0. + */ + minZoom?: number; + + /** + * Origin, i.e. the bottom-left corner of the grid. Default is null. + */ + origin?: ol.Coordinate; + + /** + * Origins, i.e. the bottom-left corners of the grid for each zoom level. If given, the array length should match the length of the resolutions array, i.e. each resolution can have a different origin. + */ + origins?: Array; + + /** + * Resolutions. The array index of each resolution needs to match the zoom level. This means that even if a minZoom is configured, the resolutions array will have a length of maxZoom + 1. + */ + resolutions?: Array; + + /** + * Tile size. Default is [256, 256]. + */ + tileSize?: number | ol.Size; + + /** + * Tile sizes. If given, the array length should match the length of the resolutions array, i.e. each resolution can have a different tile size. + */ + tileSizes?: Array; + } + + interface WMTSOptions { + + /** + * Extent for the tile grid. No tiles outside this extent will be requested by ol.source.WMTS sources. When no origin or origins are configured, the origin will be calculated from the extent. When no sizes are configured, they will be calculated from the extent. + */ + extent?: ol.Extent; + + /** + * Origin, i.e. the top-left corner of the grid. + */ + origin?: ol.Coordinate; + + /** + * Origins, i.e. the top-left corners of the grid for each zoom level. The length of this array needs to match the length of the resolutions array. + */ + origins?: Array; + + /** + * Resolutions. The array index of each resolution needs to match the zoom level. This means that even if a minZoom is configured, the resolutions array will have a length of maxZoom + 1 + */ + resolutions?: Array; + + /** + * matrix IDs. The length of this array needs to match the length of the resolutions array. + */ + matrixIds?: Array; + + /** + * Number of tile rows and columns of the grid for each zoom level. The values here are the TileMatrixWidth and TileMatrixHeight advertised in the GetCapabilities response of the WMTS, and define the grid's extent together with the origin. An extent can be configured in addition, and will further limit the extent for which tile requests are made by sources. + */ + sizes?: Array; + + /** + * Tile size. + */ + tileSize?: number | ol.Size; + + /** + * Tile sizes. The length of this array needs to match the length of the resolutions array. + */ + tileSizes?: Array; + + /** + * Number of tile columns that cover the grid's extent for each zoom level. Only required when used with a source that has wrapX set to true, and only when the grid's origin differs from the one of the projection's extent. The array length has to match the length of the resolutions array, i.e. each resolution will have a matching entry here. + */ + widths?: Array; + } + + interface XYZOptions { + + /** + * Extent for the tile grid. The origin for an XYZ tile grid is the top-left corner of the extent. The zero level of the grid is defined by the resolution at which one tile fits in the provided extent. If not provided, the extent of the EPSG:3857 projection is used. + */ + extent?: ol.Extent; + + /** + * Maximum zoom. The default is ol.DEFAULT_MAX_ZOOM. This determines the number of levels in the grid set. For example, a maxZoom of 21 means there are 22 levels in the grid set. + */ + maxZoom?: number; + + /** + * Minimum zoom. Default is 0. + */ + minZoom?: number; + + /** + * Tile size in pixels. Default is [256, 256]. + */ + tileSize?: number | ol.Size; + } + + interface ZoomifyOptions { + + /** + * Resolutions + */ + resolutions: Array; + } + } + + module view { + + interface FitGeometryOptions { + + /** + * Padding (in pixels) to be cleared inside the view. Values in the array are top, right, bottom and left padding. Default is [0, 0, 0, 0]. + */ + padding?: Array; + + /** + * Constrain the resolution. Default is true. + */ + constrainResolution?: boolean; + + /** + * Get the nearest extent. Default is false. + */ + nearest?: boolean; + + /** + * Minimum resolution that we zoom to. Default is 0. + */ + minResolution?: number; + + /** + * Maximum zoom level that we zoom to. If minResolution is given, this property is ignored. + */ + maxZoom?: number; + } + } +} + /** * A high-performance, feature-packed library for all your mapping needs. */ @@ -16,7 +657,7 @@ declare module ol { * @constructor * @param options Attribution options. */ - constructor(options: AttributionOptions); + constructor(options: olx.AttributionOptions); /** * Get the attribution markup. @@ -24,12 +665,7 @@ declare module ol { */ getHTML(): string; } - interface AttributionOptions { - - /** HTML markup for this attribution. */ - html: string; - } - + /** * An expanded version of standard JS Array, adding convenience methods for manipulation. Add and remove changes to the Collection trigger a Collection event. Note that this does not cover changes to the objects within the Collection; they trigger events on the appropriate object, not on the Collection as a whole. */ @@ -141,7 +777,7 @@ declare module ol { * @constructor * @param options Options. */ - constructor(options: DeviceOrientationOptions); + constructor(options?: olx.DeviceOrientationOptions); /** * Rotation around the device z-axis (in radians). @@ -179,14 +815,7 @@ declare module ol { */ setTracking(tracking: boolean): void; } - interface DeviceOrientationOptions { - - /** - * Start tracking. Default is false. - */ - tracking?: boolean; - } - + /** * Events emitted by ol.interaction.DragBox instances are instances of this type. */ @@ -284,7 +913,7 @@ declare module ol { * @constructor * @param options Options. */ - constructor(options: FeatureOverlayOptions); + constructor(options?: olx.FeatureOverlayOptions); /** * Add a feature to the overlay. @@ -344,24 +973,6 @@ declare module ol { setStyle(style: Array): void; setStyle(style: any): void; } - interface FeatureOverlayOptions { - - /** - * Features - */ - // TODO: implement stylefunction - features?: Array | Collection | any; - - /** - * Map - */ - map: Map; - - /** - * Style - */ - style: style.Style | Array; - } /** * Helper class for providing HTML5 Geolocation capabilities. The Geolocation API is used to locate a user's position. @@ -372,7 +983,7 @@ declare module ol { * @constructor * @param options Options. */ - constructor(options: GeolocationOptions); + constructor(options?: olx.GeolocationOptions); /** * Get the accuracy of the position in meters. @@ -452,23 +1063,6 @@ declare module ol { */ setTrackingOptions(options: PositionOptions): void; } - interface GeolocationOptions { - - /** - * Start Tracking. Default is false. - */ - tracking?: boolean; - - /** - * Tracking options. See http://www.w3.org/TR/geolocation-API/#position_options_interface. - */ - trackingOptions?: PositionOptions; - - /** - * The projection the position is reported in. - */ - projection?: ol.proj.ProjectionLike; - } /** * Render a grid for a coordinate system on a map. @@ -478,7 +1072,7 @@ declare module ol { * @constructor * @param options Options. */ - constructor(options: GraticuleOptions); + constructor(options?: olx.GraticuleOptions); /** * Get the map associated with this graticule. @@ -504,21 +1098,7 @@ declare module ol { */ setMap(map: Map): void; } - interface GraticuleOptions { - - /** Reference to an ol.Map object. */ - map?: Map; - - /** The maximum number of meridians and parallels from the center of the map. The default value is 100, which means that at most 200 meridians and 200 parallels will be displayed. The default value is appropriate for conformal projections like Spherical Mercator. If you increase the value more lines will be drawn and the drawing performance will decrease. */ - maxLines?: number; - - /** The stroke style to use for drawing the graticule. If not provided, the lines will be drawn with rgba(0,0,0,0.2), a not fully opaque black. */ - strokeStyle?: style.Stroke; - - /** The target size of the graticule cells, in pixels. Default value is 100 pixels. */ - targetSize?: number; - } - + /** * */ @@ -574,7 +1154,7 @@ declare module ol { * @constructor * @params options Options. */ - constructor(options: MapOptions); + constructor(options: olx.MapOptions); /** * Add the given control to the map. @@ -794,45 +1374,7 @@ declare module ol { * */ updateSize(): void; } - interface MapOptions { - - /** Controls initially added to the map. If not specified, ol.control.defaults() is used. */ - controls?: any; - - /** The ratio between physical pixels and device-independent pixels (dips) on the device. If undefined then it gets set by using window.devicePixelRatio. */ - pixelRatio?: number; - - /** Interactions that are initially added to the map. If not specified, ol.interaction.defaults() is used. */ - interactions?: any; - - /** The element to listen to keyboard events on. This determines when the KeyboardPan and KeyboardZoom interactions trigger. For example, if this option is set to document the keyboard interactions will always trigger. If this option is not specified, the element the library listens to keyboard events on is the map target (i.e. the user-provided div for the map). If this is not document the target element needs to be focused for key events to be emitted, requiring that the target element has a tabindex attribute. */ - keyboardEventTarget?: any; - - /** Layers. If this is not defined, a map with no layers will be rendered. Note that layers are rendered in the order supplied, so if you want, for example, a vector layer to appear on top of a tile layer, it must come after the tile layer. */ - layers?: Array - - /** When set to true, tiles will be loaded during animations. This may improve the user experience, but can also make animations stutter on devices with slow memory. Default is false. */ - loadTilesWhileAnimating?: boolean; - - /** When set to true, tiles will be loaded while interacting with the map. This may improve the user experience, but can also make map panning and zooming choppy on devices with slow memory. Default is false. */ - loadTilesWhileInteracting?: boolean; - - /** The map logo. A logo to be displayed on the map at all times. If a string is provided, it will be set as the image source of the logo. If an object is provided, the src property should be the URL for an image and the href property should be a URL for creating a link. To disable the map logo, set the option to false. By default, the OpenLayers 3 logo is shown. */ - logo?: any; - - /** Overlays initially added to the map. By default, no overlays are added. */ - overlays?: any; - - /** Renderer. By default, Canvas, DOM and WebGL renderers are tested for support in that order, and the first supported used. Specify a ol.RendererType here to use a specific renderer. Note that at present only the Canvas renderer supports vector data. */ - renderer?: any; - - /** The container for the map, either the element itself or the id of the element. If not specified at construction time, ol.Map#setTarget must be called for the map to be rendered. */ - target?: any; - - /** The map's view. No layer sources will be fetched unless this is specified at construction time or through ol.Map#setView. */ - view?: ViewOptions; - } - + /** * Events emitted as map browser events are instances of this type. See ol.Map for which events trigger a map browser event. */ @@ -1051,7 +1593,7 @@ declare module ol { * @constructor * @param options Overlay options. */ - constructor(options: OverlayOptions); + constructor(options: olx.OverlayOptions); /** * Get the DOM element of this overlay. @@ -1113,55 +1655,7 @@ declare module ol { */ setPositioning(positioning: ol.OverlayPositioning): void; } - interface OverlayOptions { - - /** - * The overlay element. - */ - element?: Element; - - /** - * Offsets in pixels used when positioning the overlay. The fist element in the array is the horizontal offset. A positive value shifts the overlay right. The second element in the array is the vertical offset. A positive value shifts the overlay down. Default is [0, 0]. - */ - offset?: Array; - - /** - * The overlay position in map projection. - */ - position?: ol.Coordinate; - - /** - * Defines how the overlay is actually positioned with respect to its position property. Possible values are 'bottom-left', 'bottom-center', 'bottom-right', 'center-left', 'center-center', 'center-right', 'top-left', 'top-center', and 'top-right'. Default is 'top-left'. - */ - positioning?: ol.OverlayPositioning; - - /** - * Whether event propagation to the map viewport should be stopped. Default is true. If true the overlay is placed in the same container as that of the controls (CSS class name ol-overlaycontainer-stopevent); if false it is placed in the container with CSS class name ol-overlaycontainer. - */ - stopEvent?: boolean; - - /** - * Whether the overlay is inserted first in the overlay container, or appended. Default is true. If the overlay is placed in the same container as that of the controls (see the stopEvent option) you will probably set insertFirst to true so the overlay is displayed below the controls. - */ - insertFirst?: boolean; - - /** - * If set to true the map is panned when calling setPosition, so that the overlay is entirely visible in the current viewport. The default is false. - */ - autoPan?: boolean; - - /** - * The options used to create a ol.animation.pan animation. This animation is only used when autoPan is enabled. By default the default options for ol.animation.pan are used. If set to null the panning is not animated. - */ - //TODO: replace with olx.animation.PanOptions - autoPanAnimation?: any; - - /** - * The margin (in pixels) between the overlay and the borders of the map when autopanning. The default is 20. - */ - autoPanMargin?: number; - } - + /** * Events emitted by ol.interaction.Select instances are instances of this type. */ @@ -1231,7 +1725,7 @@ declare module ol { * @constructor * @param options Options. */ - constructor(options: ViewOptions); + constructor(options?: olx.ViewOptions); /** * Calculate the extent for the current view state and the passed size. The size is the pixel dimensions of the box into which the calculated extent should fit. In most cases you want to get the extent of the entire map, that is map.getSize(). @@ -1277,7 +1771,7 @@ declare module ol { * @param size Box pixel size. * @param options Options */ - fitGeometry(geometry: ol.geom.SimpleGeometry, size: ol.Size, options?: ViewFitGeometryOptions): void; + fitGeometry(geometry: ol.geom.SimpleGeometry, size: ol.Size, options?: olx.view.FitGeometryOptions): void; /** * Get the view center. @@ -1340,78 +1834,7 @@ declare module ol { */ setZoom(zoom: number): void; } - interface ViewOptions { - - /** The initial center for the view. The coordinate system for the center is specified with the projection option. Default is undefined, and layer sources will not be fetched if this is not set. */ - center?: Coordinate; - - /** Rotation constraint. false means no constraint. true means no constraint, but snap to zero near zero. A number constrains the rotation to that number of values. For example, 4 will constrain the rotation to 0, 90, 180, and 270 degrees. The default is true. */ - constrainRotation?: boolean; - - /** Enable rotation. Default is true. If false a rotation constraint that always sets the rotation to zero is used. The constrainRotation option has no effect if enableRotation is false. */ - enableRotation?: boolean; - - /**The extent that constrains the center, in other words, center cannot be set outside this extent. Default is undefined. */ - extent?: Extent; - - /** The maximum resolution used to determine the resolution constraint. It is used together with minResolution (or maxZoom) and zoomFactor. If unspecified it is calculated in such a way that the projection's validity extent fits in a 256x256 px tile. If the projection is Spherical Mercator (the default) then maxResolution defaults to 40075016.68557849 / 256 = 156543.03392804097. */ - maxResolution?: number; - - /** The minimum resolution used to determine the resolution constraint. It is used together with maxResolution (or minZoom) and zoomFactor. If unspecified it is calculated assuming 29 zoom levels (with a factor of 2). If the projection is Spherical Mercator (the default) then minResolution defaults to 40075016.68557849 / 256 / Math.pow(2, 28) = 0.0005831682455839253. */ - minResolution?: number; - - /** The maximum zoom level used to determine the resolution constraint. It is used together with minZoom (or maxResolution) and zoomFactor. Default is 28. Note that if minResolution is also provided, it is given precedence over maxZoom. */ - maxZoom?: number; - - /** The minimum zoom level used to determine the resolution constraint. It is used together with maxZoom (or minResolution) and zoomFactor. Default is 0. Note that if maxResolution is also provided, it is given precedence over minZoom. */ - minZoom?: number; - - /** The projection. Default is EPSG:3857 (Spherical Mercator). */ - projection?: any; - - /** The initial resolution for the view. The units are projection units per pixel (e.g. meters per pixel). An alternative to setting this is to set zoom. Default is undefined, and layer sources will not be fetched if neither this nor zoom are defined. */ - resolution?: number; - - /** Resolutions to determine the resolution constraint. If set the maxResolution, minResolution, minZoom, maxZoom, and zoomFactor options are ignored. */ - resolutions?: Array; - - /** The initial rotation for the view in radians (positive rotation clockwise). Default is 0. */ - rotation?: number; - - /** Only used if resolution is not defined. Zoom level used to calculate the initial resolution for the view. The initial resolution is determined using the ol.View#constrainResolution method. */ - zoom?: number; - - /** The zoom factor used to determine the resolution constraint. Default is 2. */ - zoomFactor?: number; - } - interface ViewFitGeometryOptions { - - /** - * Padding (in pixels) to be cleared inside the view. Values in the array are top, right, bottom and left padding. Default is [0, 0, 0, 0]. - */ - padding?: Array; - - /** - * Constrain the resolution. Default is true. - */ - constrainResolution?: boolean; - - /** - * Get the nearest extent. Default is false. - */ - nearest?: boolean; - - /** - * Minimum resolution that we zoom to. Default is 0. - */ - minResolution?: number; - - /** - * Maximum zoom level that we zoom to. If minResolution is given, this property is ignored. - */ - maxZoom?: number; - } - + // NAMESPACES /** @@ -1424,124 +1847,27 @@ declare module ol { * @param options Bounce options. */ //TODO: return ol.PreRenderFunction - function bounce(options: AnimationBounceOptions): any; - interface AnimationBounceOptions { - - /** - * The resolution to start the bounce from, typically map.getView().getResolution(). - */ - resolution: number; - - /** - * The start time of the animation. Default is immediately. - */ - start?: number; - - /** - * The duration of the animation in milliseconds. Default is 1000. - */ - duration?: number; - - /** - * The easing function to use. Can be an ol.easing or a custom function. Default is ol.easing.upAndDown. - */ - // TODO: Check if it is an ol.easing function - easing: () => void; - } - + function bounce(options: olx.animation.BounceOptions): any; + /** * Generate an animated transition while updating the view center. * @param options Pan options. */ //TODO: return ol.PreRenderFunction - function pan(options: AnimationPanOptions): any; - interface AnimationPanOptions { - - /** - * The resolution to start the bounce from, typically map.getView().getResolution(). - */ - source: ol.Coordinate; - - /** - * The start time of the animation. Default is immediately. - */ - start?: number; - - /** - * The duration of the animation in milliseconds. Default is 1000. - */ - duration?: number; - - /** - * The easing function to use. Can be an ol.easing or a custom function. Default is ol.easing.upAndDown. - */ - // TODO: Check if it is an ol.easing function - easing: () => void; - } + function pan(options: olx.animation.PanOptions): any; /** * Generate an animated transition while updating the view rotation. * @param options Rotate options. */ //TODO: return ol.PreRenderFunction - function rotate(options: AnimationRotateOptions): any; - interface AnimationRotateOptions { - - /** - * The rotation value (in radians) to begin rotating from, typically map.getView().getRotation(). If undefined then 0 is assumed. - */ - rotation?: number; - - /** - * The rotation center/anchor. The map rotates around the center of the view if unspecified. - */ - anchor?: ol.Coordinate; - - /** - * The start time of the animation. Default is immediately. - */ - start?: number; - - /** - * The duration of the animation in milliseconds. Default is 1000. - */ - duration?: number; - - /** - * The easing function to use. Can be an ol.easing or a custom function. Default is ol.easing.upAndDown. - */ - // TODO: Check if it is an ol.easing function - easing: () => void; - } + function rotate(options: olx.animation.RotateOptions): any; /** * Generate an animated transition while updating the view resolution. * @param options Zoom options. */ - function pan(options: AnimationZoomOptions): any; - interface AnimationZoomOptions { - - /** - * The resolution to begin zooming from, typically map.getView().getResolution(). - */ - resolution: number; - - /** - * The start time of the animation. Default is immediately. - */ - start?: number; - - /** - * The duration of the animation in milliseconds. Default is 1000. - */ - duration?: number; - - /** - * The easing function to use. Can be an ol.easing or a custom function. Default is ol.easing.upAndDown. - */ - // TODO: Check if it is an ol.easing function - easing: () => void; - } + function pan(options: olx.animation.PanOptions): any; } /** @@ -1571,43 +1897,8 @@ declare module ol { * @param options Defaults options * @returns Control.s */ - function defaults(opt_options: ControlDefaultsOptions): ol.Collection; - interface ControlDefaultsOptions { - - /** - * Attribution. Default is true. - */ - attribution?: boolean; - - /** - * Attribution options. - */ - //TODO: Replace with olx.control.AttributionOptions - attributionOptions?: any; - - /** - * Rotate. Default is true; - */ - rotate?: boolean; - - /** - * Rotate options - */ - //TODO: Replace with olx.control.RotateOptions - rotateOptions?: any; - - /** - * Zoom. Default is true - */ - zoom?: boolean; - - /** - * - */ - //TODO: Replace with olx.control.ZoomOptions - zoomOptions?: any; - } - + function defaults(options?: olx.control.DefaultsOptions): ol.Collection; + /** * Units for the scale line. Supported values are 'degrees', 'imperial', 'nautical', 'metric', 'us'. */ @@ -1852,7 +2143,7 @@ declare module ol { * @constructor * @param options Layer options. */ - constructor(options?: BaseOptions); + constructor(options?: olx.layer.BaseOptions); /** * Return the brightness of the layer. @@ -1972,7 +2263,7 @@ declare module ol { * @constructor * @param options Layer options. */ - constructor(options?: GroupOptions); + constructor(options?: olx.layer.GroupOptions); /** * Returns the collection of layers in this group. @@ -1996,7 +2287,7 @@ declare module ol { * @constructor * @param options Options */ - constructor(options?: HeatmapOptions); + constructor(options?: olx.layer.HeatmapOptions); /** * Return the blur size in pixels. @@ -2044,7 +2335,7 @@ declare module ol { * @constructor * @param options Layer options */ - constructor(options?: ImageOptions); + constructor(options?: olx.layer.ImageOptions); /** * Return the associated source of the image layer. @@ -2062,7 +2353,7 @@ declare module ol { * @constructor * @param options Layer options */ - constructor(options?: LayerOptions); + constructor(options?: olx.layer.LayerOptions); /** * Get the layer source. @@ -2086,7 +2377,7 @@ declare module ol { * @constructor * @param options Tile layer options. */ - constructor(options?: TileOptions); + constructor(options?: olx.layer.TileOptions); /** * Return the level as number to which we will preload tiles up to. @@ -2128,7 +2419,7 @@ declare module ol { * @constructor * @param options Options */ - constructor(options?: VectorOptions); + constructor(options?: olx.layer.VectorOptions); /** * Return the associated vectorsource of the layer. @@ -2173,148 +2464,6 @@ declare module ol { // TODO: Replace 'any' with ol.style.StyleFunction setStyle(style: any): void; } - - interface BaseOptions { - - /** - * Brightness. Default is 0. - */ - brightness?: number; - - /** - * Contrast. Default is 1. - */ - contrast?: number; - - /** - * Hue. Default is 0. - */ - hue?: number; - - /** - * Opacity (0, 1). Default is 1. - */ - opacity?: number; - - /** - * Saturation. Default is 1. - */ - saturation?: number; - - /** - * Visibility. Default is true. - */ - visible?: boolean; - - /** - * The bounding extent for layer rendering. The layer will not be rendered outside of this extent. - */ - extent?: ol.Extent; - - /** - * The minimum resolution (inclusive) at which this layer will be visible. - */ - minResolution?: number; - - /** - * The maximum resolution (exclusive) below which this layer will be visible. - */ - maxResolution?: number; - } - - interface LayerOptions extends BaseOptions { - - /** - * The layer source (or null if not yet set). - */ - source?: ol.source.Source; - } - - interface GroupOptions extends BaseOptions { - - /** - * Child layers - */ - layers?: Array | ol.Collection; - } - - interface TileOptions extends LayerOptions { - - /** - * Preload. Load low-resolution tiles up to preload levels. By default preload is 0, which means no preloading. - */ - preload?: number; - - /** - * Source for this layer. - */ - source?: ol.source.Tile; - - /** - * Use interim tiles on error. Default is true. - */ - useInterimTilesOnError?: boolean; - } - - interface ImageOptions extends LayerOptions { - } - - interface VectorOptions extends LayerOptions { - - /** - * When set to true, feature batches will be recreated during animations. This means that no vectors will be shown clipped, but the setting will have a performance impact for large amounts of vector data. When set to false, batches will be recreated when no animation is active. Default is false. - */ - updateWhileAnimating?: boolean; - - /** - * When set to true, feature batches will be recreated during interactions. See also updateWhileInteracting. Default is false. - */ - updateWhileInteracting?: boolean; - - /** - * Render order. Function to be used when sorting features before rendering. By default features are drawn in the order that they are created. Use null to avoid the sort, but get an undefined draw order. - */ - // TODO: replace any with the expected function, unclear in documentation what the parameters are - renderOrder?: any; - - /** - * The buffer around the viewport extent used by the renderer when getting features from the vector source for the rendering or hit-detection. Recommended value: the size of the largest symbol, line width or label. Default is 100 pixels. - */ - renderBuffer?: number; - - /** - * Source. - */ - source?: ol.source.Vector; - - /** - * Layer style. See ol.style for default style which will be used if this is not defined. - */ - style?: ol.style.Style | Array | any; - } - - interface HeatmapOptions extends VectorOptions { - - /** - * The color gradient of the heatmap, specified as an array of CSS color strings. Default is ['#00f', '#0ff', '#0f0', '#ff0', '#f00']. - */ - gradient?: Array; - - /** - * Radius size in pixels. Default is 8. - */ - radius?: number; - - /** - * Blur size in pixels. Default is 15. - */ - blur?: number; - - /** - * Shadow size in pixels. Default is 250. - */ - shadow?: number; - } } module loadingstrategy { @@ -2558,7 +2707,7 @@ declare module ol { * @constructor * @param options Tile grid options */ - constructor(options?: TileGridOptions); + constructor(options: olx.tilegrid.TileGridOptions); /** * Creates a TileCoord transform function for use with this tile grid. Transforms the internal tile coordinates with bottom-left origin to the tile coordinates used by the ol.TileUrlFunction. The returned function expects an ol.TileCoord as first and an ol.proj.Projection as second argument and returns a transformed ol.TileCoord. @@ -2623,44 +2772,7 @@ declare module ol { */ getTileSize(z: number): number | ol.Size; } - interface TileGridOptions { - - /** - * Extent for the tile grid. No tiles outside this extent will be requested by ol.source.Tile sources. When no origin or origins are configured, the origin will be set to the bottom-left corner of the extent. When no sizes are configured, they will be calculated from the extent. - */ - extent?: ol.Extent; - - /** - * Minimum zoom. Default is 0. - */ - minZoom?: number; - - /** - * Origin, i.e. the bottom-left corner of the grid. Default is null. - */ - origin?: ol.Coordinate; - - /** - * Origins, i.e. the bottom-left corners of the grid for each zoom level. If given, the array length should match the length of the resolutions array, i.e. each resolution can have a different origin. - */ - origins?: Array; - - /** - * Resolutions. The array index of each resolution needs to match the zoom level. This means that even if a minZoom is configured, the resolutions array will have a length of maxZoom + 1. - */ - resolutions?: Array; - - /** - * Tile size. Default is [256, 256]. - */ - tileSize?: number | ol.Size; - - /** - * Tile sizes. If given, the array length should match the length of the resolutions array, i.e. each resolution can have a different tile size. - */ - tileSizes?: Array; - } - + /** * Set the grid pattern for sources accessing WMTS tiled-image servers. */ @@ -2670,7 +2782,7 @@ declare module ol { * @constructor * @param options WMTS options */ - constructor(options: WMTSOptions); + constructor(options: olx.tilegrid.WMTSOptions); /** * Create a tile grid from a WMTS capabilities matrix set. @@ -2686,54 +2798,7 @@ declare module ol { */ getMatrixIds(): Array; } - interface WMTSOptions { - - /** - * Extent for the tile grid. No tiles outside this extent will be requested by ol.source.WMTS sources. When no origin or origins are configured, the origin will be calculated from the extent. When no sizes are configured, they will be calculated from the extent. - */ - extent?: ol.Extent; - - /** - * Origin, i.e. the top-left corner of the grid. - */ - origin?: ol.Coordinate; - - /** - * Origins, i.e. the top-left corners of the grid for each zoom level. The length of this array needs to match the length of the resolutions array. - */ - origins?: Array; - - /** - * Resolutions. The array index of each resolution needs to match the zoom level. This means that even if a minZoom is configured, the resolutions array will have a length of maxZoom + 1 - */ - resolutions?: Array; - - /** - * matrix IDs. The length of this array needs to match the length of the resolutions array. - */ - matrixIds?: Array; - - /** - * Number of tile rows and columns of the grid for each zoom level. The values here are the TileMatrixWidth and TileMatrixHeight advertised in the GetCapabilities response of the WMTS, and define the grid's extent together with the origin. An extent can be configured in addition, and will further limit the extent for which tile requests are made by sources. - */ - sizes?: Array; - - /** - * Tile size. - */ - tileSize?: number | ol.Size; - - /** - * Tile sizes. The length of this array needs to match the length of the resolutions array. - */ - tileSizes?: Array; - - /** - * Number of tile columns that cover the grid's extent for each zoom level. Only required when used with a source that has wrapX set to true, and only when the grid's origin differs from the one of the projection's extent. The array length has to match the length of the resolutions array, i.e. each resolution will have a matching entry here. - */ - widths?: Array; - } - + /** * Set the grid pattern for sources accessing Zoomify tiled-image servers. */ @@ -2743,14 +2808,7 @@ declare module ol { * @constructor * @param options Options */ - constructor(options?: ZoomifyOptions); - } - interface ZoomifyOptions { - - /** - * Resolutions - */ - resolutions: Array; + constructor(options?: olx.tilegrid.ZoomifyOptions); } /** @@ -2758,29 +2816,7 @@ declare module ol { * @param options Tile grid options. * @returns The grid instance */ - function createXYZ(options: CreateXYZOptions): ol.tilegrid.TileGrid; - interface CreateXYZOptions { - - /** - * Extent for the tile grid. The origin for an XYZ tile grid is the top-left corner of the extent. The zero level of the grid is defined by the resolution at which one tile fits in the provided extent. If not provided, the extent of the EPSG:3857 projection is used. - */ - extent?: ol.Extent; - - /** - * Maximum zoom. The default is ol.DEFAULT_MAX_ZOOM. This determines the number of levels in the grid set. For example, a maxZoom of 21 means there are 22 levels in the grid set. - */ - maxZoom?: number; - - /** - * Minimum zoom. Default is 0. - */ - minZoom?: number; - - /** - * Tile size in pixels. Default is [256, 256]. - */ - tileSize?: number | ol.Size; - } + function createXYZ(options?: olx.tilegrid.XYZOptions): ol.tilegrid.TileGrid; } module webgl { From c70200ca8f04479d969903e9f37f37726f3fadda Mon Sep 17 00:00:00 2001 From: Alex Eagle Date: Wed, 24 Jun 2015 17:20:37 -0700 Subject: [PATCH 0181/1358] Update angular2 typings for alpha.28. --- angular2/angular2-2.0.0-alpha.26.d.ts | 4624 +++++++++++++++++ angular2/angular2-2.0.0-alpha.28.d.ts | 6162 ++++++++++++++++++++++ angular2/angular2.d.ts | 6833 +++++++++++++++---------- 3 files changed, 14971 insertions(+), 2648 deletions(-) create mode 100644 angular2/angular2-2.0.0-alpha.26.d.ts create mode 100644 angular2/angular2-2.0.0-alpha.28.d.ts diff --git a/angular2/angular2-2.0.0-alpha.26.d.ts b/angular2/angular2-2.0.0-alpha.26.d.ts new file mode 100644 index 0000000000..a527b13cab --- /dev/null +++ b/angular2/angular2-2.0.0-alpha.26.d.ts @@ -0,0 +1,4624 @@ +// Type definitions for Angular v2.0.0-alpha.26 +// Project: http://angular.io/ +// Definitions by: angular team +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +// *********************************************************** +// This file is generated by the Angular build process. +// Please do not create manual edits or send pull requests +// modifying this file. +// *********************************************************** + +// Angular depends transitively on these libraries. +// If you don't have them installed you can run +// $ tsd query es6-promise rx rx-lite --action install --save +/// +/// + +interface List extends Array {} +interface Map {} +interface StringMap {} +interface Type {} + +declare module "angular2/angular2" { + type SetterFn = typeof Function; + type int = number; + + // See https://github.com/Microsoft/TypeScript/issues/1168 + class BaseException /* extends Error */ { + message: any; + stack: any; + toString(): string; + } +} + + +declare module "angular2/angular2" { + class AbstractChangeDetector extends ChangeDetector { + addChild(cd: ChangeDetector): any; + addShadowDomChild(cd: ChangeDetector): any; + callOnAllChangesDone(): any; + checkNoChanges(): any; + detectChanges(): any; + detectChangesInRecords(throwOnChange: boolean): any; + lightDomChildren: List; + markAsCheckOnce(): any; + markPathToRootAsCheckOnce(): any; + mode: string; + parent: ChangeDetector; + ref: ChangeDetectorRef; + remove(): any; + removeChild(cd: ChangeDetector): any; + removeShadowDomChild(cd: ChangeDetector): any; + shadowDomChildren: List; + } + + class ProtoRecord { + args: List; + bindingRecord: BindingRecord; + contextIndex: number; + directiveIndex: DirectiveIndex; + expressionAsString: string; + fixedArgs: List; + funcOrValue: any; + isLifeCycleRecord(): boolean; + isPipeRecord(): boolean; + isPureFunction(): boolean; + lastInBinding: boolean; + lastInDirective: boolean; + mode: number; + name: string; + selfIndex: number; + } + + class LifecycleEvent { + name: string; + } + + interface FormDirective { + addControl(dir: ControlDirective): void; + addControlGroup(dir: ControlGroupDirective): void; + getControl(dir: ControlDirective): Control; + removeControl(dir: ControlDirective): void; + removeControlGroup(dir: ControlGroupDirective): void; + updateModel(dir: ControlDirective, value: any): void; + } + + + /** + * A directive that contains a group of [ControlDirective]. + * + * @exportedAs angular2/forms + */ + class ControlContainerDirective { + formDirective: FormDirective; + name: string; + path: List; + } + + + /** + * A marker annotation that marks a class as available to `Injector` for creation. Used by tooling + * for generating constructor stubs. + * + * ``` + * class NeedsService { + * constructor(svc:UsefulService) {} + * } + * + * @Injectable + * class UsefulService {} + * ``` + * @exportedAs angular2/di_annotations + */ + class Injectable { + } + + + /** + * Injectable Objects that contains a live list of child directives in the light Dom of a directive. + * The directives are kept in depth-first pre-order traversal of the DOM. + * + * In the future this class will implement an Observable interface. + * For now it uses a plain list of observable callbacks. + * + * @exportedAs angular2/view + */ + class BaseQueryList { + add(obj: any): any; + fireCallbacks(): any; + onChange(callback: any): any; + removeCallback(callback: any): any; + reset(newList: any): any; + } + + class AppProtoView { + bindElement(parent: ElementBinder, distanceToParent: int, protoElementInjector: ProtoElementInjector, componentDirective?: DirectiveBinding): ElementBinder; + + /** + * Adds an event binding for the last created ElementBinder via bindElement. + * + * If the directive index is a positive integer, the event is evaluated in the context of + * the given directive. + * + * If the directive index is -1, the event is evaluated in the context of the enclosing view. + * + * @param {string} eventName + * @param {AST} expression + * @param {int} directiveIndex The directive index in the binder or -1 when the event is not bound + * to a directive + */ + bindEvent(eventBindings: List, boundElementIndex: number, directiveIndex?: int): void; + elementBinders: List; + protoChangeDetector: ProtoChangeDetector; + protoLocals: Map; + render: RenderProtoViewRef; + variableBindings: Map; + } + + + /** + * Const of making objects: http://jsperf.com/instantiate-size-of-object + */ + class AppView implements ChangeDispatcher, EventDispatcher { + callAction(elementIndex: number, actionExpression: string, action: Object): any; + changeDetector: ChangeDetector; + componentChildViews: List; + + /** + * The context against which data-binding expressions in this view are evaluated against. + * This is always a component instance. + */ + context: any; + dispatchEvent(elementIndex: number, eventName: string, locals: Map): boolean; + elementInjectors: List; + freeHostViews: List; + getDetectorFor(directive: DirectiveIndex): any; + getDirectiveFor(directive: DirectiveIndex): any; + hydrated(): boolean; + init(changeDetector: ChangeDetector, elementInjectors: List, rootElementInjectors: List, preBuiltObjects: List, componentChildViews: List): any; + + /** + * Variables, local to this view, that can be used in binding expressions (in addition to the + * context). This is used for thing like `