From 771eca0e7db693c4675cb3b78e3e2b2c5b53eea3 Mon Sep 17 00:00:00 2001 From: Niklas Mollenhauer Date: Sat, 20 Sep 2014 10:10:07 +0200 Subject: [PATCH 1/5] Add podcast --- podcast/podcast-tests.ts | 56 ++++++++++++++++++++++++++++ podcast/podcast.d.ts | 80 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 136 insertions(+) create mode 100644 podcast/podcast-tests.ts create mode 100644 podcast/podcast.d.ts diff --git a/podcast/podcast-tests.ts b/podcast/podcast-tests.ts new file mode 100644 index 000000000..c8989d7a8 --- /dev/null +++ b/podcast/podcast-tests.ts @@ -0,0 +1,56 @@ +/// + +import Podcast = require('podcast'); + +/* lets create an rss feed */ +var feed = new Podcast({ + title: 'title', + description: 'description', + feed_url: 'http://example.com/rss.xml', + site_url: 'http://example.com', + image_url: 'http://example.com/icon.png', + docs: 'http://example.com/rss/docs.html', + author: 'Dylan Greene', + managingEditor: 'Dylan Greene', + webMaster: 'Dylan Greene', + copyright: '2013 Dylan Greene', + language: 'en', + categories: ['Category 1','Category 2','Category 3'], + pubDate: new Date('May 20, 2012 04:00:00 GMT'), + ttl: 60, + itunesAuthor: 'Max Nowack', + itunesSubtitle: 'I am a sub title', + itunesSummary: 'I am a summary', + itunesOwner: { name: 'Max Nowack', email:'max@unsou.de' }, + itunesExplicit: false, + itunesCategory: { + "name": "Entertainment", + "subcats": null + }, + itunesImage: 'http://link.to/image.png' +}); + +/* loop over data and add to feed */ +feed.item({ + title: 'item title', + description: 'use this for the content. It can include html.', + url: 'http://example.com/article4?this&that', // link to the item + guid: '1123', // optional - defaults to url + categories: ['Category 1','Category 2','Category 3','Category 4'], // optional - array of item categories + author: 'Guest Author', // optional - defaults to feed author property + date: new Date('May 27, 2012'), + lat: 33.417974, //optional latitude field for GeoRSS + long: -111.933231, //optional longitude field for GeoRSS + enclosure : {url:'...', file:'path-to-file'}, // optional enclosure + itunesAuthor: 'Max Nowack', + itunesExplicit: false, + itunesSubtitle: 'I am a sub title', + itunesSummary: 'I am a summary', + itunesDuration: 12345, + itunesKeywords: ['javascript','podcast'] +}); + +// cache the xml to send to clients +var xml = feed.xml(); + +console.log(xml); diff --git a/podcast/podcast.d.ts b/podcast/podcast.d.ts new file mode 100644 index 000000000..cfe4766ad --- /dev/null +++ b/podcast/podcast.d.ts @@ -0,0 +1,80 @@ +// Type definitions for podcast v0.1.0 +// Project: http://github.com/maxnowack/node-podcast +// Definitions by: Niklas Mollenhauer +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +interface PodcastStatic +{ + new(options: IFeedOptions): PodcastStatic; + + item(options: IItemOptions): void; + xml(indent?: string): string; +} + +interface IFeedOptions +{ + title: string; + description?: string; + generator?: string; + feed_url: string; + site_url: string; + image_url?: string; + docs?: string; + author: string; + managingEditor?: string; + webMaster?: string; + copyright?: string; + language?: string; + categories?: string[]; + pubDate?: Date; + ttl?: number; + itunesAuthor?: string; + itunesSubtitle?: string; + itunesSummary?: string; + itunesOwner?: IItunesOwner; + itunesExplicit?: boolean; + itunesCategory?: IItunesCategory; + itunesImage?: string; +} + +interface IItunesOwner +{ + name: string; + email: string; +} +interface IItunesCategory +{ + name: string; + subcats: IItunesSubCategory[] +} +interface IItunesSubCategory +{ + name: string; + subcat: string[] /* ? */ +} + +interface IItemOptions +{ + title: string; + description: string; + url: string; + guid: string; + categories?: string[]; + author?: string; + date: Date; + lat?: number; + long?: number; + itunesAuthor?: string; + itunesExplicit?: boolean; + itunesSubtitle?: string; + itunesSummary?: string; + itunesDuration?: number; + itunesKeywords?: string[]; +} + +declare var Podcast: PodcastStatic; + +declare module "podcast" +{ + export = Podcast; +} From 2a63a2d7102eee1659f596f8655fbe4ff577583c Mon Sep 17 00:00:00 2001 From: Niklas Mollenhauer Date: Sat, 20 Sep 2014 10:13:53 +0200 Subject: [PATCH 2/5] Add myself to contributors --- CONTRIBUTORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 10ebf956d..540d91252 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -288,6 +288,7 @@ All definitions files include a header with the author and editors, so at some p * [PhoneGap](http://phonegap.com) (by [Boris Yankov](https://github.com/borisyankov)) * [PixiJS](https://github.com/GoodBoyDigital/pixi.js) (by [Pedro Casaubon](https://github.com/xperiments)) * [Platform](https://github.com/bestiejs/platform.js) (by [Jake Hickman](https://github.com/JakeH)) +* [podcast](http://github.com/maxnowack/node-podcast) (by [Niklas Mollenhauer](https://github.com/nikeee)) * [PouchDB](http://pouchdb.com) (by [Bill Sears](https://github.com/MrBigDog2U/)) * [PreloadJS](http://www.createjs.com/#!/PreloadJS) (by [Pedro Ferreira](https://bitbucket.org/drk4)) * [ProgressJs](http://usablica.github.io/progress.js/) (by [Shunsuke Ohtani](https://github.com/zaneli)) From 67469b12e480f8e1df580dd82c993f14e0c087ac Mon Sep 17 00:00:00 2001 From: error Date: Mon, 27 Oct 2014 10:31:35 -0500 Subject: [PATCH 3/5] remove cast method --- es6-promise/es6-promise-commonjs-tests.ts | 6 ------ es6-promise/es6-promise-tests.ts | 6 ------ es6-promise/es6-promise.d.ts | 12 +----------- 3 files changed, 1 insertion(+), 23 deletions(-) diff --git a/es6-promise/es6-promise-commonjs-tests.ts b/es6-promise/es6-promise-commonjs-tests.ts index 4bcb4d057..b5a2fcbe4 100644 --- a/es6-promise/es6-promise-commonjs-tests.ts +++ b/es6-promise/es6-promise-commonjs-tests.ts @@ -22,12 +22,6 @@ var constructResult1 = new Promise((resolve: (promise: Thenable) }); promiseString = constructResult1; -//cast test -var castResult = Promise.cast('a string'); -promiseString = castResult; -var castResult1 = Promise.cast(Promise.resolve('a string')); -promiseString = castResult1; - //resolve test var resolveResult = Promise.resolve('a string'); promiseString = resolveResult; diff --git a/es6-promise/es6-promise-tests.ts b/es6-promise/es6-promise-tests.ts index 402328eb5..3bf5d3707 100644 --- a/es6-promise/es6-promise-tests.ts +++ b/es6-promise/es6-promise-tests.ts @@ -20,12 +20,6 @@ var constructResult1 = new Promise((resolve:(promise: Thenable) }); promiseString = constructResult1; -//cast test -var castResult = Promise.cast('a string'); -promiseString = castResult; -var castResult1 = Promise.cast(Promise.resolve('a string')); -promiseString = castResult1; - //resolve test var resolveResult = Promise.resolve('a string'); promiseString = resolveResult; diff --git a/es6-promise/es6-promise.d.ts b/es6-promise/es6-promise.d.ts index 9bb8d79f2..c71f7daca 100644 --- a/es6-promise/es6-promise.d.ts +++ b/es6-promise/es6-promise.d.ts @@ -118,23 +118,13 @@ declare class Promise implements Thenable { } declare module Promise { - /** - * Returns promise (only if promise.constructor == Promise) - */ - function cast(promise: Promise): Promise; - /** - * Make a promise that fulfills to obj. - */ - function cast(object: R): Promise; - /** * Make a new promise from the thenable. * A thenable is promise-like in as far as it has a "then" method. - * This also creates a new promise if you pass it a genuine JavaScript promise, making it less efficient for casting than Promise.cast. */ function resolve(thenable?: Thenable): Promise; /** - * Make a promise that fulfills to obj. Same as Promise.cast(obj) in this situation. + * Make a promise that fulfills to obj. */ function resolve(object?: R): Promise; From 1036916639cc4b646fac4a7202f28347dfb299b3 Mon Sep 17 00:00:00 2001 From: MIZUNE Pine Date: Tue, 28 Oct 2014 02:53:19 +0900 Subject: [PATCH 4/5] Fix --noImplicitAny error --- knockout.es5/knockout.es5-tests.ts | 2 +- knockout.es5/knockout.es5.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/knockout.es5/knockout.es5-tests.ts b/knockout.es5/knockout.es5-tests.ts index c51b9bc9d..f35ea44b8 100644 --- a/knockout.es5/knockout.es5-tests.ts +++ b/knockout.es5/knockout.es5-tests.ts @@ -5,7 +5,7 @@ var empty = {}, observable = ko.observable(123), computed = ko.computed(function () { return observable() + 1; }), model = { prop: 100 }, - notifiedValues = []; + notifiedValues: any[] = []; // Basic properties diff --git a/knockout.es5/knockout.es5.d.ts b/knockout.es5/knockout.es5.d.ts index 651d7d40f..6eb210a20 100644 --- a/knockout.es5/knockout.es5.d.ts +++ b/knockout.es5/knockout.es5.d.ts @@ -19,7 +19,7 @@ interface KnockoutDefinePropertyOptions { } interface Array { - remove(item): T[]; + remove(item: T): T[]; removeAll(items: T[]): T[]; removeAll(): T[]; From 70d7fc3befbfaf0b6ee3ee8c6ba36b28ef6970e5 Mon Sep 17 00:00:00 2001 From: Chintan Shah Date: Tue, 28 Oct 2014 01:11:57 +0530 Subject: [PATCH 5/5] Added svg-pan-zoom typings and their test file. Updated CONTRIBUTORS.md. --- CONTRIBUTORS.md | 1 + svg-pan-zoom/svg-pan-zoom-test.ts | 77 +++++++++++++++ svg-pan-zoom/svg-pan-zoom.d.ts | 151 ++++++++++++++++++++++++++++++ 3 files changed, 229 insertions(+) create mode 100644 svg-pan-zoom/svg-pan-zoom-test.ts create mode 100644 svg-pan-zoom/svg-pan-zoom.d.ts diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 52c592cc3..ab6984db6 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -382,6 +382,7 @@ All definitions files include a header with the author and editors, so at some p * [Store.js](https://github.com/marcuswestin/store.js/) (by [Vincent Bortone](https://github.com/vbortone)) * [stylus](https://github.com/LearnBoost/stylus) (by [Maxime LUCE](https://github.com/SomaticIT)) * [Sugar](http://sugarjs.com/) (by [Josh Baldwin](https://github.com/jbaldwin/)) +* [svg-pan-zoom] (https://github.com/ariutta/svg-pan-zoom) (by [Chintan Shah] (https://github.com/Promact)) * [swfobject](https://code.google.com/p/swfobject/) (by [rou](https://github.com/rou)) * [Swiper](http://www.idangero.us/sliders/swiper) (by [Sebastián Galiano](https://github.com/sgaliano)) * [SwipeView](http://cubiq.org/swipeview) (by [Boris Yankov](https://github.com/borisyankov)) diff --git a/svg-pan-zoom/svg-pan-zoom-test.ts b/svg-pan-zoom/svg-pan-zoom-test.ts new file mode 100644 index 000000000..2cb34b7c5 --- /dev/null +++ b/svg-pan-zoom/svg-pan-zoom-test.ts @@ -0,0 +1,77 @@ +/// + +var svgPanZoomOptions : SvgPanZoom.OptionConfig = { + panEnabled: true // enable or disable panning (default enabled) + , controlIconsEnabled: false // insert icons to give user an option in addition to mouse events to control pan/zoom (default disabled) + , zoomEnabled: true // enable or disable zooming (default enabled) + , dblClickZoomEnabled: true // enable or disable zooming by double clicking (default enabled) + , zoomScaleSensitivity: 0.2 // Zoom sensitivity + , minZoom: 0.5 // Minimum Zoom level + , maxZoom: 10 // Maximum Zoom level + , fit: true // enable or disable viewport fit in SVG (default true) + , center: true // enable or disable viewport centering in SVG (default true) + , beforeZoom: null + , onZoom: function(){} + , beforePan: null + , onPan: function(){} + , refreshRate: 60 // in hz +}; + +var panZoomTiger: SvgPanZoom.ISvgPanZoom = svgPanZoom('#demo-tiger'); + +var svgElement = document.querySelector('#demo-tiger'); +panZoomTiger = svgPanZoom(svgElement); + +panZoomTiger = svgPanZoom('#demo-tiger', { + panEnabled: true + , controlIconsEnabled: false + , zoomEnabled: true + , dblClickZoomEnabled: true + , zoomScaleSensitivity: 0.2 + , minZoom: 0.5 + , maxZoom: 10 + , fit: true + , center: true + , refreshRate: 'auto' + , beforeZoom: function(){} + , onZoom: function(){} + , beforePan: function(){} + , onPan: function(){} +}); + +// Pan to rendered point x = 50, y = 50 +panZoomTiger.pan({x: 50, y: 50}); + +// Pan by x = 50, y = 50 of rendered pixels +panZoomTiger.panBy({x: 50, y: 50}); + +// Set zoom level to 2 +panZoomTiger.zoom(2); + +// Zoom by 130% +panZoomTiger.zoomBy(1.3); + +// Set zoom level to 2 at point +panZoomTiger.zoomAtPoint(2, {x: 50, y: 50}); + +// Zoom by 130% at point +panZoomTiger.zoomAtPointBy(1.3, {x: 50, y: 50}); + +panZoomTiger.zoomIn(); +panZoomTiger.zoomOut(); +panZoomTiger.resetZoom(); + +panZoomTiger.enablePan(); +panZoomTiger.disablePan(); + +panZoomTiger.enableZoom(); +panZoomTiger.disableZoom(); + +panZoomTiger.fit(); +panZoomTiger.center(); + +panZoomTiger.resize(); // update SVG cached size and controls positions +panZoomTiger.fit(true); // dropCache and fit +panZoomTiger.center(true); // dropCache and center + +delete panZoomTiger; \ No newline at end of file diff --git a/svg-pan-zoom/svg-pan-zoom.d.ts b/svg-pan-zoom/svg-pan-zoom.d.ts new file mode 100644 index 000000000..75f223d7e --- /dev/null +++ b/svg-pan-zoom/svg-pan-zoom.d.ts @@ -0,0 +1,151 @@ +// Type definitions for svg-pan-zoom v2.3.9 +// Project: https://github.com/ariutta/svg-pan-zoom +// Definitions by: Chintan Shah +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module SvgPanZoom { + + interface OptionConfig { + panEnabled?: boolean; // enable or disable panning (default enabled) + controlIconsEnabled?: boolean; // insert icons to give user an option in addition to mouse events to control pan/zoom (default disabled) + zoomEnabled?: boolean; // enable or disable zooming (default enabled) + dblClickZoomEnabled?: boolean; // enable or disable zooming by double clicking (default enabled) + zoomScaleSensitivity?: number; // Zoom sensitivity + minZoom?: number; // Minimum Zoom level + maxZoom?: number; // Maximum Zoom level + fit?: boolean; // enable or disable viewport fit in SVG (default true) + center?: boolean; // enable or disable viewport centering in SVG (default true) + beforeZoom?: (scale:number) => void; + onZoom?: (scale:number) => void; + beforePan?: (point:IPoint) => void; + onPan?: (point:IPoint) => void; + refreshRate?: any; // in hz + } + + interface IPoint { + x: number; + y: number; + } + + interface ISvgPanZoom { + /** + * Creates a new SvgPanZoom instance with given element selector. + * + * @param svg selector of the tag on which it is to be applied. + * @param options provides customization options at the initialization of the object. + */ + (svg:any, options?:OptionConfig): ISvgPanZoom; + + /** + * Enables Panning on svg element + */ + enablePan(): void; + + /** + * Disables panning on svg element + */ + disablePan(): void; + + /** + * Checks if Panning is enabled or not + * @return true or false based on panning settings + */ + isPanEnabled(): boolean; + + + setBeforePan(fn: (point:IPoint)=> void): void; + + setOnPan(fn: (point:IPoint)=> void): void; + + enableZoom(): void; + + disableZoom(): void; + + isZoomEnabled(): boolean; + + enableControlIcons(): void; + + disableControlIcons(): void; + + isControlIconsEnabled(): boolean; + + enableDblClickZoom(): void; + + disableDblClickZoom(): void; + + setZoomScaleSensitivity(scale: number): void; + + setMinZoom(zoom: number): void; + + setMaxZoom(zoom: number): void; + + setBeforeZoom(fn: (scale: number) => void): void; + + setOnZoom(fn: (scale: number) => void): void; + + zoom(scale: number):void; + + zoomIn(): void; + + zoomOut(): void; + + zoomBy(scale: number): void; + + resetZoom(): void; + + /** + * Get zoom scale/level + * + * @return {float} zoom scale + */ + getZoom(): number; + + /** + * Adjust viewport size (only) so it will fit in SVG + * Does not center image + * + * @param {bool} dropCache drop viewBox cache and recalculate SVG's viewport sizes. Default false + */ + fit(dropCache?: boolean): void; + + /** + * Adjust viewport pan (only) so it will be centered in SVG + * Does not zoom/fit image + * + * @param {bool} dropCache drop viewBox cache and recalculate SVG's viewport sizes. Default false + */ + center(dropCache?: boolean): void; + + /** + * Recalculates cached svg dimensions and controls position + */ + resize(): void; + + /** + * Pan to a rendered position + * + * @param {object} point {x: 0, y: 0} + */ + pan(point: IPoint): void; + + /** + * Relatively pan the graph by a specified rendered position vector + * + * @param {object} point {x: 0, y: 0} + */ + panBy(point: IPoint): void; + + /** + * Get pan vector + * + * @return {object} {x: 0, y: 0} + */ + getPan(): IPoint; + + zoomAtPoint(scale:number, point:IPoint): boolean; + + zoomAtPointBy(scale:number, point:IPoint): boolean; + } +} + +declare var svgPanZoom:SvgPanZoom.ISvgPanZoom; \ No newline at end of file