From 2b02c1b894bc5215d3c16f5b6eb92c955ce939ef Mon Sep 17 00:00:00 2001 From: Cyril Schumacher Date: Tue, 20 Jan 2015 15:46:40 +0100 Subject: [PATCH 1/7] Add definition for "acc-wizard". --- acc-wizard/acc-wizard-tests.ts | 36 ++++++++++ acc-wizard/acc-wizard.d.ts | 101 +++++++++++++++++++++++++++++ acc-wizard/acc-wizard.ts.tscparams | 1 + 3 files changed, 138 insertions(+) create mode 100644 acc-wizard/acc-wizard-tests.ts create mode 100644 acc-wizard/acc-wizard.d.ts create mode 100644 acc-wizard/acc-wizard.ts.tscparams diff --git a/acc-wizard/acc-wizard-tests.ts b/acc-wizard/acc-wizard-tests.ts new file mode 100644 index 0000000000..1ccef7c7d7 --- /dev/null +++ b/acc-wizard/acc-wizard-tests.ts @@ -0,0 +1,36 @@ +/// +/// + +/** + * @summary Test for "accwizard" without options. + */ +function testBasic() { + $('#test').accwizard(); +} + +/** + * @summary Test for "accwizard" with options. + */ +function testBasic() { + var options: AccWizardOptions = { + addButtons: true, + sidebar: '.acc-wizard-sidebar', + activeClass: 'acc-wizard-active', + completedClass: 'acc-wizard-completed', + todoClass: 'acc-wizard-todo', + stepClass: 'acc-wizard-step', + nextText: 'Next Step', + backText: 'Go Back', + nextType: 'submit', + backType: 'reset', + nextClasses: 'btn btn-primary', + backClasses: 'btn', + autoScrolling: true, + onNext: function() {}, + onBack: function() {}, + onInit: function() {}, + onDestroy: function() {} + }; + + $('#test').accwizard(options); +} \ No newline at end of file diff --git a/acc-wizard/acc-wizard.d.ts b/acc-wizard/acc-wizard.d.ts new file mode 100644 index 0000000000..899f04b6d5 --- /dev/null +++ b/acc-wizard/acc-wizard.d.ts @@ -0,0 +1,101 @@ +// Type definitions for acc-wizard +// Project: https://github.com/sathomas/acc-wizard +// Definitions by: Cyril Schumacher +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +interface AccWizardOptions { + /** + * @summary Add next/prev buttons to panels. + * @type {boolean} + */ + addButtons: boolean; + + /** + * @summary Selector for task sidebar. + * @type {string} + */ + sidebar: string; + + /** + * @summary Class to indicate the active task in sidebar. + * @type {string} + */ + activeClass: string; + + /** + * @summary Class to indicate task is complete. + * @type {string} + */ + completedClass: string; + + /** + * @summary Class to indicate task is still pending. + * @type {string} + */ + todoClass: string; + + /** + * @summary Class for step buttons within panels. + * @type {string} + */ + stepClass: string; + + /** + * @summary Text for next button. + * @type {string} + */ + nextText: string; + + /** + * @summary Text for back button + * @type {string} + */ + backType: string; + + /** + * @summary Class(es) for next button. + * @type {string} + */ + nextClasses: string; + + /** + * @summary Class(es) for back button. + * @type {string} + */ + backClasses: string; + + /** + * @summary Auto-scrolling. + * @type {boolean} + */ + autoScrolling: boolean; + + /** + * @summary Function to call on next step. + */ + onNext: Function; + + /** + * @summary Function to call on back up. + */ + onBack: Function; + + /** + * @summary A chance to hook initialization. + */ + onInit: Function; + + /** + * @summary A chance to hook destruction. + */ + onDestroy: Function; +} + +/** + * @summary Interface for "acc-wizard" JQuery plugin. + * @author Cyril Schumacher + * @version 1.0 + */ +interface JQueryStatic { + accwizard(options: AccWizardOptions): void; +} \ No newline at end of file diff --git a/acc-wizard/acc-wizard.ts.tscparams b/acc-wizard/acc-wizard.ts.tscparams new file mode 100644 index 0000000000..934bc29ef2 --- /dev/null +++ b/acc-wizard/acc-wizard.ts.tscparams @@ -0,0 +1 @@ +--noImplicitAny \ No newline at end of file From 3dedff38f82faf28502cc52c90f671b625759566 Mon Sep 17 00:00:00 2001 From: Cyril Schumacher Date: Tue, 20 Jan 2015 15:46:40 +0100 Subject: [PATCH 2/7] Add definition for "acc-wizard". --- acc-wizard/acc-wizard-tests.ts | 36 ++++++++++ acc-wizard/acc-wizard.d.ts | 101 +++++++++++++++++++++++++++++ acc-wizard/acc-wizard.ts.tscparams | 1 + 3 files changed, 138 insertions(+) create mode 100644 acc-wizard/acc-wizard-tests.ts create mode 100644 acc-wizard/acc-wizard.d.ts create mode 100644 acc-wizard/acc-wizard.ts.tscparams diff --git a/acc-wizard/acc-wizard-tests.ts b/acc-wizard/acc-wizard-tests.ts new file mode 100644 index 0000000000..1ccef7c7d7 --- /dev/null +++ b/acc-wizard/acc-wizard-tests.ts @@ -0,0 +1,36 @@ +/// +/// + +/** + * @summary Test for "accwizard" without options. + */ +function testBasic() { + $('#test').accwizard(); +} + +/** + * @summary Test for "accwizard" with options. + */ +function testBasic() { + var options: AccWizardOptions = { + addButtons: true, + sidebar: '.acc-wizard-sidebar', + activeClass: 'acc-wizard-active', + completedClass: 'acc-wizard-completed', + todoClass: 'acc-wizard-todo', + stepClass: 'acc-wizard-step', + nextText: 'Next Step', + backText: 'Go Back', + nextType: 'submit', + backType: 'reset', + nextClasses: 'btn btn-primary', + backClasses: 'btn', + autoScrolling: true, + onNext: function() {}, + onBack: function() {}, + onInit: function() {}, + onDestroy: function() {} + }; + + $('#test').accwizard(options); +} \ No newline at end of file diff --git a/acc-wizard/acc-wizard.d.ts b/acc-wizard/acc-wizard.d.ts new file mode 100644 index 0000000000..899f04b6d5 --- /dev/null +++ b/acc-wizard/acc-wizard.d.ts @@ -0,0 +1,101 @@ +// Type definitions for acc-wizard +// Project: https://github.com/sathomas/acc-wizard +// Definitions by: Cyril Schumacher +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +interface AccWizardOptions { + /** + * @summary Add next/prev buttons to panels. + * @type {boolean} + */ + addButtons: boolean; + + /** + * @summary Selector for task sidebar. + * @type {string} + */ + sidebar: string; + + /** + * @summary Class to indicate the active task in sidebar. + * @type {string} + */ + activeClass: string; + + /** + * @summary Class to indicate task is complete. + * @type {string} + */ + completedClass: string; + + /** + * @summary Class to indicate task is still pending. + * @type {string} + */ + todoClass: string; + + /** + * @summary Class for step buttons within panels. + * @type {string} + */ + stepClass: string; + + /** + * @summary Text for next button. + * @type {string} + */ + nextText: string; + + /** + * @summary Text for back button + * @type {string} + */ + backType: string; + + /** + * @summary Class(es) for next button. + * @type {string} + */ + nextClasses: string; + + /** + * @summary Class(es) for back button. + * @type {string} + */ + backClasses: string; + + /** + * @summary Auto-scrolling. + * @type {boolean} + */ + autoScrolling: boolean; + + /** + * @summary Function to call on next step. + */ + onNext: Function; + + /** + * @summary Function to call on back up. + */ + onBack: Function; + + /** + * @summary A chance to hook initialization. + */ + onInit: Function; + + /** + * @summary A chance to hook destruction. + */ + onDestroy: Function; +} + +/** + * @summary Interface for "acc-wizard" JQuery plugin. + * @author Cyril Schumacher + * @version 1.0 + */ +interface JQueryStatic { + accwizard(options: AccWizardOptions): void; +} \ No newline at end of file diff --git a/acc-wizard/acc-wizard.ts.tscparams b/acc-wizard/acc-wizard.ts.tscparams new file mode 100644 index 0000000000..934bc29ef2 --- /dev/null +++ b/acc-wizard/acc-wizard.ts.tscparams @@ -0,0 +1 @@ +--noImplicitAny \ No newline at end of file From 32404b178f2e7de1889c9fc782326fc765853d5c Mon Sep 17 00:00:00 2001 From: Cyril Schumacher Date: Thu, 29 Jan 2015 17:16:42 +0100 Subject: [PATCH 3/7] Add definition for "IBAN.js". --- iban/iban.d.ts | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 iban/iban.d.ts diff --git a/iban/iban.d.ts b/iban/iban.d.ts new file mode 100644 index 0000000000..55efdaa2ad --- /dev/null +++ b/iban/iban.d.ts @@ -0,0 +1,58 @@ +// Type definitions for iban.js 0.0.5 +// Project: https://github.com/arhs/iban.js/ +// Definitions by: Cyril Schumacher +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module ARHS { + /** + * @summary Interface for {@link IBAN} object. + * @author Cyril Schumacher + * @version 1.0 + */ + interface IBANStatic { + /** + * @summary Returns the IBAN in a electronic format. + * @param {string} iban The IBAN to convert. + * @param {string} The IBAN in electronic format. + */ + electronicFormat(iban: string): string; + + /** + * @summary Convert the passed BBAN to an IBAN for this country specification. + * @param {string} bban The BBAN to convert to IBAN + * @returns {string} The IBAN + */ + fromBBAN(bban: string): string; + + /** + * @summary Check if the passed iban is valid according to this specification. + * @param {string} iban The iban to validate. + * @returns {boolean} True if valid, false otherwise. + */ + isValid(iban: string): boolean; + + /** + * @summary Check of the passed BBAN is valid. + * @param {string} bban The BBAN to validate + * @returns {boolean} True if valid, false otherwise. + */ + isValidBBAN(bban: string): boolean; + + /** + * @summary Returns the IBAN in a print format. + * @param {string} iban The IBAN to convert. + * @param {string} The IBAN in print format. + */ + printFormat(iban: string, separator: string[]): string; + + /** + * @summary Convert the passed IBAN to a country-specific BBAN. + * @param {string} iban The IBAN to convert. + * @param {string[]} Separator the separator to use between BBAN blocks. + * @returns {string} The BBAN + */ + toBBAN(iban: string, separator: string[]): string; + } +} + +declare var IBAN: ARHS.IBANStatic; \ No newline at end of file From 77b4c9cb9aed8de7b17434a7bd5f05676c93096c Mon Sep 17 00:00:00 2001 From: Cyril Schumacher Date: Fri, 30 Jan 2015 08:50:31 +0100 Subject: [PATCH 4/7] Add tests. Update definition. --- iban/iban-tests.ts | 53 ++++++++++++++++++++++++++++++++++++++++++ iban/iban.d.ts | 12 ++++++---- iban/iban.ts.tscparams | 1 + 3 files changed, 61 insertions(+), 5 deletions(-) create mode 100644 iban/iban-tests.ts create mode 100644 iban/iban.ts.tscparams diff --git a/iban/iban-tests.ts b/iban/iban-tests.ts new file mode 100644 index 0000000000..f33faeebd0 --- /dev/null +++ b/iban/iban-tests.ts @@ -0,0 +1,53 @@ +/// + +/** + * @summary Test for "electronicFormat" method. + */ +function testElectronicFormat() { + var iban: string = 'BE68539007547034'; + var format: string = IBAN.electronicFormat(iban); +} + +/** + * @summary Test for "fromBBAN" method. + */ +function testFromBBAN() { + var countryCode: string = 'fr'; + var bban: string = 'BBBBBGGGGGCCCCCCCCCCCKK'; + var iban: string = IBAN.fromBBAN(countryCode, bban); +} + +/** + * @summary Test for "isValid" method. + */ +function testIsValid() { + var iban: string = 'BE68539007547034'; + var valid: boolean = IBAN.isValid(iban); +} + +/** + * @summary Test for "isValidBBAN" method. + */ +function testIsValidBBAN() { + var countryCode: string = 'fr'; + var bban: string = 'BBBBBGGGGGCCCCCCCCCCCKK'; + var valid: boolean = IBAN.isValidBBAN(countryCode, bban); +} + +/** + * @summary Test for "printFormat" method. + */ +function testPrintFormat() { + var iban: string = 'BE68539007547034'; + var separator: string[] = ['fr']; + var format: string = IBAN.printFormat(iban, separator); +} + +/** + * @summary Test for "toBBAN" method. + */ +function testToBBAN() { + var iban: string = 'BE68539007547034'; + var separator: string[] = ['-']; + var bban: string = IBAN.toBBAN(iban, separator); +} \ No newline at end of file diff --git a/iban/iban.d.ts b/iban/iban.d.ts index 55efdaa2ad..b39f5908ce 100644 --- a/iban/iban.d.ts +++ b/iban/iban.d.ts @@ -19,10 +19,11 @@ declare module ARHS { /** * @summary Convert the passed BBAN to an IBAN for this country specification. - * @param {string} bban The BBAN to convert to IBAN - * @returns {string} The IBAN + * @param {string} countryCode The country of the BBAN. + * @param {string} bban The BBAN to convert to IBAN. + * @returns {string} The IBAN. */ - fromBBAN(bban: string): string; + fromBBAN(countryCode: string, bban: string): string; /** * @summary Check if the passed iban is valid according to this specification. @@ -33,10 +34,11 @@ declare module ARHS { /** * @summary Check of the passed BBAN is valid. - * @param {string} bban The BBAN to validate + * @param {string} countryCode The country of the BBAN. + * @param {string} bban The BBAN to validate. * @returns {boolean} True if valid, false otherwise. */ - isValidBBAN(bban: string): boolean; + isValidBBAN(countryCode: string, bban: string): boolean; /** * @summary Returns the IBAN in a print format. diff --git a/iban/iban.ts.tscparams b/iban/iban.ts.tscparams new file mode 100644 index 0000000000..934bc29ef2 --- /dev/null +++ b/iban/iban.ts.tscparams @@ -0,0 +1 @@ +--noImplicitAny \ No newline at end of file From 62c57a3c8a88f1ea5b586f44dbf1903a719547fe Mon Sep 17 00:00:00 2001 From: Cyril Schumacher Date: Fri, 30 Jan 2015 13:13:46 +0100 Subject: [PATCH 5/7] Add definition for "jquery.dropotron". --- jquery.dropotron/jquery.dropotron-tests.ts | 42 +++++ jquery.dropotron/jquery.dropotron.d.ts | 160 ++++++++++++++++++ .../jquery.dropotron.ts.tscparams | 1 + 3 files changed, 203 insertions(+) create mode 100644 jquery.dropotron/jquery.dropotron-tests.ts create mode 100644 jquery.dropotron/jquery.dropotron.d.ts create mode 100644 jquery.dropotron/jquery.dropotron.ts.tscparams diff --git a/jquery.dropotron/jquery.dropotron-tests.ts b/jquery.dropotron/jquery.dropotron-tests.ts new file mode 100644 index 0000000000..6b55c6d584 --- /dev/null +++ b/jquery.dropotron/jquery.dropotron-tests.ts @@ -0,0 +1,42 @@ +/// +/// + +/** + * @summary Test for "dropotron" without configurations. + */ +function testDropotron() { + var foo: JQuery = $('#main-nav > ul'); + foo.dropotron(); +} + +/** + * @summary Test for "dropotron" with configurations. + */ +function testDropotronConfiguration() { + var config: DropotronConfiguration = { + selectorParent: null, + baseZIndex: 1000, + menuClass: 'dropotron', + expandMode: 'hover', + hoverDelay: 150, + hideDelay: 250, + openerClass: 'opener', + openerActiveClass: 'active', + submenuClassPrefix: 'level-', + mode: 'fade', + speed: 'fast', + easing: 'swing', + alignment: 'left', + offsetX: 0, + offsetY: 0, + globalOffsetY: 0, + IEOffsetX: 0, + IEOffsetY: 0, + noOpenerFade: true, + detach: true, + cloneOnDetach: true + }; + + var foo: JQuery = $('#main-nav > ul'); + foo.dropotron(config); +} \ No newline at end of file diff --git a/jquery.dropotron/jquery.dropotron.d.ts b/jquery.dropotron/jquery.dropotron.d.ts new file mode 100644 index 0000000000..6c3df6a27e --- /dev/null +++ b/jquery.dropotron/jquery.dropotron.d.ts @@ -0,0 +1,160 @@ +// Type definitions for jquery.dropotron 1.4.3 +// Project: https://github.com/n33/jquery.dropotron +// Definitions by: Cyril Schumacher +// Definitions: https://github.com/borisyankov/DefinitelyTyped/ + +/** + * @summary Interface for "dropotron" configurations. + * @author Cyril Schumacher + * @version 1.0 + */ +interface DropotronConfiguration { + + /** + * @summary Alignment ("left", "center", "right"). + * @type {string} + */ + alignment: string; + + /** + * @summary Base Z-Index. + * @type {number} + */ + baseZIndex: number; + + /** + * @summary If true and detach = true, leave original menu intact. + * @type {boolean} + */ + cloneOnDetach: boolean; + + /** + * @summary Detach second level menus (prevents parent style bleed). + * @type {boolean} + */ + detach: boolean; + + /** + * @summary Easing mode ("swing", "linear"). + * @type {string} + */ + easing: string; + + /** + * @summary IE Offset X. + * @type {number} + */ + IEOffsetX: number; + + /** + * @summary IE Offset Y. + * @type {number} + */ + IEOffsetY: number; + + /** + * @summary Expansion mode ("hover" or "click"). + * @type {string} + */ + expandMode: string; + + /** + * @summary Global offset Y. + * @type {number} + */ + globalOffsetY: number; + + /** + * @summary Hide delay (in ms; 0 disables). + * @type {number} + */ + hideDelay: number; + + /** + * @summary Hover delay (in ms). + * @type {number} + */ + hoverDelay: number; + + /** + * @summary Menu class (assigned to every
    ). + * @type {string} + */ + menuClass: string; + + /** + * @summary Menu mode ("instant", "fade", "slide", "zoom"). + * @type {string} + */ + mode: string; + + /** + * @summary If true and mode = "fade", prevents top-level opener fade. + * @type {boolean} + */ + noOpenerFade: boolean; + + /** + * @summary Submenu offset X. + * @type {number} + */ + offsetX: number; + + /** + * @summary Submenu offset Y. + * @type {number} + */ + offsetY: number; + + /** + * @summary Active opener class. + * @type {string} + */ + openerActiveClass: string; + + /** + * @summary Opener class. + * @type {number} + */ + openerClass: number; + + /** + * @summary Parent jQuery object. + * @type {JQuery} + */ + selectorParent: JQuery; + + /** + * @summary Menu speed ("fast", "slow", or ms). + * @type {string} + */ + speed: string; + + /** + * @summary Submenu class prefix. + * @type {string} + */ + submenuClassPrefix: string; +} + +/** + * @summary Interface for "dropotron". + * @author Cyril Schumacher + * @version 1.0 + */ +interface Dropotron { + /** + * @summary Adds multilevel dropdown menus to jQuery. + * @param {DropotronConfiguration} config Optional. Configuration. + */ + (config?: DropotronConfiguration): void; +} + +/** + * @summary Interface for "JQuery". + * @author Cyril Schumacher + * @version 1.0 + */ +interface JQuery { + dropotron: Dropotron; +} \ No newline at end of file diff --git a/jquery.dropotron/jquery.dropotron.ts.tscparams b/jquery.dropotron/jquery.dropotron.ts.tscparams new file mode 100644 index 0000000000..934bc29ef2 --- /dev/null +++ b/jquery.dropotron/jquery.dropotron.ts.tscparams @@ -0,0 +1 @@ +--noImplicitAny \ No newline at end of file From e16b425072e83dbbeb12d4d492ba972f32d06195 Mon Sep 17 00:00:00 2001 From: cyrilschumacher Date: Fri, 30 Jan 2015 20:10:32 +0100 Subject: [PATCH 6/7] Fix bugs. --- acc-wizard/acc-wizard-tests.ts | 2 +- acc-wizard/acc-wizard.d.ts | 2 +- jquery.dropotron/jquery.dropotron.d.ts | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/acc-wizard/acc-wizard-tests.ts b/acc-wizard/acc-wizard-tests.ts index 1ccef7c7d7..9cf089b44a 100644 --- a/acc-wizard/acc-wizard-tests.ts +++ b/acc-wizard/acc-wizard-tests.ts @@ -11,7 +11,7 @@ function testBasic() { /** * @summary Test for "accwizard" with options. */ -function testBasic() { +function testWithOptions() { var options: AccWizardOptions = { addButtons: true, sidebar: '.acc-wizard-sidebar', diff --git a/acc-wizard/acc-wizard.d.ts b/acc-wizard/acc-wizard.d.ts index 899f04b6d5..19d5498847 100644 --- a/acc-wizard/acc-wizard.d.ts +++ b/acc-wizard/acc-wizard.d.ts @@ -96,6 +96,6 @@ interface AccWizardOptions { * @author Cyril Schumacher * @version 1.0 */ -interface JQueryStatic { +interface JQuery { accwizard(options: AccWizardOptions): void; } \ No newline at end of file diff --git a/jquery.dropotron/jquery.dropotron.d.ts b/jquery.dropotron/jquery.dropotron.d.ts index 6c3df6a27e..2b7d2090ee 100644 --- a/jquery.dropotron/jquery.dropotron.d.ts +++ b/jquery.dropotron/jquery.dropotron.d.ts @@ -114,9 +114,9 @@ interface DropotronConfiguration { /** * @summary Opener class. - * @type {number} + * @type {string} */ - openerClass: number; + openerClass: string; /** * @summary Parent jQuery object. From 7ab1e5f60455d21dfb208dbc11f6837dbe2a4fa3 Mon Sep 17 00:00:00 2001 From: cyrilschumacher Date: Fri, 30 Jan 2015 20:12:14 +0100 Subject: [PATCH 7/7] Fix bugs. --- acc-wizard/acc-wizard.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/acc-wizard/acc-wizard.d.ts b/acc-wizard/acc-wizard.d.ts index 19d5498847..5eb81a11c7 100644 --- a/acc-wizard/acc-wizard.d.ts +++ b/acc-wizard/acc-wizard.d.ts @@ -97,5 +97,5 @@ interface AccWizardOptions { * @version 1.0 */ interface JQuery { - accwizard(options: AccWizardOptions): void; + accwizard(options?: AccWizardOptions): void; } \ No newline at end of file