From eff54af628a053f78dc63d6d79da6862a8a71439 Mon Sep 17 00:00:00 2001 From: peferron Date: Mon, 13 Apr 2015 21:02:00 -0700 Subject: [PATCH 001/179] lodash: update _.zipObject and _.object - Update the jsdoc and parameter names. - Add the 'two-dimensional array' invocation type. - Add chaining. - In the test file, replace `{ [key: string]: any }` by `Dictionary` for consistency with the rest of the code. --- lodash/lodash-tests.ts | 10 +++++++-- lodash/lodash.d.ts | 46 +++++++++++++++++++++++++++++++----------- 2 files changed, 42 insertions(+), 14 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 46c11ebf6..4c19db806 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -255,8 +255,14 @@ result = _.last(foodsType, { 'type': 'vegetable' }); result = _.lastIndexOf([1, 2, 3, 1, 2, 3], 2); result = _.lastIndexOf([1, 2, 3, 1, 2, 3], 2, 3); -result = <{ [key: string]: any }>_.zipObject(['moe', 'larry'], [30, 40]); -result = <{ [key: string]: any }>_.object(['moe', 'larry'], [30, 40]); +result = <_.Dictionary>_.zipObject(['moe', 'larry'], [30, 40]); +result = <_.LoDashObjectWrapper<_.Dictionary>>_(['moe', 'larry']).zipObject([30, 40]); +result = <_.Dictionary>_.object(['moe', 'larry'], [30, 40]); +result = <_.LoDashObjectWrapper<_.Dictionary>>_(['moe', 'larry']).object([30, 40]); +result = <_.Dictionary>_.zipObject([['moe', 30], ['larry', 40]]); +result = <_.LoDashObjectWrapper<_.Dictionary>>_([['moe', 30], ['larry', 40]]).zipObject(); +result = <_.Dictionary>_.object([['moe', 30], ['larry', 40]]); +result = <_.LoDashObjectWrapper<_.Dictionary>>_([['moe', 30], ['larry', 40]]).object(); result = _.pull([1, 2, 3, 1, 2, 3], 2, 3); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 55d35707f..55d099f18 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -2042,25 +2042,47 @@ declare module _ { //_.zipObject interface LoDashStatic { /** - * Creates an object composed from arrays of keys and values. Provide either a single - * two dimensional array, i.e. [[key1, value1], [key2, value2]] or two arrays, one of - * keys and one of corresponding values. - * @param keys The array of keys. - * @param values The array of values. - * @return An object composed of the given keys and corresponding values. + * The inverse of _.pairs; this method returns an object composed from arrays of property + * names and values. Provide either a single two dimensional array, e.g. [[key1, value1], + * [key2, value2]] or two arrays, one of property names and one of corresponding values. + * @param props The property names. + * @param values The property values. + * @return Returns the new object. **/ zipObject( - keys: List, - values: List): TResult; + props: List, + values?: List): TResult; /** - * @see _.object + * @see _.zipObject + **/ + zipObject(props: List>): Dictionary; + + /** + * @see _.zipObject **/ object( - keys: List, - values: List): TResult; - } + props: List, + values?: List): TResult; + /** + * @see _.zipObject + **/ + object(props: List>): Dictionary; + } + + interface LoDashArrayWrapper { + /** + * @see _.zipObject + **/ + zipObject(values?: List): _.LoDashObjectWrapper>; + + /** + * @see _.zipObject + **/ + object(values?: List): _.LoDashObjectWrapper>; + } + /* ************* * Collections * ************* */ From cdd08b72e65740475a5621e94f09f488b1cf3fc9 Mon Sep 17 00:00:00 2001 From: peferron Date: Mon, 20 Apr 2015 15:48:52 -0700 Subject: [PATCH 002/179] lodash: add _.sum --- lodash/lodash-tests.ts | 26 ++++++++- lodash/lodash.d.ts | 116 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 141 insertions(+), 1 deletion(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 10900315f..8297014f8 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -39,6 +39,10 @@ interface IKey { code: number; } +interface IDictionary { + [index: string]: T; +} + var foodsOrganic: IFoodOrganic[] = [ { name: 'banana', organic: true }, { name: 'beet', organic: false }, @@ -61,7 +65,10 @@ var stoogesAges: IStoogesAge[] = [ { 'name': 'moe', 'age': 40 }, { 'name': 'larry', 'age': 50 } ]; - +var stoogesAgesDict: IDictionary = { + first: { 'name': 'moe', 'age': 40 }, + second: { 'name': 'larry', 'age': 50 } +}; var stoogesCombined: IStoogesCombined[] = [ { 'name': 'curly', 'age': 30, 'quotes': ['Oh, a wise guy, eh?', 'Poifect!'] }, { 'name': 'moe', 'age': 40, 'quotes': ['Spread out!', 'You knucklehead!'] } @@ -501,6 +508,23 @@ result = <_.LoDashWrapper>_([4, 2, 8, 6]).min(); result = <_.LoDashWrapper>_(stoogesAges).min(function (stooge) { return stooge.age; }); result = <_.LoDashWrapper>_(stoogesAges).min('age'); +result = _.sum([4, 2, 8, 6]); +result = _.sum([4, 2, 8, 6], function(v) { return v; }); +result = _.sum({a: 2, b: 4}); +result = _.sum({a: 2, b: 4}, function(v) { return v; }); +result = _.sum(stoogesAges, function (stooge) { return stooge.age; }); +result = _.sum(stoogesAges, 'age'); +result = _.sum(stoogesAgesDict, function(stooge) { return stooge.age; }); +result = _.sum(stoogesAgesDict, 'age'); +result = _([4, 2, 8, 6]).sum(); +result = _([4, 2, 8, 6]).sum(function(v) { return v; }); +result = _({a: 2, b: 4}).sum(); +result = _({a: 2, b: 4}).sum(function(v) { return v; }); +result = _(stoogesAges).sum(function (stooge) { return stooge.age; }); +result = _(stoogesAges).sum('age'); +result = _(stoogesAgesDict).sum(function (stooge) { return stooge.age; }); +result = _(stoogesAgesDict).sum('age'); + result = _.pluck(stoogesAges, 'name'); result = _(stoogesAges).pluck('name').value(); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 01238b769..145849230 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -3842,6 +3842,122 @@ declare module _ { min( whereValue: W): LoDashWrapper; } + + //_.sum + interface LoDashStatic { + /** + * Gets the sum of the values in collection. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the sum. + **/ + sum( + collection: Array): number; + + /** + * @see _.sum + **/ + sum( + collection: List): number; + + /** + * @see _.sum + **/ + sum( + collection: Dictionary): number; + + /** + * @see _.sum + **/ + sum( + collection: Array, + iteratee: ListIterator, + thisArg?: any): number; + + /** + * @see _.sum + **/ + sum( + collection: List, + iteratee: ListIterator, + thisArg?: any): number; + + /** + * @see _.sum + **/ + sum( + collection: Dictionary, + iteratee: ObjectIterator, + thisArg?: any): number; + + /** + * @see _.sum + * @param property _.property callback shorthand. + **/ + sum( + collection: Array, + property: string): number; + + /** + * @see _.sum + * @param property _.property callback shorthand. + **/ + sum( + collection: List, + property: string): number; + + /** + * @see _.sum + * @param property _.property callback shorthand. + **/ + sum( + collection: Dictionary, + property: string): number; + } + + interface LoDashArrayWrapper { + /** + * @see _.sum + **/ + sum(): number + + /** + * @see _.sum + **/ + sum( + iteratee: ListIterator, + thisArg?: any): number; + + /** + * @see _.sum + * @param property _.property callback shorthand. + **/ + sum( + property: string): number; + } + + interface LoDashObjectWrapper { + /** + * @see _.sum + **/ + sum(): number + + /** + * @see _.sum + **/ + sum( + iteratee: ObjectIterator, + thisArg?: any): number; + + /** + * @see _.sum + * @param property _.property callback shorthand. + **/ + sum( + property: string): number; + } //_.pluck interface LoDashStatic { From 90360d69d98f95825f5390b96c44db0a6d72ad1c Mon Sep 17 00:00:00 2001 From: peferron Date: Tue, 28 Apr 2015 12:19:53 -0700 Subject: [PATCH 003/179] lodash: make `sum()` only callable on wrapped arrays of numbers This change triggers a compilation error when typing e.g. _(["abc"]).sum() --- lodash/lodash.d.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 145849230..331ec46ae 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -41,6 +41,7 @@ declare module _ { (value: number): LoDashWrapper; (value: string): LoDashWrapper; (value: boolean): LoDashWrapper; + (value: Array): LoDashNumberArrayWrapper; (value: Array): LoDashArrayWrapper; (value: T): LoDashObjectWrapper; (value: any): LoDashWrapper; @@ -205,6 +206,8 @@ declare module _ { unshift(...items: any[]): LoDashWrapper; } + interface LoDashNumberArrayWrapper extends LoDashArrayWrapper { } + //_.chain interface LoDashStatic { /** @@ -3917,12 +3920,21 @@ declare module _ { property: string): number; } - interface LoDashArrayWrapper { + interface LoDashNumberArrayWrapper { /** * @see _.sum **/ sum(): number + /** + * @see _.sum + **/ + sum( + iteratee: ListIterator, + thisArg?: any): number; + } + + interface LoDashArrayWrapper { /** * @see _.sum **/ From 9d7073f5725e97e8a2522fdf1ae3df9470d2cffd Mon Sep 17 00:00:00 2001 From: campers Date: Wed, 6 May 2015 16:13:45 +0800 Subject: [PATCH 004/179] Update parse.d.ts Add additional error codes --- parse/parse.d.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/parse/parse.d.ts b/parse/parse.d.ts index 1aab10416..01d72df7a 100644 --- a/parse/parse.d.ts +++ b/parse/parse.d.ts @@ -851,6 +851,9 @@ declare module Parse { INVALID_IMAGE_DATA = 150, UNSAVED_FILE_ERROR = 151, INVALID_PUSH_TIME_ERROR = 152, + FILE_DELETE_ERROR = 153, + REQUEST_LIMIT_EXCEEDED = 155, + INVALID_EVENT_NAME = 160, USERNAME_MISSING = 200, PASSWORD_MISSING = 201, USERNAME_TAKEN = 202, @@ -860,6 +863,7 @@ declare module Parse { SESSION_MISSING = 206, MUST_CREATE_USER_THROUGH_SIGNUP = 207, ACCOUNT_ALREADY_LINKED = 208, + INVALID_SESSION_TOKEN = 209, LINKED_ID_MISSING = 250, INVALID_LINKED_SESSION = 251, UNSUPPORTED_SERVICE = 252, From 9a53f5ee84bbd1bd8f69d0ac6e369950a9ad46f6 Mon Sep 17 00:00:00 2001 From: Mads Date: Thu, 7 May 2015 07:57:08 +0200 Subject: [PATCH 005/179] UpdateSpec properties should be optional --- react/react-addons-global.d.ts | 6 +++--- react/react-addons.d.ts | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/react/react-addons-global.d.ts b/react/react-addons-global.d.ts index 891e0d101..3e028f5f0 100644 --- a/react/react-addons-global.d.ts +++ b/react/react-addons-global.d.ts @@ -77,9 +77,9 @@ declare module React { // ---------------------------------------------------------------------- interface UpdateSpec { - $set: any; - $merge: {}; - $apply(value: any): any; + $set?: any; + $merge?: {}; + $apply(value: any)?: any; // [key: string]: UpdateSpec; } diff --git a/react/react-addons.d.ts b/react/react-addons.d.ts index caf0fa8e0..d61bf4221 100644 --- a/react/react-addons.d.ts +++ b/react/react-addons.d.ts @@ -812,9 +812,9 @@ declare module "react/addons" { // ---------------------------------------------------------------------- interface UpdateSpec { - $set: any; - $merge: {}; - $apply(value: any): any; + $set?: any; + $merge?: {}; + $apply(value: any)?: any; // [key: string]: UpdateSpec; } From ce1a362952514d191e9654d8a4ce1917cf72dfe5 Mon Sep 17 00:00:00 2001 From: Peter Grman Date: Thu, 7 May 2015 17:42:56 +0200 Subject: [PATCH 006/179] Add type definitions for angular-meteor --- angular-meteor/angular-meteor-tests.ts | 253 +++++++++++++++++++ angular-meteor/angular-meteor.d.ts | 322 +++++++++++++++++++++++++ 2 files changed, 575 insertions(+) create mode 100644 angular-meteor/angular-meteor-tests.ts create mode 100644 angular-meteor/angular-meteor.d.ts diff --git a/angular-meteor/angular-meteor-tests.ts b/angular-meteor/angular-meteor-tests.ts new file mode 100644 index 000000000..be75f196b --- /dev/null +++ b/angular-meteor/angular-meteor-tests.ts @@ -0,0 +1,253 @@ +/// + +interface ITodo { + _id?: string; + name: string; + public?: boolean; + sticky?: boolean; +} + +interface TodoAngularMeteorObject extends ITodo, angular.meteor.AngularMeteorObject {} + +interface CustomScope extends angular.meteor.IScope { + sticky: boolean; + + todos: angular.meteor.AngularMeteorCollection; + stickyTodos: angular.meteor.AngularMeteorCollection; + notAutoTodos: angular.meteor.AngularMeteorCollection; + + todo: ITodo; + todoNotAuto: TodoAngularMeteorObject; + + save: (todo: ITodo) => void; + saveAll: () =>void; + autoSave: (todo: ITodo) => void; + remove: (todoId: string) => void; + removeAll: () => void; + removeAuto: (todo: ITodo) => void; + toSticky: (todo: ITodo) => void; +} + +var Todos = new Mongo.Collection('todos'); + +var app = angular.module('angularMeteorTestApp'); + +app.controller("mainCtrl", ['$scope', '$meteor', ($scope: CustomScope, $meteor: angular.meteor.IMeteorService) => { + // Bind all the todos to $scope.todos + $scope.todos = $meteor.collection(Todos); + + $scope.sticky = true; + // Bind all sticky todos to $scope.stickyTodos + // Binds the query to $scope.sticky so that if it changes, Meteor will re-run the query and bind it + // to $scope.stickyTodos + $scope.stickyTodos = $meteor.collection(function(){ + return Todos.find({sticky: $scope.getReactively('sticky')}); + }); + + // Bind without auto-save all todos to $scope.notAutoTodos + $scope.notAutoTodos = $meteor.collection(Todos, false).subscribe("publicTodos"); + + $scope.todoNotAuto = $meteor.object(Todos, 'TodoID', false); + $scope.todo = $scope.todoNotAuto.getRawObject(); + $scope.todoNotAuto.reset(); + $scope.todoNotAuto.save($scope.todo).then((data) => { return data == 1; });; + + // todo might be an object like this {text: "Learn Angular", sticky: false} + // or an array like this: + // [{text: "Learn Angular", sticky: false}, {text: "Hello World", sticky: true}] + + $scope.save = function(todo) { + $scope.notAutoTodos.save(todo); + }; + + $scope.saveAll = function() { + $scope.notAutoTodos.save(); + }; + + $scope.autoSave = function(todo) { + $scope.todos.push(todo); + }; + + // todoId might be an string like this "WhrnEez5yBRgo4yEm" + // or an array like this ["WhrnEez5yBRgo4yEm","gH6Fa4DXA3XxQjXNS"] + $scope.remove = function(todoId) { + $scope.notAutoTodos.remove(todoId); + }; + + $scope.removeAll = function() { + $scope.notAutoTodos.remove(); + }; + + $scope.removeAuto = function(todo) { + $scope.todos.splice( $scope.todos.indexOf(todo), 1 ); + } + + $scope.toSticky = function(todo) { + if (angular.isArray(todo)){ + angular.forEach(todo, function(object) { + object.sticky = true; + }); + } else { + todo.sticky = true; + } + + $scope.stickyTodos.save(todo); + }; + + var todoObject = {name:'first todo'}; + var todosArray = [{name:'second todo'}, {name:'third todo'}]; + var todoSecondObject = {name:'forth todo'}; + + $scope.todos.save(todoObject); // todos equals [{name:'first todo'}] + + $scope.todos.save(todosArray); // todos equals [{name:'first todo'}, {name:'second todo'}, {name:'third todo'}] + + $scope.todos.push(todoSecondObject); // The scope variable equals to [{name:'first todo'}, {name:'second todo'}, {name:'third todo'}, {name:'forth todo'}] + // but the collection still equals to [{name:'first todo'}, {name:'second todo'}, {name:'third todo'}] + + $scope.todos.save(); // Now the collection also equals to [{name:'first todo'}, {name:'second todo'}, {name:'third todo'}, {name:'forth todo'}] + + $scope.todos.remove('firstTodoId'); // scope and collection equals to [{name:'second todo'}, {name:'third todo'}, {name:'forth todo'}] + + var todoIdsArray = ['secondTodoId', 'thirdTodoId']; + $scope.todos.remove(todoIdsArray); // removes everything matches the array of IDs both in scope and in collection + + $scope.todos.pop(); // removes only in scope + + $scope.todos.remove(); // syncs also in Meteor collection + + // Subscribe -> + + $meteor.subscribe('todos').then((subscriptionHandle) => { + // Bind all the todos to $scope.todos + $scope.todos = $meteor.collection(Todos); + + console.log($scope.todos + ' is ready'); + + // You can use the subscription handle to stop the subscription if you want + subscriptionHandle.stop(); + }); + + $scope.subscribe('todos').then((subscriptionHandle) => { + // Bind all the todos to $scope.books + $scope.todos = $meteor.collection(Todos); + + console.log($scope.todos + ' is ready'); + + // No need to stop the subscription, it will automatically close on scope destroy + }); + + $meteor.call('subscribe', $scope.todo._id, $scope.currentUser._id).then((data) => { + // Handle success + console.log('success subscribing', data.name); + }, (err) => { + // Handle error + console.log('failed', err); + }); + + if (!$scope.loggingIn) { + $meteor.waitForUser(); + + $meteor.requireUser(); + + $meteor.requireValidUser(user => { + return user.username == 'admin'; + }); + + $meteor.loginWithPassword('user', 'password').then(() => { + console.log('Login success'); + }, err => { + console.log('Login error - ', err); + }); + + $meteor.createUser({ + username:'moma', + email:'example@gmail.com', + password: 'Bksd@asdf', + profile: {expertize: 'Developer'} + }).then(() => { + console.log('Login success'); + }, err => { + console.log('Login error - ', err); + }); + + $meteor.changePassword('old', 'new232f3').then(() => { + console.log('Change password success'); + }, err => { + console.log('Error changing password - ', err); + }); + + $meteor.forgotPassword({email: 'sample@gmail.com'}).then(() => { + console.log('Success sending forgot password email'); + }, err => { + console.log('Error sending forgot password email - ', err); + }); + + $meteor.resetPassword('tokenID', 'new232f3').then(() => { + console.log('Reset password success'); + }, err => { + console.log('Error resetting password - ', err); + }); + + $meteor.verifyEmail('tokenID').then(() => { + console.log('Success verifying password '); + }, err => { + console.log('Error verifying password - ', err); + }); + + $meteor.logout().then(() => { + console.log('Logout success'); + }, err => { + console.log('logout error - ', err); + }); + + $meteor.logoutOtherClients().then(() => { + console.log('Logout success'); + }, err => { + console.log('logout error - ', err); + }); + + var loginWithOptions = {requestPermissions: ['email']}; + + $meteor.loginWithFacebook({requestPermissions: ['email']}).then(() => { + console.log('Login success'); + }, err => { + console.log('Login error - ', err); + }); + $meteor.loginWithGithub({requestPermissions: ['email']}).then(() => { + console.log('Login success'); + }, err => { + console.log('Login error - ', err); + }); + $meteor.loginWithGoogle({requestPermissions: ['email']}).then(() => { + console.log('Login success'); + }, err => { + console.log('Login error - ', err); + }); + $meteor.loginWithMeetup({requestPermissions: ['email']}).then(() => { + console.log('Login success'); + }, err => { + console.log('Login error - ', err); + }); + $meteor.loginWithTwitter({requestPermissions: ['email']}).then(() => { + console.log('Login success'); + }, err => { + console.log('Login error - ', err); + }); + $meteor.loginWithWeibo({requestPermissions: ['email']}).then(() => { + console.log('Login success'); + }, err => { + console.log('Login error - ', err); + }); + } + + $meteor.autorun($scope, () => { console.log("Aurorun triggered."); }); + $meteor.getCollectionByName('collectionName'); + + // requires meteor add mdg:camera + $meteor.getPicture().then(function(data){ + $scope['picture'] = data; + }); + + $meteor.session('counter').bind($scope, 'counter'); +}]); diff --git a/angular-meteor/angular-meteor.d.ts b/angular-meteor/angular-meteor.d.ts new file mode 100644 index 000000000..18f2e033e --- /dev/null +++ b/angular-meteor/angular-meteor.d.ts @@ -0,0 +1,322 @@ +// Type definitions for Angular JS Meteor v0.8.8 (angular.meteor module) +// Project: https://github.com/Urigo/angular-meteor +// Definitions by: Peter Grman +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +/// + +declare module angular.meteor { + interface IRootScopeService extends angular.IRootScopeService { + /** + * The current logged in user and it's data. it is null if the user is not logged in. A reactive data source. + */ + currentUser: Meteor.User; + + /** + * True if a login method (such as Meteor.loginWithPassword, Meteor.loginWithFacebook, or Accounts.createUser) is currently in progress. + * A reactive data source. Can be use to display animation while user is logging in. + */ + loggingIn: boolean; + } + + interface IScope extends angular.IScope, IRootScopeService { + /** + * A method to get a $scope variable and watch it reactivly + * + * @param scopeVariableName - The name of the scope's variable to bind to + * @param [objectEquality=false] - Watch the object equality using angular.equals instead of comparing for reference equality, deeper watch but also slower + */ + getReactively(scopeVariableName: string, objectEquality?: boolean): ReactiveResult; + + /** + * A service which is a wrapper for Meteor.subscribe. It subscribes to a Meteor.publish method in the client and returns a AngularJS promise when ready. + * Calling $scope.subscribe will automatically stop the subscription when the scope is destroyed. + * + * @param name - Name of the subscription. Matches the name of the server's publish() call. + * @param publisherArguments - Optional arguments passed to publisher function on server. + * + * @return The promise solved successfully when subscription is ready. The success promise holds the subscription handle. + */ + subscribe(name: string, ...publisherArguments: any[]): angular.IPromise; + } + + /** + * $meteor in angularjs + */ + interface IMeteorService { + /** + * A service that wraps the Meteor collections to enable reactivity within AngularJS. + * + * @param collection - A Meteor Collection or a reactive function to bind to. + * - Reactive function can be used with $scope.getReactively to add $scope variable as reactive variable to the cursor. + * @param [autoClientSave=true] - By default, changes in the Angular collection will automatically update the Meteor collection. + * - However if set to false, changes in the client won't be automatically propagated back to the Meteor collection. + */ + collection(collection: Mongo.Collection|ReactiveResult, autoClientSave?: boolean): AngularMeteorCollection; + + /** + * A service that wraps the Meteor collections to enable reactivity within AngularJS. + * + * @param collection - A Meteor Collection or a reactive function to bind to. + * - Reactive function can be used with $scope.getReactively to add $scope variable as reactive variable to the cursor. + * @param [autoClientSave=true] - By default, changes in the Angular collection will automatically update the Meteor collection. + * - However if set to false, changes in the client won't be automatically propagated back to the Meteor collection. + * @param [updateCollection] - A collection object which will be used for updates (insert, update, delete). + */ + collection(collection: Mongo.Collection|ReactiveResult, autoClientSave: boolean, updateCollection: Mongo.Collection): AngularMeteorCollection2; + + /** + * A service that wraps a Meteor object to enable reactivity within AngularJS. + * Finds the first document that matches the selector, as ordered by sort and skip options. Wraps collection.findOne + * + * @param collection - A Meteor Collection to bind to. + * @param selector - A query describing the documents to find or just the ID of the document. + * - $meteor.object will find the first document that matches the selector, + * - as ordered by sort and skip options, exactly like Meteor's collection.findOne + * @param [autoClientSave=true] - By default, changes in the Angular object will automatically update the Meteor object. + * - However if set to false, changes in the client won't be automatically propagated back to the Meteor object. + */ + object(collection: Mongo.Collection, selector: Mongo.Selector|Mongo.ObjectID|string, autoClientSave?: boolean): AngularMeteorObject; + + /** + * A service which is a wrapper for Meteor.subscribe. It subscribes to a Meteor.publish method in the client and returns a AngularJS promise when ready. + * + * @param name - Name of the subscription. Matches the name of the server's publish() call. + * @param publisherArguments - Optional arguments passed to publisher function on server. + * + * @return The promise solved successfully when subscription is ready. The success promise holds the subscription handle. + */ + subscribe(name: string, ...publisherArguments: any[]): angular.IPromise; + + /** + * A service service which wraps up Meteor.methods with AngularJS promises. + * + * @param name - Name of method to invoke + * @param methodArguments - Optional method arguments + * + * @return The promise solves successfully with the return value of the method or return reject with the error from the method. + */ + call(name: string, ...methodArguments: any[]): angular.IPromise; + + // User Authentication BEGIN -> + + /** + * Returns a promise fulfilled with the currentUser when the user subscription is ready. + * This is useful when you want to grab the current user before the route is rendered. + * If there is no logged in user, it will return null. + * See the “Authentication with Routers” section of our tutorial for more information and a full example. + */ + waitForUser(): angular.IPromise; + + /** + * Resolves the promise successfully if a user is authenticated and rejects otherwise. + * This is useful in cases where you want to require a route to have an authenticated user. + * You can catch the rejected promise and redirect the unauthenticated user to a different page, such as the login page. + * See the “Authentication with Routers” section of our tutorial for more information and a full example. + */ + requireUser(): angular.IPromise; + + /** + * Resolves the promise successfully if a user is authenticated and the validatorFn returns true; rejects otherwise. + * This is useful in cases where you want to require a route to have an authenticated user and do extra validation like the user's role or group. + * You can catch the rejected promise and redirect the unauthenticated user to a different page, such as the login page. + * See the “Authentication with Routers” section of our tutorial for more information and a full example. + * + * The mandatory validator function will be called with the authenticated user as the single param and it's expected to return true in order to resolve. + * If it returns a string, the promise will be rejected using said string as the reason. + * Any other return (false, null, undefined) will be rejected with the default "FORBIDDEN" reason. + */ + requireValidUser(validatorFn: (user: Meteor.User) => boolean|string): angular.IPromise; + + /** + * Log the user in with a password. + * + * @param user - Either a string interpreted as a username or an email; or an object with a single key: email, username or id. + * @param password - The user's password. + */ + loginWithPassword(user: string|{email: string}|{username: string}|{id: string}, password: string): angular.IPromise; + + /** + * Create a new user. More information: http://docs.meteor.com/#/full/accounts_createuser + * + * @param options.username - A unique name for this user. Either this, or email is required. + * @param options.email - The user's email address. Either this, or username is required. + * @param options.password - The user's password. This is not sent in plain text over the wire. + * @param options.profile - The user's profile, typically including the name field. + */ + createUser(options: {username?: string; email?: string; password: string; profile?: Object}): angular.IPromise; + + /** + * Change the current user's password. Must be logged in. + * + * @param oldPassword - The user's current password. This is not sent in plain text over the wire. + * @param newPassword - A new password for the user. This is not sent in plain text over the wire. + */ + changePassword(oldPassword: string, newPassword: string): angular.IPromise; + + /** + * Request a forgot password email. + * + * @param options.email - The email address to send a password reset link. + */ + forgotPassword(options: {email: string}): angular.IPromise; + + /** + * Reset the password for a user using a token received in email. Logs the user in afterwards. + * + * @param token - The token retrieved from the reset password URL. + * @param newPassword - A new password for the user. This is not sent in plain text over the wire. + */ + resetPassword(token: string, newPassword: string): angular.IPromise; + + /** + * Marks the user's email address as verified. Logs the user in afterwards. + * + * @param token - The token retrieved from the reset password URL. + */ + verifyEmail(token: string): angular.IPromise; + + loginWithFacebook: ILoginWithExternalService; + loginWithTwitter: ILoginWithExternalService; + loginWithGoogle: ILoginWithExternalService; + loginWithGithub: ILoginWithExternalService; + loginWithMeetup: ILoginWithExternalService; + loginWithWeibo: ILoginWithExternalService; + + /** + * Log the user out. + * + * @return Resolves with no arguments on success, or reject with a Error argument on failure. + */ + logout(): angular.IPromise; + + /** + * Log out other clients logged in as the current user, but does not log out the client that calls this function. + * For example, when called in a user's browser, connections in that browser remain logged in, + * but any other browsers or DDP clients logged in as that user will be logged out. + * + * @return Resolves with no arguments on success, or reject with a Error argument on failure. + */ + logoutOtherClients(): angular.IPromise; + + // <- User Authentication END + // $meteorUtils BEGIN -> + + /** + * @param scope - The AngularJS scope you use the autorun on. + * @param fn - The function that will re-run every time a reactive variable changes inside it. + */ + autorun(scope: angular.IScope, fn: Function): void; + + /** + * @param collectionName - The name of the collection you want to get back + */ + getCollectionByName(collectionName: string): Mongo.Collection; + + // <- $meteorUtils END + // $meteorCamera BEGIN -> + + /** + * A helper service for taking pictures across platforms. + * Must add mdg:camera package to use! (meteor add mdg:camera) + * + * @param [options] - options is an optional argument that is an Object with the following possible keys: + * @param options.width - An integer that specifies the minimum width of the returned photo. + * @param options.height - An integer that specifies the minimum height of the returned photo. + * @param options.quality - A number from 0 to 100 specifying the desired quality of JPEG encoding. + * + * @return The promise solved successfully when the picture is taken with the data as a parameter or rejected with an error as a parameter in case of error. + */ + getPicture(options?: {width?: number; height?: number; quality?: number}): angular.IPromise; + + // <- $meteorCamera END + + /** + * A service that binds a scope variable to a Meteor Session variable. + * + * @param sessionKey - The name of the session variable + * @return An object with a single function bind - to bind to that variable. + */ + session(sessionKey: string): { + /** + * @param scope - The scope the document will be bound to. + * @param model - The name of the scope's model variable that the document will be bound to. + */ + bind: (scope: IScope, model: string) => void; + }; + } + + /** + * An object that connects a Meteor Object to an AngularJS scope variable. + * + * The object contains also all the properties from the generic type T, + * unfortunately TypeScript doesn't at the moment allow to extend a generic type (see https://github.com/Microsoft/TypeScript/issues/2225 for details and updates). + * For a workaround, you'll need to implement an interface which will merge AngularMeteorObject together with T and cast it, like this: + * + * interface TodoAngularMeteorObject extends ITodo, AngularMeteorObject { } + * var todo = $meteor.object(TodoCollection, 'TodoID'); + */ + interface AngularMeteorObject { + /** + * @param [doc] - The doc to save to the Meteor Object. If nothing is passed, the method saves everything in the AngularMeteorObject as is. + * - Unchanged properties will be overridden with their existing values, which may trigger hooks. + * - If doc is passed, the method only updates the Meteor Object with the properties passed, and no other changes will be saved. + * + * @return Returns a promise with an error in case for an error or a number of successful docs changed in case of success. + */ + save(doc?: T): angular.IPromise; + + /** + * Reset the current value of the object to the one in the server. + */ + reset(): void; + + /** + * Returns a copy of the AngularMeteorObject with all the AngularMeteor-specific internal properties removed. + * The returned object is then safe to use as a parameter for method calls, or anywhere else where the data needs to be converted to JSON. + */ + getRawObject(): T; + } + + /** + * An object that connects a Meteor Collection to an AngularJS scope variable + */ + interface AngularMeteorCollection extends AngularMeteorCollection2 { } + + /** + * An object that connects a Meteor Collection to an AngularJS scope variable, + * but can use a differen type for updates. + */ + interface AngularMeteorCollection2 extends Array { + /** + * @param [docs] - The docs to save to the Meteor Collection. + * - If the docs parameter is empty, the method saves everything in the AngularMeteorCollection as is. + * - If an object is passed, the method pushes that object into the AngularMeteorCollection. + * - If an array is passed, the method pushes all objects in the array into the AngularMeteorCollection. + */ + save(docs?: U|U[]): void; + + /** + * @param [keys] - The keys of the object to remove from the Meteor Collection. + * - If nothing is passed, the method removes all the documents from the AngularMeteorCollection. + * - If an object is passed, the method removes the object with that key from the AngularMeteorCollection. + * - If an array is passed, the method removes all objects that matches the keys in the array from the AngularMeteorCollection. + */ + remove(keys?: string|number|string[]|number[]): void; + + /** + * A shorten (Syntactic sugar) function for the $meteor.subscribe function. + * Takes only one parameter and not returns a promise like $meteor.subscribe does. + * + * @param subscriptionName - The subscription name to subscribe to. Exactly like the first parameter in $meteor.subscribe service. + */ + subscribe(subscriptionName:string): AngularMeteorCollection2; + } + + interface ILoginWithExternalService { + (options: Meteor.LoginWithExternalServiceOptions): angular.IPromise; + } + + interface ReactiveResult { } +} From 10564f321b2cf3df2cb54ac7a6f211f9df3603eb Mon Sep 17 00:00:00 2001 From: Peter Grman Date: Thu, 7 May 2015 18:09:01 +0200 Subject: [PATCH 007/179] Fix implicit any types Most types already would have been any, the others were changed based on documentation, and similar changes. I used also `any` if the type was unclear. --- meteor/meteor-tests.ts | 2 +- meteor/meteor.d.ts | 102 ++++++++++++++++++++--------------------- 2 files changed, 52 insertions(+), 52 deletions(-) diff --git a/meteor/meteor-tests.ts b/meteor/meteor-tests.ts index ec2ad3b81..f26527911 100644 --- a/meteor/meteor-tests.ts +++ b/meteor/meteor-tests.ts @@ -272,7 +272,7 @@ Posts.allow({ Posts.deny({ update: function (userId, docs, fields, modifier) { // can't change owners - return docs.userId = userId; + return docs.userId !== userId; }, remove: function (userId, doc) { // can't remove locked documents diff --git a/meteor/meteor.d.ts b/meteor/meteor.d.ts index 4118fbe06..ed0c97b29 100644 --- a/meteor/meteor.d.ts +++ b/meteor/meteor.d.ts @@ -16,17 +16,17 @@ interface JSONable { interface EJSON extends EJSONable {} declare module Match { - var Any; - var String; - var Integer; - var Boolean; - var undefined; + var Any:any; + var String:any; + var Integer:any; + var Boolean:any; + var undefined:any; //function null(); // not allowed in TypeScript - var Object; - function Optional(pattern):boolean; - function ObjectIncluding(dico):boolean; - function OneOf(...patterns); - function Where(condition); + var Object:any; + function Optional(pattern:any):boolean; + function ObjectIncluding(dico:any):boolean; + function OneOf(...patterns:any[]):any; + function Where(condition:any):any; } declare module Meteor { @@ -89,8 +89,8 @@ declare module Meteor { } interface Tinytest { - add(name:string, func:Function); - addAsync(name:string, func:Function); + add(name:string, func:Function):any; + addAsync(name:string, func:Function):any; } enum StatusEnum { @@ -145,9 +145,9 @@ declare module Mongo { MONGO } interface AllowDenyOptions { - insert?: (userId:string, doc) => boolean; - update?: (userId, doc, fieldNames, modifier) => boolean; - remove?: (userId, doc) => boolean; + insert?: (userId:string, doc:any) => boolean; + update?: (userId:string, doc:any, fieldNames:string[], modifier:any) => boolean; + remove?: (userId:string, doc:any) => boolean; fetch?: string[]; transform?: Function; } @@ -184,10 +184,10 @@ declare module HTTP { declare module Email { interface EmailMessage { from: string; - to: any; // string or string[] - cc?: any; // string or string[] - bcc?: any; // string or string[] - replyTo?: any; // string or string[] + to: string|string[]; + cc?: string|string[]; + bcc?: string|string[]; + replyTo?: string|string[]; subject: string; text?: string; html?: string; @@ -197,14 +197,14 @@ declare module Email { declare module DDP { interface DDPStatic { - subscribe(name, ...rest); - call(method:string, ...parameters):void; - apply(method:string, ...parameters):void; - methods(IMeteorMethodsDictionary); + subscribe(name:string, ...rest:any[]):void; + call(method:string, ...parameters:any[]):void; + apply(method:string, ...parameters:any[]):void; + methods(IMeteorMethodsDictionary:any):any; status():DDPStatus; - reconnect(); - disconnect(); - onReconnect(); + reconnect():void; + disconnect():void; + onReconnect():void; } interface DDPStatus { @@ -344,7 +344,7 @@ declare module Accounts { declare module App { function accessRule(domainRule: string, options?: { launchExternal?: boolean; - }); /** TODO: add return value **/ + }):any; /** TODO: add return value **/ function configurePlugin(pluginName: string, config: Object): void; function icons(icons: Object): void; function info(options: { @@ -393,7 +393,7 @@ declare module Blaze { findAll(selector: string): Blaze.TemplateInstance[]; firstNode: Object; lastNode: Object; - subscribe(name: string, ...args): Meteor.SubscriptionHandle; + subscribe(name: string, ...args: any[]): Meteor.SubscriptionHandle; subscriptionsReady(): boolean; view: Object; } @@ -475,7 +475,7 @@ declare module Meteor { wait?: boolean; onResultReceived?: Function; }, asyncCallback?: Function): any; - function call(name: string, ...args): any; + function call(name: string, ...args: any[]): any; function clearInterval(id: number): void; function clearTimeout(id: number): void; function disconnect(): void; @@ -503,7 +503,7 @@ declare module Meteor { var settings: {[id:string]: any}; function startup(func: Function): void; function status(): Meteor.StatusEnum; - function subscribe(name: string, ...args): Meteor.SubscriptionHandle; + function subscribe(name: string, ...args: any[]): Meteor.SubscriptionHandle; function user(): Meteor.User; function userId(): string; var users: Mongo.Collection; @@ -521,16 +521,16 @@ declare module Mongo { } interface Collection { allow(options: { - insert?: (userId:string, doc) => boolean; - update?: (userId, doc, fieldNames, modifier) => boolean; - remove?: (userId, doc) => boolean; + insert?: (userId:string, doc:any) => boolean; + update?: (userId:string, doc:any, fieldNames:string[], modifier:any) => boolean; + remove?: (userId:string, doc:any) => boolean; fetch?: string[]; transform?: Function; }): boolean; deny(options: { - insert?: (userId:string, doc) => boolean; - update?: (userId, doc, fieldNames, modifier) => boolean; - remove?: (userId, doc) => boolean; + insert?: (userId:string, doc:any) => boolean; + update?: (userId:string, doc:any, fieldNames:string[], modifier:any) => boolean; + remove?: (userId:string, doc:any) => boolean; fetch?: string[]; transform?: Function; }): boolean; @@ -684,30 +684,30 @@ interface CompileStepStatic { } interface CompileStep { addAsset(options: { - }, path: string, data: any /** Buffer **/ | string); /** TODO: add return value **/ + }, path: string, data: any /** Buffer **/ | string): any; /** TODO: add return value **/ addHtml(options: { section?: string; data?: string; - }); /** TODO: add return value **/ + }): any; /** TODO: add return value **/ addJavaScript(options: { path?: string; data?: string; sourcePath?: string; - }); /** TODO: add return value **/ + }): any; /** TODO: add return value **/ addStylesheet(options: { - }, path: string, data: string, sourceMap: string); /** TODO: add return value **/ - arch; /** TODO: add return value **/ - declaredExports; /** TODO: add return value **/ + }, path: string, data: string, sourceMap: string): any; /** TODO: add return value **/ + arch: any; /** TODO: add return value **/ + declaredExports: any; /** TODO: add return value **/ error(options: { - }, message: string, sourcePath?: string, line?: number, func?: string); /** TODO: add return value **/ - fileOptions; /** TODO: add return value **/ - fullInputPath; /** TODO: add return value **/ - inputPath; /** TODO: add return value **/ - inputSize; /** TODO: add return value **/ - packageName; /** TODO: add return value **/ - pathForSourceMap; /** TODO: add return value **/ + }, message: string, sourcePath?: string, line?: number, func?: string): any; /** TODO: add return value **/ + fileOptions: any; /** TODO: add return value **/ + fullInputPath: any; /** TODO: add return value **/ + inputPath: any; /** TODO: add return value **/ + inputSize: any; /** TODO: add return value **/ + packageName: any; /** TODO: add return value **/ + pathForSourceMap: any; /** TODO: add return value **/ read(n?: number): any; - rootOutputPath; /** TODO: add return value **/ + rootOutputPath: any; /** TODO: add return value **/ } declare var PackageAPI: PackageAPIStatic; @@ -777,5 +777,5 @@ interface Template { } declare function MethodInvocation(options: { -}); /** TODO: add return value **/ +}): any; /** TODO: add return value **/ declare function check(value: any, pattern: any): void; From 28666dd8c44278523c780030d88fcd8c60b3acc4 Mon Sep 17 00:00:00 2001 From: Peter Grman Date: Sun, 10 May 2015 00:19:29 +0200 Subject: [PATCH 008/179] Add additional parameter types --- angular-meteor/angular-meteor.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/angular-meteor/angular-meteor.d.ts b/angular-meteor/angular-meteor.d.ts index 18f2e033e..89ae4bc9f 100644 --- a/angular-meteor/angular-meteor.d.ts +++ b/angular-meteor/angular-meteor.d.ts @@ -53,7 +53,7 @@ declare module angular.meteor { * @param [autoClientSave=true] - By default, changes in the Angular collection will automatically update the Meteor collection. * - However if set to false, changes in the client won't be automatically propagated back to the Meteor collection. */ - collection(collection: Mongo.Collection|ReactiveResult, autoClientSave?: boolean): AngularMeteorCollection; + collection(collection: Mongo.Collection|ReactiveResult|Function|(()=>T), autoClientSave?: boolean): AngularMeteorCollection; /** * A service that wraps the Meteor collections to enable reactivity within AngularJS. @@ -64,7 +64,7 @@ declare module angular.meteor { * - However if set to false, changes in the client won't be automatically propagated back to the Meteor collection. * @param [updateCollection] - A collection object which will be used for updates (insert, update, delete). */ - collection(collection: Mongo.Collection|ReactiveResult, autoClientSave: boolean, updateCollection: Mongo.Collection): AngularMeteorCollection2; + collection(collection: Mongo.Collection|ReactiveResult|Function|(()=>T), autoClientSave: boolean, updateCollection: Mongo.Collection): AngularMeteorCollection2; /** * A service that wraps a Meteor object to enable reactivity within AngularJS. @@ -303,7 +303,7 @@ declare module angular.meteor { * - If an object is passed, the method removes the object with that key from the AngularMeteorCollection. * - If an array is passed, the method removes all objects that matches the keys in the array from the AngularMeteorCollection. */ - remove(keys?: string|number|string[]|number[]): void; + remove(keys?: U|string|number|string[]|number[]): void; /** * A shorten (Syntactic sugar) function for the $meteor.subscribe function. From 5c11852cd6bc4f52a674f7a67c4db0ba454e076a Mon Sep 17 00:00:00 2001 From: sigita42 Date: Sun, 10 May 2015 15:41:05 +0200 Subject: [PATCH 009/179] Subscribe should work also on AngularMeteorObject --- angular-meteor/angular-meteor.d.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/angular-meteor/angular-meteor.d.ts b/angular-meteor/angular-meteor.d.ts index 89ae4bc9f..b3f520ac5 100644 --- a/angular-meteor/angular-meteor.d.ts +++ b/angular-meteor/angular-meteor.d.ts @@ -277,6 +277,14 @@ declare module angular.meteor { * The returned object is then safe to use as a parameter for method calls, or anywhere else where the data needs to be converted to JSON. */ getRawObject(): T; + + /** + * A shorten (Syntactic sugar) function for the $meteor.subscribe function. + * Takes only one parameter and not returns a promise like $meteor.subscribe does. + * + * @param subscriptionName - The subscription name to subscribe to. Exactly like the first parameter in $meteor.subscribe service. + */ + subscribe(subscriptionName:string): AngularMeteorObject; } /** From 97f329eb6dd95ee9ae439b8956838f09e91e1303 Mon Sep 17 00:00:00 2001 From: sigita42 Date: Sun, 10 May 2015 15:44:56 +0200 Subject: [PATCH 010/179] Add test for subscribe on single object --- angular-meteor/angular-meteor-tests.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/angular-meteor/angular-meteor-tests.ts b/angular-meteor/angular-meteor-tests.ts index be75f196b..9ce0a33e9 100644 --- a/angular-meteor/angular-meteor-tests.ts +++ b/angular-meteor/angular-meteor-tests.ts @@ -18,6 +18,7 @@ interface CustomScope extends angular.meteor.IScope { todo: ITodo; todoNotAuto: TodoAngularMeteorObject; + todoSubscribed: TodoAngularMeteorObject; save: (todo: ITodo) => void; saveAll: () =>void; @@ -48,6 +49,7 @@ app.controller("mainCtrl", ['$scope', '$meteor', ($scope: CustomScope, $meteor: $scope.notAutoTodos = $meteor.collection(Todos, false).subscribe("publicTodos"); $scope.todoNotAuto = $meteor.object(Todos, 'TodoID', false); + $scope.todoSubscribed = $meteor.object(Todos, 'TodoID').subscribe('todos'); $scope.todo = $scope.todoNotAuto.getRawObject(); $scope.todoNotAuto.reset(); $scope.todoNotAuto.save($scope.todo).then((data) => { return data == 1; });; From ce539b1cd0bf655a25751582f28f37e4b2679033 Mon Sep 17 00:00:00 2001 From: campers Date: Mon, 11 May 2015 14:17:24 +0800 Subject: [PATCH 011/179] Update parse.d.ts Remove duplicate FILE_DELETE_ERROR, (keep in code numeric order) --- parse/parse.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/parse/parse.d.ts b/parse/parse.d.ts index 01d72df7a..9f8df5c3f 100644 --- a/parse/parse.d.ts +++ b/parse/parse.d.ts @@ -842,7 +842,6 @@ declare module Parse { INVALID_CONTENT_LENGTH = 128, FILE_TOO_LARGE = 129, FILE_SAVE_ERROR = 130, - FILE_DELETE_ERROR = 153, DUPLICATE_VALUE = 137, INVALID_ROLE_NAME = 139, EXCEEDED_QUOTA = 140, From 28ad1db4bfacce6af20b97a3977ff550b3ca7d88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Morch=C3=B3n=20Poveda?= Date: Mon, 11 May 2015 10:02:25 +0200 Subject: [PATCH 012/179] Knockout uses Nodes, not Elements Less restrictive API: knockout uses nodes, not elements. --- knockout/knockout.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/knockout/knockout.d.ts b/knockout/knockout.d.ts index 5bbc116e0..8e923ac23 100644 --- a/knockout/knockout.d.ts +++ b/knockout/knockout.d.ts @@ -248,9 +248,9 @@ interface KnockoutUtils { removeDisposeCallback(node: Element, callback: Function): void; - cleanNode(node: Element): Element; + cleanNode(node: Node): Element; - removeNode(node: Element): void; + removeNode(node: Node): void; }; ////////////////////////////////// From ab457e18986ef43b3dd8e3992f9bbf8dedace191 Mon Sep 17 00:00:00 2001 From: Nathan Pitman Date: Tue, 12 May 2015 16:51:56 +1200 Subject: [PATCH 013/179] Added type bindings for jQuery Sortable. --- jquery-sortable/jquery-sortable-tests.ts | 225 +++++++++++++++++++++++ jquery-sortable/jquery-sortable.d.ts | 104 +++++++++++ 2 files changed, 329 insertions(+) create mode 100644 jquery-sortable/jquery-sortable-tests.ts create mode 100644 jquery-sortable/jquery-sortable.d.ts diff --git a/jquery-sortable/jquery-sortable-tests.ts b/jquery-sortable/jquery-sortable-tests.ts new file mode 100644 index 000000000..67dcf01b4 --- /dev/null +++ b/jquery-sortable/jquery-sortable-tests.ts @@ -0,0 +1,225 @@ +/// + + +/** + * http://johnny.github.io/jquery-sortable/#connected + */ +function connectedListsWithDropAnimation() { + var adjustment: any; + + $('ol.simple_with_animation').sortable({ + group: 'simple_with_animation', + pullPlaceholder: false, + // animation on drop + onDrop: function (item, targetContainer, _super) { + var clonedItem = $('
  • ').css({height: 0}) + item.before(clonedItem) + clonedItem.animate({'height': item.height()}) + + item.animate(clonedItem.position(), function () { + clonedItem.detach(); + _super(item); + }) + }, + + // set item relative to cursor position + onDragStart: function ($item, container, _super) { + var offset = $item.offset(), + pointer = container.rootGroup.pointer; + + adjustment = { + left: pointer.left - offset.left, + top: pointer.top - offset.top + }; + + _super($item, container); + }, + onDrag: function ($item, position) { + $item.css({ + left: position.left - adjustment.left, + top: position.top - adjustment.top + }) + } + }); +} + + +/** + * http://johnny.github.io/jquery-sortable/#handle + */ +function sortHandleAndLimitedDragDrop() { + $('ol.simple_with_drop').sortable({ + group: 'no-drop', + handle: 'i.icon-move', + onDragStart: function (item, container, _super) { + // Duplicate items of the no drop area + if(!container.options.drop) + item.clone().insertAfter(item) + _super(item) + } + }); + + $('ol.simple_with_no_drop').sortable({ + group: 'no-drop', + drop: false + }); + + $('ol.simple_with_no_drag').sortable({ + group: 'no-drop', + drag: false + }); +} + + +/** + * http://johnny.github.io/jquery-sortable/#nested + */ +function toggleNestedLists() { + var oldContainer: any; + + $('ol.nested_with_switch').sortable({ + group: 'nested', + afterMove: function (placeholder, container) { + if(oldContainer != container){ + if(oldContainer) + oldContainer.el.removeClass('active') + container.el.addClass('active') + + oldContainer = container + } + }, + onDrop: function (item, container, _super) { + container.el.removeClass('active') + _super(item) + } + }); + + $('.switch-container').on('click', '.switch', function (e) { + var method = $(this).hasClass('active') ? 'enable' : 'disable' + $(e.delegateTarget).next().sortable(method) + }); +} + + +/** + * http://johnny.github.io/jquery-sortable/#limited-target + */ +function connectedListsWithLimitedDropTargets() { + var group = $('ol.limited_drop_targets').sortable({ + group: 'limited_drop_targets', + isValidTarget: function (item, container) { + if(item.is('.highlight')) + return true + else { + return item.parent('ol')[0] == container.el[0] + } + }, + onDrop: function (item, container, _super) { + $('#serialize_output').text(group.sortable('serialize').get().join('\n')); + _super(item, container); + }, + serialize: function (parent, children, isContainer) { + return isContainer ? children.join() : 24; + }, + tolerance: 6, + distance: 10 + }); +} + + +/** + * http://johnny.github.io/jquery-sortable/#bootstrap + */ +function sortingABootstrapMenu() { + $('ol.nav').sortable({ + group: 'nav', + nested: false, + vertical: false, + exclude: '.divider-vertical', + onDragStart: function($item, container, _super) { + $item.find('ol.dropdown-menu').sortable('disable'); + _super($item, container); + }, + onDrop: function($item, container, _super) { + $item.find('ol.dropdown-menu').sortable('enable'); + _super($item, container); + } + }); + + $('ol.dropdown-menu').sortable({ + group: 'nav' + }); +} + + +/** + * http://johnny.github.io/jquery-sortable#serialization + */ +function serializationAndDelay() { + var group = $('ol.serialization').sortable({ + group: 'serialization', + delay: 500, + onDrop: function (item, container, _super) { + var data = group.sortable('serialize').get(); + + var jsonString = JSON.stringify(data, null, ' '); + + $('#serialize_output2').text(jsonString); + _super(item, container); + } + }); +} + + +/** + * http://johnny.github.io/jquery-sortable/#table + */ +function sortTables() { + // Sortable rows + $('.sorted_table').sortable({ + containerSelector: 'table', + itemPath: '> tbody', + itemSelector: 'tr', + placeholder: '' + }); + + // Sortable column heads + var oldIndex: any; + + $('.sorted_head tr').sortable({ + containerSelector: 'tr', + itemSelector: 'th', + placeholder: '', + vertical: false, + onDragStart: function (item, group, _super) { + oldIndex = item.index(); + item.appendTo(item.parent()); + _super(item); + }, + onDrop: function (item, container, _super) { + var field: any, + newIndex = item.index() + + if (newIndex != oldIndex) + item.closest('table').find('tbody tr').each(function (i, row) { + var $row = $(row); + field = $row.children().eq(oldIndex); + if(newIndex) + field.before($row.children()[newIndex]); + else + $row.prepend(field); + }); + + _super(item); + } + }); +} + + +/** + * http://johnny.github.io/jquery-sortable/#docs + */ +function api() { + $('.horatio').sortable().sortable('disable').sortable('enable') + .sortable('refresh').sortable('serialize').sortable('destroy'); +} \ No newline at end of file diff --git a/jquery-sortable/jquery-sortable.d.ts b/jquery-sortable/jquery-sortable.d.ts new file mode 100644 index 000000000..82f4e8aa0 --- /dev/null +++ b/jquery-sortable/jquery-sortable.d.ts @@ -0,0 +1,104 @@ +// Type definitions for jQuery Sortable v0.9.12 +// Project: http://johnny.github.io/jquery-sortable/ +// Definitions by: Nathan Pitman +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module JQuerySortable { + + interface Position { + top: number; + left: number; + } + + type Dimensions = number[]; + + interface ContainerGroup { + $document: JQuery; + containerDimensions: Dimensions[] + containers: Container[]; + delayMet: boolean; + dragInitDone: boolean; + dragProxy: any; + dragging: boolean; + dropProxy: any; + item: JQuery; + itemContainer: Container; + lastAppendedItem: JQuery; + lastPointer: Position; + lastRelativePointer: Position; + offsetParent: JQuery; + options: Options; + placeholder: JQuery; + pointer: Position; + relativePointer: Position; + sameResultBox: { bottom: number; left: number; right: number; top: number; }; + scrollProxy: any; + } + + interface Container { + el: JQuery; + options: Options; + group: ContainerGroup; + rootGroup: ContainerGroup; + handle: string; + target: JQuery; + itemDimensions: Dimensions[]; + items: HTMLElement[]; + } + + + type GenericEventHandler = ($item?: JQuery, container?: Container, _super?: GenericEventHandler, event?: Event) => void; + type OnDragEventHandler = ($item?: JQuery, position?: Position, _super?: OnDragEventHandler, event?: Event) => void; + type OnMousedownHandler = ($item?: JQuery, _super?: OnMousedownHandler, event?: Event) => void; + type OnCancelHandler = ($item?: JQuery, container?: Container, _super?: OnCancelHandler, event?: Event) => void; + + // Deliberately typing $children as an any here as it makes it much easier to use. Actual type is JQuery | any[] + type SerializeFunc = ($parent: JQuery, $children: any, parentIsContainer: boolean) => void; + + interface GroupOptions { + afterMove?: ($placeholder: JQuery, container: Container, $closestItemOrContainer: JQuery) => void; + containerPath?: string; + containerSelector?: string; + distance?: number; + delay?: number; + handle?: string; + itemPath?: string; + itemSelector?: string; + isValidTarget?: ($item: JQuery, container: Container) => boolean; + onCancel?: OnCancelHandler; + onDrag?: OnDragEventHandler; + onDragStart?: GenericEventHandler; + onDrop?: GenericEventHandler; + onMousedown?: OnMousedownHandler; + placeholder?: JQuery | any[] | Element | string; + pullPlaceholder?: boolean; + serialize?: SerializeFunc; + tolerance?: number; + } + + + interface ContainerOptions { + drag?: boolean; + drop?: boolean; + exclude?: string; + nested?: boolean; + vertical?: boolean; + } + + interface Options extends GroupOptions, ContainerOptions { + } +} + + +interface JQuery { + sortable(options?: JQuerySortable.Options): JQuery; + + sortable(methodName: 'enable'): JQuery; + sortable(methodName: 'disable'): JQuery; + sortable(methodName: 'refresh'): JQuery; + sortable(methodName: 'destroy'): JQuery; + sortable(methodName: 'serialize'): JQuery; + sortable(methodName: string): JQuery; +} From 9439dc4ab093788829067802c0fdff0e21fbce70 Mon Sep 17 00:00:00 2001 From: Nathan Pitman Date: Tue, 12 May 2015 17:07:03 +1200 Subject: [PATCH 014/179] Fixed nullability in qtip2.d.ts. Fixed style tests in qtip2-tests.ts --- qtip2/qtip2-tests.ts | 8 ++++---- qtip2/qtip2.d.ts | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/qtip2/qtip2-tests.ts b/qtip2/qtip2-tests.ts index ea4e16099..144b4aa51 100644 --- a/qtip2/qtip2-tests.ts +++ b/qtip2/qtip2-tests.ts @@ -398,7 +398,7 @@ function testStyleProperty() { }); $a.qtip({ - show: { + style: { classes: false, width: 24, height: 24, @@ -407,7 +407,7 @@ function testStyleProperty() { }); $a.qtip({ - show: { + style: { classes: false, width: false, height: false, @@ -423,7 +423,7 @@ function testStyleProperty() { }); $a.qtip({ - show: { + style: { tip: { corner: true, mimic: true, @@ -433,7 +433,7 @@ function testStyleProperty() { }); $a.qtip({ - show: { + style: { tip: { } } }); diff --git a/qtip2/qtip2.d.ts b/qtip2/qtip2.d.ts index 1691715b6..8d17544f1 100644 --- a/qtip2/qtip2.d.ts +++ b/qtip2/qtip2.d.ts @@ -98,8 +98,8 @@ declare module QTip2 { classes?: string | boolean; def?: boolean; widget?: boolean; - width: string | number | boolean; - height: string | number | boolean; + width?: string | number | boolean; + height?: string | number | boolean; tip?: string | boolean | Tip; } From f39cdea7ad90129418fdf5980f04aacc5952bf00 Mon Sep 17 00:00:00 2001 From: Nathan Pitman Date: Tue, 12 May 2015 17:08:33 +1200 Subject: [PATCH 015/179] Fix my contributor info in qtip2.d.ts and CONTRIBUTORS.md --- CONTRIBUTORS.md | 2 +- qtip2/qtip2.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 36bcdb307..a41d225ec 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -726,7 +726,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](q-io/Q-io.d.ts) [Q-io](https://github.com/kriskowal/q-io) by [Bart van der Schoor](https://github.com/Bartvds) * [: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/Seltzer100) +* [:link:](qtip2/qtip2.d.ts) [qtip2](http://qtip2.com) by [Nathan Pitman](https://github.com/Seltzer) * [: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) diff --git a/qtip2/qtip2.d.ts b/qtip2/qtip2.d.ts index 8d17544f1..3d1f841f2 100644 --- a/qtip2/qtip2.d.ts +++ b/qtip2/qtip2.d.ts @@ -1,6 +1,6 @@ // Type definitions for qtip2 v2.2.1 // Project: http://qtip2.com/ -// Definitions by: Nathan Pitman +// Definitions by: Nathan Pitman // Definitions: https://github.com/borisyankov/DefinitelyTyped // Notes: // - Type bindings for the QTip2 API and options are included. Bindings for global settings aren't required. From fa51db8eb0872d311240909c546d6add52118a1a Mon Sep 17 00:00:00 2001 From: ksmigiel Date: Tue, 12 May 2015 09:39:54 +0200 Subject: [PATCH 016/179] Typings file for jsblocks framework --- blocks/blocks-tests.ts | 333 +++++++++++++++++++ blocks/blocks.d.ts | 731 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 1064 insertions(+) create mode 100644 blocks/blocks-tests.ts create mode 100644 blocks/blocks.d.ts diff --git a/blocks/blocks-tests.ts b/blocks/blocks-tests.ts new file mode 100644 index 000000000..5adc719e8 --- /dev/null +++ b/blocks/blocks-tests.ts @@ -0,0 +1,333 @@ +/// + +function test_blocks_methods() { + var extended; + blocks.extend(extended, new Object()); + + blocks.each([3, 1, 4], function(value, index, collection) { + // value is the current item (3, 1 and 4) + // index is the current index (0, 1 and 2) + // collection points to the array passed to the function - [3, 1, 4] + }); + + blocks.eachRight([3, 1, 4], function(value, index, collection) { + // value is the current item (4, 1 and 3) + // index is the current index (2, 1 and 0) + // collection points to the array passed to the function - [3, 1, 4] + }); + + blocks.isArray([1, 2, 3]); + // -> true + + function calculate() { + blocks.isArray(arguments); + // -> false + } + + function max(collection, callback) { + callback = callback || blocks.noop; + } + + blocks.type('a string'); + // -> string + + blocks.type(314); + // -> number + + blocks.type([]); + // -> array + + blocks.type({}); + // -> object + + blocks.type(blocks.noop); + // -> function + + blocks.type(new RegExp('')); + // -> regexp + + blocks.type(undefined); + // -> undefined + + blocks.type(null); + // -> null + + blocks.is([], 'array'); + // -> true + + blocks.is(function() { }, 'object'); + // -> false + + blocks.has({ + price: undefined + }, 'price'); + // -> true + + blocks.has({ + price: 314 + }, 'ratio'); + // -> false + + blocks.unwrap(blocks.observable(314)); + // -> 314 + + blocks.unwrap(blocks([3, 1, 4])); + // -> [3, 1, 4] + + blocks.unwrap('a string or any other value will not be changed'); + // -> 'a string or any other value will not be changed' + + blocks.toArray(3); + // -> [3] + + blocks.toArray([3, 1, 4]); + // -> [3, 1, 4] + + blocks.toUnit(230); + // -> 230px + + blocks.toUnit(230, '%'); + // -> 230% + + blocks.toUnit('60px', '%'); + // -> 60% + + var array = [3, 1, 4]; + var cloned = blocks.clone(array); + // -> [3, 1, 4] + var areEqual = array == cloned; + // -> false + + blocks.isElement(document.body); + // -> true + + blocks.isElement({}); + // -> false + + blocks.isBoolean(true); + // -> true + + blocks.isBoolean(new Boolean(false)); + // -> true + + blocks.isBoolean(1); + // -> false + + blocks.isPlainObject({ property: true }); + // -> true + + blocks.isPlainObject(new Object()); + // -> true + + function Car() { + + } + + blocks.isPlainObject(new Car()); + // -> false + + var alert = blocks.bind(function() { + alert(this); + }, 'Hello bind method!'); + + alert(); + // -> alerts 'Hello bind method' + + var alertAll = blocks.bind(function(firstName, lastName) { + alert('My name is ' + firstName + ' ' + lastName); + }, null, 'John', 'Doe'); + + alertAll(); + // -> alerts 'My name is John Doe' + + blocks.equals([3, 4], [3, 4]); + // -> true + + blocks.equals({ value: 7 }, { value: 7, result: 1 }); + // -> false + + blocks.query({ + message: 'Hello World!' + }); + + blocks.query({ + items: ['John', 'Alf', 'Mega'], + alertIndex: function(e) { + alert('Clicked an item with index:' + blocks.context(e.target).$index); + } + }); + + blocks.query({ + items: [1, 2, 3], + alertValue: function(e) { + alert('Clicked the value: ' + blocks.dataItem(e.target)); + } + }); + + blocks.isObservable(blocks.observable(3)); + // -> true + + blocks.isObservable(3); + // -> false + + blocks.unwrapObservable(blocks.observable(304)); + // -> 304 + + blocks.unwrapObservable(305); + // -> 305 +} + +function test_observable() { + blocks.observable['formatter'] = () => { + // your code here + }; + + // extending using the formatter extender + var data = blocks.observable([1, 2, 3]).extend('formatter'); +} + +function test_observable_array() { + // creates an observable array with [1, 2, 3] as values + var items = blocks.observable([1, 2, 3]); + + // removes the previous values and fills the observable array with [5, 6, 7] values + items.reset([5, 6, 7]) + + // results in observable array with [1, 2, 3, 4] values + items.add(4); + + // results in observable array with [1, 2, 3, 4, 5, 6] values + items.addMany([4, 5, 6]); + + var items = blocks.observable([4, 2, 3, 1]); + + // results in observable array with [1, 2, 3, 4] values + items.swap(0, 3); + + var items = blocks.observable([1, 4, 2, 3, 5]); + + // results in observable array with [1, 2, 3, 4, 5] values + items.move(1, 4); +} + +function test_Property() { + var App = blocks.Application(); + + var User = App.Model({ + username: App.Property({ + defaultValue: 'John Doe' + }) + }); +} + +function test_Model() { + var App = blocks.Application(); + + var User = App.Model({ + firstName: App.Property({ + required: true, + validateOnChange: true + }), + + lastName: App.Property({ + required: true, + validateOnChange: true + }), + + fullName: App.Property({ + value: function() { + return this.firstName() + ' ' + this.lastName(); + } + }) + }); + + App.View('Profile', { + user: User({ + firstName: 'John', + lastName: 'Doe' + }) + }); +} + +function test_Collection() { + var App = blocks.Application(); + + var User = App.Model({ + firstName: App.Property({ + required: true, + validateOnChange: true + }), + + lastName: App.Property({ + required: true, + validateOnChange: true + }), + + fullName: App.Property({ + value: function() { + return this.firstName() + ' ' + this.lastName(); + } + }) + }); + + var Users = App.Collection(User, { + count: App.Property({ + value: function() { + return this().length; + } + }) + }); + + App.View('Profiles', { + users: Users([{ + firstName: 'John', + lastName: 'Doe' + }, { + firstName: 'Johna', + lastName: 'Doa' + }]) + }); +} + +function test_View() { + var App = blocks.Application(); + + App.View('Clicker', { + handleClick: function() { + alert('Clicky! Click!'); + } + }); + + + App.View('Statistics', { + init: function() { + this.loadRemoteData(); + }, + + loadRemoteData: function() { + // ...stuff... + } + }); + + App.View('ContactUs', { + options: { + route: 'contactus' + }, + + routed: function() { + alert('Navigated to ContactUs page!') + } + }); + + App.View('ContactUs', { + options: { + route: 'contactus' + } + }); + + App.View('Navigation', { + navigateToContactUs: function() { + this.route('contactus') + } + }); +} \ No newline at end of file diff --git a/blocks/blocks.d.ts b/blocks/blocks.d.ts new file mode 100644 index 000000000..aedef9d04 --- /dev/null +++ b/blocks/blocks.d.ts @@ -0,0 +1,731 @@ +// Type definitions for jsblocks v0.3.0 +// Project: http://jsblocks.com/ +// Definitions by: Krzysztof Śmigiel +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +///////////////////////////////////////// +// blocks methods +///////////////////////////////////////// + +interface BlocksStatic { + (obj: any): any; + + /** + * Performs a query operation on the DOM. Executes all data-query attributes + * and renders the html result to the specified HTMLElement if not specified + * uses document.body by default. + * + * @param model The model that will be used to query the DOM. + */ + query(model: any): void; + /** + * @param model The model that will be used to query the DOM. + * @param element Optional element on which to execute the query. + */ + query(model: any, element: HTMLElement): void; + + /** + * Copies properties from all provided objects into the first object parameter + */ + extend(obj: Object, ...objects): void; + + /** + * Iterates over the collection + * + * @param collection The array or object to iterate over + * @param callback The callback that will be executed for each element in the collection + * @param thisArg Optional this context for the callback + */ + each(collection: any, callback: (value: any, index: any, collection: any) => void, thisArg?: any): void; + + /** + * Iterates over the collection from end to start + * + * @param collection The array or object to iterate over + * @param callback The callback that will be executed for each element in the collection + * @param thisArg Optional this context for the callback + */ + eachRight(collection: any, callback: (value: any, index: any, collection: any) => void, thisArg?: any): void; + + /** + * Determines if a value is an array. + * Returns false for array like objects (for example arguments object). + * + * @param value The value to check if it is an array + */ + isArray(value: any): boolean; + + /** + * Represents a dummy empty function + */ + noop(): Function; + + /** + * Determines the true type of an object. + * Returns the type of the value as a string. + * + * @param value The value for which to determine its type + */ + type(value: any): string; + + /** + * Determines if a specific value is the specified type + * + * @param value The value + * @param type The type + */ + is(value: any, type: string): boolean; + + /** + * Checks if a variable has the specified property. Uses hasOwnProperty internally + * + * @param obj The object to call hasOwnPrototype for + * @param key The key to check if exists in the object + */ + has(obj: any, key: string): boolean; + + /** + * Unwraps a jsblocks value to its raw representation. + * Unwraps blocks.observable() and blocks() values + * + * @param value The value that will be unwrapped + */ + unwrap(value: any): any; + + /** + * Converts a value to an array. Arguments object is converted to array and primitive values + * are wrapped in an array. + * Does nothing when value is already an array + * + * @param value The value to be converted to an array + */ + toArray(value: any): any[]; + + /** + * Converts an integer or string to a unit. If the value could not be parsed to a number it is not converted + * + * @param value The value to be converted to the specified unit + */ + toUnit(value: any): any; + /** + * @param value The value to be converted to the specified unit + * @param unit Optionally provide a unit to convert to. Default value is 'px' + */ + toUnit(value: any, unit: string): any; + + /** + * Clones value. If deepClone is set to true the value will be cloned recursively + * + * @param value Value/object to be cloned + */ + clone(value: any): any; + /** + * @param value Value/object to be cloned + * @param deepClone By default false + */ + clone(value: any, deepClone: boolean): any; + + /** + * Determines if the specified value is a HTML elements collection. + * Returns whether the value is elements collection. + * + * @param value The value to check if it is elements collection + */ + isElements(value: any): boolean; + + /** + * Determines if the specified value is a HTML element. + * Returns whether the value is a HTML element. + * + * @param value The value to check if it is a HTML element + */ + isElement(value: any): boolean; + + /** + * Determines if a the specified value is a boolean. + * Whether the value is a boolean or not. + * + * @param value The value to be checked if it is a boolean + */ + isBoolean(value: any): boolean; + + /** + * Determines if the specified value is an object. + * Returns whether the value is an object. + * + * @param obj The value to check for if it is an object + */ + isObject(obj: any): boolean; + + /** + * Determines if a value is a object created using {} or new Object. + * Whether the value is a plain object or not. + * + * @param obj The value that will be checked + */ + isPlainObject(obj: any): boolean; + + /** + * Changes the this binding to a function and optionally passes additional parameters to the function. + * Returns the newly created function having the new this binding and optional arguments. + * + * @param func The function for which to change the this binding and optionally add arguments + * @param thisArg The new this binding context value + * @param args Optional arguments that will be passed to the function + */ + bind(func: Function, thisArg: any, ...args): Function; + + /** + * Determines if two values are deeply equal. Set deepEqual to false to stop recusively equality checking + * + * @param a The first object to be campared + * @param b The second object to be compared + */ + equals(a: any, b: any): boolean; + /** + * @param a The first object to be campared + * @param b The second object to be compared + * @param deepEqual Determines if the equality check will recursively check all child properties + */ + equals(a: any, b: any, deepEqual: boolean): boolean; + + /** + * Gets the context for a particular element. Searches all parents until it finds the context. + * + * @param element The element from which to search for a context + * + */ + context(element: any): any; + + /** + * Gets the associated dataItem for a particlar element. Searches all parents until it finds the context + * + * @param element The element from which to search for a dataItem + */ + dataItem(element: any): any; + + /** + * Determines if particular value is an blocks.observable + * + * @param value The value to check if the value is observable + */ + isObservable(value: any): boolean; + + /** + * Gets the raw value of an observable or returns the value if the specified object is not an observable + * + * @param value The value that could be any object observable or not + */ + unwrapObservable(value: any): any; + + route(route: string): BlocksStatic; + + optional(param: string): BlocksStatic; + optional(param: string, defaultValue: any): BlocksStatic; + + range(start: number, end: number): BlocksStatic; + + /** + * Creates the server which will automatically handle server-side rendering. + */ + server(): { express() }; + /** + * @param options Overrides default jsblocks options + */ + server(options: Server): { express() }; + + /** + * Make observable property. You can specify initial value in parentheses. + */ + observable(): BlocksObservable; + observable(value: any[]): BlocksArray; + observable(value: any): BlocksObservable; + + /** + * Use blocks.Application and its MVC(Model-View-Collection) structure to create better architecture and maintainability for your application. + */ + Application(): App; + Application(options: { history: string }): App; +} + +///////////////////////////////////////// +// blocks observable +///////////////////////////////////////// + +interface BlocksObservable extends Extendable { + (any): BlocksObservable; + + /** + * Updates all elements, expressions and dependencies where the observable is used + */ + update(): BlocksObservable; + + /** + * If event in prototype is not defined use this function instead. + * + * @param event Name of the event to raise + * @param trigger Function to be called when event is fired + */ + on(event: string, trigger: Function): BlocksObservable; +} + +///////////////////////////////////////// +// blocks array +///////////////////////////////////////// + +interface BlocksArray extends BlocksObservable { + + /** + * Updates all elements, expressions and dependencies where the observable is used + */ + update(): BlocksArray; + + /** + * Extends the current observable with particular functionality depending on the parameters specified. + * If the method is called without arguments and jsvalue framework is included the observable will be + * extended with the methods available in jsvalue for the current type. + * + * @param options Optional options + */ + extend(...options): BlocksArray; + /** + * @param name Name of the extender + * @param options Optional options + */ + extend(name: string, ...options): BlocksArray; + + /** + * Removes all items from the collection and replaces them with the new value provided. + * The value could be Array, observable array or jsvalue.Array + * + * @param value The new value that will be populated + */ + reset(value: any[]): BlocksArray; + + /** + * Adds values to the end of the observable array + * + * @param value The values that will be added to the end of the array + */ + add(value: any): BlocksArray; + /** + * @param value The values that will be added to the end of the array + * @param index Optional index specifying where to insert the value + */ + add(value: any, index: number): BlocksArray; + + /** + * Adds the values from the provided array(s) to the end of the collection + * + * @param value The array that will be added to the end of the array + */ + addMany(value: any[]): BlocksArray; + /** + * @param value The array that will be added to the end of the array + * @param index Optional position where the array of values to be inserted + */ + addMany(value: any[], index: number): BlocksArray; + + /** + * Swaps two values in the observable array. Note: Faster than removing the items and adding them at the locations + * + * @param indexA The first index that points to the index in the array that will be swapped + * @param indexB The second index that points to the index in the array that will be swapped + */ + swap(indexA: number, indexB: number): BlocksArray; + + /** + * Moves an item from one location to another in the array. Note: Faster than removing the item and adding it at the location + * + * @param sourceIndex The index pointing to the item that will be moved + * @param targetIndex The index where the item will be moved to + */ + move(sourceIndex: number, targetIndex: number): BlocksArray; + + /** + * Removes an item from the observable array + * + * @param value The value that will be removed or a callback function which returns true or false to determine if the value should be removed + */ + remove(value: any): BlocksArray; + /** + * @param value The value that will be removed or a callback function which returns true or false to determine if the value should be removed + * @param thisArg Optional this context for the callback + */ + remove(value: any, thisArg: Function): BlocksArray; + + /** + * Removes an item at the specified index + * + * @param index The index location of the item that will be removed + */ + removeAt(index: number): BlocksArray; + /** + * @param index The index location of the item that will be removed + * @param count Optional parameter that if specified will remove the next items starting from the specified index + */ + removeAt(index: number, count: number): BlocksArray; + + /** + * Removes all items from the observable array and optionally filter which items to be removed by providing a callback + */ + removeAll(): BlocksArray; + /** + * @param callback Optional callback function which filters which items to be removed. Returning a truthy value will remove the item and vice versa + */ + removeAll(callback: Function): BlocksArray; + /** + * @param callback Optional callback function which filters which items to be removed. Returning a truthy value will remove the item and vice versa + * @param thisArg Optional this context for the callback function + */ + removeAll(callback: Function, thisArg: any): BlocksArray; + + /** + * The concat() method is used to join two or more arrays + * + * @param arrays The arrays to be joined + */ + concat(...arrays: any[]): any[] + + /** + * The slice() method returns the selected elements in an array, as a new array object + * + * @param start An integer that specifies where to start the selection (The first element has an index of 0) + */ + slice(start: number): any[]; + /** + * @param start An integer that specifies where to start the selection (The first element has an index of 0) + * @param end An integer that specifies where to end the selection. If omitted, all elements from the start position and to the end of the array will be selected. + * Use negative numbers to select from the end of an array + */ + slice(start: number, end: number): any[]; + + /** + * The join() method joins the elements of an array into a string, and returns the string + */ + join(): string; + /** + * @param separator The separator to be used. If omitted, the elements are separated with a comma + */ + join(seperator: string): string; + + /** + * The pop() method removes the last element of a observable array, and returns that element + */ + pop(): any; + + /** + * The push() method adds new items to the end of the observable array, and returns the new length + * + * @param values The item(s) to add to the observable array + */ + push(...values): number; + + /** + * Reverses the order of the elements in the observable array + */ + reverse(): any[]; + + /** + * Removes the first element of a observable array, and returns that element + */ + shift(): any + + /** + * Sorts the elements of an array + */ + sort(): any[]; + /** + * @param sortfunction A function that defines the sort order + */ + sort(sortfunction: Function): any[]; + + /** + * Adds and/or removes elements from the observable array + * Returns A new array containing the removed items, if any. + * + * @param index An integer that specifies at what position to add/remove items. Use negative values to specify the position from the end of the array. + * @param howMany The number of items to be removed. If set to 0, no items will be removed. + * @param items The new item(s) to be added to the array. + */ + splice(index: number, howMany: number, ...items: any[]): any[]; + + /** + * The unshift() method adds new items to the beginning of an array, and returns the new length. + * + * @param items + */ + unshift(...items: any[]): number; +} + +///////////////////////////////////////// +// blocks MVC App +///////////////////////////////////////// + +interface App extends Extendable { + + /** + * Creates an application property for a Model. + */ + Property(): any; + /** + * @param options Configuration options for property + */ + Property(options: PropertyPrototype): any; + + /** + * Defines a view that will be part of the Application. + * + * @param name The name of the View you are creating + * @param prototype The object that will represent the View + */ + View(name: string, prototype: ViewPrototype): any; + /** + * Defines a view that will be part of the Application. + * + * @param parentViewName Provide this parameter only if you are creating nested views. This is the name of the parent View + * @param name The name of the View you are creating + * @param prototype The object that will represent the View + */ + View(parentViewName: string, name: string, prototype: ViewPrototype): any; + + /** + * Creates a new Model + * + * @param prototype The Model object properties that will be created + */ + Model(prototype: ModelPrototype): Model; + + /** + * Creates a new Collection + * + * @param prototype The Collection object properties that will be created. + */ + Collection(prototype: CollectionPrototype): Collection; + Collection(model: Model, prototype: CollectionPrototype): Collection; +} + +///////////////////////////////////////// +// App.Property +///////////////////////////////////////// + +interface PropertyPrototype { + defaultValue?: any; + isObservable?: boolean; + field?: string; + value?: any; + validateOnChange?: boolean; + maxErrors?: number; + validateInitially?: boolean + + // Validators + required?: Validator; + minlength?: Validator; + maxlength?: Validator; + min?: Validator; + max?: Validator; + email?: Validator; + url?: Validator; + date?: Validator; + creditcard?: Validator; + regexp?: Validator; + number?: Validator; + digits?: Validator; + letters?: Validator; + equals?: Validator; +} + +interface Validator { } + +///////////////////////////////////////// +// App.View +///////////////////////////////////////// + +interface ViewPrototype { + parentView?: any; + + /** + * Routes to a specific URL and actives the appropriate views associated with the URL + * + * @param name Name of the route + */ + route?(name: string): ViewPrototype; + + + /** + * Determines if the view is visible + */ + isActive?(): boolean; + + /** + * Override the init method to perform actions when the View is first created and shown on the page + */ + init?: Function; + + /** + * Override the routed method to perform actions when the View have routing and routing mechanism actives it. + */ + routed?: Function; + + navigateTo?: Function; + + /** + * Override the ready method to perform actions when the DOM is ready and + * all data-query have been executed. + */ + ready?: Function; + + options?: { + route?: any, + url?: string + }; +} + +///////////////////////////////////////// +// App.Model +///////////////////////////////////////// + +interface Model { + (): Model; + (props: Object): Model; + + /** + * Fires a request to the server to populate the Model based on the read URL specified + */ + read(): Model; + /** + * @param params The parameters Object that will be used to populate the Model from the specified options.read URL. If the URL does not contain parameters + */ + read(params: Object): Model; + + /** + * Synchronizes the changes with the server by sending requests to the provided URL's + */ + sync(): Model; +} + +interface ModelPrototype { + + /** + * Override the init method to perform actions on creation for each Model instance + */ + init?: Function; + + /** + * Validates all observable properties that have validation and returns true if all values are valid otherwise returns false + */ + validate?(): boolean; + + /** + * Extracts the raw(non observable) dataItem object values from the Model + */ + dataItem?(): Object; + + /** + * Applies new properties to the Model by providing an Object + * + * @param dataItem The object from which the new values will be applied + */ + reset?(dataItem: ModelPrototype): ModelPrototype; + + /** + * Determines whether the instance is new. If true when syncing the item will send for insertion instead of updating it. + * The check is determined by the idAttr value specified in the options. If idAttr is not specified the item will always be considered new. + * + */ + isNew?(): boolean; + + options?: { + idAttr?: string, + baseUrl?: string, + read?: { url?: string }, + create?: { url?: string }, + destroy?: { url?: string }, + update?: { url?: string }, + }; +} + +///////////////////////////////////////// +// App.Collection +///////////////////////////////////////// + +interface Collection extends Extendable { + (): Collection; + (props: Object[]): Collection; + + /** + * Fires a request to the server to populate the Model based on the read URL specified + */ + read(): Collection; + /** + * @param params The parameters Object that will be used to populate the Collection from the specified options.read URL. If the URL does not contain parameters + */ + read(params: Object): Collection; + + /** + * Clear all changes made to the collection + */ + clearChanges(): Collection; + + /** + * Performs an ajax request for all create, update and delete operations in order to sync them with a database. + */ + sync(): Collection; + + update(id: number, newValues: Object): Collection; +} + +interface CollectionPrototype { + options?: { + read?: { url?: string }, + create?: { url?: string }, + destroy?: { url?: string }, + update?: { url?: string }, + }; +} + +interface Extendable { + + /** + * Extends the current observable with particular functionality depending on the parameters specified. + * If the method is called without arguments and jsvalue framework is included the observable will be + * extended with the methods available in jsvalue for the current type. + * + * @param name Name of the extender + * @param options Optional options + */ + extend(name?: string, ...options): T; + extend(any): T; +} + +interface Server { + + /** + * The port at which your application will be run + */ + port?: number, + + /** + * The folder where your application files like .html, .js and .css are going to be. + * The value is passed to express.static() middleware. + */ + static?: string, + + /** + * Caches pages result instead of executing them each time. + * Disabling cache could impact performance. + */ + cache?: boolean, + + /** + * Provide an express middleware function or an array of middleware functions. + * Use: [compression(), bodyParser()] + */ + use?: any, +} + +declare var blocks: BlocksStatic; + +declare module "blocks" { + export = blocks; +} \ No newline at end of file From 9f576a221d3f1612649cf858fe40095e5ca2fde9 Mon Sep 17 00:00:00 2001 From: ksmigiel Date: Tue, 12 May 2015 11:08:38 +0200 Subject: [PATCH 017/179] Make Travis tests pass --- blocks/blocks-tests.ts | 41 ++++++++++++-------------------- blocks/blocks.d.ts | 54 +++++++++++++++++++++--------------------- 2 files changed, 42 insertions(+), 53 deletions(-) diff --git a/blocks/blocks-tests.ts b/blocks/blocks-tests.ts index 5adc719e8..7b83b52a6 100644 --- a/blocks/blocks-tests.ts +++ b/blocks/blocks-tests.ts @@ -1,7 +1,7 @@ /// function test_blocks_methods() { - var extended; + var extended: Object; blocks.extend(extended, new Object()); blocks.each([3, 1, 4], function(value, index, collection) { @@ -24,7 +24,7 @@ function test_blocks_methods() { // -> false } - function max(collection, callback) { + function max(collection: any, callback: any) { callback = callback || blocks.noop; } @@ -119,21 +119,19 @@ function test_blocks_methods() { blocks.isPlainObject(new Object()); // -> true - function Car() { + var car = new Object(); - } - - blocks.isPlainObject(new Car()); + blocks.isPlainObject(car); // -> false - var alert = blocks.bind(function() { + var alert = blocks.bind(() => { alert(this); }, 'Hello bind method!'); alert(); // -> alerts 'Hello bind method' - var alertAll = blocks.bind(function(firstName, lastName) { + var alertAll = blocks.bind((firstName: string, lastName: string) => { alert('My name is ' + firstName + ' ' + lastName); }, null, 'John', 'Doe'); @@ -150,16 +148,16 @@ function test_blocks_methods() { message: 'Hello World!' }); - blocks.query({ + blocks.query({ items: ['John', 'Alf', 'Mega'], - alertIndex: function(e) { + alertIndex: (e: any) => { alert('Clicked an item with index:' + blocks.context(e.target).$index); } }); blocks.query({ items: [1, 2, 3], - alertValue: function(e) { + alertValue: (e: any) => { alert('Clicked the value: ' + blocks.dataItem(e.target)); } }); @@ -177,15 +175,6 @@ function test_blocks_methods() { // -> 305 } -function test_observable() { - blocks.observable['formatter'] = () => { - // your code here - }; - - // extending using the formatter extender - var data = blocks.observable([1, 2, 3]).extend('formatter'); -} - function test_observable_array() { // creates an observable array with [1, 2, 3] as values var items = blocks.observable([1, 2, 3]); @@ -272,7 +261,7 @@ function test_Collection() { var Users = App.Collection(User, { count: App.Property({ - value: function() { + value: () => { return this().length; } }) @@ -293,18 +282,18 @@ function test_View() { var App = blocks.Application(); App.View('Clicker', { - handleClick: function() { + handleClick: () => { alert('Clicky! Click!'); } }); App.View('Statistics', { - init: function() { + init: () => { this.loadRemoteData(); }, - loadRemoteData: function() { + loadRemoteData: () => { // ...stuff... } }); @@ -314,7 +303,7 @@ function test_View() { route: 'contactus' }, - routed: function() { + routed: () => { alert('Navigated to ContactUs page!') } }); @@ -326,7 +315,7 @@ function test_View() { }); App.View('Navigation', { - navigateToContactUs: function() { + navigateToContactUs: () => { this.route('contactus') } }); diff --git a/blocks/blocks.d.ts b/blocks/blocks.d.ts index aedef9d04..ad492333e 100644 --- a/blocks/blocks.d.ts +++ b/blocks/blocks.d.ts @@ -27,7 +27,7 @@ interface BlocksStatic { /** * Copies properties from all provided objects into the first object parameter */ - extend(obj: Object, ...objects): void; + extend(obj: Object, ...objects: any[]): void; /** * Iterates over the collection @@ -173,7 +173,7 @@ interface BlocksStatic { * @param thisArg The new this binding context value * @param args Optional arguments that will be passed to the function */ - bind(func: Function, thisArg: any, ...args): Function; + bind(func: Function, thisArg: any, ...args: any[]): Function; /** * Determines if two values are deeply equal. Set deepEqual to false to stop recusively equality checking @@ -228,11 +228,11 @@ interface BlocksStatic { /** * Creates the server which will automatically handle server-side rendering. */ - server(): { express() }; + server(): { express(): any }; /** * @param options Overrides default jsblocks options */ - server(options: Server): { express() }; + server(options: Server): { express(): any }; /** * Make observable property. You can specify initial value in parentheses. @@ -253,7 +253,7 @@ interface BlocksStatic { ///////////////////////////////////////// interface BlocksObservable extends Extendable { - (any): BlocksObservable; + (arg: any): BlocksObservable; /** * Updates all elements, expressions and dependencies where the observable is used @@ -287,12 +287,12 @@ interface BlocksArray extends BlocksObservable { * * @param options Optional options */ - extend(...options): BlocksArray; + extend(...options: any[]): BlocksArray; /** * @param name Name of the extender * @param options Optional options */ - extend(name: string, ...options): BlocksArray; + extend(name: string, ...options: any[]): BlocksArray; /** * Removes all items from the collection and replaces them with the new value provided. @@ -419,7 +419,7 @@ interface BlocksArray extends BlocksObservable { * * @param values The item(s) to add to the observable array */ - push(...values): number; + push(...values: any[]): number; /** * Reverses the order of the elements in the observable array @@ -576,7 +576,7 @@ interface ViewPrototype { ready?: Function; options?: { - route?: any, + route?: any; url?: string }; } @@ -636,12 +636,12 @@ interface ModelPrototype { isNew?(): boolean; options?: { - idAttr?: string, - baseUrl?: string, - read?: { url?: string }, - create?: { url?: string }, - destroy?: { url?: string }, - update?: { url?: string }, + idAttr?: string; + baseUrl?: string; + read?: { url?: string }; + create?: { url?: string }; + destroy?: { url?: string }; + update?: { url?: string }; }; } @@ -677,10 +677,10 @@ interface Collection extends Extendable { interface CollectionPrototype { options?: { - read?: { url?: string }, - create?: { url?: string }, - destroy?: { url?: string }, - update?: { url?: string }, + read?: { url?: string }; + create?: { url?: string }; + destroy?: { url?: string }; + update?: { url?: string }; }; } @@ -694,8 +694,8 @@ interface Extendable { * @param name Name of the extender * @param options Optional options */ - extend(name?: string, ...options): T; - extend(any): T; + extend(name?: string, ...options: any[]): T; + extend(arg: any): T; } interface Server { @@ -703,25 +703,25 @@ interface Server { /** * The port at which your application will be run */ - port?: number, + port?: number; /** - * The folder where your application files like .html, .js and .css are going to be. + * The folder where your application files like .html; .js and .css are going to be. * The value is passed to express.static() middleware. */ - static?: string, + static?: string; /** * Caches pages result instead of executing them each time. * Disabling cache could impact performance. */ - cache?: boolean, + cache?: boolean; /** * Provide an express middleware function or an array of middleware functions. - * Use: [compression(), bodyParser()] + * Use: [compression(); bodyParser()] */ - use?: any, + use?: any; } declare var blocks: BlocksStatic; From 16744e323f0a6669bcb91dccfea8445823a7cf1e Mon Sep 17 00:00:00 2001 From: Max Nylin Date: Tue, 12 May 2015 11:45:48 +0200 Subject: [PATCH 018/179] Added definition of extendModel() in IService for Restangular --- restangular/restangular.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/restangular/restangular.d.ts b/restangular/restangular.d.ts index f2388fc12..4f48101d8 100644 --- a/restangular/restangular.d.ts +++ b/restangular/restangular.d.ts @@ -95,6 +95,7 @@ declare module restangular { restangularizeCollection(parent: any, element: any, route: string): ICollection; service(route: string, parent?: any): IService; stripRestangular(element: any): any; + extendModel(route: string, extender: (model: IElement) => any): void; } interface IElement extends IService { From 943b4db4abb771ed881bb96a696f3a7d0760deb3 Mon Sep 17 00:00:00 2001 From: Joseph Rossi Date: Tue, 12 May 2015 12:10:16 -0400 Subject: [PATCH 019/179] Adding the default logger's `level` property. --- winston/winston-tests.ts | 4 +++- winston/winston.d.ts | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/winston/winston-tests.ts b/winston/winston-tests.ts index 0fa3cb442..3bfd0d5a5 100644 --- a/winston/winston-tests.ts +++ b/winston/winston-tests.ts @@ -8,6 +8,8 @@ var num: number; var metadata: any; var obj: any = {}; +winston.level = 'debug'; + var queryOptions: winston.QueryOptions; var transportOptions: winston.TransportOptions; var loggerOptions: winston.LoggerOptions = { @@ -218,4 +220,4 @@ var logger: winston.LoggerInstance = new (winston.Logger)({ ssl: {}, }), ] -}); \ No newline at end of file +}); diff --git a/winston/winston.d.ts b/winston/winston.d.ts index 983f7cbbc..954e3358b 100644 --- a/winston/winston.d.ts +++ b/winston/winston.d.ts @@ -17,7 +17,7 @@ declare module "winston" { export var defaultLogger: LoggerInstance; export var exitOnError: boolean; - + export var level: string; export function log(level: string, msg: string, meta: any, callback?: (err: Error, level: string, msg: string, meta: any) => void): LoggerInstance; export function log(level: string, msg: string, callback?: (err: Error, level: string, msg: string, meta: any) => void): LoggerInstance; From 433ed3d130befb6f11aa0a172684c98eb1921931 Mon Sep 17 00:00:00 2001 From: Blake Niemyjski Date: Tue, 12 May 2015 11:45:03 -0500 Subject: [PATCH 020/179] Added stack trace.js and node stack trace definitions --- node-stack-trace/node-stack-trace.d.ts | 20 ++++++++ node-stack-trace/node-stack-trace.ts | 8 ++++ stacktrace/stacktrace.d.ts | 64 ++++++++++++++++++++++++++ 3 files changed, 92 insertions(+) create mode 100644 node-stack-trace/node-stack-trace.d.ts create mode 100644 node-stack-trace/node-stack-trace.ts create mode 100644 stacktrace/stacktrace.d.ts diff --git a/node-stack-trace/node-stack-trace.d.ts b/node-stack-trace/node-stack-trace.d.ts new file mode 100644 index 000000000..c3684b3db --- /dev/null +++ b/node-stack-trace/node-stack-trace.d.ts @@ -0,0 +1,20 @@ +// Type definitions for node-stack-trace +// Project: https://github.com/felixge/node-stack-trace +// Definitions by: [Exceptionless] +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module 'stack-trace' { + export interface StackFrame { + getTypeName():string; + getFunctionName():string; + getMethodName():string; + getFileName():string; + getTypeName():string; + getLineNumber():number; + getColumnNumber():number; + isNative():boolean; + } + + export function get(belowFn:() => void): StackFrame[]; + export function parse(err:Error): StackFrame[]; +} diff --git a/node-stack-trace/node-stack-trace.ts b/node-stack-trace/node-stack-trace.ts new file mode 100644 index 000000000..a0b2f8d55 --- /dev/null +++ b/node-stack-trace/node-stack-trace.ts @@ -0,0 +1,8 @@ +import stackTrace = require('stack-trace'); + +var currentStackTrace = stackTrace.get(); + +var err = new Error('something went wrong'); +var trace = stackTrace.parse(err); + +var fileName = trace[0].getFileName(); diff --git a/stacktrace/stacktrace.d.ts b/stacktrace/stacktrace.d.ts new file mode 100644 index 000000000..a23216a95 --- /dev/null +++ b/stacktrace/stacktrace.d.ts @@ -0,0 +1,64 @@ +// Type definitions for stacktrace.js +// Project: https://github.com/stacktracejs/stacktrace.js +// Definitions by: [Exceptionless] +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module StackTrace { + export interface StackTraceOptions { + filter?: (stackFrame:StackFrame) => boolean; + sourceCache?: { URL:string }; + offline?: boolean; + } + + export interface StackFrame { + constructor(functionName:string, args:any, fileName:string, lineNumber:number, columnNumber:number); + + functionName?:string; + args?:any; + fileName?:string; + lineNumber?:number; + columnNumber?:number; + toString():string; + } + + /** + * Get a backtrace from invocation point. + * @param options Options Object + * @return Array[StackFrame] + */ + export function get(options: StackTraceOptions): Promise; + + /** + * Given an error object, parse it. + * @param error Error object + * @param options Object for options + * @return Array[StackFrame] + */ + export function fromError(error:Error, options?:StackTraceOptions): Promise; + + /** + * Use StackGenerator to generate a backtrace. + * @param options Object options + * @returns Array[StackFrame] + */ + export function generateArtificially(options: StackTraceOptions): Promise; + + /** + * Given a function, wrap it such that invocations trigger a callback that + * is called with a stack trace. + * + * @param {Function} fn to be instrumented + * @param {Function} callback function to call with a stack trace on invocation + * @param {Function} errorCallback optional function to call with error if unable to get stack trace. + * @param {Object} thisArg optional context object (e.g. window) + */ + export function instrument(fn:() => void, callback:(stackFrames:StackFrame[]) => void, errorCallback:() => void, thisArg:any): void; + + /** + * Given a function that has been instrumented, + * revert the function to it's original (non-instrumented) state. + * + * @param fn {Function} + */ + export function deinstrument(fn:() => void): void; +} From 6b54b0b58f23d95a9670a7f1c364459fb349f548 Mon Sep 17 00:00:00 2001 From: Blake Niemyjski Date: Tue, 12 May 2015 11:45:17 -0500 Subject: [PATCH 021/179] Added stack trace.js tests --- stacktrace/stacktrace-tests.ts | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 stacktrace/stacktrace-tests.ts diff --git a/stacktrace/stacktrace-tests.ts b/stacktrace/stacktrace-tests.ts new file mode 100644 index 000000000..39a968d61 --- /dev/null +++ b/stacktrace/stacktrace-tests.ts @@ -0,0 +1,25 @@ +import StackTrace = require('StackTrace'); + +function interestingFn() { + return 'https://github.com/exceptionless/Exceptionless'; +} + +var callback = function(stackframes) { + var stringifiedStack = stackframes.map(function(sf) { + return sf.toString(); + }).join('\n'); + console.log(stringifiedStack); +}; + +var errback = function(err) { console.log(err.message); }; + + +StackTrace.get(); + +// Somewhere else... +var error = new Error('BOOM!'); +StackTrace.fromError(error); +StackTrace.generateArtificially(); + +StackTrace.instrument(interestingFn, callback, errback); +StackTrace.deinstrument(interestingFn); From a07aca985c3842a22f2de49879ff25a44e37ef9a Mon Sep 17 00:00:00 2001 From: Blake Niemyjski Date: Tue, 12 May 2015 11:46:47 -0500 Subject: [PATCH 022/179] Added missing promise definition file. --- stacktrace/stacktrace.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/stacktrace/stacktrace.d.ts b/stacktrace/stacktrace.d.ts index a23216a95..b54efe43e 100644 --- a/stacktrace/stacktrace.d.ts +++ b/stacktrace/stacktrace.d.ts @@ -3,6 +3,8 @@ // Definitions by: [Exceptionless] // Definitions: https://github.com/borisyankov/DefinitelyTyped +/// + declare module StackTrace { export interface StackTraceOptions { filter?: (stackFrame:StackFrame) => boolean; From 3fc51aa130576f5260e35c2fb8ace3359000771a Mon Sep 17 00:00:00 2001 From: Sam Noedel Date: Tue, 12 May 2015 10:25:39 -0700 Subject: [PATCH 023/179] Added definitions for chai-subset --- chai-subset/chai-subset-tests.ts | 62 ++++++++++++++++++++++++++++++++ chai-subset/chai-subset.d.ts | 21 +++++++++++ 2 files changed, 83 insertions(+) create mode 100644 chai-subset/chai-subset-tests.ts create mode 100644 chai-subset/chai-subset.d.ts diff --git a/chai-subset/chai-subset-tests.ts b/chai-subset/chai-subset-tests.ts new file mode 100644 index 000000000..8b88e5c6a --- /dev/null +++ b/chai-subset/chai-subset-tests.ts @@ -0,0 +1,62 @@ +/// + +import chai = require('chai'); +import chaiSubset = require('chai-subset'); + +chai.use(chaiSubset); +var expect = chai.expect; +var assert = chai.assert; + +function test_containSubset() { + var obj: Object = { + a: 'b', + c: 'd', + e: { + foo: 'bar', + baz: { + qux: 'quux' + } + } + }; + + expect(obj).to.containSubset({ + a: 'b', + e: { + baz: { + qux: 'quux' + } + } + }); + + obj.should.containSubset({ a: 'b' }); +} + +function test_notContainSubset() { + var obj: Object = { + a: 'b', + c: 'd', + e: { + foo: 'bar', + baz: { + qux: 'quux' + } + } + }; + + expect(obj).to.not.containSubset({ g: 'whatever' }); + obj.should.not.containSubset({ g: 'whatever' }); +} + +function test_arrayContainSubset() { + var list: Array = [{a: 'a', b: 'b'}, {v: 'f', d: {z: 'g'}} ]; + + expect(list).to.containSubset([{a:'a', b: 'b'}]); + list.should.containSubset([{a:'a', b: 'b'}]); +} + +function test_arrayNotContainSubset() { + var list: Array = [{a: 'a', b: 'b'}, {v: 'f', d: {z: 'g'}} ]; + + expect(list).not.to.containSubset([{a:'a', b: 'bd'}]); + list.should.not.containSubset([{a:'a', b: 'bd'}]); +} diff --git a/chai-subset/chai-subset.d.ts b/chai-subset/chai-subset.d.ts new file mode 100644 index 000000000..44bbef9cc --- /dev/null +++ b/chai-subset/chai-subset.d.ts @@ -0,0 +1,21 @@ +// Type definitions for chai-subset 1.0.0 +// Project: https://github.com/e-conomic/chai-subset +// Definitions by: Sam Noedel +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module Chai { + interface Assertion { + containSubset(obj: Object): Assertion; + } +} + +interface Object { + should: Chai.Assertion; +} + +declare module "chai-subset" { + function chaiSubset(chai: any, utils: any): void; + export = chaiSubset; +} From 372a2c4cd967a8a38b4e92cc5192a36dddfb0ffc Mon Sep 17 00:00:00 2001 From: Phips Peter Date: Tue, 12 May 2015 11:56:55 -0700 Subject: [PATCH 024/179] Updating the mocha type definitions --- mocha/mocha.d.ts | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/mocha/mocha.d.ts b/mocha/mocha.d.ts index 3f5d3e571..63ad66014 100644 --- a/mocha/mocha.d.ts +++ b/mocha/mocha.d.ts @@ -52,7 +52,7 @@ interface MochaDone { declare var mocha: Mocha; -declare var describe : { +declare var describe: { (description: string, spec: () => void): void; only(description: string, spec: () => void): void; skip(description: string, spec: () => void): void; @@ -60,12 +60,20 @@ declare var describe : { } // alias for `describe` -declare var context : { +declare var context: { (contextTitle: string, spec: () => void): void; only(contextTitle: string, spec: () => void): void; skip(contextTitle: string, spec: () => void): void; timeout(ms: number): void; -} +}; + +// 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; @@ -77,6 +85,17 @@ declare var it: { timeout(ms: number): void; }; +// 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 function before(action: () => void): void; declare function before(action: (done: MochaDone) => void): void; From 66d8808c98856feae7d5a2d5acfc955110fb126d Mon Sep 17 00:00:00 2001 From: Phips Peter Date: Tue, 12 May 2015 11:57:21 -0700 Subject: [PATCH 025/179] Adding test for new mocha API --- mocha/mocha-tests.ts | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/mocha/mocha-tests.ts b/mocha/mocha-tests.ts index dffd86e44..f90fefaf9 100644 --- a/mocha/mocha-tests.ts +++ b/mocha/mocha-tests.ts @@ -24,6 +24,18 @@ function test_context() { }); } +function test_suite() { + suite('some context', () => { }); + + suite.only('some context', () => { }); + + suite.skip('some context', () => { }); + + suite('some context', function() { + this.timeout(2000); + }); +} + function test_it() { it('does something', () => { }); @@ -39,6 +51,21 @@ function test_it() { }); } +function test_test() { + + test('does something', () => { }); + + test('does something', (done) => { done(); }); + + test.only('does something', () => { }); + + test.skip('does something', () => { }); + + test('does something', function () { + this.timeout(2000); + }); +} + function test_before() { before(() => { }); @@ -221,4 +248,4 @@ function test_run_withOnComplete() { instance.run((failures: number): void => { console.log(failures); }); -} \ No newline at end of file +} From 3d26b455fbad55603589c4ddee9b27770a155e96 Mon Sep 17 00:00:00 2001 From: Ben Tesser Date: Wed, 13 May 2015 04:09:28 -0400 Subject: [PATCH 026/179] Typings for angularjs-toaster --- angularjs-toaster/angularjs-toaster-tests.ts | 42 +++++++ angularjs-toaster/angularjs-toaster.d.ts | 109 +++++++++++++++++++ 2 files changed, 151 insertions(+) create mode 100644 angularjs-toaster/angularjs-toaster-tests.ts create mode 100644 angularjs-toaster/angularjs-toaster.d.ts diff --git a/angularjs-toaster/angularjs-toaster-tests.ts b/angularjs-toaster/angularjs-toaster-tests.ts new file mode 100644 index 000000000..ffff32159 --- /dev/null +++ b/angularjs-toaster/angularjs-toaster-tests.ts @@ -0,0 +1,42 @@ +/// +class NgToasterTestController { + constructor(public $scope: ng.IScope, public $window: ng.IWindowService, public toaster: ngtoaster.IToasterService) { + this.bar = 'Hi'; + } + bar: string; + + pop(): void { + this.toaster.success({ title: "title", body: "text1" }); + this.toaster.error("title", "text2"); + this.toaster.pop({ type: 'wait', title: "title", body: "text" }); + this.toaster.pop('success', "title", '
    • Render html
    ', 5000, 'trustedHtml'); + this.toaster.pop('error', "title", '
    • Render html
    ', null, 'trustedHtml'); + this.toaster.pop('wait', "title", null, null, 'template'); + this.toaster.pop('warning', "title", "myTemplate.html", null, 'template'); + this.toaster.pop('note', "title", "text"); + this.toaster.pop('success', "title", 'Its address is https://google.com.', 5000, 'trustedHtml', (toaster: ngtoaster.IToast): boolean => { + var match = toaster.body.match(/http[s]?:\/\/[^\s]+/); + if (match) { + this.$window.open(match[0]); + } + return true; + }); + this.toaster.pop('warning', "Hi ", "{template: 'myTemplateWithData.html', data: 'MyData'}", 15000, 'templateWithData'); + } + + goToLink(toaster: ngtoaster.IToast): boolean { + var match = toaster.body.match(/http[s]?:\/\/[^\s]+/); + if (match) { + this.$window.open(match[0]); + } + return true; + } + + clear(): void { + this.toaster.clear(); + } +} + +angular + .module('main', ['ngAnimate', 'toaster']) + .controller('myController', NgToasterTestController); \ No newline at end of file diff --git a/angularjs-toaster/angularjs-toaster.d.ts b/angularjs-toaster/angularjs-toaster.d.ts new file mode 100644 index 000000000..398704514 --- /dev/null +++ b/angularjs-toaster/angularjs-toaster.d.ts @@ -0,0 +1,109 @@ +// Type definitions for angularjs-toaster v0.4.13 +// Project: https://github.com/jirikavi/AngularJS-Toaster +// Definitions by: Ben Tesser +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module ngtoaster { + interface IToasterService { + pop(params:IPopParams): void + /** + * @param {string} type Type of toaster -- 'error', 'info', 'wait', 'success', and 'warning' + */ + pop(type?:string, title?:string, body?:string, timeout?:number, bodyOutputType?:string, clickHandler?:EventListener, + toasterId?:number, showCloseButton?:boolean): void + error(params: IPopParams): void + error(title?:string, body?:string, timeout?:number, bodyOutputType?:string, clickHandler?:EventListener, + toasterId?:number): void + into(params: IPopParams): void + info(title?:string, body?:string, timeout?:number, bodyOutputType?:string, clickHandler?:EventListener, + toasterId?:number): void + wait(params: IPopParams): void + wait(title?:string, body?:string, timeout?:number, bodyOutputType?:string, clickHandler?:EventListener, + toasterId?:number): void + success(params: IPopParams): void + success(title?:string, body?:string, timeout?:number, bodyOutputType?:string, clickHandler?:EventListener, + toasterId?:number): void + warning(params: IPopParams): void + warning(title?:string, body?:string, timeout?:number, bodyOutputType?:string, clickHandler?:EventListener, + toasterId?:number): void + clear(): void + toast:IToast; + } + + interface IToasterEventRegistry { + setup(): void + subscribeToNewToastEvent(onNewToast:IToastEventListener): void + subscribeToClearToastsEvent(onClearToasts:IToastEventListener): void + unsubscribeToNewToastEvent(onNewToast:IToastEventListener): void + unsubscribeToClearToastsEvent(onClearToasts:IToastEventListener): void + } + + interface IPopParams extends IToast{ + toasterId?: number; + } + + interface IToastEventListener { + (event:Event, toasterId: number): void; + } + + interface IToast { + /** + * Acceptable types are: + * 'error', 'info', 'wait', 'success', and 'warning' + */ + type?: string; + title?: string; + body?: string; + timeout?: number; + bodyOutputType?: string; + clickHandler?: EventListener; + showCloseButton?: boolean; + } + + interface IToasterConfig { + /** + * limits max number of toasts + */ + limit?: number; + 'tap-to-dismiss'?: boolean; + 'close-button'?: boolean; + 'newest-on-top'?: boolean; + 'time-out'?: number; + 'icon-classes'?: IIconClasses; + /** + * Options include: + * '', 'trustedHtml', 'template', 'templateWithData' + */ + 'body-output-type'?: string; + 'body-template'?: string; + 'icon-class'?: string; + /** + * Options include: + * 'toast-top-full-width', 'toast-bottom-full-width', 'toast-center', + * 'toast-top-left', 'toast-top-center', 'toast-top-rigt', + * 'toast-bottom-left', 'toast-bottom-center', 'toast-bottom-rigt', + */ + 'position-class'?: string; + 'title-class'?: string; + 'message-class'?: string; + 'prevent-duplicates'?: boolean; + /** + * stop timeout on mouseover and restart timer on mouseout + */ + 'mouseover-timer-stop'?: boolean; + } + + interface IIconClasses { + error: string; + info: string; + wait: string; + success: string; + warning: string; + } +} + +declare module "ngtoaster" { + export = ngtoaster +} From b0d1fa0b584ebdd8fa1f2455931565c4c4b1ba94 Mon Sep 17 00:00:00 2001 From: Alexander Shutov Date: Wed, 13 May 2015 16:46:45 +0300 Subject: [PATCH 027/179] Added missing AppWindow events. --- chrome/chrome-app-tests.ts | 8 ++++++++ chrome/chrome-app.d.ts | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/chrome/chrome-app-tests.ts b/chrome/chrome-app-tests.ts index de56bbac8..970e03517 100644 --- a/chrome/chrome-app-tests.ts +++ b/chrome/chrome-app-tests.ts @@ -28,6 +28,14 @@ var currentWindow: cwindow.AppWindow = chrome.app.window.current(); var otherWindow: cwindow.AppWindow = chrome.app.window.get('some-string'); var allWindows: cwindow.AppWindow[] = chrome.app.window.getAll(); +// listening to window events +currentWindow.onBoundsChanged.addListener(function () { return; }); +currentWindow.onClosed.addListener(function () { return; }); +currentWindow.onFullscreened.addListener(function () { return; }); +currentWindow.onMaximized.addListener(function () { return; }); +currentWindow.onMinimized.addListener(function () { return; }); +currentWindow.onRestored.addListener(function () { return; }); + // check platform capabilities var visibleEverywhere: boolean = chrome.app.window.canSetVisibleOnAllWorkspaces(); diff --git a/chrome/chrome-app.d.ts b/chrome/chrome-app.d.ts index 2f498ed28..5cfa0fbce 100644 --- a/chrome/chrome-app.d.ts +++ b/chrome/chrome-app.d.ts @@ -122,6 +122,12 @@ declare module chrome.app.window { id: string; innerBounds: Bounds; outerBounds: Bounds; + onBoundsChanged: WindowEvent; + onClosed: WindowEvent; + onFullscreened: WindowEvent; + onMaximized: WindowEvent; + onMinimized: WindowEvent; + onRestored: WindowEvent; } export function create(url: string, options?: CreateWindowOptions, callback?: (created_window: AppWindow) => void): void; From 4969fc2f1e1a24b859cb25de785dc6d738b63c52 Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Tue, 12 May 2015 22:02:15 +0200 Subject: [PATCH 028/179] Added typings for knockout-paging library --- knockout-paging/knockout-paging-tests.ts | 90 ++++++++++++++++++++++++ knockout-paging/knockout-paging.d.ts | 67 ++++++++++++++++++ 2 files changed, 157 insertions(+) create mode 100644 knockout-paging/knockout-paging-tests.ts create mode 100644 knockout-paging/knockout-paging.d.ts diff --git a/knockout-paging/knockout-paging-tests.ts b/knockout-paging/knockout-paging-tests.ts new file mode 100644 index 000000000..eae5490bb --- /dev/null +++ b/knockout-paging/knockout-paging-tests.ts @@ -0,0 +1,90 @@ +/// + +// Different option formats +var emptyOptions = {}; +var pageNumberOptions = { pageNumber: 2 }; +var pageSizeOptions = { pageSize: 10 }; +var generatorOptions = { pageGenerator: 'sliding' }; +var allOptions = { pageNumber: 2, pageSize: 10, pageGenerator: 'sliding' }; + +function defaults() { + ko.paging.defaults.pageNumber = 1; + ko.paging.defaults.pageSize = 50; +} + +function pageGenerators() { + + // Allow to set the windowSize on sliding page generator + ko.paging.generators['sliding'].windowSize(5); + + // Add custom page generator + ko.paging.generators['custom'] = { + generate: function(pagedObservable: KnockoutObservable) { + return [0, 1]; + } + } +} + +function usingPagedObservableArrayFunctionOnKnockoutStatic() { + var simplePaged = ko.pagedObservableArray(); + var initializedPaged = ko.pagedObservableArray([1, 2, 3]); + var emptyOptionsPaged = ko.pagedObservableArray([1, 2, 3], emptyOptions); + var pageNumberOptionsPaged = ko.pagedObservableArray([1, 2, 3], pageNumberOptions); + var pageSizeOptionsPaged = ko.pagedObservableArray([1, 2, 3], pageSizeOptions); + var generatorOptionsPaged = ko.pagedObservableArray([1, 2, 3], generatorOptions); + var allOptionsPaged = ko.pagedObservableArray([1, 2, 3], allOptions); + + // Here we verify that the returned type is the paged observable array + simplePaged.pageSize(); + initializedPaged.pageSize(); + emptyOptionsPaged.pageSize(); + pageNumberOptionsPaged.pageSize(); + pageSizeOptionsPaged.pageSize(); + generatorOptionsPaged.pageSize(); + allOptionsPaged.pageSize(); +} + +function usingExtend() { + var emptyOptionsPaged = ko.observableArray([]).extend({ paged: emptyOptions }); + var pageNumberOptionsPaged = ko.observableArray([]).extend({ paged: pageNumberOptions }); + var pageSizeOptionsPaged = ko.observableArray([]).extend({ paged: pageSizeOptions }); + var generatorOptionsPaged = ko.observableArray([]).extend({ paged: generatorOptions }); + var allOptionsPaged = ko.observableArray([]).extend({ paged: allOptions }); + var withInitialArrayValue = ko.observableArray([1, 2, 3]).extend({ paged: emptyOptions }); + + // Here we verify that the returned type is the paged observable array + emptyOptionsPaged.pageSize(); + pageNumberOptionsPaged.pageSize(); + pageSizeOptionsPaged.pageSize(); + generatorOptionsPaged.pageSize(); + allOptionsPaged.pageSize(); +} + +function observables() { + var paged = ko.pagedObservableArray([]); + var pageSize = paged.pageSize(); + var pageNumber = paged.pageNumber(); +} + +function computed() { + var paged = ko.pagedObservableArray([]); + var pageItems = paged.pageItems(); + var pageCount = paged.pageCount(); + var itemCount = paged.itemCount(); + var firstItemOnPage = paged.firstItemOnPage(); + var lastItemOnPage = paged.lastItemOnPage(); + var hasPreviousPage = paged.hasPreviousPage(); + var hasNextPage = paged.hasNextPage(); + var isFirstPage = paged.isFirstPage(); + var isLastPage = paged.isLastPage(); + var pages = paged.pages(); +} + +function functions() { + var paged = ko.pagedObservableArray([]); + paged.toNextPage(); + paged.toLastPage(); + paged.toNextPage(); + paged.toPreviousPage(); + paged.toFirstPage(); +} \ No newline at end of file diff --git a/knockout-paging/knockout-paging.d.ts b/knockout-paging/knockout-paging.d.ts new file mode 100644 index 000000000..b5f7627a6 --- /dev/null +++ b/knockout-paging/knockout-paging.d.ts @@ -0,0 +1,67 @@ +// Type definitions for knockout-paging +// Project: https://github.com/ErikSchierboom/knockout-paging +// Definitions by: Erik Schierboom +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +interface KnockoutStatic { + paging: KnockoutPagingOptions; + pagedObservableArray(initialValue?: T[], options?: KnockoutPagedOptions): KnockoutPagedObservableArray; +} + +interface KnockoutPagingOptions { + defaults: KnockoutPagingDefaultOptions; + generators: { + [name: string]: KnockoutPageGenerator; + 'sliding': KnockoutSlidingPageGenerator + } +} + +interface KnockoutPagingDefaultOptions { + pageNumber: number; + pageSize: number; +} + +interface KnockoutPagedObservableArray extends KnockoutObservableArray { + pageSize: KnockoutObservable; + pageNumber: KnockoutObservable; + + pageItems: KnockoutComputed; + pageCount: KnockoutComputed; + itemCount: KnockoutComputed; + firstItemOnPage: KnockoutComputed; + lastItemOnPage: KnockoutComputed; + hasPreviousPage: KnockoutComputed; + hasNextPage: KnockoutComputed; + isFirstPage: KnockoutComputed; + isLastPage: KnockoutComputed; + pages: KnockoutComputed; + + toNextPage(): void; + toPreviousPage(): void; + toLastPage(): void; + toFirstPage(): void; +} + +interface KnockoutPagedOptions { + pageSize?: number; + pageNumber?: number; + pageGenerator?: string; +} + +interface KnockoutObservableArray { + extend(requestedExtenders: { 'paged': any; }): KnockoutPagedObservableArray; +} + +interface KnockoutPageGenerator { + generate(pagedObservable: KnockoutPagedObservableArray): number[]; +} + +interface KnockoutSlidingPageGenerator extends KnockoutPageGenerator { + windowSize: KnockoutObservable; +} + +interface KnockoutExtenders { + paged(target: KnockoutObservableArray, options: KnockoutPagedOptions): KnockoutObservableArray; +} \ No newline at end of file From c18e95ed4fd760a713f2e943b66af73fd1f757e6 Mon Sep 17 00:00:00 2001 From: jandic Date: Wed, 13 May 2015 19:15:07 +0200 Subject: [PATCH 029/179] Changed return type for registry.byId() --- dojo/dijit.d.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/dojo/dijit.d.ts b/dojo/dijit.d.ts index 33144b9da..0bb2ab67d 100644 --- a/dojo/dijit.d.ts +++ b/dojo/dijit.d.ts @@ -34291,7 +34291,7 @@ declare module dijit { * * @param id */ - byId(id: String): any; + byId(id: String): dijit._WidgetBase; /** * A synthetic clone of array.every acting explicitly on this WidgetSet * @@ -105714,14 +105714,14 @@ declare module dijit { * * @param id */ - byId(id: String): String; + byId(id: String): dijit._WidgetBase; /** * Find a widget by it's id. * If passed a widget then just returns the widget. * * @param id */ - byId(id: dijit._WidgetBase): String; + byId(id: dijit._WidgetBase): dijit._WidgetBase; /** * Returns the widget corresponding to the given DOMNode * @@ -105956,14 +105956,14 @@ declare module dijit { * * @param id */ - byId(id: String): String; + byId(id: String): dijit._WidgetBase; /** * Find a widget by it's id. * If passed a widget then just returns the widget. * * @param id */ - byId(id: dijit._WidgetBase): String; + byId(id: dijit._WidgetBase): dijit._WidgetBase; /** * Returns the widget corresponding to the given DOMNode * From 45595b750957b4490d194f300594707c1b88f4c8 Mon Sep 17 00:00:00 2001 From: Alasdair Mercer Date: Wed, 13 May 2015 18:40:00 +0100 Subject: [PATCH 030/179] updated places sub-module for google.maps --- googlemaps/google.maps.d.ts | 76 +++++++++++++++++++++++++++++-------- 1 file changed, 61 insertions(+), 15 deletions(-) diff --git a/googlemaps/google.maps.d.ts b/googlemaps/google.maps.d.ts index 3ba451c8a..81ee2594a 100644 --- a/googlemaps/google.maps.d.ts +++ b/googlemaps/google.maps.d.ts @@ -470,7 +470,7 @@ declare module google.maps { visible?: boolean; zIndex?: number; } - + export enum StrokePosition { CENTER, INSIDE, @@ -1414,8 +1414,19 @@ declare module google.maps { country: string; } + export interface PhotoOptions { + maxHeight?: number; + maxWidth?: number; + } + + export interface PlaceAspectRating { + rating: number; + type: string; + } + export interface PlaceDetailsRequest { - reference: string; + placeId: string; + reference?: string; } export interface PlaceGeometry { @@ -1423,29 +1434,53 @@ declare module google.maps { viewport: LatLngBounds; } + export interface PlacePhoto { + height: number; + html_attributions: string[]; + width: number; + getUrl(opts: PhotoOptions): string; + } + export interface PlaceResult { address_components: GeocoderAddressComponent[]; + aspects: PlaceAspectRating[]; formatted_address: string; formatted_phone_number: string; geometry: PlaceGeometry; html_attributions: string[]; icon: string; - id: string; + id?: string; international_phone_number: string; name: string; + permanently_closed: boolean; + photos: PlacePhoto[]; + place_id: string; + price_level: number; rating: number; - reference: string; + reference?: string; + reviews: PlaceReview[]; types: string[]; url: string; vicinity: string; website: string; } + export interface PlaceReview { + aspects: PlaceAspectRating[]; + author_name: string; + author_url: string; + language: string; + text: string; + } + export interface PlaceSearchRequest { bounds: LatLngBounds; keyword: string; location: LatLng; + maxPriceLevel?: number; + minPriceLevel?: number; name: string; + openNow: boolean; radius: number; rankBy: RankBy; types: string[]; @@ -1461,6 +1496,7 @@ declare module google.maps { constructor (attrContainer: Map); getDetails(request: PlaceDetailsRequest, callback: (result: PlaceResult, status: PlacesServiceStatus) => void ): void; nearbySearch(request: PlaceSearchRequest, callback: (results: PlaceResult[], status: PlacesServiceStatus, pagination: PlaceSearchPagination) => void ): void; + radarSearch(request: RadarSearchRequest, callback: (results: PlaceResult[], status: PlacesServiceStatus) => void ): void; textSearch(request: TextSearchRequest, callback: (results: PlaceResult[], status: PlacesServiceStatus) => void ): void; } @@ -1473,27 +1509,37 @@ declare module google.maps { ZERO_RESULTS } + export interface RadarSearchRequest { + bounds: LatLngBounds; + keyword: string; + location: LatLng; + name: string; + radius: number; + types: string[]; + } + export enum RankBy { DISTANCE, PROMINENCE } - - export class SearchBox { - constructor(inputField: HTMLInputElement, opts?: SearchBoxOptions); - getBounds(): LatLngBounds; - setBounds(bounds: LatLngBounds): void; - getPlaces(): PlaceResult[]; - } - export interface SearchBoxOptions { - bounds: LatLngBounds; - } + export class SearchBox extends MVCObject { + constructor(inputField: HTMLInputElement, opts?: SearchBoxOptions); + getBounds(): LatLngBounds; + setBounds(bounds: LatLngBounds): void; + getPlaces(): PlaceResult[]; + } + + export interface SearchBoxOptions { + bounds: LatLngBounds; + } export interface TextSearchRequest { bounds: LatLngBounds; location: LatLng; query: string; radius: number; + types: string[]; } } @@ -1643,6 +1689,6 @@ declare module google.maps { export class MapsEventListener { - } + } } } From 6aa0f25a1a3ca42cbc031d0633e7d66b561f6b3e Mon Sep 17 00:00:00 2001 From: Inez Korczynski Date: Wed, 13 May 2015 16:00:52 -0700 Subject: [PATCH 031/179] Ember.computed takes for instance string and a function --- ember/ember.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ember/ember.d.ts b/ember/ember.d.ts index e5300d967..a35d51eb9 100644 --- a/ember/ember.d.ts +++ b/ember/ember.d.ts @@ -2830,7 +2830,7 @@ declare module Ember { function compare(v: any, w: any): number; // ReSharper disable once DuplicatingLocalDeclaration var computed: { - (callback: Function): ComputedProperty; + (...args: any[]): ComputedProperty; alias(dependentKey: string): ComputedProperty; and(...args: string[]): ComputedProperty; any(...args: string[]): ComputedProperty; From 03286161b4021762ef638b6529f5e5c36a8cb4ec Mon Sep 17 00:00:00 2001 From: Inez Korczynski Date: Wed, 13 May 2015 16:03:49 -0700 Subject: [PATCH 032/179] Ember.observer takes as parameters for instance string and a function --- ember/ember.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ember/ember.d.ts b/ember/ember.d.ts index a35d51eb9..c47c4248c 100644 --- a/ember/ember.d.ts +++ b/ember/ember.d.ts @@ -2916,7 +2916,7 @@ declare module Ember { **/ var none: typeof deprecateFunc; function normalizeTuple(target: any, path: string): any[]; - function observer(func: Function, ...args: string[]): Function; + function observer(...args: any[]): Function; function observersFor(obj: any, path: string): any[]; function onLoad(name: string, callback: Function): void; function oneWay(obj: any, to: string, from: string): Binding; From fba82fdad1c7a24df7a4c4ab6a79f02741134496 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Thu, 14 May 2015 11:07:34 +0500 Subject: [PATCH 033/179] lodash: added now() method --- lodash/lodash-tests.ts | 6 ++++++ lodash/lodash.d.ts | 14 ++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index b16f03b46..e87da2110 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -611,6 +611,12 @@ result = _.where(stoogesCombined, { 'quotes': ['Poifect!'] } result = _(stoogesCombined).where({ 'age': 40 }).value(); result = _(stoogesCombined).where({ 'quotes': ['Poifect!'] }).value(); +/******** + * Date * + ********/ + +result = _.now(); + /************* * Functions * *************/ diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 84db97b2d..e2878d595 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -4795,6 +4795,20 @@ declare module _ { where(properties: U): LoDashArrayWrapper; } + /******** + * Date * + ********/ + + //_.now + interface LoDashStatic { + /** + * Gets the number of milliseconds that have elapsed since the Unix epoch + * (1 January 1970 00:00:00 UTC). + * @return The number of milliseconds. + **/ + now(): number; + } + /************* * Functions * *************/ From adf53d0cc0db2a468f3158719729626373fce12f Mon Sep 17 00:00:00 2001 From: Horiuchi_H Date: Thu, 14 May 2015 18:00:13 +0900 Subject: [PATCH 034/179] add `node-gcm` type definition file --- node-gcm/node-gcm-tests.ts | 72 ++++++++++++++++++++++++++++++++++++++ node-gcm/node-gcm.d.ts | 62 ++++++++++++++++++++++++++++++++ 2 files changed, 134 insertions(+) create mode 100644 node-gcm/node-gcm-tests.ts create mode 100644 node-gcm/node-gcm.d.ts diff --git a/node-gcm/node-gcm-tests.ts b/node-gcm/node-gcm-tests.ts new file mode 100644 index 000000000..b184949ed --- /dev/null +++ b/node-gcm/node-gcm-tests.ts @@ -0,0 +1,72 @@ +/// + +import gcm = require('node-gcm'); + +// Create a message +// ... with default values +var message = new gcm.Message(); + +// ... or some given values +var message = new gcm.Message({ + collapseKey: 'demo', + delayWhileIdle: true, + timeToLive: 3, + data: { + key1: 'message1', + key2: 'message2' + } +}); + +// Change the message data +// ... as key-value +message.addData('key1','message1'); +message.addData('key2','message2'); + +// ... or as a data object (overwrites previous data object) +message.addData({ + key1: 'message1', + key2: 'message2' +}); + +// Change the message variables +message.collapseKey = 'demo'; +message.delayWhileIdle = true; +message.timeToLive = 3; +message.dryRun = true; + +// Set up the sender with you API key +var sender = new gcm.Sender('insert Google Server API Key here'); + +// Add the registration IDs of the devices you want to send to +var registrationIds: string[] = []; +registrationIds.push('regId1'); +registrationIds.push('regId2'); + +// Send the message +// ... trying only once +sender.sendNoRetry(message, registrationIds, (err, result) => { + if (err) { + console.error(err); + } else { + console.log(result); + } +}); + +// ... or retrying +sender.send(message, registrationIds, (err, result) => { + if (err) { + console.error(err); + } else { + console.log(result); + } +}); + +// ... or retrying a specific number of times (10) +sender.send(message, registrationIds, 10, (err, result) => { + if (err) { + console.error(err); + } else { + console.log(result); + } +}); + diff --git a/node-gcm/node-gcm.d.ts b/node-gcm/node-gcm.d.ts new file mode 100644 index 000000000..3272acac4 --- /dev/null +++ b/node-gcm/node-gcm.d.ts @@ -0,0 +1,62 @@ +// Type definitions for node-gcm 0.9.15 +// Project: https://www.npmjs.org/package/node-gcm +// Definitions by: Hiroki Horiuchi +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "node-gcm" { + + export interface IMessageOptions { + collapseKey?: string; + delayWhileIdle?: boolean; + timeToLive?: number; + dryRun?: boolean; + } + + export class Message { + constructor(options?: IMessageOptions); + collapseKey: string; + delayWhileIdle: boolean; + timeToLive: number; + dryRun: boolean; + + addData(key: string, value: string): void; + addData(data: any): void; + } + + + export interface ISenderOptions { + proxy?: any; + maxSockets?: number; + timeout?: number; + } + export interface ISenderSendOptions { + retries?: number; + backoff?: number; + } + + export class Sender { + constructor(key: string, options?: ISenderOptions); + key: string; + options: ISenderOptions; + + send(message: Message, registrationIds: string|string[], callback: (err: any, resJson: IResponseBody) => void): void; + send(message: Message, registrationIds: string|string[], retries: number, callback: (err: any, resJson: IResponseBody) => void): void; + send(message: Message, registrationIds: string|string[], options: ISenderSendOptions, callback: (err: any, resJson: IResponseBody) => void): void; + sendNoRetry(message: Message, registrationIds: string|string[], callback: (err: any, resJson: IResponseBody) => void): void; + } + + + export interface IResponseBody { + success: number; + failure: number; + canonical_ids: number; + multicast_id?: number; + results?: { + message_id?: string; + registration_id?: string; + error?: string; + }[]; + } + +} + From c52274c369d7f3d44d2de1a67260bfae5a9a9ce2 Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Thu, 14 May 2015 11:02:31 +0200 Subject: [PATCH 035/179] Added typings for knockout-pre-rendered library --- .../knockout-pre-rendered-tests.ts | 15 +++++++++++++++ knockout-pre-rendered/knockout-pre-rendered.d.ts | 11 +++++++++++ 2 files changed, 26 insertions(+) create mode 100644 knockout-pre-rendered/knockout-pre-rendered-tests.ts create mode 100644 knockout-pre-rendered/knockout-pre-rendered.d.ts diff --git a/knockout-pre-rendered/knockout-pre-rendered-tests.ts b/knockout-pre-rendered/knockout-pre-rendered-tests.ts new file mode 100644 index 000000000..f3a011e95 --- /dev/null +++ b/knockout-pre-rendered/knockout-pre-rendered-tests.ts @@ -0,0 +1,15 @@ +/// + +function initBindingHandler() { + ko.bindingHandlers.init = { + init: (element: any, valueAccessor: () => any, allBindingsAccessor: KnockoutAllBindingsAccessor, viewModel: any, bindingContext: KnockoutBindingContext) => {}, + update: (element: any, valueAccessor: () => any, allBindingsAccessor: KnockoutAllBindingsAccessor, viewModel: any, bindingContext: KnockoutBindingContext) => {} + }; +} + +function foreachInitBindingHandler() { + ko.bindingHandlers.foreachInit = { + init: (element: any, valueAccessor: () => any, allBindingsAccessor: KnockoutAllBindingsAccessor, viewModel: any, bindingContext: KnockoutBindingContext) => { }, + update: (element: any, valueAccessor: () => any, allBindingsAccessor: KnockoutAllBindingsAccessor, viewModel: any, bindingContext: KnockoutBindingContext) => { } + }; +} \ No newline at end of file diff --git a/knockout-pre-rendered/knockout-pre-rendered.d.ts b/knockout-pre-rendered/knockout-pre-rendered.d.ts new file mode 100644 index 000000000..8c3641aa9 --- /dev/null +++ b/knockout-pre-rendered/knockout-pre-rendered.d.ts @@ -0,0 +1,11 @@ +// Type definitions for knockout-pre-rendered +// Project: https://github.com/ErikSchierboom/knockout-pre-rendered +// Definitions by: Erik Schierboom +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +interface KnockoutBindingHandlers { + init: KnockoutBindingHandler; + foreachInit: KnockoutBindingHandler; +} \ No newline at end of file From f9996b4dda9790d89d5c8ebe5356dab22597f856 Mon Sep 17 00:00:00 2001 From: Blake Niemyjski Date: Thu, 14 May 2015 10:14:44 -0500 Subject: [PATCH 036/179] Fixed unit tests and naming conventions. --- .../stack-trace-tests.ts | 0 .../stack-trace.d.ts | 4 ++-- .../stacktrace-js-tests.ts | 11 +++++------ .../stacktrace-js.d.ts | 8 ++++---- 4 files changed, 11 insertions(+), 12 deletions(-) rename node-stack-trace/node-stack-trace.ts => stack-trace/stack-trace-tests.ts (100%) rename node-stack-trace/node-stack-trace.d.ts => stack-trace/stack-trace.d.ts (79%) rename stacktrace/stacktrace-tests.ts => stacktrace-js/stacktrace-js-tests.ts (52%) rename stacktrace/stacktrace.d.ts => stacktrace-js/stacktrace-js.d.ts (86%) diff --git a/node-stack-trace/node-stack-trace.ts b/stack-trace/stack-trace-tests.ts similarity index 100% rename from node-stack-trace/node-stack-trace.ts rename to stack-trace/stack-trace-tests.ts diff --git a/node-stack-trace/node-stack-trace.d.ts b/stack-trace/stack-trace.d.ts similarity index 79% rename from node-stack-trace/node-stack-trace.d.ts rename to stack-trace/stack-trace.d.ts index c3684b3db..21c12f8f2 100644 --- a/node-stack-trace/node-stack-trace.d.ts +++ b/stack-trace/stack-trace.d.ts @@ -1,6 +1,6 @@ // Type definitions for node-stack-trace // Project: https://github.com/felixge/node-stack-trace -// Definitions by: [Exceptionless] +// Definitions by: Exceptionless // Definitions: https://github.com/borisyankov/DefinitelyTyped declare module 'stack-trace' { @@ -15,6 +15,6 @@ declare module 'stack-trace' { isNative():boolean; } - export function get(belowFn:() => void): StackFrame[]; + export function get(belowFn?:() => void): StackFrame[]; export function parse(err:Error): StackFrame[]; } diff --git a/stacktrace/stacktrace-tests.ts b/stacktrace-js/stacktrace-js-tests.ts similarity index 52% rename from stacktrace/stacktrace-tests.ts rename to stacktrace-js/stacktrace-js-tests.ts index 39a968d61..c4c9bcf87 100644 --- a/stacktrace/stacktrace-tests.ts +++ b/stacktrace-js/stacktrace-js-tests.ts @@ -1,18 +1,17 @@ -import StackTrace = require('StackTrace'); +/// function interestingFn() { return 'https://github.com/exceptionless/Exceptionless'; } -var callback = function(stackframes) { - var stringifiedStack = stackframes.map(function(sf) { +var callback = function(stackframes:StackTrace.StackFrame[]) { + var stringifiedStack = stackframes.map(function(sf:StackTrace.StackFrame) { return sf.toString(); }).join('\n'); console.log(stringifiedStack); }; -var errback = function(err) { console.log(err.message); }; - +var errorCallback = function(err:Error) { console.log(err.message); }; StackTrace.get(); @@ -21,5 +20,5 @@ var error = new Error('BOOM!'); StackTrace.fromError(error); StackTrace.generateArtificially(); -StackTrace.instrument(interestingFn, callback, errback); +StackTrace.instrument(interestingFn, callback, errorCallback); StackTrace.deinstrument(interestingFn); diff --git a/stacktrace/stacktrace.d.ts b/stacktrace-js/stacktrace-js.d.ts similarity index 86% rename from stacktrace/stacktrace.d.ts rename to stacktrace-js/stacktrace-js.d.ts index b54efe43e..21ad6839e 100644 --- a/stacktrace/stacktrace.d.ts +++ b/stacktrace-js/stacktrace-js.d.ts @@ -13,7 +13,7 @@ declare module StackTrace { } export interface StackFrame { - constructor(functionName:string, args:any, fileName:string, lineNumber:number, columnNumber:number); + constructor(functionName:string, args:any, fileName:string, lineNumber:number, columnNumber:number): StackFrame; functionName?:string; args?:any; @@ -28,7 +28,7 @@ declare module StackTrace { * @param options Options Object * @return Array[StackFrame] */ - export function get(options: StackTraceOptions): Promise; + export function get(options?: StackTraceOptions): Promise; /** * Given an error object, parse it. @@ -43,7 +43,7 @@ declare module StackTrace { * @param options Object options * @returns Array[StackFrame] */ - export function generateArtificially(options: StackTraceOptions): Promise; + export function generateArtificially(options?: StackTraceOptions): Promise; /** * Given a function, wrap it such that invocations trigger a callback that @@ -54,7 +54,7 @@ declare module StackTrace { * @param {Function} errorCallback optional function to call with error if unable to get stack trace. * @param {Object} thisArg optional context object (e.g. window) */ - export function instrument(fn:() => void, callback:(stackFrames:StackFrame[]) => void, errorCallback:() => void, thisArg:any): void; + export function instrument(fn:() => void, callback:(stackFrames:StackFrame[]) => void, errorCallback:(error:Error) => void, thisArg?:any): void; /** * Given a function that has been instrumented, From bf147fd816ea0eef37b7c96489e140f29bee4cfb Mon Sep 17 00:00:00 2001 From: Blake Niemyjski Date: Thu, 14 May 2015 10:15:16 -0500 Subject: [PATCH 037/179] Fixed name on definition header. --- stacktrace-js/stacktrace-js.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stacktrace-js/stacktrace-js.d.ts b/stacktrace-js/stacktrace-js.d.ts index 21ad6839e..9f7ce5ea2 100644 --- a/stacktrace-js/stacktrace-js.d.ts +++ b/stacktrace-js/stacktrace-js.d.ts @@ -1,6 +1,6 @@ // Type definitions for stacktrace.js // Project: https://github.com/stacktracejs/stacktrace.js -// Definitions by: [Exceptionless] +// Definitions by: Exceptionless // Definitions: https://github.com/borisyankov/DefinitelyTyped /// From 2dabe041c4ce0631a06209e5ff6b3b61e4d17a62 Mon Sep 17 00:00:00 2001 From: Mads Date: Thu, 14 May 2015 18:57:45 +0200 Subject: [PATCH 038/179] whoops, syntax error --- react/react-addons-global.d.ts | 2 +- react/react-addons.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/react/react-addons-global.d.ts b/react/react-addons-global.d.ts index 3e028f5f0..bccd3f427 100644 --- a/react/react-addons-global.d.ts +++ b/react/react-addons-global.d.ts @@ -79,7 +79,7 @@ declare module React { interface UpdateSpec { $set?: any; $merge?: {}; - $apply(value: any)?: any; + $apply?(value: any): any; // [key: string]: UpdateSpec; } diff --git a/react/react-addons.d.ts b/react/react-addons.d.ts index d61bf4221..c4e768f27 100644 --- a/react/react-addons.d.ts +++ b/react/react-addons.d.ts @@ -814,7 +814,7 @@ declare module "react/addons" { interface UpdateSpec { $set?: any; $merge?: {}; - $apply(value: any)?: any; + $apply?(value: any): any; // [key: string]: UpdateSpec; } From ccd672639b2c21ae8188ecb5164946ac8f9ea028 Mon Sep 17 00:00:00 2001 From: Matt Brooks Date: Thu, 14 May 2015 23:35:28 +0100 Subject: [PATCH 039/179] New definition for jQuery Succinct plugin Added definition for jQuery Succinct plugin with accompanying tests file. --- jquery.succinct/jquery.succinct-tests.ts | 31 ++++++++++++++++++++++++ jquery.succinct/jquery.succinct.d.ts | 18 ++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 jquery.succinct/jquery.succinct-tests.ts create mode 100644 jquery.succinct/jquery.succinct.d.ts diff --git a/jquery.succinct/jquery.succinct-tests.ts b/jquery.succinct/jquery.succinct-tests.ts new file mode 100644 index 000000000..7ca72048e --- /dev/null +++ b/jquery.succinct/jquery.succinct-tests.ts @@ -0,0 +1,31 @@ +/// + +// Call with no arguments (accepting defaults) +$(".truncate").succinct(); + +// Specify size +$(".truncate").succinct({ + size: 120 +}); + +// Specify ellipsis replacement +$(".truncate").succinct({ + omission: "→" +}); + +// Specify flag to leave trailing special characters +$(".truncate").succinct({ + ignore: false +}); + +// Combine options +$(".truncate").succinct({ + size: 120, + omission: '...', + ignore: false +}); + +// Can chain jQuery methods +$(".truncate") + .succinct() + .removeClass("truncate"); \ No newline at end of file diff --git a/jquery.succinct/jquery.succinct.d.ts b/jquery.succinct/jquery.succinct.d.ts new file mode 100644 index 000000000..489ee98d2 --- /dev/null +++ b/jquery.succinct/jquery.succinct.d.ts @@ -0,0 +1,18 @@ +// Type definitions for jQuery Succinct v1.1.0 +// Project: http://mikeking.io/succinct/ +// Definitions by: Matt Brooks +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module JQuerySuccinct { + interface Options { + size?: number; + omission?: string; + ignore?: boolean; + } +} + +interface JQuery { + succinct(settings?: JQuerySuccinct.Options): JQuery; +} \ No newline at end of file From fefe9f1de673efd12fadd16ea8577fdbbc8a4431 Mon Sep 17 00:00:00 2001 From: John Reilly Date: Fri, 15 May 2015 09:30:41 +0100 Subject: [PATCH 040/179] angular.d.ts - added JSDoc for $broadcast and $emit --- angularjs/angular.d.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index 1e62aa5f2..7d1f3140b 100755 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -539,9 +539,29 @@ declare module angular { $applyAsync(exp: string): any; $applyAsync(exp: (scope: IScope) => any): any; + /** + * Dispatches an event name downwards to all child scopes (and their children) notifying the registered $rootScope.Scope listeners. + * + * The event life cycle starts at the scope on which $broadcast was called. All listeners listening for name event on this scope get notified. Afterwards, the event propagates to all direct and indirect scopes of the current scope and calls all registered listeners along the way. The event cannot be canceled. + * + * Any exception emitted from the listeners will be passed onto the $exceptionHandler service. + * + * @param name Event name to broadcast. + * @param args Optional one or more arguments which will be passed onto the event listeners. + */ $broadcast(name: string, ...args: any[]): IAngularEvent; $destroy(): void; $digest(): void; + /** + * Dispatches an event name upwards through the scope hierarchy notifying the registered $rootScope.Scope listeners. + * + * The event life cycle starts at the scope on which $emit was called. All listeners listening for name event on this scope get notified. Afterwards, the event traverses upwards toward the root scope and calls all registered listeners along the way. The event will stop propagating if one of the listeners cancels it. + * + * Any exception emitted from the listeners will be passed onto the $exceptionHandler service. + * + * @param name Event name to emit. + * @param args Optional one or more arguments which will be passed onto the event listeners. + */ $emit(name: string, ...args: any[]): IAngularEvent; $eval(): any; From a7ee9ec55f70644adc68dfe26434673e2834821f Mon Sep 17 00:00:00 2001 From: Simon Altschuler Date: Fri, 15 May 2015 11:13:34 +0200 Subject: [PATCH 041/179] Add module declaration for AMD compatability --- js-signals/js-signals.d.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/js-signals/js-signals.d.ts b/js-signals/js-signals.d.ts index ebc8f72ae..c396bf490 100644 --- a/js-signals/js-signals.d.ts +++ b/js-signals/js-signals.d.ts @@ -5,6 +5,10 @@ declare var signals: SignalWrapper; +declare module "signals" { + export = signals; +} + interface SignalWrapper { Signal: Signal } From 6a55702abf51f13e5150c5aff6e8820c9b63864c Mon Sep 17 00:00:00 2001 From: Joseph Livecchi Date: Fri, 15 May 2015 09:50:34 -0400 Subject: [PATCH 042/179] Started updating fabric.d.ts Updating to be compatible with fabric v1.5 Reorganizing some of the methods to make it easier to find stuff in the definition file --- fabricjs/fabricjs.d.ts | 3930 +++++++++++++++++++++++++++++++--------- 1 file changed, 3039 insertions(+), 891 deletions(-) diff --git a/fabricjs/fabricjs.d.ts b/fabricjs/fabricjs.d.ts index f764d4768..2a13cac4e 100644 --- a/fabricjs/fabricjs.d.ts +++ b/fabricjs/fabricjs.d.ts @@ -5,895 +5,3043 @@ declare module fabric { - function createCanvasForNode(width: number, height: number): ICanvas; - function getCSSRules(doc: SVGElement); - function getGradientDefs(doc: SVGElement); - function loadSVGFromString(text: string, callback: (results: IObject[], options) => void , reviver?: (el, obj) => void ); - function loadSVGFromURL(url, callback: (results: IObject[], options) => void , reviver?: (el, obj) => void ); - function log(values); - function parseAttributes(element, attributes: any[]): any; - function parseElements(elements: any[], callback, options, reviver); - function parsePointsAttribute(points: string): any[]; - function parseStyleAttribute(element: SVGElement); - function parseSVGDocument(doc: SVGElement, callback: (results, options) => void , reviver?: (el, obj) => void ); - function parseTransformAttribute(attributeValue: string); - function warn(values); - - var isLikelyNode: boolean; - var isTouchSupported: boolean; - - export interface IObservable { - observe(eventCollection: IEventList); - on(eventCollection: IEventList); - - observe(eventName: string, handler: (e) => any); - on(eventName: string, handler: (e) => any); - - fire(eventName: string, options); - stopObserving(eventName: string, handler: (e) => any); - - off(eventName, handler); - } - - export interface IFilter { - new (): IFilter; - new (options: any): IFilter; - } - - export interface IEventList { - [index: string]: (e: Event) => void; - } - - export interface IObjectOptions { - angle?: number; - borderColor?: string; - borderOpacityWhenMoving?: number; - borderScaleFactor?: number; - cornerColor?: string; - cornersize?: number; - fill?: string; - fillRule?: string; - flipX?: boolean; - flipY?: boolean; - hasBorders?: boolean; - hasControls?: boolean; - hasRotatingPoint?: boolean; - height?: number; - includeDefaultValues?: boolean; - left?: number; - lockMovementX?: boolean; - lockMovementY?: boolean; - lockScalingX?: boolean; - lockScalingY?: boolean; - lockUniScaling?: boolean; - lockRotation?: boolean; - opacity?: number; - originX?: string; - originY?: string; - overlayFill?: string; - padding?: number; - perPixelTargetFind?: boolean; - rotatingPointOffset?: number; - scaleX?: number; - scaleY?: number; - selectable?: boolean; - stateProperties?: any[]; - stroke?: string; - strokeDashArray?: any[]; - strokeWidth?: number; - top?: number; - transformMatrix?: any[]; - transparentCorners?: boolean; - type?: string; - width?: number; - } - - export interface ITextOptions extends IObjectOptions { - fontSize?: number; - fontWeight?: any; - fontFamily?: string; - textDecoration?: string; - textShadow?: string; - textAlign?: string; - fontStyle?: string; - lineHeight?: number; - strokeStyle?: string; - strokeWidth?: number; - backgroundColor?: string; - textBackgroundColor?: string; - path?: string; - type?: string; - useNative?: Boolean; - } - - export interface ICircleOptions extends IObjectOptions { - radius?: number; - } - - export interface IPoint { - add(that: IPoint): IPoint; - addEquals(that: IPoint): IPoint; - distanceFrom(that: IPoint); - divide(scalar: number); - divideEquals(scalar: number); - eq(that: IPoint); - gt(that: IPoint); - gte(that: IPoint); - init(x, y); - lerp(that: IPoint, t); - lt(that: IPoint); - lte(that: IPoint); - max(that: IPoint); - min(that: IPoint); - multiply(scalar); - multiplyEquals(scalar); - scalarAdd(scalar): IPoint; - scalarAddEquals(scalar: number, thisArg: IPoint); - scalarSubtract(scalar: number); - scalarSubtractEquals(scalar); - setFromPoint(that: IPoint); - setXY(x, y); - subtract(that: IPoint): IPoint; - subtractEquals(that: IPoint): IPoint; - swap(that: IPoint); - tostring(): string; - } - - export interface IRect extends IObject { - x: number; - y: number; - rx: number; - ry: number; - - complexity(): number; - initialize(options: any); - initialize(points: number[], options: any): IRect; - toObject(propertiesToInclude: any[]): any; - toSVG(): string; - } - - export interface IText extends IObject { - fontSize: number; - fontWeight: any; - fontFamily: string; - text: string; - textDecoration: string; - textShadow?: string; - textAlign: string; - fontStyle: string; - lineHeight: number; - strokeStyle: string; - strokeWidth: number; - backgroundColor: string; - textBackgroundColor: string; - path?: string; - type: string; - useNative: Boolean; - - initialize(options: any); - initialize(text: string, options: any): IText; - toString(): string; - render(ctx: CanvasRenderingContext2D, noTransform: boolean); - toObject(propertiesToInclude: any[]): IObject; - toSVG(): string; - setColor(value: string): IText; - setFontsize(value: number): IText; - getText(): string; - setText(value: string): IText; - } - - export interface ITriangle extends IObject { - complexity(): number; - initialize(options: any): ITriangle; - toSVG(): string; - } - - export interface IEllipse { - initialize(options: any): any; - toObject(propertiesToInclude: any[]): any; - toSVG(): string; - render(ctx: CanvasRenderingContext2D, noTransform: boolean); - complexity(): number; - } - - export interface IGradient { - initialize(options): any; - toObject(): any; - toLiveGradient(ctx: CanvasRenderingContext2D): any; - } - - export interface IColor { - getSource(): any[]; - setSource(source: any[]): any; - toRgb(): string; - toRgba(): string; - toHex(): string; - getAlpha(): number; - setAlpha(alpha: number): IColor; - toGrayscale(): IColor; - toBlackWhite(threshold): IColor; - overlayWith(otherColor: string): IColor; - overlayWith(otherColor: IColor): IColor; - } - - export interface IElement { - } - - export interface IObject extends IObservable { - - // constraint properties - lockMovementX: boolean; - lockMovementY: boolean; - lockScalingX: boolean; - lockScalingY: boolean; - lockScaling: boolean; - lockUniScaling: boolean; - lockRotation: boolean; - - getCurrentWidth(): number; - getCurrentHeight(): number; - - originX: string; - originY: string; - - angle: number; - getAngle(): number; - setAngle(value: number): IObject; - - borderColor: string; - getBorderColor(): string; - setBorderColor(value: string): IObject; - - borderOpacityWhenMoving: number; - borderScaleFactor: number; - getBorderScaleFactor(): number; - - cornerColor: string; - - cornersize: number; - getCornersize(): number; - setCornersize(value: number): IObject; - - fill: string; - getFill(): string; - setFill(value: string): IObject; - - fillRule: string; - getFillRule(): string; - setFillRule(value: string): IObject; - - flipX: boolean; - getFlipX(): boolean; - setFlipX(value: boolean): IObject; - - flipY: boolean; - getFlipY(): boolean; - setFlipY(value: boolean): IObject; - - hasBorders: boolean; - - hasControls: boolean; - hasRotatingPoint: boolean; - - height: number; - getHeight(): number; - setHeight(value: number): IObject; - - includeDefaultValues: boolean; - - left: number; - getLeft(): number; - setLeft(value: number): IObject; - - opacity: number; - getOpacity(): number; - setOpacity(value: number): IObject; - - overlayFill: string; - getOverlayFill(): string; - setOverlayFill(value: string): IObject; - - padding: number; - perPixelTargetFind: boolean; - rotatingPointOffset: number; - - scaleX: number; - getScaleX(): number; - setScaleX(value: number): IObject; - - scaleY: number; - getScaleY(): number; - setScaleY(value: number): IObject; - - selectable: boolean; - stateProperties: any[]; - stroke: string; - strokeDashArray: any[]; - strokeWidth: number; - - top: number; - getTop(): number; - setTop(value: number): IObject; - - transformMatrix: any[]; - transparentCorners: boolean; - type: string; - - width: number; - getWidth(): number; - setWidth(value: number): IObject; - - // methods - bringForward(intersecting?: boolean): IObject; - bringToFront(): IObject; - center(): IObject; - centerH(): IObject; - centerV(): IObject; - clone(callback?, propertiesToInclude?): IObject; - cloneAsImage(callback): IObject; - complexity(): number; - drawBorders(context: CanvasRenderingContext2D): IObject; - drawCorners(context: CanvasRenderingContext2D): IObject; - get (property: string): any; - getBoundingRect(): {left:number; top:number; width:number; height:number}; - getBoundingRectHeight(): number; - getBoundingRectWidth(): number; - getSvgStyles(): string; - getSvgTransform(): string; - hasStateChanged(): boolean; - initialize(options: any); - intersectsWithObject(other: IObject): boolean; - intersectsWithRect(selectionTL: any, selectionBR: any): boolean; - isActive(): boolean; - isContainedWithinObject(other: IObject): boolean; - isContainedWithinRect(selectionTL: any, selectionBR: any): boolean; - isType(type: string): boolean; - remove(): IObject; - render(ctx: CanvasRenderingContext2D, noTransform: boolean); - rotate(value: number): IObject; - saveState(): IObject; - scale(value: number): IObject; - scaleToHeight(value: number): IObject; - scaleToWidth(value: number): IObject; - sendBackwards(intersecting?: boolean): IObject; - sendToBack(): IObject; - - set (properties: IObjectOptions): IObject; - set (name: string, value: any): IObject; - setActive(active: boolean): IObject; - setCoords(); - setGradientFill(options); - setOptions(options: any); - setSourcePath(value: string): IObject; - toDatalessObject(propertiesToInclude): any; - toDataURL(callback): string; - toggle(property): IObject; - toGrayscale(): IObject; - toJSON(propertiesToInclude): string; - toObject(propertiesToInclude): any; - tostring(): string; - transform(ctx: CanvasRenderingContext2D); - } - - export interface IGroup extends IObject { - type: string; - - activateAllObjects(): IGroup; - add(object): IGroup; - addWithUpdate(object): IGroup; - complexity(): number; - contains(object): boolean; - containsPoint(point): boolean; - destroy(): IGroup; - getObjects(): IObject[]; - hasMoved(): boolean; - initialize(options: any); - initialize(objects, options): any; - item(index): IObject; - remove(object?): IGroup; - removeWithUpdate(object): IGroup; - render(ctx, noTransform): void; - saveCoords(): IGroup; - setObjectsCoords(): IGroup; - size(): number; - toGrayscale(): IGroup; - toObject(propertiesToInclude: any[]): any; - tostring(): string; - toSVG(): string; - } - - - export interface ILine extends IObject { - x1: number; - x2: number; - y1: number; - y2: number; - - complexity(): number; - initialize(options: any); - initialize(points: number[], options: any): ILine; - toObject(propertiesToInclude: any[]): any; - toSVG(): string; - } - - export interface IIntersection { - appendPoint(status: string); - appendPoints(status: string); - init(status: string); - } - - export interface IImage extends IObject { - filters: any; - - applyFilters(callback); - clone(callback?, propertiesToInclude?): IObject; - clone(propertiesToInclude, callback); - complexity(): number; - getElement(): HTMLImageElement; - getOriginalSize(): { width: number; height: number; }; - getSrc(): string; - initialize(options: any); - initialize(element: string, options: any); - initialize(element: HTMLImageElement, options: any); - render(ctx: CanvasRenderingContext2D, noTransform: boolean); - setElement(element): IImage; - toObject(propertiesToInclude): any; - tostring(): string; - toSVG(): string; - } - - export interface ICircle extends IObject { - // methods - complexity(): number; - getRadiusX(): number; - getRadiusY(): number; - initialize(options: ICircleOptions): ICircle; - setRadius(value: number): number; - toObject(propertiesToInclude): any; - toSVG(): string; - } - - - - export interface IPath extends IObject { - complexity(): number; - initialize(options: any); - initialize(path, options); - render(ctx: CanvasRenderingContext2D, noTransform: boolean); - toDatalessObject(propertiesToInclude): any; - toObject(propertiesToInclude): any; - tostring(): string; - toSVG(): string; - } - - export interface IPolygon extends IObject { - complexity(): number; - initialize(options: any); - initialize(points, options); - toObject(propertiesToInclude): any; - toSVG(): string; - } - - export interface IPolyline extends IObject { - complexity(): number; - initialize(options: any); - initialize(points, options); - toObject(propertiesToInclude): any; - toSVG(): string; - } - - export interface IPathGroup extends IObject { - complexity(): number; - initialize(options: any); - initialize(paths, options); - isSameColor(): boolean; - render(ctx: CanvasRenderingContext2D); - toDatalessObject(propertiesToInclude): any; - toGrayscale(): IPathGroup; - toObject(propertiesToInclude): any; - tostring(): string; - toSVG(): string; - } - - export interface IStaticCanvas extends IObservable { - - // fields - backgroundColor: string; - backgroundImage: string; - backgroundImageOpacity: number; - backgroundImageStretch: number; - clipTo(clipFunction: (context: CanvasRenderingContext2D) => void ); - controlsAboveOverlay: boolean; - includeDefaultValues: boolean; - overlayImage: string; - overlayImageLeft: number; - overlayImageTop: number; - renderOnAddition: boolean; - stateful: boolean; - - // static - EMPTY_JSON: string; - supports(methodName: string): boolean; - - // methods - add(...object: IObject[]): ICanvas; - bringForward(object: IObject): ICanvas; - calcOffset(): ICanvas; - centerObject(object: IObject): ICanvas; - centerObjectH(object: IObject): ICanvas; - centerObjectV(object: IObject): ICanvas; - clear(): ICanvas; - clearContext(context: CanvasRenderingContext2D): ICanvas; - complexity(): number; - dispose(): ICanvas; - drawControls(); - forEachObject(callback: (object: IObject) => void , context?: CanvasRenderingContext2D): ICanvas; - getActiveGroup(): IGroup; - getActiveObject(): IObject; - getCenter(): IObject; - getContext(): CanvasRenderingContext2D; - getElement(): HTMLCanvasElement; - getHeight(): number; - getObjects(): IObject[]; - getWidth(): number; - insertAt(object: IObject, index: number, nonSplicing: boolean): ICanvas; - isEmpty(): boolean; - item(index: number): IObject; - onBeforeScaleRotate(target: IObject); - remove(object: IObject): IObject; - renderAll(allOnTop?: boolean): ICanvas; - renderTop(): ICanvas; - - sendBackwards(object: IObject): ICanvas; - sendToBack(object: IObject): ICanvas; - setBackgroundImage(image: any, callback: () => any, options?): ICanvas; - setDimensions(object: { width: number; height: number; }): ICanvas; - setHeight(height: number): ICanvas; - setOverlayImage(url: string, callback: () => any, options): ICanvas; - setWidth(width: number): ICanvas; - toDatalessJSON(propertiesToInclude?: any[]): string; - toDatalessObject(propertiesToInclude?: any[]): string; - toDataURL(format: string, quality?: number): string; - toDataURLWithMultiplier(propertiesToInclude: any[]): string; - toGrayscale(propertiesToInclude: any[]): string; - toJSON(propertiesToInclude: any[]): string; - toObject(propertiesToInclude: any[]): string; - tostring(): string; - toSVG(): string; - } - - export interface ICanvas extends IStaticCanvas { - - // constructors - (element: HTMLCanvasElement): ICanvas; - (element: string): ICanvas; - - _objects: IObject[]; - - // fields - containerClass: string; - defaultCursor: string; - freeDrawingColor: string; - freeDrawingLineWidth: number; - hoverCursor: string; - interactive: boolean; - moveCursor: string; - perPixelTargetFind: boolean; - rotationCursor: string; - selection: boolean; - selectionBorderColor: string; - selectionColor: string; - selectionDashArray: number[]; - selectionLineWidth: number; - targetFindTolerance: number; - - // methods - containsPoint(e: Event, target: IObject): boolean; - deactivateAll(): ICanvas; - deactivateAllWithDispatch(): ICanvas; - discardActiveGroup(): ICanvas; - discardActiveObject(): ICanvas; - drawDashedLine(ctx: CanvasRenderingContext2D, x: number, y: number, x2: number, y2: number, dashArray: number[]): ICanvas; - findTarget(e: MouseEvent, skipGroup: boolean): ICanvas; - getActiveGroup(): IGroup; - getActiveObject(): IObject; - getPointer(e): { x: number; y: number; }; - getSelectionContext(): CanvasRenderingContext2D; - getSelectionElement(): HTMLCanvasElement; - setActiveGroup(group: IGroup): ICanvas; - setActiveObject(object: IObject, e?): ICanvas; - - loadFromJSON(json, callback: () => void): void; - loadFromDatalessJSON(json, callback: () => void): void; - } - - export interface IPattern { - (options: IPatternOptions): IPattern; - - initialise(options: IPatternOptions): IPattern; - - toLive(ctx: CanvasRenderingContext2D): IPattern; - toObject(): any; - toSVG(): string; - - offsetX: number; - offsetY: number; - repeat: string; - source: any; - } - - export interface IBrightnessFilter { - } - export interface IInvertFilter { - } - export interface IRemoveWhiteFilter { - } - export interface IGrayscaleFilter { - } - export interface ISepiaFilter { - } - export interface ISepia2Filter { - } - export interface INoiseFilter { - } - export interface IGradientTransparencyFilter { - } - export interface IPixelateFilter { - } - export interface IConvoluteFilter { - } - - export interface ICanvasOptions { - containerClass?: string; - defaultCursor?: string; - freeDrawingColor?: string; - freeDrawingLineWidth?: number; - hoverCursor?: string; - interactive?: boolean; - moveCursor?: string; - perPixelTargetFind?: boolean; - rotationCursor?: string; - selection?: boolean; - selectionBorderColor?: string; - selectionColor?: string; - selectionDashArray?: number[]; - selectionLineWidth?: number; - targetFindTolerance?: number; - - backgroundColor?: string; - backgroundImage?: string; - backgroundImageOpacity?: number; - backgroundImageStretch?: number; - controlsAboveOverlay?: boolean; - includeDefaultValues?: boolean; - overlayImage?: string; - overlayImageLeft?: number; - overlayImageTop?: number; - renderOnAddition?: boolean; - stateful?: boolean; - } - - export interface IPatternOptions { - source: any; - offsetX: number; - offsetY: number; - repeat: string; - } - - export interface IRectOptions extends IObjectOptions { - x?: number; - y?: number; - rx?: number; - ry?: number; - } - - export interface ITriangleOptions extends IObjectOptions { - } - - var Rect: { - fromElement(element: SVGElement, options: IRectOptions): IRect; - fromObject(object): IRect; - new (options?: IRectOptions): IRect; - prototype: any; - } - - var Triangle: { - new (options?: ITriangleOptions): ITriangle; - } - - var Canvas: { - new (element: HTMLCanvasElement, options?: ICanvasOptions): ICanvas; - new (element: string, options?: ICanvasOptions): ICanvas; - - EMPTY_JSON: string; - supports(methodName: string): boolean; - prototype: any; - } - - var StaticCanvas: { - new (element: HTMLCanvasElement, options?: ICanvasOptions): ICanvas; - new (element: string, options?: ICanvasOptions): ICanvas; - - EMPTY_JSON: string; - supports(methodName: string): boolean; - prototype: any; - } - - var Pattern: { - new (options: IPatternOptions): IPattern; - - prototype: any; - } - - var Circle: { - ATTRIBUTE_NAMES: string[]; - fromElement(element: SVGElement, options: ICircleOptions): ICircle; - fromObject(object): ICircle; - new (options?: ICircleOptions): ICircle; - prototype: any; - } - - var Group: { - new (items?: any[], options?: IObjectOptions): IGroup; - } - - var Line: { - ATTRIBUTE_NAMES: string[]; - fromElement(element: SVGElement, options): ILine; - fromObject(object): ILine; - prototype: any; - new (points: number[], objObjects?: IObjectOptions): ILine; - } - - var Intersection: { - intersectLineLine(a1, a2, b1, b2); - intersectLinePolygon(a1, a2, points); - intersectPolygonPolygon(points1, points2); - intersectPolygonRectangle(points, r1, r2); - } - - var Path: { - fromElement(element: SVGElement, options): IPath; - fromObject(object): IPath; - new (): IPath; - } - - var PathGroup: { - fromObject(object): IPathGroup; - new (): IPathGroup; - prototype: any; - } - - var Point: { - new (x, y): IPoint; - prototype: any; - } - - var Object: { - prototype: any; - } - - var Polygon: { - fromObject(object): IPolygon; - fromElement(element: SVGElement, options): IPolygon; - new (): IPolygon; - prototype: any; - } - - var Polyline: { - fromObject(object): IPolyline; - fromElement(element: SVGElement, options): IPolyline; - new (): IPolyline; - prototype: any; - } - - var Text: { - new (text: string, options?: ITextOptions): IText; - } - - var Image: { - fromURL(url: string): IImage; - fromURL(url: string, callback: (image: IImage) => any): IImage; - fromURL(url: string, callback: (image: IImage) => any, objObjects: IObjectOptions): IImage; - new (element: HTMLImageElement, objObjects: IObjectOptions): IImage; - prototype: any; - - filters: - { - Grayscale: { - new (): IGrayscaleFilter; - }; - Brightness: { - new (options?: { brightness: number; }): IBrightnessFilter; - }; - RemoveWhite: { - new (options?: { - threshold?: string; // TODO: Check this - distance?: string; // TODO: Check this - }): IRemoveWhiteFilter; - }; - Invert: { - new (): IInvertFilter; - }; - Sepia: { - new (): ISepiaFilter; - }; - Sepia2: { - new (): ISepia2Filter; - }; - Noise: { - new (options?: { - noise?: number; - }): INoiseFilter; - }; - GradientTransparency: { - new (options?: { - threshold?: number; - }): IGradientTransparencyFilter; - }; - Pixelate: { - new (options?: { - color?: any; - }): IPixelateFilter; - }; - Convolute: { - new (options?: { - matrix: any; - }): IConvoluteFilter; - }; - }; - - } - - var util: { - addClass(element: HTMLElement, className: string); - addListener(element, eventName: string, handler); - animate(options: { - onChange?: (value: number) => void; - onComplete?: () => void; - startValue?: number; - endValue?: number; - byValue?: number; - easing?: (currentTime, startValue, byValue, duration) => number; - duration?: number; - }); - createClass(parent, properties); - degreesToRadians(degrees: number): number; - falseFunction(): () => boolean; - getById(id: HTMLElement): HTMLElement; - getById(id: string): HTMLElement; - getElementOffset(element): { left: number; top: number; }; - getPointer(event: Event); - getRandomInt(min: number, max: number); - getScript(url: string, callback); - groupSVGElements(elements: any[], options, path?: string); - loadImage(url, callback, context); - makeElement(tagName: string, attributes); - makeElementSelectable(element: HTMLElement); - makeElementUnselectable(element: HTMLElement); - populateWithProperties(source, destination, properties): any[]; - radiansToDegrees(radians: number): number; - removeFromArray(array: any[], value); - removeListener(element: HTMLElement, eventName, handler); - request(url, options); - requestAnimFrame(callback, element); - setStyle(element: HTMLElement, styles); - toArray(arrayLike): any[]; - toFixed(number, fractionDigits); - wrapElement(element: HTMLElement, wrapper, attributes); - rotatePoint(point: IPoint, origin: IPoint, radians: number); - transformPoint(p: IPoint, t: any[], ignoreOffset: boolean); - invertTransform(t: any[]); - parseUnit(value: number|string, fontSize?: number); - getKlass(type: string, namespace: string); - resolveNamespace(namespace: string); - enlivenObjects(objects: any[], callback: Function, namespace: string, reviver: Function); - drawDashedLine(ctx: CanvasRenderingContext2D, x: number, y: number, x2: number, y2: number, da: any[]); - createCanvasElement(canvasEl?: HTMLElement); - createImage(); - createAccessors(klass: Object); - clipContext(receiver: IObject, ctx: CanvasRenderingContext2D); - isTransparent(ctx: CanvasRenderingContext2D, x: number, y: number, tolerance: number); - - } + function createCanvasForNode(width: number, height: number): ICanvas; + function getCSSRules(doc: SVGElement); + function getGradientDefs(doc: SVGElement); + function loadSVGFromString(text: string, callback: (results: IObject[], options) => void, reviver?: (el, obj) => void); + function loadSVGFromURL(url, callback: (results: IObject[], options) => void, reviver?: (el, obj) => void); + + /** + * Wrapper around `console.log` (when available) + */ + function log(values); + function parseAttributes(element, attributes: any[]): any; + function parseElements(elements: any[], callback, options, reviver); + function parsePointsAttribute(points: string): any[]; + function parseStyleAttribute(element: SVGElement); + function parseSVGDocument(doc: SVGElement, callback: (results, options) => void, reviver?: (el, obj) => void); + function parseTransformAttribute(attributeValue: string); + /** + * Wrapper around `console.warn` (when available) + */ + function warn(values); + + var isLikelyNode: boolean; + var isTouchSupported: boolean; + + /////////////////////////////////////////////////////////////////////////////// + // Data Object Interfaces - These intrface are not specific part of fabric, + // They are just helpful for for defining function paramters + ////////////////////////////////////////////////////////////////////////////// + export interface IDataURLOptions { + /** + * The format of the output image. Either "jpeg" or "png" + */ + format?: string; + /** + * Quality level (0..1). Only used for jpeg + */ + quality?: number; + /** + * Multiplier to scale by + */ + multiplier?: number; + /** + * Cropping left offset. Introduced in v1.2.14 + */ + left?: number; + /** + * Cropping top offset. Introduced in v1.2.14 + */ + top?: number; + /** + * Cropping width. Introduced in v1.2.14 + */ + width?: number; + /** + * Cropping height. Introduced in v1.2.14 + */ + height?: number; + } + + export interface IEvent { + e: Event; + target?: fabric.IObject; + } + + export interface IFillOptions { + /** + * options.source Pattern source + */ + source: string|HTMLImageElement; + /** + * Repeat property of a pattern (one of repeat, repeat-x, repeat-y or no-repeat) + */ + repeat?: string; + /** + * Pattern horizontal offset from object's left/top corner + */ + offsetX?: number; + /** + * Pattern vertical offset from object's left/top corner + */ + offsetY?: number; + } + + export interface IGradientOptions { + /** + * @param {String} [options.type] Type of gradient 'radial' or 'linear' + */ + type?: string; + /** + * x-coordinate of start point + */ + x1?: number; + /** + * y-coordinate of start point + */ + y1?: number; + /** + * x-coordinate of end point + */ + x2?: number; + /** + * y-coordinate of end point + */ + y2?: number; + /** + * Radius of start point (only for radial gradients) + */ + r1?: number; + /** + * Radius of end point (only for radial gradients) + */ + r2?: number; + /** + * Color stops object eg. {0:string; 1:string; + */ + colorStops?: any; + } + + export interface IToSVGOptions { + /** + * If true xml tag is not included + */ + suppressPreamble: boolean; + /** + * SVG viewbox object + */ + viewBox: IViewBox; + /** + * Encoding of SVG output + */ + encoding: string; + } + + export interface IViewBox { + /** + * x-cooridnate of viewbox + */ + x: number; + /** + * y-coordinate of viewbox + */ + y: number; + /** + * Width of viewbox + */ + width: number; + /**Height of viewbox */ + height: number; + } + + export interface IFilter { + new (): IFilter; + new (options: any): IFilter; + } + + export interface IEventList { + [index: string]: (e: Event) => void; + } + + export interface IAnimationOptions { + /** + * Allows to specify starting value of animatable property (if we don't want current value to be used). + */ + from?: string|number; + /** + * Defaults to 500 (ms). Can be used to change duration of an animation. + */ + duration?: number; + /** + * Callback that's invoked during the animation. + */ + onChange?: Function; + /** + * Callback that's invoked at the end of the animation. + */ + onComplete?: Function + /** + * Easing function. Default: fabric.util.ease.easeInSine + */ + easing?: Function; + } + + /////////////////////////////////////////////////////////////////////////////// + // Mixins Interfaces + ////////////////////////////////////////////////////////////////////////////// + export interface ICollection { + /** + * Adds objects to collection, then renders canvas (if `renderOnAddRemove` is not `false`) + * Objects should be instances of (or inherit from) fabric.Object + * @param {...fabric.Object} object Zero or more fabric instances + */ + add(...object: IObject[]): T; + + /** + * Inserts an object into collection at specified index, then renders canvas (if `renderOnAddRemove` is not `false`) + * An object should be an instance of (or inherit from) fabric.Object + * @param {Object} object Object to insert + * @param {Number} index Index to insert object at + * @param {Boolean} nonSplicing When `true`, no splicing (shifting) of objects occurs + * @return {Self} thisArg + * @chainable + */ + insertAt(object: IObject, index: number, nonSplicing: boolean): T; + + /** + * Removes objects from a collection, then renders canvas (if `renderOnAddRemove` is not `false`) + * @param {...fabric.Object} object Zero or more fabric instances + * @return {Self} thisArg + * @chainable + */ + remove(...object: IObject[]): T; + + /** + * Executes given function for each object in this group + * @param {Function} callback + * @param {Object} context Context (aka thisObject) + * @return {Self} thisArg + */ + forEachObject(callback: (element: IObject, index: number, array: IObject[]) => any, context?: any): T; + + /** + * Returns an array of children objects of this instance + * Type parameter introduced in 1.3.10 + * @param {String} [type] When specified, only objects of this type are returned + * @return {Array} + */ + getObjects(type?: string): IObject[]; + + + /** + * Returns object at specified index + * @param {Number} index + * @return {Self} thisArg + */ + item(index: number): T; + + /** + * Returns true if collection contains no objects + * @return {Boolean} true if collection is empty + */ + isEmpty(): boolean; + + /** + * Returns a size of a collection (i.e: length of an array containing its objects) + * @return {Number} Collection size + */ + size(): number; + + /** + * Returns true if collection contains an object + * @param {Object} object Object to check against + * @return {Boolean} `true` if collection contains an object + */ + contains(object: IObject): boolean; + + /** + * Returns number representation of a collection complexity + * @return {Number} complexity + */ + complexity(): number; + } + + export interface IObservable { + /** + * Observes specified event + * @deprecated `observe` deprecated since 0.8.34 (use `on` instead) + * @param {String|Object} eventName Event name (eg. 'after:render') or object with key/value pairs (eg. {'after:render': handler, 'selection:cleared': handler}) + * @param {Function} handler Function that receives a notification when an event of the specified type occurs + */ + on(eventName: string|any, handler: (e: IEvent) => any): T; + /** + * Fires event with an optional options object + * @deprecated `fire` deprecated since 1.0.7 (use `trigger` instead) + * @param {String} eventName Event name to fire + * @param {Object} [options] Options object + */ + trigger(eventName: string, options?: any): T; + /** + * Stops event observing for a particular event handler. Calling this method + * without arguments removes all handlers for all events + * @deprecated `stopObserving` deprecated since 0.8.34 (use `off` instead) + * @param {String|Object} eventName Event name (eg. 'after:render') or object with key/value pairs (eg. {'after:render': handler, 'selection:cleared': handler}) + * @param {Function} handler Function to be deleted from EventListeners + */ + off(eventName: string|any, handler: (e) => any): T; + } + + + + /////////////////////////////////////////////////////////////////////////////// + // General Fabric Interfaces + ////////////////////////////////////////////////////////////////////////////// + export interface IColor { + /** + * Returns source of this color (where source is an array representation; ex: [200, 200, 100, 1]) + */ + getSource(): number[]; + + /** + * Sets source of this color (where source is an array representation; ex: [200, 200, 100, 1]) + */ + setSource(source: number[]); + + /** + * Returns color represenation in RGB format ex: rgb(0-255,0-255,0-255) + */ + toRgb(): string; + + /** + * Returns color represenation in RGBA format ex: rgba(0-255,0-255,0-255,0-1) + */ + toRgba(): string; + + /** + * Returns color represenation in HSL format ex: hsl(0-360,0%-100%,0%-100%) + */ + toHsl(): string; + + /** + * Returns color represenation in HSLA format ex: hsla(0-360,0%-100%,0%-100%,0-1) + */ + toHsla(): string; + + /** + * Returns color represenation in HEX format ex: FF5555 + */ + toHex(): string; + + /** + * Gets value of alpha channel for this color + */ + getAlpha(): number; + + /** + * Sets value of alpha channel for this color + * @param {Number} alpha Alpha value 0-1 + */ + setAlpha(alpha: number); + + /** + * Transforms color to its grayscale representation + */ + toGrayscale(): IColor; + + /** + * Transforms color to its black and white representation + * @param {Number} threshold + */ + toBlackWhite(threshold: number): IColor; + /** + * Overlays color with another color + * @param {String|fabric.Color} otherColor + */ + overlayWith(otherColor: string|IColor): IColor; + } + + export interface IGradient { + initialize(options): any; + toObject(): any; + toLiveGradient(ctx: CanvasRenderingContext2D): any; + } + + export interface IIntersection { + /** + * Appends a point to intersection + */ + appendPoint(point: fabric.IPoint); + /** + * Appends points to intersection + */ + appendPoints(point: fabric.IPoint); + + init(status?: string); + /** + * Checks if polygon intersects another polygon + */ + intersectPolygonPolygon(points1: IPoint[], points2: IPoint[]): IIntersection; + /** + * Checks if line intersects polygon + */ + intersectLinePolygon(a1: IPoint, a2: IPoint, points: IPoint[]): IIntersection + /** + * Checks if one line intersects another + */ + intersectLineLine(a1: IPoint, a2: IPoint, b1: IPoint, b2: IPoint): IIntersection + /** + * Checks if polygon intersects rectangle + */ + intersectPolygonRectangle(points: IPoint[], r1: number, r2: number): IIntersection; + } + + export interface IPoint { + x: number; + y: number; + /** + * Adds another point to this one and returns another one + * @param {fabric.Point} that + * @return {fabric.Point} new Point instance with added values + */ + add(that: IPoint): IPoint; + + /** + * Adds another point to this one + * @param {fabric.Point} that + * @return {fabric.Point} thisArg + */ + addEquals(that: IPoint): IPoint; + + /** + * Adds value to this point and returns a new one + * @param {Number} scalar + * @return {fabric.Point} new Point with added value + */ + scalarAdd(scalar: number): IPoint; + + /** + * Adds value to this point + * @param {Number} scalar + * @return {fabric.Point} thisArg + */ + scalarAddEquals(scalar: number): IPoint; + + /** + * Subtracts another point from this point and returns a new one + * @param {fabric.Point} that + * @return {fabric.Point} new Point object with subtracted values + */ + subtract(that: IPoint): IPoint + + /** + * Subtracts another point from this point + * @param {fabric.Point} that + * @return {fabric.Point} thisArg + */ + subtractEquals(that): IPoint; + + /** + * Subtracts value from this point and returns a new one + * @param {Number} scalar + * @return {fabric.Point} + */ + scalarSubtract(scalar: number): IPoint; + + /** + * Subtracts value from this point + * @param {Number} scalar + * @return {fabric.Point} thisArg + */ + scalarSubtractEquals(scalar: number): IPoint; + + /** + * Miltiplies this point by a value and returns a new one + * @param {Number} scalar + * @return {fabric.Point} + */ + multiply(scalar: number): IPoint; + + /** + * Miltiplies this point by a value + * @param {Number} scalar + * @return {fabric.Point} thisArg + */ + multiplyEquals(scalar): IPoint; + + /** + * Divides this point by a value and returns a new one + * @param {Number} scalar + * @return {fabric.Point} + */ + divide(scalar): IPoint; + + /** + * Divides this point by a value + * @param {Number} scalar + * @return {fabric.Point} thisArg + */ + divideEquals(scalar: number): IPoint; + + /** + * Returns true if this point is equal to another one + * @param {fabric.Point} that + * @return {Boolean} + */ + eq(that: IPoint): IPoint; + + /** + * Returns true if this point is less than another one + * @param {fabric.Point} that + * @return {Boolean} + */ + lt(that: IPoint): IPoint; + + /** + * Returns true if this point is less than or equal to another one + * @param {fabric.Point} that + * @return {Boolean} + */ + lte(that: IPoint): IPoint; + + /** + * Returns true if this point is greater another one + * @param {fabric.Point} that + * @return {Boolean} + */ + gt(that: IPoint): IPoint; + + /** + * Returns true if this point is greater than or equal to another one + * @param {fabric.Point} that + * @return {Boolean} + */ + gte(that: IPoint): IPoint; + + /** + * Returns new point which is the result of linear interpolation with this one and another one + * @param {fabric.Point} that + * @param {Number} t + * @return {fabric.Point} + */ + lerp(that, t: number): IPoint; + + /** + * Returns distance from this point and another one + * @param {fabric.Point} that + * @return {Number} + */ + distanceFrom(that: IPoint): number; + + /** + * Returns the point between this point and another one + * @param {fabric.Point} that + * @return {fabric.Point} + */ + midPointFrom(that: IPoint): IPoint; + + /** + * Returns a new point which is the min of this and another one + * @param {fabric.Point} that + * @return {fabric.Point} + */ + min(that: IPoint): IPoint; + + /** + * Returns a new point which is the max of this and another one + * @param {fabric.Point} that + * @return {fabric.Point} + */ + max(that: IPoint): IPoint; + + /** + * Returns string representation of this point + * @return {String} + */ + toString(): string; + + /** + * Sets x/y of this point + * @param {Number} x + * @param {Number} y + */ + setXY(x, y: IPoint): IPoint; + + /** + * Sets x/y of this point from another point + * @param {fabric.Point} that + */ + setFromPoint(that: IPoint): IPoint; + + /** + * Swaps x/y of this point and another point + * @param {fabric.Point} that + */ + swap(that: IPoint): IPoint; + } + + export interface IShadowOptions { + /** + * Whether the shadow should affect stroke operations + */ + affectStrike: boolean; + /** + * Shadow blur + */ + blur: number; + /** + * Shadow color + */ + color: string; + /** + * Indicates whether toObject should include default values + */ + includeDefaultValues: boolean; + /** + * Shadow horizontal offset + */ + offsetX: number; + /** + * Shadow vertical offset + */ + offsetY: number; + } + export interface IShadow extends IShadowOptions { + initialize(options?: IShadowOptions|string): IShadow; + /** + * Returns object representation of a shadow + */ + toObject(): IObject; + /** + * Returns a string representation of an instance, CSS3 text-shadow declaration + */ + toString(): string; + /** + * Returns SVG representation of a shadow + * @param {fabric.Object} object + */ + toSVG(object: IObject): string; + + /** + * Regex matching shadow offsetX, offsetY and blur, Static + */ + reOffsetsAndBlur: RegExp + } + + /////////////////////////////////////////////////////////////////////////////// + // Canvas Interfaces + ////////////////////////////////////////////////////////////////////////////// + export interface ICanvasDimensions { + /** + * Width of canvas element + */ + width: number; + /** + * Height of canvas element + */ + height: number; + } + + export interface ICanvasDimensionsOptions { + /** + * Set the given dimensions only as canvas backstore dimensions + */ + backstoreOnly?: boolean; + /** + * Set the given dimensions only as css dimensions + */ + cssOnly?: boolean; + } + + export interface IStaticCanvas extends IObservable, IStaticCanvasOptions, ICollection { + /** + * Calculates canvas element offset relative to the document + * This method is also attached as "resize" event handler of window + */ + calcOffset(): IStaticCanvas; + + /** + * Sets {@link fabric.StaticCanvas#overlayImage|overlay image} for this canvas + * @param {(fabric.Image|String)} image fabric.Image instance or URL of an image to set overlay to + * @param {Function} callback callback to invoke when image is loaded and set as an overlay + * @param {Object} [options] Optional options to set for the {@link fabric.Image|overlay image}. + */ + setOverlayImage(image: IImage | string, callback: Function, options?: IObjectOptions): IStaticCanvas; + + /** + * Sets {@link fabric.StaticCanvas#backgroundImage|background image} for this canvas + * @param {(fabric.Image|String)} image fabric.Image instance or URL of an image to set background to + * @param {Function} callback Callback to invoke when image is loaded and set as background + * @param {Object} [options] Optional options to set for the {@link fabric.Image|background image}. + */ + setBackgroundImage(image: IImage|string, callback: Function, options?: IObjectOptions): IStaticCanvas; + + /** + * Sets {@link fabric.StaticCanvas#overlayColor|background color} for this canvas + * @param {(String|fabric.Pattern)} overlayColor Color or pattern to set background color to + * @param {Function} callback Callback to invoke when background color is set + */ + setOverlayColor(overlayColor: string|IPattern, callback: Function): IStaticCanvas; + + /** + * Sets {@link fabric.StaticCanvas#backgroundColor|background color} for this canvas + * @param {(String|fabric.Pattern)} backgroundColor Color or pattern to set background color to + * @param {Function} callback Callback to invoke when background color is set + */ + setBackgroundColor(backgroundColor: string|IPattern, callback: Function): IStaticCanvas; + + /** + * Returns canvas width (in px) + */ + getWidth(): number; + + /** + * Returns canvas height (in px) + */ + getHeight(): number; + + /** + * Sets width of this canvas instance + * @param {Number|String} value Value to set width to + * @param {Object} [options] Options object + */ + setWidth(value: number|string, options?: ICanvasDimensionsOptions): IStaticCanvas + + /** + * Sets height of this canvas instance + * @param {Number|String} value Value to set height to + * @param {Object} [options] Options object + */ + setHeight(value: number|string, options?: ICanvasDimensionsOptions): IStaticCanvas + + /** + * Sets dimensions (width, height) of this canvas instance. when options.cssOnly flag active you should also supply the unit of measure (px/%/em) + * @param {Object} dimensions Object with width/height properties + * @param {Object} [options] Options object + */ + setDimensions(dimensions: ICanvasDimensions, options?: ICanvasDimensionsOptions): IStaticCanvas; + + /** + * Returns canvas zoom level + */ + getZoom(): number; + + /** + * Sets viewport transform of this canvas instance + * @param {Array} vpt the transform in the form of context.transform + */ + setViewportTransform(vpt: number[]): IStaticCanvas; + + + /** + * Sets zoom level of this canvas instance, zoom centered around point + * @param {fabric.Point} point to zoom with respect to + * @param {Number} value to set zoom to, less than 1 zooms out + */ + zoomToPoint(point: IPoint, value: number): IStaticCanvas; + + /** + * Sets zoom level of this canvas instance + * @param {Number} value to set zoom to, less than 1 zooms out + */ + setZoom(value: number): IStaticCanvas; + + /** + * Pan viewport so as to place point at top left corner of canvas + * @param {fabric.Point} point to move to + */ + absolutePan(point: IPoint): IStaticCanvas; + + /** + * Pans viewpoint relatively + * @param {fabric.Point} point (position vector) to move by + */ + relativePan(point: IPoint): IStaticCanvas; + + /** + * Returns element corresponding to this instance + */ + getElement(): HTMLCanvasElement; + + /** + * Returns currently selected object, if any + */ + getActiveObject(): IObject; + + /** + * Returns currently selected group of object, if any + */ + getActiveGroup(): IGroup; + + /** + * Clears specified context of canvas element + * @param {CanvasRenderingContext2D} ctx Context to clear + * @chainable + */ + clearContext(ctx: CanvasRenderingContext2D): IStaticCanvas; + + /** + * Returns context of canvas where objects are drawn + */ + getContext(): CanvasRenderingContext2D; + + /** + * Clears all contexts (background, main, top) of an instance + */ + clear(): IStaticCanvas; + + /** + * Renders both the top canvas and the secondary container canvas. + * @param {Boolean} [allOnTop] Whether we want to force all images to be rendered on the top canvas + * @chainable + */ + renderAll(allOnTop?: boolean): IStaticCanvas; + + /** + * Method to render only the top canvas. + * Also used to render the group selection box. + * @chainable + */ + renderTop(): IStaticCanvas; + + /** + * Returns coordinates of a center of canvas. + * Returned value is an object with top and left properties + */ + getCenter(): { top: number; left: number; } + + /** + * Centers object horizontally. + * You might need to call `setCoords` on an object after centering, to update controls area. + * @param {fabric.Object} object Object to center horizontally + */ + centerObjectH(object: IObject): IStaticCanvas; + + /** + * Centers object vertically. + * You might need to call `setCoords` on an object after centering, to update controls area. + * @param {fabric.Object} object Object to center vertically + */ + centerObjectV(object: IObject): IStaticCanvas; + + /** + * Centers object vertically and horizontally. + * You might need to call `setCoords` on an object after centering, to update controls area. + * @param {fabric.Object} object Object to center vertically and horizontally + */ + centerObject(object: IObject): IStaticCanvas; + + /** + * Returs dataless JSON representation of canvas + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + */ + toDatalessJSON(propertiesToInclude?: any[]): string; + + /** + * Returns object representation of canvas + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + */ + toObject(propertiesToInclude?: any[]): any; + + /** + * Returns dataless object representation of canvas + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + */ + toDatalessObject(propertiesToInclude?: any[]): any; + + /** + * When true, getSvgTransform() will apply the StaticCanvas.viewportTransform to the SVG transformation. When true, + * a zoomed canvas will then produce zoomed SVG output. + */ + svgViewportTransformation: boolean; + + /** + * Returns SVG representation of canvas + * @param {Object} [options] Options object for SVG output + * @param {Function} [reviver] Method for further parsing of svg elements, called after each fabric object converted into svg representation. + */ + toSVG(options: IToSVGOptions, reviver?: Function): string; + + /** + * Moves an object to the bottom of the stack of drawn objects + * @param {fabric.Object} object Object to send to back + * @chainable + */ + sendToBack(object: IObject): IStaticCanvas; + + /** + * Moves an object to the top of the stack of drawn objects + * @param {fabric.Object} object Object to send + * @chainable + */ + bringToFront(object: IObject): IStaticCanvas; + + /** + * Moves an object down in stack of drawn objects + * @param {fabric.Object} object Object to send + * @param {Boolean} [intersecting] If `true`, send object behind next lower intersecting object + * @chainable + */ + sendBackwards(object: IObject): IStaticCanvas; + + /** + * Moves an object up in stack of drawn objects + * @param {fabric.Object} object Object to send + * @param {Boolean} [intersecting] If `true`, send object in front of next upper intersecting object + * @chainable + */ + bringForward(object: IObject): IStaticCanvas; + /** + * Moves an object to specified level in stack of drawn objects + * @param {fabric.Object} object Object to send + * @param {Number} index Position to move to + * @chainable + */ + moveTo(object: IObject, index: number): IStaticCanvas; + + /** + * Clears a canvas element and removes all event listeners + */ + dispose(): IStaticCanvas; + + /** + * Returns a string representation of an instance + */ + toString(): string; + + /** + * Provides a way to check support of some of the canvas methods + * (either those of HTMLCanvasElement itself, or rendering context) + * + * @param {String} methodName Method to check support for; + * Could be one of "getImageData", "toDataURL", "toDataURLWithQuality" or "setLineDash" + * @return {Boolean | null} `true` if method is supported (or at least exists), + * `null` if canvas element or context can not be initialized + */ + supports(methodName: string): boolean; + EMPTY_JSON: string; + + // methods + onBeforeScaleRotate(target: IObject); + toGrayscale(propertiesToInclude: any[]): string; + } + + export interface ICanvas extends IStaticCanvas, ICanvasOptions { + // constructors + new (element: HTMLCanvasElement|string, options: ICanvasOptions): ICanvas; + + _objects: IObject[]; + + // fields + freeDrawingColor: string; + freeDrawingLineWidth: number; + + /** + * Checks if point is contained within an area of given object + * @param {Event} e Event object + * @param {fabric.Object} target Object to test against + */ + containsPoint(e: Event, target: IObject): boolean; + /** + * Deactivates all objects on canvas, removing any active group or object + * @return {fabric.Canvas} thisArg + */ + deactivateAll(): ICanvas; + /** + * Deactivates all objects and dispatches appropriate events + * @param {Event} [e] Event (passed along when firing) + * @return {fabric.Canvas} thisArg + */ + deactivateAllWithDispatch(e?: Event): ICanvas; + /** + * Discards currently active group + * @param {Event} [e] Event (passed along when firing) + * @return {fabric.Canvas} thisArg + */ + discardActiveGroup(e?: Event): ICanvas; + /** + * Discards currently active object + * @param {Event} [e] Event (passed along when firing) + * @return {fabric.Canvas} thisArg + * @chainable + */ + discardActiveObject(e?: Event): ICanvas; + /** + * Draws objects' controls (borders/controls) + * @param {CanvasRenderingContext2D} ctx Context to render controls on + */ + drawControls(ctx: CanvasRenderingContext2D): void; + drawDashedLine(ctx: CanvasRenderingContext2D, x: number, y: number, x2: number, y2: number, dashArray: number[]): ICanvas; + /** + * Method that determines what object we are clicking on + * @param {Event} e mouse event + * @param {Boolean} skipGroup when true, group is skipped and only objects are traversed through + */ + findTarget(e: MouseEvent, skipGroup: boolean): ICanvas; + /** + * Returns currently active group + * @return {fabric.Group} Current group + */ + getActiveGroup(): IGroup; + /** + * Returns currently active object + * @return {fabric.Object} active object + */ + getActiveObject(): IObject; + /** + * Returns pointer coordinates relative to canvas. + * @param {Event} e + * @return {Object} object with "x" and "y" number values + */ + getPointer(e: Event, ignoreZoom?: boolean, upperCanvasEl?: CanvasRenderingContext2D): { x: number; y: number; }; + /** + * Returns context of canvas where object selection is drawn + * @return {CanvasRenderingContext2D} + */ + getSelectionContext(): CanvasRenderingContext2D; + /** + * Returns element on which object selection is drawn + * @return {HTMLCanvasElement} + */ + getSelectionElement(): HTMLCanvasElement; + /** + * Returns true if object is transparent at a certain location + * @param {fabric.Object} target Object to check + * @param {Number} x Left coordinate + * @param {Number} y Top coordinate + */ + isTargetTransparent(target: IObject, x: number, y: number): boolean; + /** + * Sets active group to a speicified one + * @param {fabric.Group} group Group to set as a current one + * @param {Event} [e] Event (passed along when firing) + */ + setActiveGroup(group: IGroup, e?: Event): ICanvas; + /** + * Sets given object as the only active object on canvas + * @param {fabric.Object} object Object to set as an active one + * @param {Event} [e] Event (passed along when firing "object:selected") + */ + setActiveObject(object: IObject, e?: Event): ICanvas; + /** + * Set the cursor type of the canvas element + * @param {String} value Cursor type of the canvas element. + * @see http://www.w3.org/TR/css3-ui/#cursor + */ + setCursor(value: string): void; + + + loadFromJSON(json, callback: () => void): void; + loadFromDatalessJSON(json, callback: () => void): void; + } + + /////////////////////////////////////////////////////////////////////////////// + // Shape Interfaces + ////////////////////////////////////////////////////////////////////////////// + + export interface ICircleOptions extends IObjectOptions { + /** + * Radius of this circle + */ + radius?: number; + /** + * Start angle of the circle, moving clockwise + */ + startAngle?: number; + + /** + * End angle of the circle + */ + endAngle?: number; + } + export interface ICircle extends IObject, ICircleOptions { + initialize(options?: ICircleOptions): ICircle; + + /** + * Returns complexity of an instance + * @return {Number} complexity of this instance + */ + complexity(): number; + /** + * Returns horizontal radius of an object (according to how an object is scaled) + * @return {Number} + */ + getRadiusX(): number; + /** + * Returns vertical radius of an object (according to how an object is scaled) + * @return {Number} + */ + getRadiusY(): number; + /** + * Sets radius of an object (and updates width accordingly) + * @return {Number} + */ + setRadius(value: number): number; + + /** + * Returns object representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} object representation of an instance + */ + toObject(propertiesToInclude?: any[]): any; + /** + * Returns svg representation of an instance + * @param {Function} [reviver] Method for further parsing of svg representation. + * @return {String} svg representation of an instance + */ + toSVG(reviver?: Function): string; + } + + export interface IEllipseOptions extends IObjectOptions { + /** + * Horizontal radius + */ + rx?: number; + /** + * Vertical radius + */ + ry?: number; + } + export interface IEllipse extends IObject, IEllipseOptions { + initialize(options?: IEllipseOptions): IEllipse; + /** + * Returns horizontal radius of an object (according to how an object is scaled) + * @return {Number} + */ + getRx(): number; + + /** + * Returns Vertical radius of an object (according to how an object is scaled) + * @return {Number} + */ + getRy(): number; + /** + * Returns object representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} object representation of an instance + */ + toObject(propertiesToInclude?: any[]): any; + /** + * Returns svg representation of an instance + * @param {Function} [reviver] Method for further parsing of svg representation. + * @return {String} svg representation of an instance + */ + toSVG(reviver?: Function): string; + /** + * Returns complexity of an instance + * @return {Number} complexity + */ + complexity(): number; + } + + export interface IGroup extends IObject, ICollection { + initialize(objects?: IObject[], options?: IObjectOptions): any; + type: string; + + activateAllObjects(): IGroup; + /** + * Adds an object to a group; Then recalculates group's dimension, position. + * @param {Object} object + * @return {fabric.Group} thisArg + * @chainable + */ + addWithUpdate(object: IObject): IGroup; + containsPoint(point): boolean; + /** + * Destroys a group (restoring state of its objects) + * @return {fabric.Group} thisArg + * @chainable + */ + destroy(): IGroup; + /** + * Returns requested property + * @param {String} prop Property to get + * @return {Any} + */ + get(prop: string): any; + /** + * Checks whether this group was moved (since `saveCoords` was called last) + * @return {Boolean} true if an object was moved (since fabric.Group#saveCoords was called) + */ + hasMoved(): boolean; + /** + * Removes an object from a group; Then recalculates group's dimension, position. + * @param {Object} object + * @return {fabric.Group} thisArg + * @chainable + */ + removeWithUpdate(object: IObject): IGroup; + /** + * Renders instance on a given context + * @param {CanvasRenderingContext2D} ctx context to render instance on + */ + render(ctx: CanvasRenderingContext2D): void; + /** + * Removes objects from a collection, then renders canvas (if `renderOnAddRemove` is not `false`) + * @param {...fabric.Object} object Zero or more fabric instances + * @return {Self} thisArg + * @chainable + */ + remove(...object: IObject[]): IGroup; + /** + * Saves coordinates of this instance (to be used together with `hasMoved`) + * @saveCoords + * @return {fabric.Group} thisArg + * @chainable + */ + saveCoords(): IGroup; + /** + * Sets coordinates of all group objects + * @return {fabric.Group} thisArg + * @chainable + */ + setObjectsCoords(): IGroup; + toGrayscale(): IGroup; + /** + * Returns object representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} object representation of an instance + */ + toObject(propertiesToInclude?: any[]): any; + /** + * Returns string represenation of a group + * @return {String} + */ + toString(): string; + /** + * Returns svg representation of an instance + * @param {Function} [reviver] Method for further parsing of svg representation. + * @return {String} svg representation of an instance + */ + toSVG(reviver?: Function): string; + } + + export interface IImageOptions extends IObjectOptions { + /** + * crossOrigin value (one of "", "anonymous", "allow-credentials") + */ + crossOrigin: string; + + /** + * AlignX value, part of preserveAspectRatio (one of "none", "mid", "min", "max") + * This parameter defines how the picture is aligned to its viewport when image element width differs from image width. + */ + alignX: string; + + /** + * AlignY value, part of preserveAspectRatio (one of "none", "mid", "min", "max") + * This parameter defines how the picture is aligned to its viewport when image element height differs from image height. + */ + alignY: string; + + /** + * meetOrSlice value, part of preserveAspectRatio (one of "meet", "slice"). + * if meet the image is always fully visibile, if slice the viewport is always filled with image. + * @see http://www.w3.org/TR/SVG/coords.html#PreserveAspectRatioAttribute + */ + meetOrSlice: string; + + /** + * Image filter array + */ + filters: IFilter[]; + } + export interface IImage extends IObject, IImageOptions { + initialize(element?: string|HTMLImageElement, options?: IImageOptions); + /** + * Applies filters assigned to this image (from "filters" array) + * @param {Function} callback Callback is invoked when all filters have been applied and new image is generated + */ + applyFilters(callback: Function); + /** + * Returns a clone of an instance + * @param {Function} callback Callback is invoked with a clone as a first argument + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + */ + clone(callback?: Function, propertiesToInclude?: any[]): IObject; + /** + * Returns complexity of an instance + * @return {Number} complexity of this instance + */ + complexity(): number; + /** + * Returns image element which this instance if based on + * @return {HTMLImageElement} Image element + */ + getElement(): HTMLImageElement; + /** + * Returns original size of an image + * @return {Object} Object with "width" and "height" properties + */ + getOriginalSize(): { width: number; height: number; }; + /** + * Returns source of an image + * @return {String} Source of an image + */ + getSrc(): string; + render(ctx: CanvasRenderingContext2D, noTransform: boolean); + + /** + * Sets image element for this instance to a specified one. + * If filters defined they are applied to new image. + * You might need to call `canvas.renderAll` and `object.setCoords` after replacing, to render new image and update controls area. + * @param {HTMLImageElement} element + * @param {Function} [callback] Callback is invoked when all filters have been applied and new image is generated + * @param {Object} [options] Options object + */ + setElement(element: HTMLImageElement, callback: Function, options: IImageOptions): IImage; + /** + * Sets crossOrigin value (on an instance and corresponding image element) + */ + setCrossOrigin(value): IImage; + /** + * Returns object representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} Object representation of an instance + */ + toObject(propertiesToInclude?: any[]): any; + /** + * Returns string representation of an instance + * @return {String} String representation of an instance + */ + toString(): string; + /** + * Returns SVG representation of an instance + * @param {Function} [reviver] Method for further parsing of svg representation. + * @return {String} svg representation of an instance + */ + toSVG(reviver?: Function): string; + /** + * Sets source of an image + * @param {String} src Source string (URL) + * @param {Function} [callback] Callback is invoked when image has been loaded (and all filters have been applied) + * @param {Object} [options] Options object + */ + setSrc(src: string, callback: Function, options: IImageOptions): IImage; + } + + export interface ILineOptions extends IObjectOptions { + /** + * x value or first line edge + */ + x1: number; + /** + * x value or second line edge + */ + x2: number; + /** + * y value or first line edge + */ + y1: number; + /** + * y value or second line edge + */ + y2: number; + } + export interface ILine extends IObject, ILineOptions { + /** + * Returns complexity of an instance + * @return {Number} complexity + */ + complexity(): number; + initialize(points?: number[], options?: ILineOptions): ILine; + /** + * Returns object representation of an instance + * @methd toObject + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} object representation of an instance + */ + toObject(propertiesToInclude: any[]): any; + /** + * Returns SVG representation of an instance + * @param {Function} [reviver] Method for further parsing of svg representation. + * @return {String} svg representation of an instance + */ + toSVG(reviver?: Function): string; + } + + export interface IObjectOptions { + /** + * Type of an object (rect, circle, path, etc.). + * Note that this property is meant to be read-only and not meant to be modified. + * If you modify, certain parts of Fabric (such as JSON loading) won't work correctly. + */ + type?: string; + + /** + * Horizontal origin of transformation of an object (one of "left", "right", "center") + */ + originX?: string; + + /** + * Vertical origin of transformation of an object (one of "top", "bottom", "center") + */ + originY?: string; + + /** + * Top position of an object. Note that by default it's relative to object center. You can change this by setting originY={top/center/bottom} + */ + top?: number; + + /** + * Left position of an object. Note that by default it's relative to object center. You can change this by setting originX={left/center/right} + */ + left?: number; + + /** + * Object width + */ + width?: number; + + /** + * Object height + */ + height?: number; + + /** + * Object scale factor (horizontal) + */ + scaleX?: number; + + /** + * Object scale factor (vertical) + */ + scaleY?: number; + + /** + * When true, an object is rendered as flipped horizontally + */ + flipX?: boolean; + + /** + * When true, an object is rendered as flipped vertically + */ + flipY?: boolean; + + /** + * Opacity of an object + */ + opacity?: number; + + /** + * Angle of rotation of an object (in degrees) + */ + angle?: number; + + /** + * Size of object's controlling corners (in pixels) + */ + cornerSize?: number; + + /** + * When true, object's controlling corners are rendered as transparent inside (i.e. stroke instead of fill) + */ + transparentCorners?: boolean; + + /** + * Default cursor value used when hovering over this object on canvas + */ + hoverCursor?: string; + + /** + * Padding between object and its controlling borders (in pixels) + */ + padding?: number; + + /** + * Color of controlling borders of an object (when it's active) + */ + borderColor?: string; + + /** + * Color of controlling corners of an object (when it's active) + */ + cornerColor?: string; + + /** + * When true, this object will use center point as the origin of transformation + * when being scaled via the controls. + * Backwards incompatibility note: This property replaces "centerTransform" (Boolean). + */ + centeredScaling?: boolean; + + /** + * When true, this object will use center point as the origin of transformation + * when being rotated via the controls. + * Backwards incompatibility note: This property replaces "centerTransform" (Boolean). + */ + centeredRotation?: boolean; + + /** + * Color of object's fill + */ + fill?: string; + + /** + * Fill rule used to fill an object + * accepted values are nonzero, evenodd + * Backwards incompatibility note: This property was used for setting globalCompositeOperation until v1.4.12 (use `fabric.Object#globalCompositeOperation` instead) + */ + fillRule?: string; + + /** + * Composite rule used for canvas globalCompositeOperation + */ + globalCompositeOperation?: string; + + /** + * Background color of an object. Only works with text objects at the moment. + */ + backgroundColor?: string; + + /** + * When defined, an object is rendered via stroke and this property specifies its color + */ + stroke?: string; + + /** + * Width of a stroke used to render this object + */ + strokeWidth?: number; + + /** + * Array specifying dash pattern of an object's stroke (stroke must be defined) + */ + strokeDashArray?: any[]; + + /** + * Line endings style of an object's stroke (one of "butt", "round", "square") + */ + strokeLineCap?: string; + + /** + * Corner style of an object's stroke (one of "bevil", "round", "miter") + */ + strokeLineJoin?: string; + + /** + * Maximum miter length (used for strokeLineJoin = "miter") of an object's stroke + */ + strokeMiterLimit?: number; + + /** + * Shadow object representing shadow of this shape + */ + shadow?: IShadow|string; + + /** + * Opacity of object's controlling borders when object is active and moving + */ + borderOpacityWhenMoving?: number; + + /** + * Scale factor of object's controlling borders + */ + borderScaleFactor?: number; + + /** + * Transform matrix (similar to SVG's transform matrix) + */ + transformMatrix?: any[]; + + /** + * Minimum allowed scale value of an object + */ + minScaleLimit?: number; + + /** + * When set to `false`, an object can not be selected for modification (using either point-click-based or group-based selection). + * But events still fire on it. + */ + selectable?: boolean; + + /** + * When set to `false`, an object can not be a target of events. All events propagate through it. Introduced in v1.3.4 + */ + evented?: boolean; + + /** + * When set to `false`, an object is not rendered on canvas + */ + visible?: boolean; + + /** + * When set to `false`, object's controls are not displayed and can not be used to manipulate object + */ + hasControls?: boolean; + + /** + * When set to `false`, object's controlling borders are not rendered + */ + hasBorders?: boolean; + + /** + * When set to `false`, object's controlling rotating point will not be visible or selectable + */ + hasRotatingPoint?: boolean; + + /** + * Offset for object's controlling rotating point (when enabled via `hasRotatingPoint`) + */ + rotatingPointOffset?: number; + + /** + * When set to `true`, objects are "found" on canvas on per-pixel basis rather than according to bounding box + */ + perPixelTargetFind?: boolean; + + /** + * When `false`, default object's values are not included in its serialization + */ + includeDefaultValues?: boolean; + + /** + * Function that determines clipping of an object (context is passed as a first argument) + * Note that context origin is at the object's center point (not left/top corner) + * @type Function + */ + clipTo?: Function; + + /** + * When `true`, object horizontal movement is locked + */ + lockMovementX?: boolean; + + /** + * When `true`, object vertical movement is locked + */ + lockMovementY?: boolean; + + /** + * When `true`, object rotation is locked + */ + lockRotation?: boolean; + + /** + * When `true`, object horizontal scaling is locked + */ + lockScalingX?: boolean; + + /** + * When `true`, object vertical scaling is locked + */ + lockScalingY?: boolean; + + /** + * When `true`, object non-uniform scaling is locked + */ + lockUniScaling?: boolean; + + /** + * When `true`, object cannot be flipped by scaling into negative values + */ + lockScalingFlip?: boolean; + + /** + * Not used by fabric, just for convenience + */ + name?: string; + + /** + * Not used by fabric, just for convenience + */ + data?: any; + } + export interface IObject extends IObservable, IObjectOptions { + /** + * Animates object's properties + * object.animate('left', ..., {duration: ...}); + * @param property Property to animate + * @param value Value to animate property + * @param options The animation options + */ + animate(property: string, value: number | string, options?: IAnimationOptions): IObject; + /** + * Animates object's properties + * object.animate({ left: ..., top: ... }, { duration: ... }); + * @param properties Properties to animate + * @param value Options object + */ + animate(properties: any, options?: IAnimationOptions): IObject; + + getCurrentWidth(): number; + getCurrentHeight(): number; + + getAngle(): number; + setAngle(value: number): IObject; + + getBorderColor(): string; + setBorderColor(value: string): IObject; + + getBorderScaleFactor(): number; + + + getCornersize(): number; + setCornersize(value: number): IObject; + + getFill(): string; + setFill(value: string): IObject; + + getFillRule(): string; + setFillRule(value: string): IObject; + + getFlipX(): boolean; + setFlipX(value: boolean): IObject; + + getFlipY(): boolean; + setFlipY(value: boolean): IObject; + + getHeight(): number; + setHeight(value: number): IObject; + + getLeft(): number; + setLeft(value: number): IObject; + + getOpacity(): number; + setOpacity(value: number): IObject; + + overlayFill: string; + getOverlayFill(): string; + setOverlayFill(value: string): IObject; + + getScaleX(): number; + setScaleX(value: number): IObject; + + getScaleY(): number; + setScaleY(value: number): IObject; + + setShadow(options: any): IObject; + getShadow(): IObject; + + stateProperties: any[]; + getTop(): number; + setTop(value: number): IObject; + + getWidth(): number; + setWidth(value: number): IObject; + + /* * Sets object's properties from options + * @param {Object} [options] Options object + */ + setOptions(options: any): void; + + /** + * Transforms context when rendering an object + * @param {CanvasRenderingContext2D} ctx Context + * @param {Boolean} fromLeft When true, context is transformed to object's top/left corner. This is used when rendering text on Node + */ + transform(ctx: CanvasRenderingContext2D, fromLeft: boolean): void; + + /** + * Returns an object representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + */ + toObject(propertiesToInclude?: any[]): any; + + /** + * Returns (dataless) object representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + */ + toDatalessObject(propertiesToInclude?: any[]): any; + + /** + * Returns a string representation of an instance + */ + toString(): string; + + /** + * Basic getter + * @param {String} property Property name + */ + get(property: string): any; + + /** + * Sets property to a given value. When changing position/dimension -related properties (left, top, scale, angle, etc.) `set` does not update position of object's borders/controls. + * If you need to update those, call `setCoords()`. + * @param {String|Object} key Property name or object (if object, iterate over the object properties) + * @param {Object|Function} value Property value (if function, the value is passed into it and its return value is used as a new one) + */ + set(key: string|any, value: any|Function): IObject; + + /** + * Toggles specified property from `true` to `false` or from `false` to `true` + * @param {String} property Property to toggle + */ + toggle(property: string): IObject; + + /** + * Sets sourcePath of an object + * @param {String} value Value to set sourcePath to + */ + setSourcePath(value): IObject + + /** + * Retrieves viewportTransform from Object's canvas if possible + * @method getViewportTransform + * @memberOf fabric.Object.prototype + */ + getViewportTransform(): boolean; + + + /** + * Renders an object on a specified context + * @param {CanvasRenderingContext2D} ctx Context to render on + * @param {Boolean} [noTransform] When true, context is not transformed + */ + render(ctx: CanvasRenderingContext2D, noTransform?: boolean): void; + + /** + * Clones an instance + * @param {Function} callback Callback is invoked with a clone as a first argument + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + */ + clone(callback: Function, propertiesToInclude?: any[]): IObject; + + /** + * Creates an instance of fabric.Image out of an object + * @param {Function} callback callback, invoked with an instance as a first argument + */ + cloneAsImage(callback: (image: IImage) => any): IObject; + + + /** + * Converts an object into a data-url-like string + * @param options Options object + */ + toDataURL(options: IDataURLOptions): string; + + /** + * Returns true if specified type is identical to the type of an instance + * @param {String} type Type to check against + */ + isType(type: string): boolean; + + /** + * Returns complexity of an instance + */ + complexity(): number; + + /** + * Returns a JSON representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + */ + toJSON(propertiesToInclude?: any[]): any; + + + + /** + * Sets gradient (fill or stroke) of an object + * Backwards incompatibility note: This method was named "setGradientFill" until v1.1.0 + * @param {String} property Property name 'stroke' or 'fill' + * @param {Object} [options] Options object + */ + setGradient(property: string, options: IGradientOptions): IObject; + + /** + * Sets pattern fill of an object + * @param {Object} options Options object + */ + setPatternFill(options: IFillOptions): IObject; + + /** + * Sets shadow of an object + * @param {String} [options] Options object or string (e.g. "2px 2px 10px rgba(0,0,0,0.2)") + */ + setShadow(options?: string): IObject; + /** + * Sets shadow of an object + * @param [options] Options object + */ + setShadow(options: IShadow): IObject; + + /** + * Sets "color" of an instance (alias of `set('fill', …)`) + * @param {String} color Color value + */ + setColor(color: string): IObject; + + /** + * Sets "angle" of an instance + * @param {Number} angle Angle value + */ + setAngle(angle: number): IObject + + /** + * Sets "angle" of an instance + * @param {Number} angle Angle value + */ + rotate(angle: number): IObject + + /** + * Centers object horizontally on canvas to which it was added last. + * You might need to call `setCoords` on an object after centering, to update controls area. + */ + centerH(): void; + + /** + * Centers object vertically on canvas to which it was added last. + * You might need to call `setCoords` on an object after centering, to update controls area. + */ + centerV(): void; + + /** + * Centers object vertically and horizontally on canvas to which is was added last + * You might need to call `setCoords` on an object after centering, to update controls area. + */ + center(): void; + + /** + * Removes object from canvas to which it was added last + */ + remove(): IObject; + + /** + * Returns coordinates of a pointer relative to an object + * @param {Event} e Event to operate upon + * @param {Object} [pointer] Pointer to operate upon (instead of event) + */ + getLocalPointer(e: Event, pointer: any): any; + + // methods + bringForward(intersecting?: boolean): IObject; + bringToFront(): IObject; + drawBorders(context: CanvasRenderingContext2D): IObject; + drawCorners(context: CanvasRenderingContext2D): IObject; + getBoundingRect(): { left: number; top: number; width: number; height: number }; + getBoundingRectHeight(): number; + getBoundingRectWidth(): number; + getSvgStyles(): string; + getSvgTransform(): string; + hasStateChanged(): boolean; + initialize(options: any); + intersectsWithObject(other: IObject): boolean; + intersectsWithRect(selectionTL: any, selectionBR: any): boolean; + isActive(): boolean; + isContainedWithinObject(other: IObject): boolean; + isContainedWithinRect(selectionTL: any, selectionBR: any): boolean; + saveState(): IObject; + scale(value: number): IObject; + scaleToHeight(value: number): IObject; + scaleToWidth(value: number): IObject; + sendBackwards(intersecting?: boolean): IObject; + sendToBack(): IObject; + + setActive(active: boolean): IObject; + setCoords(); + setOptions(options: any); + setSourcePath(value: string): IObject; + toGrayscale(): IObject; + } + + export interface IPathOptions extends IObjectOptions { + /** + * Array of path points + */ + path?: any[]; + + /** + * Minimum X from points values, necessary to offset points + */ + minX?: number; + + /** + * Minimum Y from points values, necessary to offset points + */ + minY?: number; + } + export interface IPath extends IObject, IPathOptions { + initialize(path?: any[], options?: IPathOptions): IPath; + + /** + * Returns number representation of an instance complexity + * @return {Number} complexity of this instance + */ + complexity(): number; + + /** + * Renders path on a specified context + * @param {CanvasRenderingContext2D} ctx context to render path on + * @param {Boolean} [noTransform] When true, context is not transformed + */ + render(ctx: CanvasRenderingContext2D, noTransform: boolean): void; + /** + * Returns dataless object representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} object representation of an instance + */ + toDatalessObject(propertiesToInclude?: any[]): any; + /** + * Returns object representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} object representation of an instance + */ + toObject(propertiesToInclude?: any[]): any; + /** + * Returns string representation of an instance + * @return {String} string representation of an instance + */ + toString(): string; + /** + * Returns svg representation of an instance + * @param {Function} [reviver] Method for further parsing of svg representation. + * @return {String} svg representation of an instance + */ + toSVG(reviver?: Function): string; + } + + export interface IPathGroup extends IObject { + initialize(paths: IPath[], options?: IObjectOptions); + /** + * Returns number representation of object's complexity + * @return {Number} complexity + */ + complexity(): number; + /** + * Returns true if all paths in this group are of same color + * @return {Boolean} true if all paths are of the same color (`fill`) + */ + isSameColor(): boolean; + /** + * Renders this group on a specified context + * @param {CanvasRenderingContext2D} ctx Context to render this instance on + */ + render(ctx: CanvasRenderingContext2D); + /** + * Returns dataless object representation of this path group + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} dataless object representation of an instance + */ + toDatalessObject(propertiesToInclude?: any[]): any; + toGrayscale(): IPathGroup; + /** + * Returns object representation of this path group + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} object representation of an instance + */ + toObject(propertiesToInclude?: any[]): any; + /** + * Returns a string representation of this path group + * @return {String} string representation of an object + */ + toString(): string; + /** + * Returns svg representation of an instance + * @param {Function} [reviver] Method for further parsing of svg representation. + * @return {String} svg representation of an instance + */ + toSVG(reviver?: Function): string; + /** + * Returns all paths in this path group + * @return {Array} array of path objects included in this path group + */ + getObjects(): IPath[]; + } + + export interface IPolygonOptions extends IObjectOptions { + /** + * Points array + */ + points?: IPoint[] + + /** + * Minimum X from points values, necessary to offset points + */ + minX?: number; + + /** + * Minimum Y from points values, necessary to offset points + */ + minY?: number; + } + export interface IPolygon extends IObject, IPolygonOptions { + initialize(points?: IPoint[], options?: IPolygonOptions): IPolygon; + /** + * Returns complexity of an instance + * @return {Number} complexity of this instance + */ + complexity(): number; + + /** + * Returns object representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} object representation of an instance + */ + toObject(propertiesToInclude?: any[]): any; + /** + * Returns svg representation of an instance + * @param {Function} [reviver] Method for further parsing of svg representation. + * @return {String} svg representation of an instance + */ + toSVG(reviver?: Function): string; + } + + export interface IPolylineOptions extends IObjectOptions { + /** + * Points array + */ + points?: IPoint[] + + /** + * Minimum X from points values, necessary to offset points + */ + minX?: number; + + /** + * Minimum Y from points values, necessary to offset points + */ + minY?: number; + } + export interface IPolyline extends IObject, IPolylineOptions { + initialize(points: IPoint[], options?: IPolylineOptions); + /** + * Returns complexity of an instance + * @return {Number} complexity of this instance + */ + complexity(): number; + /** + * Returns object representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} Object representation of an instance + */ + toObject(propertiesToInclude?: any[]): any; + /** + * Returns SVG representation of an instance + * @param {Function} [reviver] Method for further parsing of svg representation. + * @return {String} svg representation of an instance + */ + toSVG(reviver?: Function): string; + } + + export interface IRectOptions extends IObjectOptions { + x?: number; + y?: number; + /** + * Horizontal border radius + */ + rx?: number; + + /** + * Vertical border radius + */ + ry?: number; + + } + export interface IRect extends IObject, IRectOptions { + initialize(points?: number[], options?: any): IRect; + /** + * Returns complexity of an instance + * @return {Number} complexity + */ + complexity(): number; + /** + * Returns object representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} object representation of an instance + */ + toObject(propertiesToInclude: any[]): any; + /** + * Returns svg representation of an instance + * @param {Function} [reviver] Method for further parsing of svg representation. + * @return {String} svg representation of an instance + */ + toSVG(reviver?: Function): string; + } + + export interface ITextOptions extends IObjectOptions { + /** + * Font size (in pixels) + */ + fontSize?: number; + /** + * Font weight (e.g. bold, normal, 400, 600, 800) + */ + fontWeight?: number|string; + /** + * Font family + */ + fontFamily?: string; + /** + * Text decoration Possible values?: "", "underline", "overline" or "line-through". + */ + textDecoration?: string; + /** + * Text alignment. Possible values?: "left", "center", or "right". + */ + textAlign?: string; + /** + * Font style . Possible values?: "", "normal", "italic" or "oblique". + */ + fontStyle?: string; + /** + * Line height + */ + lineHeight?: number; + /** + * When defined, an object is rendered via stroke and this property specifies its color. + * Backwards incompatibility note?: This property was named "strokeStyle" until v1.1.6 + */ + stroke?: string; + /** + * Shadow object representing shadow of this shape. + * Backwards incompatibility note?: This property was named "textShadow" (String) until v1.2.11 + */ + shadow?: IShadow|string; + /** + * Background color of text lines + * @type String + * @default + */ + textBackgroundColor?: string; + + path?: string; + useNative?: Boolean; + text?: string; + } + export interface IText extends IObject, ITextOptions { + + + initialize(text: string, options?: IITextOptions): IText; + /** + * Returns complexity of an instance + * @return {Number} complexity + */ + complexity(): number; + /** + * Returns string representation of an instance + * @return {String} String representation of text object + */ + toString(): string; + /** + * Renders text instance on a specified context + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + render(ctx: CanvasRenderingContext2D, noTransform: boolean); + /** + * Returns object representation of an instance + * @method toObject + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} object representation of an instance + */ + toObject(propertiesToInclude?: any[]): IObject; + /** + * Returns SVG representation of an instance + * @param {Function} [reviver] Method for further parsing of svg representation. + * @return {String} svg representation of an instance + */ + toSVG(reviver?: Function): string; + /** + * Retrieves object's fontSize + */ + getFontSize(): number; + /** + * Sets object's fontSize + * @param {Number} fontSize Font size (in pixels) + */ + setFontSize(fontSize): IText; + /** + * Retrieves object's fontWeight + */ + getFontWeight(): number|string; + /** + * Sets object's fontWeight + * @method setFontWeight + * @param {(Number|String)} fontWeight Font weight + */ + setFontWeight(fontWeight: string|number): IText; + /** + * Retrieves object's fontFamily + */ + getFontFamily(): string; + /** + * Sets object's fontFamily + * @param {String} fontFamily Font family + */ + setFontFamily(fontFamily: string): IText; + /** + * Retrieves object's text + */ + getText(): string; + /** + * Sets object's text + * @param {String} text Text + */ + setText(text: string): IText; + /** + * Retrieves object's textDecoration + */ + getTextDecoration(): string; + /** + * Sets object's textDecoration + * @param {String} textDecoration Text decoration + */ + setTextDecoration(textDecoration: string): IText; + /** + * Retrieves object's fontStyle + */ + getFontStyle(): string; + /** + * Sets object's fontStyle + * @param {String} fontStyle Font style + */ + setFontStyle(fontStyle: string): IText; + /** + * Retrieves object's lineHeight + */ + getLineHeight(): number; + /** + * Sets object's lineHeight + * @param {Number} lineHeight Line height + */ + setLineHeight(lineHeight: number): IText; + /** + * Retrieves object's textAlign + */ + getTextAlign(): string; + /** + * Sets object's textAlign + * @param {String} textAlign Text alignment + */ + setTextAlign(textAlign: string): IText; + /** + * Retrieves object's textBackgroundColor + */ + getTextBackgroundColor(): string; + /** + * Sets object's textBackgroundColor + * @param {String} textBackgroundColor Text background color + */ + setTextBackgroundColor(textBackgroundColor: string): IText; + + } + + export interface IITextOptions extends IObjectOptions, ITextOptions { + /** + * Index where text selection starts (or where cursor is when there is no selection) + */ + selectionStart?: number; + + /** + * Index where text selection ends + */ + selectionEnd?: number; + + /** + * Color of text selection + */ + selectionColor?: string; + + /** + * Indicates whether text is in editing mode + */ + isEditing?: boolean; + + /** + * Indicates whether a text can be edited + */ + editable?: boolean; + + /** + * Border color of text object while it's in editing mode + */ + editingBorderColor?: string; + + /** + * Width of cursor (in px) + */ + cursorWidth?: number; + + /** + * Color of default cursor (when not overwritten by character style) + */ + cursorColor?: string; + + /** + * Delay between cursor blink (in ms) + */ + cursorDelay?: number; + + /** + * Duration of cursor fadein (in ms) + */ + cursorDuration?: number; + + /** + * Object containing character styles + * (where top-level properties corresponds to line number and 2nd-level properties -- to char number in a line) + */ + styles?: any; + + /** + * Indicates whether internal text char widths can be cached + */ + caching?: boolean; + } + export interface IIText extends IObject, IText, IITextOptions { + initialize(text?: string, options?: IITextOptions): IText; + + /** + * Returns true if object has no styling + */ + isEmptyStyles(): boolean; + render(ctx: CanvasRenderingContext2D, noTransform: boolean); + /** + * Returns object representation of an instance + * @method toObject + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} object representation of an instance + */ + toObject(propertiesToInclude?: any[]): IObject; + + setText(value: string): IText; + /** + * Sets selection start (left boundary of a selection) + * @param {Number} index Index to set selection start to + */ + setSelectionStart(index: number): void; + /** + * Sets selection end (right boundary of a selection) + * @param {Number} index Index to set selection end to + */ + setSelectionEnd(index: number): void; + /** + * Gets style of a current selection/cursor (at the start position) + * @param {Number} [startIndex] Start index to get styles at + * @param {Number} [endIndex] End index to get styles at + * @return {Object} styles Style object at a specified (or current) index + */ + getSelectionStyles(startIndex: number, endIndex: number): any; + /** + * Sets style of a current selection + * @param {Object} [styles] Styles object + * @return {fabric.IText} thisArg + * @chainable + */ + setSelectionStyles(styles: any): IText; + + /** + * Renders cursor or selection (depending on what exists) + */ + renderCursorOrSelection(): void; + + /** + * Returns 2d representation (lineIndex and charIndex) of cursor (or selection start) + * @param {Number} [selectionStart] Optional index. When not given, current selectionStart is used. + */ + get2DCursorLocation(selectionStart?: number): void; + /** + * Returns complete style of char at the current cursor + * @param {Number} lineIndex Line index + * @param {Number} charIndex Char index + * @return {Object} Character style + */ + getCurrentCharStyle(lineIndex: number, charIndex: number): any; + + /** + * Returns fontSize of char at the current cursor + * @param {Number} lineIndex Line index + * @param {Number} charIndex Char index + * @return {Number} Character font size + */ + getCurrentCharFontSize(lineIndex: number, charIndex: number): number; + + /** + * Returns color (fill) of char at the current cursor + * @param {Number} lineIndex Line index + * @param {Number} charIndex Char index + * @return {String} Character color (fill) + */ + getCurrentCharColor(lineIndex: number, charIndex: number): string; + /** + * Renders cursor + * @param {Object} boundaries + */ + renderCursor(boundaries): void; + + /** + * Renders text selection + * @param {Array} chars Array of characters + * @param {Object} boundaries Object with left/top/leftOffset/topOffset + */ + renderSelection(chars: string[], boundaries: any): void; + + } + + export interface ITriangleOptions extends IObjectOptions { } + export interface ITriangle extends IObject { + initialize(options: IObjectOptions): ITriangle; + + /** + * Returns complexity of an instance + * @return {Number} complexity of this instance + */ + + complexity(): number; + /** + * Returns SVG representation of an instance + * @param {Function} [reviver] Method for further parsing of svg representation. + * @return {String} svg representation of an instance + */ + toSVG(reviver?: Function): string; + } + + + + + + + + + + + + export interface IPatternOptions { + /** + * Repeat property of a pattern (one of repeat, repeat-x, repeat-y or no-repeat) + */ + repeat: string; + + /** + * Pattern horizontal offset from object's left/top corner + */ + offsetX: number; + + /** + * Pattern vertical offset from object's left/top corner + */ + offsetY: number; + /** + * The source for the pattern + */ + source: string|HTMLImageElement; + } + + export interface IPattern extends IPatternOptions { + new (options?: IPatternOptions): IPattern; + + initialise(options?: IPatternOptions): IPattern; + /** + * Returns an instance of CanvasPattern + */ + toLive(ctx: CanvasRenderingContext2D): IPattern; + + /** + * Returns object representation of a pattern + */ + toObject(): any; + /** + * Returns SVG representation of a pattern + * @param {fabric.Object} object + */ + toSVG(object: IObject): string; + } + + export interface IBrightnessFilter { + } + export interface IInvertFilter { + } + export interface IRemoveWhiteFilter { + } + export interface IGrayscaleFilter { + } + export interface ISepiaFilter { + } + export interface ISepia2Filter { + } + export interface INoiseFilter { + } + export interface IGradientTransparencyFilter { + } + export interface IPixelateFilter { + } + export interface IConvoluteFilter { + } + export interface ICanvasOptions extends IStaticCanvasOptions { + /** + * When true, objects can be transformed by one side (unproportionally) + */ + uniScaleTransform?: boolean; + + /** + * When true, objects use center point as the origin of scale transformation. + * Backwards incompatibility note: This property replaces "centerTransform" (Boolean). + */ + centeredScaling?: boolean; + + /** + * When true, objects use center point as the origin of rotate transformation. + * Backwards incompatibility note: This property replaces "centerTransform" (Boolean). + */ + centeredRotation?: boolean; + + /** + * Indicates that canvas is interactive. This property should not be changed. + */ + interactive?: boolean; + + /** + * Indicates whether group selection should be enabled + */ + selection?: boolean; + + /** + * Color of selection + */ + selectionColor?: string; + + /** + * Default dash array pattern + * If not empty the selection border is dashed + */ + selectionDashArray?: any[]; + + /** + * Color of the border of selection (usually slightly darker than color of selection itself) + */ + selectionBorderColor?: string; + + /** + * Width of a line used in object/group selection + */ + selectionLineWidth?: number; + + /** + * Default cursor value used when hovering over an object on canvas + */ + hoverCursor?: string; + + /** + * Default cursor value used when moving an object on canvas + */ + moveCursor?: string; + + /** + * Default cursor value used for the entire canvas + */ + defaultCursor?: string; + + /** + * Cursor value used during free drawing + */ + freeDrawingCursor?: string; + + /** + * Cursor value used for rotation point + */ + rotationCursor?: string; + + /** + * Default element class that's given to wrapper (div) element of canvas + */ + containerClass?: string; + + /** + * When true, object detection happens on per-pixel basis rather than on per-bounding-box + */ + perPixelTargetFind?: boolean; + + /** + * Number of pixels around target pixel to tolerate (consider active) during object detection + */ + targetFindTolerance?: number; + + /** + * When true, target detection is skipped when hovering over canvas. This can be used to improve performance. + */ + skipTargetFind?: boolean; + + /** + * When true, mouse events on canvas (mousedown/mousemove/mouseup) result in free drawing. + * After mousedown, mousemove creates a shape, + * and then mouseup finalizes it and adds an instance of `fabric.Path` onto canvas. + */ + isDrawingMode?: boolean; + } + export interface IStaticCanvasOptions { + /** + * Indicates whether the browser can be scrolled when using a touchscreen and dragging on the canvas + */ + allowTouchScrolling?: boolean; + /** + * Indicates whether this canvas will use image smoothing, this is on by default in browsers + */ + imageSmoothingEnabled?: boolean; + + /** + * Indicates whether objects should remain in current stack position when selected. When false objects are brought to top and rendered as part of the selection group + */ + preserveObjectStacking?: boolean; + + /** + * The transformation (in the format of Canvas transform) which focuses the viewport + */ + viewportTransform?: number[]; + + + + freeDrawingColor?: string; + freeDrawingLineWidth?: number; + + /** + * Background color of canvas instance. + * Should be set via setBackgroundColor + */ + backgroundColor?: string | IPattern; + /** + * Background image of canvas instance. + * Should be set via setBackgroundImage + * Backwards incompatibility note: The "backgroundImageOpacity" and "backgroundImageStretch" properties are deprecated since 1.3.9. + */ + backgroundImage?: IImage; + backgroundImageOpacity?: number; + backgroundImageStretch?: number; + /** + * Function that determines clipping of entire canvas area + * Being passed context as first argument. See clipping canvas area + */ + clipTo?: (context: CanvasRenderingContext2D) => void; + + /** + * Indicates whether object controls (borders/controls) are rendered above overlay image + */ + controlsAboveOverlay?: boolean; + + /** + * Indicates whether toObject/toDatalessObject should include default values + */ + includeDefaultValues?: boolean; + /** + * Overlay color of canvas instance. + * Should be set via setOverlayColor + */ + overlayColor?: string | IPattern; + /** + * Overlay image of canvas instance. + * Should be set via setOverlayImage + * Backwards incompatibility note: The "overlayImageLeft" and "overlayImageTop" properties are deprecated since 1.3.9. + */ + overlayImage?: fabric.IImage; + overlayImageLeft?: number; + overlayImageTop?: number; + /** + * Indicates whether add, insertAt and remove should also re-render canvas. + * Disabling this option could give a great performance boost when adding/removing a lot of objects to/from canvas at once + * (followed by a manual rendering after addition/deletion) + */ + renderOnAddRemove?: boolean; + /** + * Indicates whether objects' state should be saved + */ + stateful?: boolean; + } + + + + var Rect: { + fromElement(element: SVGElement, options: IRectOptions): IRect; + fromObject(object): IRect; + new (options?: IRectOptions): IRect; + prototype: any; + } + + var Triangle: { + new (options?: ITriangleOptions): ITriangle; + } + + var Canvas: { + /** + * Constructor + * @param {HTMLElement|String} element element to initialize instance on + * @param {Object} [options] Options object + */ + new (element: HTMLCanvasElement | string, options?: ICanvasOptions): ICanvas; + + EMPTY_JSON: string; + supports(methodName: string): boolean; + prototype: any; + } + + var StaticCanvas: { + /** + * Constructor + * @param {HTMLElement | String} element element to initialize instance on + * @param {Object} [options] Options object + */ + new (element: HTMLCanvasElement | string, options?: ICanvasOptions): ICanvas; + + EMPTY_JSON: string; + supports(methodName: string): boolean; + prototype: any; + } + + var Color: { + /** + * Color class + * The purpose of Color is to abstract and encapsulate common color operations; + * @param {String} color optional in hex or rgb(a) format + */ + new (color?: string): IColor; + + /** + * Returns new color object, when given a color in RGB format + * @param {String} color Color value ex: rgb(0-255,0-255,0-255) + */ + fromRgb(color): IColor + /** + * Returns new color object, when given a color in RGBA format + * @param {String} color Color value ex: rgb(0-255,0-255,0-255) + */ + fromRgba(color): IColor + /** + * Returns array represenatation (ex: [100, 100, 200, 1]) of a color that's in RGB or RGBA format + * @param {String} color Color value ex: rgb(0-255,0-255,0-255), rgb(0%-100%,0%-100%,0%-100%) + */ + sourceFromRgb(color: string): number[]; + /** + * Returns new color object, when given a color in HSL format + * @param {String} color Color value ex: hsl(0-260,0%-100%,0%-100%) + */ + fromHsl(color: string): IColor + /** + * Returns new color object, when given a color in HSLA format + * @param {String} color Color value ex: hsl(0-260,0%-100%,0%-100%) + */ + fromHsla(color: string): IColor + /** + * Returns array represenatation (ex: [100, 100, 200, 1]) of a color that's in HSL or HSLA format. + * @param {String} color Color value ex: hsl(0-360,0%-100%,0%-100%) or hsla(0-360,0%-100%,0%-100%, 0-1) + */ + sourceFromHsl(color: string): number[]; + /** + * Returns new color object, when given a color in HEX format + * @param {String} color Color value ex: FF5555 + */ + fromHex(color: string): IColor + + /** + * Returns array represenatation (ex: [100, 100, 200, 1]) of a color that's in HEX format + * @param {String} color ex: FF5555 + */ + sourceFromHex(color: string): number[]; + /** + * Returns new color object, when given color in array representation (ex: [200, 100, 100, 0.5]) + * @param {Array} source + */ + fromSource(source: number[]): IColor; + prototype: any; + } + var Pattern: { + new (options: IPatternOptions): IPattern; + + prototype: any; + } + + var Circle: { + ATTRIBUTE_NAMES: string[]; + fromElement(element: SVGElement, options: ICircleOptions): ICircle; + fromObject(object): ICircle; + new (options?: ICircleOptions): ICircle; + prototype: any; + } + + var Group: { + new (items?: any[], options?: IObjectOptions): IGroup; + } + + var Line: { + ATTRIBUTE_NAMES: string[]; + fromElement(element: SVGElement, options): ILine; + fromObject(object): ILine; + prototype: any; + new (points: number[], objObjects?: IObjectOptions): ILine; + } + + var Intersection: { + intersectLineLine(a1, a2, b1, b2); + intersectLinePolygon(a1, a2, points); + intersectPolygonPolygon(points1, points2); + intersectPolygonRectangle(points, r1, r2); + } + + var Path: { + fromElement(element: SVGElement, options): IPath; + fromObject(object): IPath; + new (): IPath; + } + + var PathGroup: { + fromObject(object): IPathGroup; + new (): IPathGroup; + prototype: any; + } + + var Point: { + new (x, y): IPoint; + prototype: any; + } + + var Object: { + prototype: any; + } + + var Polygon: { + fromObject(object): IPolygon; + fromElement(element: SVGElement, options): IPolygon; + new (points: any[], options?: IObjectOptions, skipOffset?: boolean): IPolygon; + prototype: any; + } + + var Polyline: { + fromObject(object): IPolyline; + fromElement(element: SVGElement, options): IPolyline; + new (): IPolyline; + prototype: any; + } + + var Text: { + new (text: string, options?: IITextOptions): IText; + } + + var Image: { + fromURL(url: string, callback?: (image: IImage) => any, objObjects?: IObjectOptions): IImage; + new (element: HTMLImageElement, objObjects: IObjectOptions): IImage; + prototype: any; + + filters: + { + Grayscale: { + new (): IGrayscaleFilter; + }; + Brightness: { + new (options?: { brightness: number; }): IBrightnessFilter; + }; + RemoveWhite: { + new (options?: { + threshold?: string; // TODO: Check this + distance?: string; // TODO: Check this + }): IRemoveWhiteFilter; + }; + Invert: { + new (): IInvertFilter; + }; + Sepia: { + new (): ISepiaFilter; + }; + Sepia2: { + new (): ISepia2Filter; + }; + Noise: { + new (options?: { + noise?: number; + }): INoiseFilter; + }; + GradientTransparency: { + new (options?: { + threshold?: number; + }): IGradientTransparencyFilter; + }; + Pixelate: { + new (options?: { + color?: any; + }): IPixelateFilter; + }; + Convolute: { + new (options?: { + matrix: any; + }): IConvoluteFilter; + }; + }; + + } + /////////////////////////////////////////////////////////////////////////////// + // Fabric ulit Interface + ////////////////////////////////////////////////////////////////////////////// + var util: { + addClass(element: HTMLElement, className: string); + addListener(element, eventName: string, handler); + animate(options: { + onChange?: (value: number) => void; + onComplete?: () => void; + startValue?: number; + endValue?: number; + byValue?: number; + easing?: (currentTime, startValue, byValue, duration) => number; + duration?: number; + }); + createClass(parent, properties); + degreesToRadians(degrees: number): number; + falseFunction(): () => boolean; + getById(id: HTMLElement): HTMLElement; + getById(id: string): HTMLElement; + getElementOffset(element): { left: number; top: number; }; + getPointer(event: Event); + getRandomInt(min: number, max: number); + getScript(url: string, callback); + groupSVGElements(elements: any[], options?: any): IPathGroup; + loadImage(url: string, callback: (image: HTMLImageElement) => any, context?: any, crossOrigin?: any); + makeElement(tagName: string, attributes); + makeElementSelectable(element: HTMLElement); + makeElementUnselectable(element: HTMLElement); + populateWithProperties(source, destination, properties): any[]; + radiansToDegrees(radians: number): number; + removeFromArray(array: any[], value); + removeListener(element: HTMLElement, eventName, handler); + request(url, options); + requestAnimFrame(callback, element); + setStyle(element: HTMLElement, styles); + toArray(arrayLike): any[]; + toFixed(number, fractionDigits); + wrapElement(element: HTMLElement, wrapper, attributes); + rotatePoint(point: IPoint, origin: IPoint, radians: number); + transformPoint(p: IPoint, t: any[], ignoreOffset: boolean); + invertTransform(t: any[]); + parseUnit(value: number|string, fontSize?: number); + getKlass(type: string, namespace: string); + resolveNamespace(namespace: string); + enlivenObjects(objects: any[], callback: Function, namespace: string, reviver?: Function); + drawDashedLine(ctx: CanvasRenderingContext2D, x: number, y: number, x2: number, y2: number, da: any[]); + createCanvasElement(canvasEl?: HTMLElement); + createImage(); + createAccessors(klass: Object); + clipContext(receiver: IObject, ctx: CanvasRenderingContext2D); + isTransparent(ctx: CanvasRenderingContext2D, x: number, y: number, tolerance: number); + object: { + clone(object: any): any + extends(destination: any, source: any): any + }; + ease: { + easeInBack(): Function; + easeInBounce(): Function; + easeInCirc(): Function; + easeInCubic(): Function; + easeInElastic(): Function; + easeInExpo(): Function; + easeInOutBack(): Function; + easeInOutBounce(): Function; + easeInOutCirc(): Function; + easeInOutCubic(): Function; + easeInOutElastic(): Function; + easeInOutExpo(): Function; + easeInOutQuad(): Function; + easeInOutQuart(): Function; + easeInOutQuint(): Function; + easeInOutSine(): Function; + easeInQuad(): Function; + easeInQuart(): Function; + easeInQuint(): Function; + easeInSine(): Function; + easeOutBack(): Function; + easeOutBounce(): Function; + easeOutCirc(): Function; + easeOutCubic(): Function; + easeOutElastic(): Function; + easeOutExpo(): Function; + easeOutQuad(): Function; + easeOutQuart(): Function; + easeOutQuint(): Function; + easeOutSine(): Function; + + }; + + + } } From 79fe4ff37587e8f0e373df5980cec5ff43a2b958 Mon Sep 17 00:00:00 2001 From: Chris Wrench Date: Fri, 15 May 2015 14:50:38 +0100 Subject: [PATCH 043/179] Add missing Google Maps Data Layer API Fixes #2249. - Add a `data` property to the `Map` class. - Add Google Maps test file and Data Layer API tests. - Add the following classes and interfaces which form the Data Layer API: - `Data` - `Data.DataOptions` - `Data.GeoJsonOptions` - `Data.StyleOptions` - `Data.StylingFunction` - `Data.Feature` - `Data.FeatureOptions` - `Data.Geometry` - `Data.Point` - `Data.MultiPoint` - `Data.LineString` - `Data.MultiLineString` - `Data.LinearRing` - `Data.Polygon` - `Data.MultiPolygon` - `Data.GeometryCollection` - `Data.MouseEvent` - `Data.AddFeatureEvent` - `Data.RemoveFeatureEvent` - `Data.SetGeometryEvent` - `Data.SetPropertyEvent` - `Data.RemovePropertyEvent` --- googlemaps/google.maps-tests.ts | 107 +++++++++++++ googlemaps/google.maps.d.ts | 258 +++++++++++++++++++++++++------- 2 files changed, 313 insertions(+), 52 deletions(-) create mode 100644 googlemaps/google.maps-tests.ts diff --git a/googlemaps/google.maps-tests.ts b/googlemaps/google.maps-tests.ts new file mode 100644 index 000000000..1079f78b2 --- /dev/null +++ b/googlemaps/google.maps-tests.ts @@ -0,0 +1,107 @@ +// Test file for Google Maps JavaScript API Definition file +/// + +var map = new google.maps.Map(document.querySelector("☺")); + +/***** Data *****/ + +new google.maps.Data(); +new google.maps.Data({ map: map }); + +var latLng = new google.maps.LatLng(52.201203, -1.724370), + feature = new google.maps.Data.Feature(), + geometry = new google.maps.Data.Geometry(); + +var data = map.data; + +data.add(feature); + +data.add({ + geometry: latLng, + id: "Test feature", + properties: {} +}); + +var isIn: boolean = map.data.contains(feature); + +data.forEach((feature: google.maps.Data.Feature) => { + console.log(feature.getId()); +}); + +var map: google.maps.Map = data.getMap(); +data.setMap(map); + +var style = data.getStyle(); +data.setStyle(style); + +data.setStyle({ + clickable: true, + cursor: "pointer", + fillColor: "#79B55B", + fillOpacity: 1, + icon: {}, + shape: { coords: [1, 2, 3], type: "circle" }, + strokeColor: "#79B55B", + strokeOpacity: 1, + strokeWeight: 1, + title: "string", + visible: true, + zIndex: 1 +}); + +data.overrideStyle(feature, { visible: true }); + +data.revertStyle(feature); + +data.addGeoJson({}); +data.addGeoJson({}, { idPropertyName: "Test feature" }); + +data.loadGeoJson("http://magicGeoJsonSource.com"); + +data.loadGeoJson( + "http://magicGeoJsonSource.com", + { idPropertyName: "test" }); + +data.loadGeoJson( + "http://magicGeoJsonSource.com", + { idPropertyName: "test" }, + (features) => { + for (var i = 0, len = features.length; i < len; i++) { + console.log(features[i].getId()); + } + }); + +data.toGeoJson((feature) => { }); + +var dataMouseEvent: google.maps.Data.MouseEvent = { + feature: feature, + latLng: latLng, + stop: (): void => {} +}; + +var addFeatureEvent : google.maps.Data.AddFeatureEvent = { + feature: feature +}; + +var removeFeatureEvent: google.maps.Data.RemoveFeatureEvent = { + feature: feature +}; + +var setGeometryEvent: google.maps.Data.SetGeometryEvent = { + feature: feature, + newGeometry: geometry, + oldGeometry: geometry, +}; + +var setPropertyEvent: google.maps.Data.SetPropertyEvent = { + feature: feature, + name: "test", + newValue: {}, + oldValue: {} +}; + +var removePropertyEvent: google.maps.Data.RemovePropertyEvent = { + feature: feature, + name: "test", + oldValue: {} +}; \ No newline at end of file diff --git a/googlemaps/google.maps.d.ts b/googlemaps/google.maps.d.ts index 81ee2594a..fa11a71ce 100644 --- a/googlemaps/google.maps.d.ts +++ b/googlemaps/google.maps.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Google Geolocation 0.4.8 +// Type definitions for Google Maps JavaScript API 3.19 // Project: https://developers.google.com/maps/ -// Definitions by: Folia A/S +// Definitions by: Folia A/S , Chris Wrench // Definitions: https://github.com/borisyankov/DefinitelyTyped /* @@ -80,9 +80,10 @@ declare module google.maps { setStreetView(panorama: StreetViewPanorama): void; setTilt(tilt: number): void; setZoom(zoom: number): void; - controls: MVCArray[]; //Array.> + controls: MVCArray[]; //Array> + data: Data; mapTypes: MapTypeRegistry; - overlayMapTypes: MVCArray; // MVCArray. + overlayMapTypes: MVCArray; // MVCArray } export interface MapOptions { @@ -206,6 +207,159 @@ declare module google.maps { ZOOM_PAN } + /***** 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; + 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; + setMap(map: Map): void; + setStyle(style: Data.StylingFunction|Data.StyleOptions): void; + toGeoJson(callback: (feature: Object) => void): void; + } + + export module Data { + export interface DataOptions { + map?: Map; + style?: Data.StylingFunction|Data.StyleOptions; + } + + export interface GeoJsonOptions { + idPropertyName?: string; + } + + export interface StyleOptions { + clickable?: boolean; + cursor?: string; + fillColor?: string; + fillOpacity?: number; + icon?: any; // TODO string|Icon|Symbol; + shape?: MarkerShape; + strokeColor?: string; + strokeOpacity?: number; + strokeWeight?: number; + title?: string; + visible?: boolean; + zIndex?: number; + } + + export type StylingFunction = (feature: Data.Feature) => Data.StyleOptions; + + export class Feature { + constructor(options?: Data.FeatureOptions); + forEachProperty(callback: (value: any, name: string) => void): void; + getGeometry(): Data.Geometry; + getId(): number|string; + 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 + } + + export interface FeatureOptions { + geometry?: Data.Geometry|LatLng; // TODO LatLngLiteral + id?: number|string; + properties?: Object; + } + + export class Geometry { + getType(): string; + } + + export class Point extends Data.Geometry { + constructor(latLng: LatLng); // TODO LatLngLiteral + get(): LatLng; + } + + export class MultiPoint extends Data.Geometry { + constructor(elements: LatLng[]); // TODO LatLngLiteral + getAt(n: number): LatLng; + getLength(): number; + } + + export class LineString extends Data.Geometry { + constructor(elements: LatLng[]); // TODO LatLngLiteral + getArray(): LatLng[]; + getAt(n: number): LatLng; + getLength(): number; + } + + export class MultiLineString extends Data.Geometry { + constructor(elements: Data.LineString[]|LatLng[]); // TODO LatLngLiteral + getArray(): Data.LineString[]; + getAt(n: number): Data.LineString; + getLength(): number; + } + + export class LinearRing extends Data.Geometry { + constructor(elements: LatLng[]); // TODO 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; + getLength(): number; + } + + export class MultiPolygon extends Data.Geometry { + constructor(elements: Data.Polygon[]|LinearRing[]|LatLng[][]); // TODO LatLngLiteral + getArray(): Data.Polygon[]; + getAt(n: number): Data.Polygon; + getLength(): number; + } + + export class GeometryCollection extends Data.Geometry { + constructor(elements: Data.Geometry[]|LatLng[]); // TODO LatLngLiteral + getArray(): Data.Geometry[]; + getAt(n: number): Data.Geometry; + getLength(): number; + } + + export interface MouseEvent extends google.maps.MouseEvent { + feature: Data.Feature; + } + + export interface AddFeatureEvent { + feature: Data.Feature; + } + + export interface RemoveFeatureEvent { + feature: Data.Feature; + } + + export interface SetGeometryEvent { + feature: Data.Feature; + newGeometry: Data.Geometry; + oldGeometry: Data.Geometry; + } + + export interface SetPropertyEvent { + feature: Data.Feature; + name: string; + newValue: any; + oldValue: any; + } + + export interface RemovePropertyEvent { + feature: Data.Feature; + name: string; + oldValue: any; + } + } + /***** Overlays *****/ export class Marker extends MVCObject { static MAX_ZINDEX: number; @@ -1345,54 +1499,54 @@ declare module google.maps { } export module places { - - export class AutocompleteService extends MVCObject { - constructor(); - getPlacePredictions(request: AutocompletionRequest, callback: (result: AutocompletePrediction[], status: PlacesServiceStatus) => void): void; - getQueryPredictions(request: QueryAutocompletionRequest, callback: (result: QueryAutocompletePrediction[], status: PlacesServiceStatus) => void): void; - } - - export interface AutocompletionRequest { - input: string; - bounds?: LatLngBounds; - componentRestrictions?: ComponentRestrictions; - location?: LatLng; - offset?: number; - radius?: number; - types?: string[]; - } - - export interface QueryAutocompletionRequest { - input: string; - bounds?: LatLngBounds; - location?: LatLng; - offset?: number; - radius?: number; - } - - export interface AutocompletePrediction { - description: string; - matched_substrings: PredictionSubstring[]; - place_id: string; - terms: PredictionTerm[]; - types: string[] - } - - export interface PredictionTerm { - offset: number; - value: string; - } - - export interface PredictionSubstring { - length: number; - offset: number; - } - - export interface QueryAutocompletePrediction { - description: string; - matched_substrings: PredictionSubstring[]; - place_id: string; - terms: PredictionTerm[]; + + export class AutocompleteService extends MVCObject { + constructor(); + getPlacePredictions(request: AutocompletionRequest, callback: (result: AutocompletePrediction[], status: PlacesServiceStatus) => void): void; + getQueryPredictions(request: QueryAutocompletionRequest, callback: (result: QueryAutocompletePrediction[], status: PlacesServiceStatus) => void): void; + } + + export interface AutocompletionRequest { + input: string; + bounds?: LatLngBounds; + componentRestrictions?: ComponentRestrictions; + location?: LatLng; + offset?: number; + radius?: number; + types?: string[]; + } + + export interface QueryAutocompletionRequest { + input: string; + bounds?: LatLngBounds; + location?: LatLng; + offset?: number; + radius?: number; + } + + export interface AutocompletePrediction { + description: string; + matched_substrings: PredictionSubstring[]; + place_id: string; + terms: PredictionTerm[]; + types: string[] + } + + export interface PredictionTerm { + offset: number; + value: string; + } + + export interface PredictionSubstring { + length: number; + offset: number; + } + + export interface QueryAutocompletePrediction { + description: string; + matched_substrings: PredictionSubstring[]; + place_id: string; + terms: PredictionTerm[]; } export class Autocomplete extends MVCObject { From 4df938d72948160e2e86befd38496e4605f9c558 Mon Sep 17 00:00:00 2001 From: Joseph Livecchi Date: Fri, 15 May 2015 12:57:49 -0400 Subject: [PATCH 044/179] More Modifications to fabric.d.ts * Added the AMD require statement * Created static interfaces as the TypeScript recommendations to clean of the definition file * Added interfaces for the fabric.util files --- fabricjs/fabricjs.d.ts | 1315 +++++++++++++++++++++++++++------------- 1 file changed, 884 insertions(+), 431 deletions(-) diff --git a/fabricjs/fabricjs.d.ts b/fabricjs/fabricjs.d.ts index 2a13cac4e..31b12db1e 100644 --- a/fabricjs/fabricjs.d.ts +++ b/fabricjs/fabricjs.d.ts @@ -1,39 +1,79 @@ -// Type definitions for FabricJS +// Type definitions for FabricJS v1.5.0 // Project: http://fabricjs.com/ -// Definitions by: Oliver Klemencic +// Definitions by: Oliver Klemencic , edited by Joseph Livecchi // Definitions: https://github.com/borisyankov/DefinitelyTyped +// Support AMD require +declare module "fabric" { + export = fabric; +} + declare module fabric { + var isLikelyNode: boolean; + var isTouchSupported: boolean; + + ///////////////////////////////////////////////////////////// + // Functions + ///////////////////////////////////////////////////////////// + function createCanvasForNode(width: number, height: number): ICanvas; function getCSSRules(doc: SVGElement); function getGradientDefs(doc: SVGElement); + + // Parser function loadSVGFromString(text: string, callback: (results: IObject[], options) => void, reviver?: (el, obj) => void); function loadSVGFromURL(url, callback: (results: IObject[], options) => void, reviver?: (el, obj) => void); - - /** - * Wrapper around `console.log` (when available) - */ - function log(values); function parseAttributes(element, attributes: any[]): any; function parseElements(elements: any[], callback, options, reviver); function parsePointsAttribute(points: string): any[]; function parseStyleAttribute(element: SVGElement); function parseSVGDocument(doc: SVGElement, callback: (results, options) => void, reviver?: (el, obj) => void); function parseTransformAttribute(attributeValue: string); + + // fabric Log + // --------------- + /** + * Wrapper around `console.log` (when available) + */ + function log(values); /** * Wrapper around `console.warn` (when available) */ function warn(values); - var isLikelyNode: boolean; - var isTouchSupported: boolean; + + //////////////////////////////////////////////////// + // Classes + //////////////////////////////////////////////////// + var Canvas: ICanvasStatic; + var StaticCanvas: IStaticCanvasStatic; + + var Color: IColorStatic; + var Pattern: IPatternStatic; + var Intersection: IIntersectionStatic; + var Point: IPointStatic + + var Circle: ICircleStatic; + var Group: IGroupStatic; + var Image: IImageStatic + var Line: ILineStatic; + var Object: IObjectStatic; + var Path: IPathStatic; + var PathGroup: IPathGroupStatic + var Polygon: IPolygonStatic + var Polyline: IPolylineStatic; + var Rect: IRectStatic; + var Text: ITextStatic; + var Triangle: ITriangleStatic + + var util: Util; /////////////////////////////////////////////////////////////////////////////// // Data Object Interfaces - These intrface are not specific part of fabric, // They are just helpful for for defining function paramters ////////////////////////////////////////////////////////////////////////////// - export interface IDataURLOptions { + interface IDataURLOptions { /** * The format of the output image. Either "jpeg" or "png" */ @@ -63,13 +103,13 @@ declare module fabric { */ height?: number; } - - export interface IEvent { + + interface IEvent { e: Event; - target?: fabric.IObject; + target?: IObject; } - export interface IFillOptions { + interface IFillOptions { /** * options.source Pattern source */ @@ -88,7 +128,7 @@ declare module fabric { offsetY?: number; } - export interface IGradientOptions { + interface IGradientOptions { /** * @param {String} [options.type] Type of gradient 'radial' or 'linear' */ @@ -123,7 +163,7 @@ declare module fabric { colorStops?: any; } - export interface IToSVGOptions { + interface IToSVGOptions { /** * If true xml tag is not included */ @@ -138,7 +178,7 @@ declare module fabric { encoding: string; } - export interface IViewBox { + interface IViewBox { /** * x-cooridnate of viewbox */ @@ -155,42 +195,20 @@ declare module fabric { height: number; } - export interface IFilter { + interface IFilter { new (): IFilter; new (options: any): IFilter; } - export interface IEventList { + interface IEventList { [index: string]: (e: Event) => void; } - export interface IAnimationOptions { - /** - * Allows to specify starting value of animatable property (if we don't want current value to be used). - */ - from?: string|number; - /** - * Defaults to 500 (ms). Can be used to change duration of an animation. - */ - duration?: number; - /** - * Callback that's invoked during the animation. - */ - onChange?: Function; - /** - * Callback that's invoked at the end of the animation. - */ - onComplete?: Function - /** - * Easing function. Default: fabric.util.ease.easeInSine - */ - easing?: Function; - } /////////////////////////////////////////////////////////////////////////////// // Mixins Interfaces ////////////////////////////////////////////////////////////////////////////// - export interface ICollection { + interface ICollection { /** * Adds objects to collection, then renders canvas (if `renderOnAddRemove` is not `false`) * Objects should be instances of (or inherit from) fabric.Object @@ -266,8 +284,8 @@ declare module fabric { */ complexity(): number; } - - export interface IObservable { + + interface IObservable { /** * Observes specified event * @deprecated `observe` deprecated since 0.8.34 (use `on` instead) @@ -292,12 +310,88 @@ declare module fabric { off(eventName: string|any, handler: (e) => any): T; } + // animation mixin + // ---------------------------------------------------- + interface ICanvasAnimation { + FX_DURATION: number; + /** + * Centers object horizontally with animation. + * @param {fabric.Object} object Object to center + * @param {Object} [callbacks] Callbacks object with optional "onComplete" and/or "onChange" properties + * @param {Function} [callbacks.onComplete] Invoked on completion + * @param {Function} [callbacks.onChange] Invoked on every step of animation + */ + fxCenterObjectH(object: IObject, callbacks?: { onComplete: Function; onChange: Function; }): T; + /** + * Centers object vertically with animation. + * @param {fabric.Object} object Object to center + * @param {Object} [callbacks] Callbacks object with optional "onComplete" and/or "onChange" properties + * @param {Function} [callbacks.onComplete] Invoked on completion + * @param {Function} [callbacks.onChange] Invoked on every step of animation + */ + fxCenterObjectV(object: IObject, callbacks?: { onComplete: Function; onChange: Function; }): T; + + /** + * Same as `fabric.Canvas#remove` but animated + * @param {fabric.Object} object Object to remove + * @param {Object} [callbacks] Callbacks object with optional "onComplete" and/or "onChange" properties + * @param {Function} [callbacks.onComplete] Invoked on completion + * @param {Function} [callbacks.onChange] Invoked on every step of animation + * @return {fabric.Canvas} thisArg + * @chainable + */ + fxRemove(object: IObject, callbacks?: { onComplete: Function; onChange: Function; }): T; + } + interface IObjectAnimation { + /** + * Animates object's properties + * object.animate('left', ..., {duration: ...}); + * @param property Property to animate + * @param value Value to animate property + * @param options The animation options + */ + animate(property: string, value: number | string, options?: IAnimationOptions): IObject; + /** + * Animates object's properties + * object.animate({ left: ..., top: ... }, { duration: ... }); + * @param properties Properties to animate + * @param value Options object + */ + animate(properties: any, options?: IAnimationOptions): IObject; + } + interface IAnimationOptions { + /** + * Allows to specify starting value of animatable property (if we don't want current value to be used). + */ + from?: string|number; + /** + * Defaults to 500 (ms). Can be used to change duration of an animation. + */ + duration?: number; + /** + * Callback; invoked on every value change + */ + onChange?: Function; + /** + * Callback; invoked when value change is completed + */ + onComplete?: Function + /** + * Easing function. Default: fabric.util.ease.easeInSine + */ + easing?: Function; + /** + * Value to modify the property by, default: end - start + */ + by?: number; + } + /////////////////////////////////////////////////////////////////////////////// // General Fabric Interfaces ////////////////////////////////////////////////////////////////////////////// - export interface IColor { + interface IColor { /** * Returns source of this color (where source is an array representation; ex: [200, 200, 100, 1]) */ @@ -360,24 +454,83 @@ declare module fabric { */ overlayWith(otherColor: string|IColor): IColor; } + interface IColorStatic { + /** + * Color class + * The purpose of Color is to abstract and encapsulate common color operations; + * @param {String} color optional in hex or rgb(a) format + */ + new (color?: string): IColor; - export interface IGradient { + /** + * Returns new color object, when given a color in RGB format + * @param {String} color Color value ex: rgb(0-255,0-255,0-255) + */ + fromRgb(color): IColor + /** + * Returns new color object, when given a color in RGBA format + * @param {String} color Color value ex: rgb(0-255,0-255,0-255) + */ + fromRgba(color): IColor + /** + * Returns array represenatation (ex: [100, 100, 200, 1]) of a color that's in RGB or RGBA format + * @param {String} color Color value ex: rgb(0-255,0-255,0-255), rgb(0%-100%,0%-100%,0%-100%) + */ + sourceFromRgb(color: string): number[]; + /** + * Returns new color object, when given a color in HSL format + * @param {String} color Color value ex: hsl(0-260,0%-100%,0%-100%) + */ + fromHsl(color: string): IColor + /** + * Returns new color object, when given a color in HSLA format + * @param {String} color Color value ex: hsl(0-260,0%-100%,0%-100%) + */ + fromHsla(color: string): IColor + /** + * Returns array represenatation (ex: [100, 100, 200, 1]) of a color that's in HSL or HSLA format. + * @param {String} color Color value ex: hsl(0-360,0%-100%,0%-100%) or hsla(0-360,0%-100%,0%-100%, 0-1) + */ + sourceFromHsl(color: string): number[]; + /** + * Returns new color object, when given a color in HEX format + * @param {String} color Color value ex: FF5555 + */ + fromHex(color: string): IColor + + /** + * Returns array represenatation (ex: [100, 100, 200, 1]) of a color that's in HEX format + * @param {String} color ex: FF5555 + */ + sourceFromHex(color: string): number[]; + /** + * Returns new color object, when given color in array representation (ex: [200, 100, 100, 0.5]) + * @param {Array} source + */ + fromSource(source: number[]): IColor; + prototype: any; + } + + + interface IGradient { initialize(options): any; toObject(): any; toLiveGradient(ctx: CanvasRenderingContext2D): any; } - - export interface IIntersection { + + interface IIntersection { /** * Appends a point to intersection */ - appendPoint(point: fabric.IPoint); + appendPoint(point: IPoint); /** * Appends points to intersection */ - appendPoints(point: fabric.IPoint); + appendPoints(point: IPoint); init(status?: string); + } + interface IIntersectionStatic { /** * Checks if polygon intersects another polygon */ @@ -395,8 +548,8 @@ declare module fabric { */ intersectPolygonRectangle(points: IPoint[], r1: number, r2: number): IIntersection; } - - export interface IPoint { + + interface IPoint { x: number; y: number; /** @@ -579,8 +732,12 @@ declare module fabric { */ swap(that: IPoint): IPoint; } - - export interface IShadowOptions { + interface IPointStatic { + new (x, y): IPoint; + prototype: any; + } + + interface IShadowOptions { /** * Whether the shadow should affect stroke operations */ @@ -606,7 +763,7 @@ declare module fabric { */ offsetY: number; } - export interface IShadow extends IShadowOptions { + interface IShadow extends IShadowOptions { initialize(options?: IShadowOptions|string): IShadow; /** * Returns object representation of a shadow @@ -631,7 +788,7 @@ declare module fabric { /////////////////////////////////////////////////////////////////////////////// // Canvas Interfaces ////////////////////////////////////////////////////////////////////////////// - export interface ICanvasDimensions { + interface ICanvasDimensions { /** * Width of canvas element */ @@ -642,7 +799,7 @@ declare module fabric { height: number; } - export interface ICanvasDimensionsOptions { + interface ICanvasDimensionsOptions { /** * Set the given dimensions only as canvas backstore dimensions */ @@ -653,7 +810,7 @@ declare module fabric { cssOnly?: boolean; } - export interface IStaticCanvas extends IObservable, IStaticCanvasOptions, ICollection { + interface IStaticCanvas extends IObservable, IStaticCanvasOptions, ICollection, ICanvasAnimation { /** * Calculates canvas element offset relative to the document * This method is also attached as "resize" event handler of window @@ -925,8 +1082,20 @@ declare module fabric { onBeforeScaleRotate(target: IObject); toGrayscale(propertiesToInclude: any[]): string; } + interface IStaticCanvasStatic { + /** + * Constructor + * @param {HTMLElement | String} element element to initialize instance on + * @param {Object} [options] Options object + */ + new (element: HTMLCanvasElement | string, options?: ICanvasOptions): ICanvas; - export interface ICanvas extends IStaticCanvas, ICanvasOptions { + EMPTY_JSON: string; + supports(methodName: string): boolean; + prototype: any; + } + + interface ICanvas extends IStaticCanvas, ICanvasOptions { // constructors new (element: HTMLCanvasElement|string, options: ICanvasOptions): ICanvas; @@ -1034,12 +1203,24 @@ declare module fabric { loadFromJSON(json, callback: () => void): void; loadFromDatalessJSON(json, callback: () => void): void; } + interface ICanvasStatic { + /** + * Constructor + * @param {HTMLElement|String} element element to initialize instance on + * @param {Object} [options] Options object + */ + new (element: HTMLCanvasElement | string, options?: ICanvasOptions): ICanvas; + + EMPTY_JSON: string; + supports(methodName: string): boolean; + prototype: any; + } /////////////////////////////////////////////////////////////////////////////// // Shape Interfaces ////////////////////////////////////////////////////////////////////////////// - export interface ICircleOptions extends IObjectOptions { + interface ICircleOptions extends IObjectOptions { /** * Radius of this circle */ @@ -1054,7 +1235,7 @@ declare module fabric { */ endAngle?: number; } - export interface ICircle extends IObject, ICircleOptions { + interface ICircle extends IObject, ICircleOptions { initialize(options?: ICircleOptions): ICircle; /** @@ -1091,8 +1272,15 @@ declare module fabric { */ toSVG(reviver?: Function): string; } + interface ICircleStatic { + ATTRIBUTE_NAMES: string[]; + fromElement(element: SVGElement, options: ICircleOptions): ICircle; + fromObject(object): ICircle; + new (options?: ICircleOptions): ICircle; + prototype: any; + } - export interface IEllipseOptions extends IObjectOptions { + interface IEllipseOptions extends IObjectOptions { /** * Horizontal radius */ @@ -1102,7 +1290,7 @@ declare module fabric { */ ry?: number; } - export interface IEllipse extends IObject, IEllipseOptions { + interface IEllipse extends IObject, IEllipseOptions { initialize(options?: IEllipseOptions): IEllipse; /** * Returns horizontal radius of an object (according to how an object is scaled) @@ -1133,8 +1321,8 @@ declare module fabric { */ complexity(): number; } - - export interface IGroup extends IObject, ICollection { + + interface IGroup extends IObject, ICollection { initialize(objects?: IObject[], options?: IObjectOptions): any; type: string; @@ -1215,8 +1403,11 @@ declare module fabric { */ toSVG(reviver?: Function): string; } - - export interface IImageOptions extends IObjectOptions { + interface IGroupStatic { + new (items?: any[], options?: IObjectOptions): IGroup; + } + + interface IImageOptions extends IObjectOptions { /** * crossOrigin value (one of "", "anonymous", "allow-credentials") */ @@ -1246,7 +1437,7 @@ declare module fabric { */ filters: IFilter[]; } - export interface IImage extends IObject, IImageOptions { + interface IImage extends IObject, IImageOptions { initialize(element?: string|HTMLImageElement, options?: IImageOptions); /** * Applies filters assigned to this image (from "filters" array) @@ -1319,8 +1510,59 @@ declare module fabric { */ setSrc(src: string, callback: Function, options: IImageOptions): IImage; } + interface IImageStatic { + fromURL(url: string, callback?: (image: IImage) => any, objObjects?: IObjectOptions): IImage; + new (element: HTMLImageElement, objObjects: IObjectOptions): IImage; + prototype: any; - export interface ILineOptions extends IObjectOptions { + filters: + { + Grayscale: { + new (): IGrayscaleFilter; + }; + Brightness: { + new (options?: { brightness: number; }): IBrightnessFilter; + }; + RemoveWhite: { + new (options?: { + threshold?: string; // TODO: Check this + distance?: string; // TODO: Check this + }): IRemoveWhiteFilter; + }; + Invert: { + new (): IInvertFilter; + }; + Sepia: { + new (): ISepiaFilter; + }; + Sepia2: { + new (): ISepia2Filter; + }; + Noise: { + new (options?: { + noise?: number; + }): INoiseFilter; + }; + GradientTransparency: { + new (options?: { + threshold?: number; + }): IGradientTransparencyFilter; + }; + Pixelate: { + new (options?: { + color?: any; + }): IPixelateFilter; + }; + Convolute: { + new (options?: { + matrix: any; + }): IConvoluteFilter; + }; + }; + + } + + interface ILineOptions extends IObjectOptions { /** * x value or first line edge */ @@ -1338,7 +1580,7 @@ declare module fabric { */ y2: number; } - export interface ILine extends IObject, ILineOptions { + interface ILine extends IObject, ILineOptions { /** * Returns complexity of an instance * @return {Number} complexity @@ -1359,8 +1601,15 @@ declare module fabric { */ toSVG(reviver?: Function): string; } + interface ILineStatic { + ATTRIBUTE_NAMES: string[]; + fromElement(element: SVGElement, options): ILine; + fromObject(object): ILine; + prototype: any; + new (points: number[], objObjects?: IObjectOptions): ILine; + } - export interface IObjectOptions { + interface IObjectOptions { /** * Type of an object (rect, circle, path, etc.). * Note that this property is meant to be read-only and not meant to be modified. @@ -1647,22 +1896,8 @@ declare module fabric { */ data?: any; } - export interface IObject extends IObservable, IObjectOptions { - /** - * Animates object's properties - * object.animate('left', ..., {duration: ...}); - * @param property Property to animate - * @param value Value to animate property - * @param options The animation options - */ - animate(property: string, value: number | string, options?: IAnimationOptions): IObject; - /** - * Animates object's properties - * object.animate({ left: ..., top: ... }, { duration: ... }); - * @param properties Properties to animate - * @param value Options object - */ - animate(properties: any, options?: IAnimationOptions): IObject; + interface IObject extends IObservable, IObjectOptions, IObjectAnimation { + getCurrentWidth(): number; getCurrentHeight(): number; @@ -1932,8 +2167,11 @@ declare module fabric { setSourcePath(value: string): IObject; toGrayscale(): IObject; } - - export interface IPathOptions extends IObjectOptions { + interface IObjectStatic { + prototype: any; + } + + interface IPathOptions extends IObjectOptions { /** * Array of path points */ @@ -1949,7 +2187,7 @@ declare module fabric { */ minY?: number; } - export interface IPath extends IObject, IPathOptions { + interface IPath extends IObject, IPathOptions { initialize(path?: any[], options?: IPathOptions): IPath; /** @@ -1988,8 +2226,13 @@ declare module fabric { */ toSVG(reviver?: Function): string; } - - export interface IPathGroup extends IObject { + interface IPathStatic { + fromElement(element: SVGElement, options): IPath; + fromObject(object): IPath; + new (): IPath; + } + + interface IPathGroup extends IObject { initialize(paths: IPath[], options?: IObjectOptions); /** * Returns number representation of object's complexity @@ -2036,8 +2279,13 @@ declare module fabric { */ getObjects(): IPath[]; } + interface IPathGroupStatic { + fromObject(object): IPathGroup; + new (): IPathGroup; + prototype: any; + } - export interface IPolygonOptions extends IObjectOptions { + interface IPolygonOptions extends IObjectOptions { /** * Points array */ @@ -2053,7 +2301,7 @@ declare module fabric { */ minY?: number; } - export interface IPolygon extends IObject, IPolygonOptions { + interface IPolygon extends IObject, IPolygonOptions { initialize(points?: IPoint[], options?: IPolygonOptions): IPolygon; /** * Returns complexity of an instance @@ -2074,8 +2322,14 @@ declare module fabric { */ toSVG(reviver?: Function): string; } + interface IPolygonStatic { + fromObject(object): IPolygon; + fromElement(element: SVGElement, options): IPolygon; + new (points: any[], options?: IObjectOptions, skipOffset?: boolean): IPolygon; + prototype: any; + } - export interface IPolylineOptions extends IObjectOptions { + interface IPolylineOptions extends IObjectOptions { /** * Points array */ @@ -2091,7 +2345,7 @@ declare module fabric { */ minY?: number; } - export interface IPolyline extends IObject, IPolylineOptions { + interface IPolyline extends IObject, IPolylineOptions { initialize(points: IPoint[], options?: IPolylineOptions); /** * Returns complexity of an instance @@ -2111,8 +2365,14 @@ declare module fabric { */ toSVG(reviver?: Function): string; } - - export interface IRectOptions extends IObjectOptions { + interface IPolylineStatic { + fromObject(object): IPolyline; + fromElement(element: SVGElement, options): IPolyline; + new (): IPolyline; + prototype: any; + } + + interface IRectOptions extends IObjectOptions { x?: number; y?: number; /** @@ -2126,7 +2386,7 @@ declare module fabric { ry?: number; } - export interface IRect extends IObject, IRectOptions { + interface IRect extends IObject, IRectOptions { initialize(points?: number[], options?: any): IRect; /** * Returns complexity of an instance @@ -2146,8 +2406,14 @@ declare module fabric { */ toSVG(reviver?: Function): string; } + interface IRectStatic { + fromElement(element: SVGElement, options: IRectOptions): IRect; + fromObject(object): IRect; + new (options?: IRectOptions): IRect; + prototype: any; + } - export interface ITextOptions extends IObjectOptions { + interface ITextOptions extends IObjectOptions { /** * Font size (in pixels) */ @@ -2197,7 +2463,7 @@ declare module fabric { useNative?: Boolean; text?: string; } - export interface IText extends IObject, ITextOptions { + interface IText extends IObject, ITextOptions { initialize(text: string, options?: IITextOptions): IText; @@ -2313,8 +2579,11 @@ declare module fabric { setTextBackgroundColor(textBackgroundColor: string): IText; } + interface ITextStatic { + new (text: string, options?: IITextOptions): IText; + } - export interface IITextOptions extends IObjectOptions, ITextOptions { + interface IITextOptions extends IObjectOptions, ITextOptions { /** * Index where text selection starts (or where cursor is when there is no selection) */ @@ -2376,7 +2645,7 @@ declare module fabric { */ caching?: boolean; } - export interface IIText extends IObject, IText, IITextOptions { + interface IIText extends IObject, IText, IITextOptions { initialize(text?: string, options?: IITextOptions): IText; /** @@ -2466,8 +2735,8 @@ declare module fabric { } - export interface ITriangleOptions extends IObjectOptions { } - export interface ITriangle extends IObject { + interface ITriangleOptions extends IObjectOptions { } + interface ITriangle extends IObject { initialize(options: IObjectOptions): ITriangle; /** @@ -2483,18 +2752,12 @@ declare module fabric { */ toSVG(reviver?: Function): string; } + interface ITriangleStatic { + new (options?: ITriangleOptions): ITriangle; + } - - - - - - - - - - export interface IPatternOptions { + interface IPatternOptions { /** * Repeat property of a pattern (one of repeat, repeat-x, repeat-y or no-repeat) */ @@ -2514,8 +2777,7 @@ declare module fabric { */ source: string|HTMLImageElement; } - - export interface IPattern extends IPatternOptions { + interface IPattern extends IPatternOptions { new (options?: IPatternOptions): IPattern; initialise(options?: IPatternOptions): IPattern; @@ -2534,28 +2796,32 @@ declare module fabric { */ toSVG(object: IObject): string; } + interface IPatternStatic { + new (options: IPatternOptions): IPattern; + prototype: any; + } - export interface IBrightnessFilter { + interface IBrightnessFilter { } - export interface IInvertFilter { + interface IInvertFilter { } - export interface IRemoveWhiteFilter { + interface IRemoveWhiteFilter { } - export interface IGrayscaleFilter { + interface IGrayscaleFilter { } - export interface ISepiaFilter { + interface ISepiaFilter { } - export interface ISepia2Filter { + interface ISepia2Filter { } - export interface INoiseFilter { + interface INoiseFilter { } - export interface IGradientTransparencyFilter { + interface IGradientTransparencyFilter { } - export interface IPixelateFilter { + interface IPixelateFilter { } - export interface IConvoluteFilter { + interface IConvoluteFilter { } - export interface ICanvasOptions extends IStaticCanvasOptions { + interface ICanvasOptions extends IStaticCanvasOptions { /** * When true, objects can be transformed by one side (unproportionally) */ @@ -2656,7 +2922,7 @@ declare module fabric { */ isDrawingMode?: boolean; } - export interface IStaticCanvasOptions { + interface IStaticCanvasOptions { /** * Indicates whether the browser can be scrolled when using a touchscreen and dragging on the canvas */ @@ -2719,7 +2985,7 @@ declare module fabric { * Should be set via setOverlayImage * Backwards incompatibility note: The "overlayImageLeft" and "overlayImageTop" properties are deprecated since 1.3.9. */ - overlayImage?: fabric.IImage; + overlayImage?: IImage; overlayImageLeft?: number; overlayImageTop?: number; /** @@ -2735,313 +3001,500 @@ declare module fabric { } - - var Rect: { - fromElement(element: SVGElement, options: IRectOptions): IRect; - fromObject(object): IRect; - new (options?: IRectOptions): IRect; - prototype: any; - } - - var Triangle: { - new (options?: ITriangleOptions): ITriangle; - } - - var Canvas: { - /** - * Constructor - * @param {HTMLElement|String} element element to initialize instance on - * @param {Object} [options] Options object - */ - new (element: HTMLCanvasElement | string, options?: ICanvasOptions): ICanvas; - - EMPTY_JSON: string; - supports(methodName: string): boolean; - prototype: any; - } - - var StaticCanvas: { - /** - * Constructor - * @param {HTMLElement | String} element element to initialize instance on - * @param {Object} [options] Options object - */ - new (element: HTMLCanvasElement | string, options?: ICanvasOptions): ICanvas; - - EMPTY_JSON: string; - supports(methodName: string): boolean; - prototype: any; - } - - var Color: { - /** - * Color class - * The purpose of Color is to abstract and encapsulate common color operations; - * @param {String} color optional in hex or rgb(a) format - */ - new (color?: string): IColor; - - /** - * Returns new color object, when given a color in RGB format - * @param {String} color Color value ex: rgb(0-255,0-255,0-255) - */ - fromRgb(color): IColor - /** - * Returns new color object, when given a color in RGBA format - * @param {String} color Color value ex: rgb(0-255,0-255,0-255) - */ - fromRgba(color): IColor - /** - * Returns array represenatation (ex: [100, 100, 200, 1]) of a color that's in RGB or RGBA format - * @param {String} color Color value ex: rgb(0-255,0-255,0-255), rgb(0%-100%,0%-100%,0%-100%) - */ - sourceFromRgb(color: string): number[]; - /** - * Returns new color object, when given a color in HSL format - * @param {String} color Color value ex: hsl(0-260,0%-100%,0%-100%) - */ - fromHsl(color: string): IColor - /** - * Returns new color object, when given a color in HSLA format - * @param {String} color Color value ex: hsl(0-260,0%-100%,0%-100%) - */ - fromHsla(color: string): IColor - /** - * Returns array represenatation (ex: [100, 100, 200, 1]) of a color that's in HSL or HSLA format. - * @param {String} color Color value ex: hsl(0-360,0%-100%,0%-100%) or hsla(0-360,0%-100%,0%-100%, 0-1) - */ - sourceFromHsl(color: string): number[]; - /** - * Returns new color object, when given a color in HEX format - * @param {String} color Color value ex: FF5555 - */ - fromHex(color: string): IColor - - /** - * Returns array represenatation (ex: [100, 100, 200, 1]) of a color that's in HEX format - * @param {String} color ex: FF5555 - */ - sourceFromHex(color: string): number[]; - /** - * Returns new color object, when given color in array representation (ex: [200, 100, 100, 0.5]) - * @param {Array} source - */ - fromSource(source: number[]): IColor; - prototype: any; - } - var Pattern: { - new (options: IPatternOptions): IPattern; - - prototype: any; - } - - var Circle: { - ATTRIBUTE_NAMES: string[]; - fromElement(element: SVGElement, options: ICircleOptions): ICircle; - fromObject(object): ICircle; - new (options?: ICircleOptions): ICircle; - prototype: any; - } - - var Group: { - new (items?: any[], options?: IObjectOptions): IGroup; - } - - var Line: { - ATTRIBUTE_NAMES: string[]; - fromElement(element: SVGElement, options): ILine; - fromObject(object): ILine; - prototype: any; - new (points: number[], objObjects?: IObjectOptions): ILine; - } - - var Intersection: { - intersectLineLine(a1, a2, b1, b2); - intersectLinePolygon(a1, a2, points); - intersectPolygonPolygon(points1, points2); - intersectPolygonRectangle(points, r1, r2); - } - - var Path: { - fromElement(element: SVGElement, options): IPath; - fromObject(object): IPath; - new (): IPath; - } - - var PathGroup: { - fromObject(object): IPathGroup; - new (): IPathGroup; - prototype: any; - } - - var Point: { - new (x, y): IPoint; - prototype: any; - } - - var Object: { - prototype: any; - } - - var Polygon: { - fromObject(object): IPolygon; - fromElement(element: SVGElement, options): IPolygon; - new (points: any[], options?: IObjectOptions, skipOffset?: boolean): IPolygon; - prototype: any; - } - - var Polyline: { - fromObject(object): IPolyline; - fromElement(element: SVGElement, options): IPolyline; - new (): IPolyline; - prototype: any; - } - - var Text: { - new (text: string, options?: IITextOptions): IText; - } - - var Image: { - fromURL(url: string, callback?: (image: IImage) => any, objObjects?: IObjectOptions): IImage; - new (element: HTMLImageElement, objObjects: IObjectOptions): IImage; - prototype: any; - - filters: - { - Grayscale: { - new (): IGrayscaleFilter; - }; - Brightness: { - new (options?: { brightness: number; }): IBrightnessFilter; - }; - RemoveWhite: { - new (options?: { - threshold?: string; // TODO: Check this - distance?: string; // TODO: Check this - }): IRemoveWhiteFilter; - }; - Invert: { - new (): IInvertFilter; - }; - Sepia: { - new (): ISepiaFilter; - }; - Sepia2: { - new (): ISepia2Filter; - }; - Noise: { - new (options?: { - noise?: number; - }): INoiseFilter; - }; - GradientTransparency: { - new (options?: { - threshold?: number; - }): IGradientTransparencyFilter; - }; - Pixelate: { - new (options?: { - color?: any; - }): IPixelateFilter; - }; - Convolute: { - new (options?: { - matrix: any; - }): IConvoluteFilter; - }; - }; - - } /////////////////////////////////////////////////////////////////////////////// - // Fabric ulit Interface + // Fabric util Interface ////////////////////////////////////////////////////////////////////////////// - var util: { - addClass(element: HTMLElement, className: string); - addListener(element, eventName: string, handler); - animate(options: { - onChange?: (value: number) => void; - onComplete?: () => void; - startValue?: number; - endValue?: number; - byValue?: number; - easing?: (currentTime, startValue, byValue, duration) => number; - duration?: number; - }); - createClass(parent, properties); + // animations + interface IUtilAnimationOptions { + /** + * Starting value + */ + startValue?: number; + /** + * Ending value + */ + endValue?: number; + /** + * Value to modify the property by + */ + byValue: number; + /** + * Duration of change (in ms) + */ + duration?: number; + /** + * Callback; invoked on every value change + */ + onChange?: Function; + /** + * Callback; invoked when value change is completed + */ + onComplete?: Function + /** + * Easing function + */ + easing?: Function; + } + interface IUtilAnimation { + /** + * Changes value from one to another within certain period of time, invoking callbacks as value is being changed. + * @param {Object} [options] Animation options + */ + animate(options?: IUtilAnimationOptions): void; + /** + * requestAnimationFrame polyfill based on http://paulirish.com/2011/requestanimationframe-for-smart-animating/ + * In order to get a precise start time, `requestAnimFrame` should be called as an entry into the method + * @param {Function} callback Callback to invoke + */ + requestAnimFrame(callback: Function): void; + } + + // anim_ease + interface anim_ease { + easeInBack(): Function; + easeInBounce(): Function; + easeInCirc(): Function; + easeInCubic(): Function; + easeInElastic(): Function; + easeInExpo(): Function; + easeInOutBack(): Function; + easeInOutBounce(): Function; + easeInOutCirc(): Function; + easeInOutCubic(): Function; + easeInOutElastic(): Function; + easeInOutExpo(): Function; + easeInOutQuad(): Function; + easeInOutQuart(): Function; + easeInOutQuint(): Function; + easeInOutSine(): Function; + easeInQuad(): Function; + easeInQuart(): Function; + easeInQuint(): Function; + easeInSine(): Function; + easeOutBack(): Function; + easeOutBounce(): Function; + easeOutCirc(): Function; + easeOutCubic(): Function; + easeOutElastic(): Function; + easeOutExpo(): Function; + easeOutQuad(): Function; + easeOutQuart(): Function; + easeOutQuint(): Function; + easeOutSine(): Function; + } + + interface IUtilArc { + /** + * Draws arc + * @param {CanvasRenderingContext2D} ctx + * @param {Number} fx + * @param {Number} fy + * @param {Array} coords + */ + drawArc(ctx: CanvasRenderingContext2D, fx: number, fy: number, coords: number[]): void; + /** + * Calculate bounding box of a elliptic-arc + * @param {Number} fx start point of arc + * @param {Number} fy + * @param {Number} rx horizontal radius + * @param {Number} ry vertical radius + * @param {Number} rot angle of horizontal axe + * @param {Number} large 1 or 0, whatever the arc is the big or the small on the 2 points + * @param {Number} sweep 1 or 0, 1 clockwise or counterclockwise direction + * @param {Number} tx end point of arc + * @param {Number} ty + */ + getBoundsOfArc(fx: number, fy: number, rx: number, ry: number, rot: number, large: number, sweep: number, tx: number, ty: number): IPoint[]; + /** + * Calculate bounding box of a beziercurve + * @param {Number} x0 starting point + * @param {Number} y0 + * @param {Number} x1 first control point + * @param {Number} y1 + * @param {Number} x2 secondo control point + * @param {Number} y2 + * @param {Number} x3 end of beizer + * @param {Number} y3 + */ + getBoundsOfCurve(x0: number, y0: number, x1: number, y1: number, x2: number, y2: number, x3: number, y3: number): IPoint[]; + + } + + interface IUtilDomEvent { + /** + * Cross-browser wrapper for getting event's coordinates + * @param {Event} event Event object + * @param {HTMLCanvasElement} upperCanvasEl <canvas> element on which object selection is drawn + */ + getPointer(event: Event, upperCanvasEl: HTMLCanvasElement): IPoint; + + /** + * Adds an event listener to an element + * @param {HTMLElement} element + * @param {String} eventName + * @param {Function} handler + */ + addListener(element: HTMLElement, eventName: string, handler: Function): void; + + /** + * Removes an event listener from an element + * @param {HTMLElement} element + * @param {String} eventName + * @param {Function} handler + */ + removeListener(element: HTMLElement, eventName: string, handler: Function): void; + } + + interface IUtilDomMisc { + /** + * Takes id and returns an element with that id (if one exists in a document) + * @param {String|HTMLElement} id + */ + getById(id: string|HTMLElement): HTMLElement; + /** + * Converts an array-like object (e.g. arguments or NodeList) to an array + * @param {Object} arrayLike + */ + toArray(arrayLike: any): any[]; + /** + * Creates specified element with specified attributes + * @memberOf fabric.util + * @param {String} tagName Type of an element to create + * @param {Object} [attributes] Attributes to set on an element + * @return {HTMLElement} Newly created element + */ + makeElement(tagName: string, attributes?: any): HTMLElement; + /** + * Adds class to an element + * @param {HTMLElement} element Element to add class to + * @param {String} className Class to add to an element + */ + addClass(element: HTMLElement, classname: string): void; + /** + * Wraps element with another element + * @param {HTMLElement} element Element to wrap + * @param {HTMLElement|String} wrapper Element to wrap with + * @param {Object} [attributes] Attributes to set on a wrapper + */ + wrapElement(element: HTMLElement, wrapper: HTMLElement|string, attributes?: any): HTMLElement; + /** + * Returns element scroll offsets + * @param {HTMLElement} element Element to operate on + * @param {HTMLElement} upperCanvasEl Upper canvas element + */ + getScrollLeftTop(element: HTMLElement, upperCanvasEl: HTMLElement): { left: number; right: number; } + /** + * Returns offset for a given element + * @param {HTMLElement} element Element to get offset for + */ + getElementOffset(element: HTMLElement): { left: number; right: number; } + /** + * Returns style attribute value of a given element + * @param {HTMLElement} element Element to get style attribute for + * @param {String} attr Style attribute to get for element + */ + getElementStyle(elment: HTMLElement, attr: string): string; + /** + * Inserts a script element with a given url into a document; invokes callback, when that script is finished loading + * @memberOf fabric.util + * @param {String} url URL of a script to load + * @param {Function} callback Callback to execute when script is finished loading + */ + getScript(url: string, callback: Function): void; + /** + * Makes element unselectable + * @param {HTMLElement} element Element to make unselectable + */ + makeElementUnselectable(element: HTMLElement): HTMLElement; + /** + * Makes element selectable + * @param {HTMLElement} element Element to make selectable + */ + makeElementSelectable(element: HTMLElement): HTMLElement; + } + + interface IUtilDomRequest { + /** + * Cross-browser abstraction for sending XMLHttpRequest + * @param {String} url URL to send XMLHttpRequest to + * @param {Object} [options] Options object + * @param {String} [options.method="GET"] + * @param {Function} options.onComplete Callback to invoke when request is completed + */ + request(url: string, options?: { method?: string; onComplete: Function }): XMLHttpRequest; + } + + interface IUtilDomStyle { + /** + * Cross-browser wrapper for setting element's style + * @param {HTMLElement} element + * @param {Object} styles + */ + setStyle(element: HTMLElement, styles: any): HTMLElement; + } + + interface IUtilArray { + /** + * Invokes method on all items in a given array + * @param {Array} array Array to iterate over + * @param {String} method Name of a method to invoke + */ + invoke(array: any[], method: string): any[]; + /** + * Finds minimum value in array (not necessarily "first" one) + * @param {Array} array Array to iterate over + * @param {String} byProperty + */ + min(array: any[], byProperty: string): any; + /** + * Finds maximum value in array (not necessarily "first" one) + * @param {Array} array Array to iterate over + * @param {String} byProperty + */ + max(array: any[], byProperty: string): any; + } + + interface IUtilClass { + /** + * Helper for creation of "classes". + * @param {Function} [parent] optional "Class" to inherit from + * @param {Object} [properties] Properties shared by all instances of this class + * (be careful modifying objects defined here as this would affect all instances) + */ + createClass(parent: Function, properties?: any); + /** + * Helper for creation of "classes". + * @param {Object} [properties] Properties shared by all instances of this class + * (be careful modifying objects defined here as this would affect all instances) + */ + createClass(properties?: any); + + } + + interface IUtilObject { + /** + * Copies all enumerable properties of one object to another + * @param {Object} destination Where to copy to + * @param {Object} source Where to copy from + */ + extend(destination: any, source: any): any; + + /** + * Creates an empty object and copies all enumerable properties of another object to it + * @memberOf fabric.util.object + * @param {Object} object Object to clone + * @return {Object} + */ + clone(object: any): any + } + + interface IUtilString { + /** + * Camelizes a string + * @param {String} string String to camelize + */ + camelize(string: string): string; + + /** + * Capitalizes a string + * @param {String} string String to capitalize + * @param {Boolean} [firstLetterOnly] If true only first letter is capitalized + * and other letters stay untouched, if false first letter is capitalized + * and other letters are converted to lowercase. + */ + capitalize(string: string, firstLetterOnly: boolean): string; + + /** + * Escapes XML in a string + * @param {String} string String to escape + */ + escapeXml(string: string): string; + } + + interface IUtilMisc { + /** + * Removes value from an array. + * Presence of value (and its position in an array) is determined via `Array.prototype.indexOf` + * @param {Array} array + * @param {Any} value + */ + removeFromArray(array: any[], value: any): any[]; + + /** + * Returns random number between 2 specified ones. + * @param {Number} min lower limit + * @param {Number} max upper limit + */ + getRandomInt(min: number, max: number): number; + + /** + * Transforms degrees to radians. + * @param {Number} degrees value in degrees + */ degreesToRadians(degrees: number): number; - falseFunction(): () => boolean; - getById(id: HTMLElement): HTMLElement; - getById(id: string): HTMLElement; - getElementOffset(element): { left: number; top: number; }; - getPointer(event: Event); - getRandomInt(min: number, max: number); - getScript(url: string, callback); - groupSVGElements(elements: any[], options?: any): IPathGroup; - loadImage(url: string, callback: (image: HTMLImageElement) => any, context?: any, crossOrigin?: any); - makeElement(tagName: string, attributes); - makeElementSelectable(element: HTMLElement); - makeElementUnselectable(element: HTMLElement); - populateWithProperties(source, destination, properties): any[]; + + /** + * Transforms radians to degrees. + * @memberOf fabric.util + * @param {Number} radians value in radians + */ radiansToDegrees(radians: number): number; - removeFromArray(array: any[], value); - removeListener(element: HTMLElement, eventName, handler); - request(url, options); - requestAnimFrame(callback, element); - setStyle(element: HTMLElement, styles); - toArray(arrayLike): any[]; - toFixed(number, fractionDigits); - wrapElement(element: HTMLElement, wrapper, attributes); - rotatePoint(point: IPoint, origin: IPoint, radians: number); - transformPoint(p: IPoint, t: any[], ignoreOffset: boolean); - invertTransform(t: any[]); - parseUnit(value: number|string, fontSize?: number); - getKlass(type: string, namespace: string); - resolveNamespace(namespace: string); - enlivenObjects(objects: any[], callback: Function, namespace: string, reviver?: Function); - drawDashedLine(ctx: CanvasRenderingContext2D, x: number, y: number, x2: number, y2: number, da: any[]); - createCanvasElement(canvasEl?: HTMLElement); - createImage(); - createAccessors(klass: Object); - clipContext(receiver: IObject, ctx: CanvasRenderingContext2D); - isTransparent(ctx: CanvasRenderingContext2D, x: number, y: number, tolerance: number); - object: { - clone(object: any): any - extends(destination: any, source: any): any - }; - ease: { - easeInBack(): Function; - easeInBounce(): Function; - easeInCirc(): Function; - easeInCubic(): Function; - easeInElastic(): Function; - easeInExpo(): Function; - easeInOutBack(): Function; - easeInOutBounce(): Function; - easeInOutCirc(): Function; - easeInOutCubic(): Function; - easeInOutElastic(): Function; - easeInOutExpo(): Function; - easeInOutQuad(): Function; - easeInOutQuart(): Function; - easeInOutQuint(): Function; - easeInOutSine(): Function; - easeInQuad(): Function; - easeInQuart(): Function; - easeInQuint(): Function; - easeInSine(): Function; - easeOutBack(): Function; - easeOutBounce(): Function; - easeOutCirc(): Function; - easeOutCubic(): Function; - easeOutElastic(): Function; - easeOutExpo(): Function; - easeOutQuad(): Function; - easeOutQuart(): Function; - easeOutQuint(): Function; - easeOutSine(): Function; - }; + /** + * Rotates `point` around `origin` with `radians` + * @param {fabric.Point} point The point to rotate + * @param {fabric.Point} origin The origin of the rotation + * @param {Number} radians The radians of the angle for the rotation + */ + rotatePoint(point: IPoint, origin: IPoint, radians: number): IPoint; + + /** + * Apply transform t to point p + * @param {fabric.Point} p The point to transform + * @param {Array} t The transform + * @param {Boolean} [ignoreOffset] Indicates that the offset should not be applied + */ + transformPoint(p: IPoint, t: any[], ignoreOffset?: boolean): IPoint + + /** + * Invert transformation t + * @param {Array} t The transform + */ + invertTransform(t: any[]): any[]; + + /** + * A wrapper around Number#toFixed, which contrary to native method returns number, not string. + * @param {Number|String} number number to operate on + * @param {Number} fractionDigits number of fraction digits to "leave" + */ + toFixed(number: number, fractionDigits: number): number; + + /** + * Converts from attribute value to pixel value if applicable. + * Returns converted pixels or original value not converted. + * @param {Number|String} value number to operate on + */ + parseUnit(value: number|string, fontSize?: number): number|string; + + /** + * Function which always returns `false`. + */ + falseFunction(): boolean + + /** + * Returns klass "Class" object of given namespace + * @param {String} type Type of object (eg. 'circle') + * @param {String} namespace Namespace to get klass "Class" object from + */ + getKlass(type: string, namespace: string): any; + + /** + * Returns object of given namespace + * @param {String} namespace Namespace string e.g. 'fabric.Image.filter' or 'fabric' + */ + resolveNamespace(namespace: string): any; + + /** + * Loads image element from given url and passes it to a callback + * @param {String} url URL representing an image + * @param {Function} callback Callback; invoked with loaded image + * @param {Any} [context] Context to invoke callback in + * @param {Object} [crossOrigin] crossOrigin value to set image element to + */ + loadImage(url: string, callback: (image: HTMLImageElement) => {}, context?: any, crossOrigin?: boolean): void; + + /** + * Creates corresponding fabric instances from their object representations + * @param {Array} objects Objects to enliven + * @param {Function} callback Callback to invoke when all objects are created + * @param {String} namespace Namespace to get klass "Class" object from + * @param {Function} reviver Method for further parsing of object elements, called after each fabric object created. + */ + enlivenObjects(objects: any[], callback: Function, namespace: string, reviver?: Function): void; + + /** + * Groups SVG elements (usually those retrieved from SVG document) + * @param {Array} elements SVG elements to group + * @param {Object} [options] Options object + */ + groupSVGElements(elements: any[], options?: any, path?: any): IPathGroup + + /** + * Populates an object with properties of another object + * @param {Object} source Source object + * @param {Object} destination Destination object + * @param {Array} properties Propertie names to include + */ + populateWithProperties(source: any, destination: any, properties: any): void; + + /** + * Draws a dashed line between two points + * + * This method is used to draw dashed line around selection area. + * + * @param {CanvasRenderingContext2D} ctx context + * @param {Number} x start x coordinate + * @param {Number} y start y coordinate + * @param {Number} x2 end x coordinate + * @param {Number} y2 end y coordinate + * @param {Array} da dash array pattern + */ + drawDashedLine(ctx: CanvasRenderingContext2D, x: number, y: number, x2: number, y2: number, da: any[]): void; + + /** + * Creates canvas element and initializes it via excanvas if necessary + * @param {CanvasElement} [canvasEl] optional canvas element to initialize; + * when not given, element is created implicitly + */ + createCanvasElement(canvasEl?: HTMLCanvasElement): HTMLCanvasElement; + + /** + * Creates image element (works on client and node) + */ + createImage(): HTMLImageElement; + + /** + * Creates accessors (getXXX, setXXX) for a "class", based on "stateProperties" array + * @param {Object} klass "Class" to create accessors for + */ + createAccessors(klass: any): any; + + /** + * @param {fabric.Object} receiver Object implementing `clipTo` method + * @param {CanvasRenderingContext2D} ctx Context to clip + */ + clipContext(receiver: IObject, ctx: CanvasRenderingContext2D): void; + + /** + * Multiply matrix A by matrix B to nest transformations + * @param {Array} a First transformMatrix + * @param {Array} b Second transformMatrix + */ + multiplyTransformMatrices(a: any[], b: any[]): any[] + + /** + * Returns string representation of function body + * @param {Function} fn Function to get body of + */ + getFunctionBody(fn: Function): string; + + /** + * Returns true if context has transparent pixel + * at specified location (taking tolerance into account) + * @param {CanvasRenderingContext2D} ctx context + * @param {Number} x x coordinate + * @param {Number} y y coordinate + * @param {Number} tolerance Tolerance + */ + isTransparent(ctx: CanvasRenderingContext2D, x: number, y: number, tolerance: number): boolean; + } + interface Util extends IUtilAnimation, IUtilArc, IObservable, IUtilDomEvent, IUtilDomMisc, + IUtilDomRequest, IUtilDomStyle, IUtilClass, IUtilMisc { + ease: anim_ease; + array: IUtilArray; + object: IUtilObject; + string: IUtilString; } } From 334c6d982d8aa021ef2f727c323eb6d59e298fb3 Mon Sep 17 00:00:00 2001 From: Aleksey Blokhin Date: Fri, 15 May 2015 20:49:11 +0300 Subject: [PATCH 045/179] Fixed character case. --- angular-translate/angular-translate.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/angular-translate/angular-translate.d.ts b/angular-translate/angular-translate.d.ts index bfc573dcc..1785fc37a 100644 --- a/angular-translate/angular-translate.d.ts +++ b/angular-translate/angular-translate.d.ts @@ -26,7 +26,7 @@ declare module angular.translate { set(name: string, value: string): void; } - interface ISTaticFilesLoaderOptions { + interface IStaticFilesLoaderOptions { prefix: string; suffix: string; key?: string; @@ -78,7 +78,7 @@ declare module angular.translate { storageKey(): string; storageKey(key: string): void; // JeroMiya - the library should probably return ITranslateProvider but it doesn't here useUrlLoader(url: string): ITranslateProvider; - useStaticFilesLoader(options: ISTaticFilesLoaderOptions): ITranslateProvider; + useStaticFilesLoader(options: IStaticFilesLoaderOptions): ITranslateProvider; useLoader(loaderFactory: string, options: any): ITranslateProvider; useLocalStorage(): ITranslateProvider; useCookieStorage(): ITranslateProvider; From c512d9c0c2edce37a57932ad0dc5276471b7afb5 Mon Sep 17 00:00:00 2001 From: Aleksey Blokhin Date: Fri, 15 May 2015 20:51:21 +0300 Subject: [PATCH 046/179] Updated and added interfaces. - added common interface IPartialLoader; - updated for ITranslatePartialLoaderService; - added interface for ITranslatePartialLoaderProvider. --- angular-translate/angular-translate.d.ts | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/angular-translate/angular-translate.d.ts b/angular-translate/angular-translate.d.ts index 1785fc37a..c32ba59b7 100644 --- a/angular-translate/angular-translate.d.ts +++ b/angular-translate/angular-translate.d.ts @@ -6,13 +6,7 @@ /// declare module angular.translate { - - interface ITranslatePartialLoaderService { - addPart(name: string): ITranslatePartialLoaderService; - deletePart(name: string, removeData?: boolean): ITranslatePartialLoaderService; - isPartAvailable(name: string): boolean; - } - + interface ITranslationTable { [key: string]: string; } @@ -32,6 +26,21 @@ declare module angular.translate { key?: string; } + interface IPartialLoader { + addPart(name : string, priority : number) : T; + setPart(lang : string, part : string, table : ITranslationTable) + deletePart(name : string) : T; + isPartAvailable(name : string) : boolean; + } + + interface ITranslatePartialLoaderService extends IPartialLoader { + getRegisteredParts() : Array; + isPartLoaded(name : string, lang : string) : boolean; + } + + interface ITranslatePartialLoaderProvider extends angular.IServiceProvider, IPartialLoader { + } + interface ITranslateService { (translationId: string, interpolateParams?: any, interpolationId?: string): angular.IPromise; (translationId: string[], interpolateParams?: any, interpolationId?: string): angular.IPromise<{ [key: string]: string }>; From f03d80a83b1cc57726fd9545f97281bf35774bf7 Mon Sep 17 00:00:00 2001 From: Aleksey Blokhin Date: Fri, 15 May 2015 21:01:26 +0300 Subject: [PATCH 047/179] Fixed missing return type. --- angular-translate/angular-translate.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/angular-translate/angular-translate.d.ts b/angular-translate/angular-translate.d.ts index c32ba59b7..b191bf455 100644 --- a/angular-translate/angular-translate.d.ts +++ b/angular-translate/angular-translate.d.ts @@ -28,7 +28,7 @@ declare module angular.translate { interface IPartialLoader { addPart(name : string, priority : number) : T; - setPart(lang : string, part : string, table : ITranslationTable) + setPart(lang : string, part : string, table : ITranslationTable) : T; deletePart(name : string) : T; isPartAvailable(name : string) : boolean; } From 7521e83e3d73c60d159fe1c687a898e04adab7a8 Mon Sep 17 00:00:00 2001 From: Joseph Livecchi Date: Fri, 15 May 2015 17:30:20 -0400 Subject: [PATCH 048/179] checked and updated static func on fabric.d.ts * Edit and Modified the static functions for fabric and shaes namespaces * Added more JSDoc comments * Started filters rewrite --- fabricjs/fabricjs.d.ts | 2014 +++++++++++++++++++++++----------------- 1 file changed, 1175 insertions(+), 839 deletions(-) diff --git a/fabricjs/fabricjs.d.ts b/fabricjs/fabricjs.d.ts index 31b12db1e..048c915df 100644 --- a/fabricjs/fabricjs.d.ts +++ b/fabricjs/fabricjs.d.ts @@ -5,7 +5,7 @@ // Support AMD require declare module "fabric" { - export = fabric; + export = fabric; } declare module fabric { @@ -14,22 +14,92 @@ declare module fabric { var isTouchSupported: boolean; ///////////////////////////////////////////////////////////// - // Functions + // farbic Functions ///////////////////////////////////////////////////////////// function createCanvasForNode(width: number, height: number): ICanvas; - function getCSSRules(doc: SVGElement); - function getGradientDefs(doc: SVGElement); - // Parser - function loadSVGFromString(text: string, callback: (results: IObject[], options) => void, reviver?: (el, obj) => void); + // Parse + // ---------------------------------------------------------- + /** + * Creates markup containing SVG referenced elements like patterns, gradients etc. + * @param {fabric.Canvas} canvas instance of fabric.Canvas + */ + function createSVGRefElementsMarkup(canvas: IStaticCanvas): string; + /** + * Creates markup containing SVG font faces + * @param {Array} objects Array of fabric objects + */ + function createSVGFontFacesMarkup(objects: IObject[]): string; + /** + * Takes string corresponding to an SVG document, and parses it into a set of fabric objects + * @param {String} string + * @param {Function} callback + * @param {Function} [reviver] Method for further parsing of SVG elements, called after each fabric object created. + */ + function loadSVGFromString(string: string, callback: (results: IObject[], options) => void, reviver?: (el, obj) => void); + /** + * Takes url corresponding to an SVG document, and parses it into a set of fabric objects. Note that SVG is fetched via XMLHttpRequest, so it needs to conform to SOP (Same Origin Policy) + * @param {String} url + * @param {Function} callback + * @param {Function} [reviver] Method for further parsing of SVG elements, called after each fabric object created. + */ function loadSVGFromURL(url, callback: (results: IObject[], options) => void, reviver?: (el, obj) => void); - function parseAttributes(element, attributes: any[]): any; + /** + * Returns CSS rules for a given SVG document + * @param {SVGDocument} doc SVG document to parse + */ + function getCSSRules(doc: SVGElement): any; + function parseElements(elements: any[], callback, options, reviver); + /** + * Parses "points" attribute, returning an array of values + * @param {String} points points attribute string + */ function parsePointsAttribute(points: string): any[]; - function parseStyleAttribute(element: SVGElement); + /** + * Parses "style" attribute, retuning an object with values + * @param {SVGElement} element Element to parse + */ + function parseStyleAttribute(element: SVGElement): any; + /** + * Transforms an array of svg elements to corresponding fabric.* instances + * @param {Array} elements Array of elements to parse + * @param {Function} callback Being passed an array of fabric instances (transformed from SVG elements) + * @param {Object} [options] Options object + * @param {Function} [reviver] Method for further parsing of SVG elements, called after each fabric object created. + */ + function parseElements(elements: any[], callback: Function, options?: any, reviver?: Function): void; + /** + * Returns an object of attributes' name/value, given element and an array of attribute names; + * Parses parent "g" nodes recursively upwards. + * @param {DOMElement} element Element to parse + * @param {Array} attributes Array of attributes to parse + */ + function parseAttributes(elemen: HTMLElement, attributes: string[], svgUid?: string): { [key: string]: string } + /** + * Parses an SVG document, returning all of the gradient declarations found in it + * @param {SVGDocument} doc SVG document to parse + */ + function getGradientDefs(doc: SVGElement): { [key: string]: any }; + /** + * Parses a short font declaration, building adding its properties to a style object + * @param {String} value font declaration + * @param {Object} oStyle definition + */ + function parseFontDeclaration(value: string, oStyle: any): void; + /** + * Parses an SVG document, converts it to an array of corresponding fabric.* instances and passes them to a callback + * @param {SVGDocument} doc SVG document to parse + * @param {Function} callback Callback to call when parsing is finished; It's being passed an array of elements (parsed from a document). + * @param {Function} [reviver] Method for further parsing of SVG elements, called after each fabric object created. + */ function parseSVGDocument(doc: SVGElement, callback: (results, options) => void, reviver?: (el, obj) => void); - function parseTransformAttribute(attributeValue: string); + /** + * Parses "transform" attribute, returning an array of values + * @param {String} attributeValue String containing attribute value + */ + function parseTransformAttribute(attributeValue: string): number[]; // fabric Log // --------------- @@ -55,6 +125,7 @@ declare module fabric { var Point: IPointStatic var Circle: ICircleStatic; + var Ellipse: IEllipseStatic; var Group: IGroupStatic; var Image: IImageStatic var Line: ILineStatic; @@ -64,7 +135,9 @@ declare module fabric { var Polygon: IPolygonStatic var Polyline: IPolylineStatic; var Rect: IRectStatic; + var Shadow: IShadowStatic; var Text: ITextStatic; + var IText: IITextStatic; var Triangle: ITriangleStatic var util: Util; @@ -128,40 +201,6 @@ declare module fabric { offsetY?: number; } - interface IGradientOptions { - /** - * @param {String} [options.type] Type of gradient 'radial' or 'linear' - */ - type?: string; - /** - * x-coordinate of start point - */ - x1?: number; - /** - * y-coordinate of start point - */ - y1?: number; - /** - * x-coordinate of end point - */ - x2?: number; - /** - * y-coordinate of end point - */ - y2?: number; - /** - * Radius of start point (only for radial gradients) - */ - r1?: number; - /** - * Radius of end point (only for radial gradients) - */ - r2?: number; - /** - * Color stops object eg. {0:string; 1:string; - */ - colorStops?: any; - } interface IToSVGOptions { /** @@ -511,11 +550,78 @@ declare module fabric { prototype: any; } - - interface IGradient { - initialize(options): any; + interface IGradientOptions { + /** + * @param {String} [options.type] Type of gradient 'radial' or 'linear' + */ + type?: string; + /** + * x-coordinate of start point + */ + x1?: number; + /** + * y-coordinate of start point + */ + y1?: number; + /** + * x-coordinate of end point + */ + x2?: number; + /** + * y-coordinate of end point + */ + y2?: number; + /** + * Radius of start point (only for radial gradients) + */ + r1?: number; + /** + * Radius of end point (only for radial gradients) + */ + r2?: number; + /** + * Color stops object eg. {0:string; 1:string; + */ + colorStops?: any; + } + interface IGradient extends IGradientOptions { + /** + * Adds another colorStop + * @param {Object} colorStop Object with offset and color + */ + addColorStop(colorStop: any): IGradient; + /** + * Returns object representation of a gradient + */ toObject(): any; - toLiveGradient(ctx: CanvasRenderingContext2D): any; + /** + * Returns SVG representation of an gradient + * @param {Object} object Object to create a gradient for + * @param {Boolean} normalize Whether coords should be normalized + * @return {String} SVG representation of an gradient (linear/radial) + */ + toSVG(object: IObject, normalize?: boolean): string; + + /** + * Returns an instance of CanvasGradient + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + toLive(ctx: CanvasRenderingContext2D, object?: IPathGroup): CanvasGradient; + } + interface IGrandientStatic { + new (options?: IGradientOptions): IGradient; + /** + * Returns instance from an SVG element + * @param {SVGGradientElement} el SVG gradient element + * @param {fabric.Object} instance + */ + fromElement(el: SVGGradientElement, instance: IObject): IGradient; + /** + * Returns instance from its object representation + * @param {Object} obj + * @param {Object} [options] Options object + */ + fromObject(obj: any, options: any[]): IGradient; } interface IIntersection { @@ -526,11 +632,13 @@ declare module fabric { /** * Appends points to intersection */ - appendPoints(point: IPoint); - - init(status?: string); + appendPoints(points: IPoint[]); } interface IIntersectionStatic { + /** + * Intersection class + */ + new (status?: string); /** * Checks if polygon intersects another polygon */ @@ -549,6 +657,50 @@ declare module fabric { intersectPolygonRectangle(points: IPoint[], r1: number, r2: number): IIntersection; } + interface IPatternOptions { + /** + * Repeat property of a pattern (one of repeat, repeat-x, repeat-y or no-repeat) + */ + repeat: string; + + /** + * Pattern horizontal offset from object's left/top corner + */ + offsetX: number; + + /** + * Pattern vertical offset from object's left/top corner + */ + offsetY: number; + /** + * The source for the pattern + */ + source: string|HTMLImageElement; + } + interface IPattern extends IPatternOptions { + new (options?: IPatternOptions): IPattern; + + initialise(options?: IPatternOptions): IPattern; + /** + * Returns an instance of CanvasPattern + */ + toLive(ctx: CanvasRenderingContext2D): IPattern; + + /** + * Returns object representation of a pattern + */ + toObject(): any; + /** + * Returns SVG representation of a pattern + * @param {fabric.Object} object + */ + toSVG(object: IObject): string; + } + interface IPatternStatic { + new (options?: IPatternOptions): IPattern; + prototype: any; + } + interface IPoint { x: number; y: number; @@ -784,6 +936,10 @@ declare module fabric { */ reOffsetsAndBlur: RegExp } + interface IShadowStatic { + new (options?: IShadowOptions): IShadow + reOffsetsAndBlur: RegExp; + } /////////////////////////////////////////////////////////////////////////////// // Canvas Interfaces @@ -798,7 +954,6 @@ declare module fabric { */ height: number; } - interface ICanvasDimensionsOptions { /** * Set the given dimensions only as canvas backstore dimensions @@ -810,6 +965,83 @@ declare module fabric { cssOnly?: boolean; } + interface IStaticCanvasOptions { + /** + * Indicates whether the browser can be scrolled when using a touchscreen and dragging on the canvas + */ + allowTouchScrolling?: boolean; + /** + * Indicates whether this canvas will use image smoothing, this is on by default in browsers + */ + imageSmoothingEnabled?: boolean; + + /** + * Indicates whether objects should remain in current stack position when selected. When false objects are brought to top and rendered as part of the selection group + */ + preserveObjectStacking?: boolean; + + /** + * The transformation (in the format of Canvas transform) which focuses the viewport + */ + viewportTransform?: number[]; + + + + freeDrawingColor?: string; + freeDrawingLineWidth?: number; + + /** + * Background color of canvas instance. + * Should be set via setBackgroundColor + */ + backgroundColor?: string | IPattern; + /** + * Background image of canvas instance. + * Should be set via setBackgroundImage + * Backwards incompatibility note: The "backgroundImageOpacity" and "backgroundImageStretch" properties are deprecated since 1.3.9. + */ + backgroundImage?: IImage; + backgroundImageOpacity?: number; + backgroundImageStretch?: number; + /** + * Function that determines clipping of entire canvas area + * Being passed context as first argument. See clipping canvas area + */ + clipTo?: (context: CanvasRenderingContext2D) => void; + + /** + * Indicates whether object controls (borders/controls) are rendered above overlay image + */ + controlsAboveOverlay?: boolean; + + /** + * Indicates whether toObject/toDatalessObject should include default values + */ + includeDefaultValues?: boolean; + /** + * Overlay color of canvas instance. + * Should be set via setOverlayColor + */ + overlayColor?: string | IPattern; + /** + * Overlay image of canvas instance. + * Should be set via setOverlayImage + * Backwards incompatibility note: The "overlayImageLeft" and "overlayImageTop" properties are deprecated since 1.3.9. + */ + overlayImage?: IImage; + overlayImageLeft?: number; + overlayImageTop?: number; + /** + * Indicates whether add, insertAt and remove should also re-render canvas. + * Disabling this option could give a great performance boost when adding/removing a lot of objects to/from canvas at once + * (followed by a manual rendering after addition/deletion) + */ + renderOnAddRemove?: boolean; + /** + * Indicates whether objects' state should be saved + */ + stateful?: boolean; + } interface IStaticCanvas extends IObservable, IStaticCanvasOptions, ICollection, ICanvasAnimation { /** * Calculates canvas element offset relative to the document @@ -1085,16 +1317,127 @@ declare module fabric { interface IStaticCanvasStatic { /** * Constructor - * @param {HTMLElement | String} element element to initialize instance on + * @param {HTMLElement|String} element element to initialize instance on * @param {Object} [options] Options object */ - new (element: HTMLCanvasElement | string, options?: ICanvasOptions): ICanvas; + new (element: HTMLCanvasElement | string, options?: ICanvasOptions): IStaticCanvas; EMPTY_JSON: string; + /** + * Provides a way to check support of some of the canvas methods + * (either those of HTMLCanvasElement itself, or rendering context) + * @param {String} methodName Method to check support for; Could be one of "getImageData", "toDataURL", "toDataURLWithQuality" or "setLineDash" + */ supports(methodName: string): boolean; prototype: any; + /** + * Returns JSON representation of canvas + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + */ + toJSON(propertiesToInclude?: any[]): string; } + interface ICanvasOptions extends IStaticCanvasOptions { + /** + * When true, objects can be transformed by one side (unproportionally) + */ + uniScaleTransform?: boolean; + + /** + * When true, objects use center point as the origin of scale transformation. + * Backwards incompatibility note: This property replaces "centerTransform" (Boolean). + */ + centeredScaling?: boolean; + + /** + * When true, objects use center point as the origin of rotate transformation. + * Backwards incompatibility note: This property replaces "centerTransform" (Boolean). + */ + centeredRotation?: boolean; + + /** + * Indicates that canvas is interactive. This property should not be changed. + */ + interactive?: boolean; + + /** + * Indicates whether group selection should be enabled + */ + selection?: boolean; + + /** + * Color of selection + */ + selectionColor?: string; + + /** + * Default dash array pattern + * If not empty the selection border is dashed + */ + selectionDashArray?: any[]; + + /** + * Color of the border of selection (usually slightly darker than color of selection itself) + */ + selectionBorderColor?: string; + + /** + * Width of a line used in object/group selection + */ + selectionLineWidth?: number; + + /** + * Default cursor value used when hovering over an object on canvas + */ + hoverCursor?: string; + + /** + * Default cursor value used when moving an object on canvas + */ + moveCursor?: string; + + /** + * Default cursor value used for the entire canvas + */ + defaultCursor?: string; + + /** + * Cursor value used during free drawing + */ + freeDrawingCursor?: string; + + /** + * Cursor value used for rotation point + */ + rotationCursor?: string; + + /** + * Default element class that's given to wrapper (div) element of canvas + */ + containerClass?: string; + + /** + * When true, object detection happens on per-pixel basis rather than on per-bounding-box + */ + perPixelTargetFind?: boolean; + + /** + * Number of pixels around target pixel to tolerate (consider active) during object detection + */ + targetFindTolerance?: number; + + /** + * When true, target detection is skipped when hovering over canvas. This can be used to improve performance. + */ + skipTargetFind?: boolean; + + /** + * When true, mouse events on canvas (mousedown/mousemove/mouseup) result in free drawing. + * After mousedown, mousemove creates a shape, + * and then mouseup finalizes it and adds an instance of `fabric.Path` onto canvas. + */ + isDrawingMode?: boolean; + } interface ICanvas extends IStaticCanvas, ICanvasOptions { // constructors new (element: HTMLCanvasElement|string, options: ICanvasOptions): ICanvas; @@ -1212,10 +1555,22 @@ declare module fabric { new (element: HTMLCanvasElement | string, options?: ICanvasOptions): ICanvas; EMPTY_JSON: string; + /** + * Provides a way to check support of some of the canvas methods + * (either those of HTMLCanvasElement itself, or rendering context) + * @param {String} methodName Method to check support for; Could be one of "getImageData", "toDataURL", "toDataURLWithQuality" or "setLineDash" + */ supports(methodName: string): boolean; prototype: any; + /** + * Returns JSON representation of canvas + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + */ + toJSON(propertiesToInclude?: any[]): string; } + + /////////////////////////////////////////////////////////////////////////////// // Shape Interfaces ////////////////////////////////////////////////////////////////////////////// @@ -1273,9 +1628,24 @@ declare module fabric { toSVG(reviver?: Function): string; } interface ICircleStatic { + /** + * List of attribute names to account for when parsing SVG element (used by {@link fabric.Circle.fromElement}) + */ ATTRIBUTE_NAMES: string[]; + /** + * Returns Circle instance from an SVG element + * @param {SVGElement} element Element to parse + * @param {Object} [options] Options object + */ fromElement(element: SVGElement, options: ICircleOptions): ICircle; - fromObject(object): ICircle; + /** + * Returns Circle instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): ICircle; + /** + * Circle class + */ new (options?: ICircleOptions): ICircle; prototype: any; } @@ -1321,6 +1691,26 @@ declare module fabric { */ complexity(): number; } + interface IEllipseStatic { + new (options?: IEllipseOptions): IEllipse; + /** + * List of attribute names to account for when parsing SVG element (used by {@link fabric.Ellipse.fromElement}) + */ + ATTRIBUTE_NAMES: string[]; + + /** + * Returns Ellipse instance from an SVG element + * @param {SVGElement} element Element to parse + * @param {Object} [options] Options object + */ + fromElement(element: SVGElement, options?: IEllipseOptions): IEllipse + + /** + * Returns Ellipse instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): IEllipse; + } interface IGroup extends IObject, ICollection { initialize(objects?: IObject[], options?: IObjectOptions): any; @@ -1404,7 +1794,18 @@ declare module fabric { toSVG(reviver?: Function): string; } interface IGroupStatic { + /** + * Constructor + * @param {Object} objects Group objects + * @param {Object} [options] Options object + */ new (items?: any[], options?: IObjectOptions): IGroup; + /** + * Returns {@link fabric.Group} instance from an object representation + * @param {Object} object Object to create a group from + * @param {Function} [callback] Callback to invoke when an group instance is created + */ + fromObject(object: any, callback: (group: IGroup) => any): void; } interface IImageOptions extends IObjectOptions { @@ -1511,55 +1912,40 @@ declare module fabric { setSrc(src: string, callback: Function, options: IImageOptions): IImage; } interface IImageStatic { - fromURL(url: string, callback?: (image: IImage) => any, objObjects?: IObjectOptions): IImage; + /** + * Constructor + * @param {HTMLImageElement | String} element Image element + * @param {Object} [options] Options object + */ new (element: HTMLImageElement, objObjects: IObjectOptions): IImage; + /** + * Creates an instance of fabric.Image from an URL string + * @param {String} url URL to create an image from + * @param {Function} [callback] Callback to invoke when image is created (newly created image is passed as a first argument) + * @param {Object} [imgOptions] Options object + */ + fromURL(url: string, callback?: (image: IImage) => any, objObjects?: IObjectOptions): IImage; + /** + * Creates an instance of fabric.Image from its object representation + * @static + * @param {Object} object Object to create an instance from + * @param {Function} [callback] Callback to invoke when an image instance is created + */ + fromObject(object: any, callback: (image: IImage) => {}): void; + /** + * Returns Image instance from an SVG element + * @param {SVGElement} element Element to parse + * @param {Function} callback Callback to execute when fabric.Image object is created + * @param {Object} [options] Options object + */ + fromElement(element: SVGElement, callback: Function, options?: IImageOptions): void; prototype: any; + /** + * Default CSS class name for canvas + */ + CSS_CANVAS: string; - filters: - { - Grayscale: { - new (): IGrayscaleFilter; - }; - Brightness: { - new (options?: { brightness: number; }): IBrightnessFilter; - }; - RemoveWhite: { - new (options?: { - threshold?: string; // TODO: Check this - distance?: string; // TODO: Check this - }): IRemoveWhiteFilter; - }; - Invert: { - new (): IInvertFilter; - }; - Sepia: { - new (): ISepiaFilter; - }; - Sepia2: { - new (): ISepia2Filter; - }; - Noise: { - new (options?: { - noise?: number; - }): INoiseFilter; - }; - GradientTransparency: { - new (options?: { - threshold?: number; - }): IGradientTransparencyFilter; - }; - Pixelate: { - new (options?: { - color?: any; - }): IPixelateFilter; - }; - Convolute: { - new (options?: { - matrix: any; - }): IConvoluteFilter; - }; - }; - + filters: IAllFilters } interface ILineOptions extends IObjectOptions { @@ -1603,10 +1989,24 @@ declare module fabric { } interface ILineStatic { ATTRIBUTE_NAMES: string[]; - fromElement(element: SVGElement, options): ILine; + /** + * Returns fabric.Line instance from an SVG element + * @param {SVGElement} element Element to parse + * @param {Object} [options] Options object + */ + fromElement(element: SVGElement, options?: ILineOptions): ILine; + /** + * Returns fabric.Line instance from an object representation + * @param {Object} object Object to create an instance from + */ fromObject(object): ILine; prototype: any; - new (points: number[], objObjects?: IObjectOptions): ILine; + /** + * Constructor + * @param {Array} [points] Array of points + * @param {Object} [options] Options object + */ + new (points?: number[], objObjects?: IObjectOptions): ILine; } interface IObjectOptions { @@ -2227,9 +2627,25 @@ declare module fabric { toSVG(reviver?: Function): string; } interface IPathStatic { - fromElement(element: SVGElement, options): IPath; - fromObject(object): IPath; - new (): IPath; + /** + * Creates an instance of fabric.Path from an SVG element + * @param {SVGElement} element to parse + * @param {Function} callback Callback to invoke when an fabric.Path instance is created + * @param {Object} [options] Options object + */ + fromElement(element: SVGElement, callback: (path: IPath) => any, options?: IPathOptions): void; + /** + * Creates an instance of fabric.Path from an object + * @param {Object} object + * @param {Function} callback Callback to invoke when an fabric.Path instance is created + */ + fromObject(object: any, callback: (path: IPath) => any): void; + /** + * Constructor + * @param {Array|String} path Path data (sequence of coordinates and corresponding "command" tokens) + * @param {Object} [options] Options object + */ + new (path?: string|any[], options?: IPathOptions): IPath; } interface IPathGroup extends IObject { @@ -2281,7 +2697,20 @@ declare module fabric { } interface IPathGroupStatic { fromObject(object): IPathGroup; - new (): IPathGroup; + /** + * Constructor + * @param {Array} paths + * @param {Object} [options] Options object + */ + new (paths: IPath[], options?: IObjectOptions): IPathGroup; + /** + * Creates fabric.PathGroup instance from an object representation + * @static + * @memberOf fabric.PathGroup + * @param {Object} object Object to create an instance from + * @param {Function} callback Callback to invoke when an fabric.PathGroup instance is created + */ + fromObject(object: any, callback: (group: IPathGroup) => any): void; prototype: any; } @@ -2302,7 +2731,6 @@ declare module fabric { minY?: number; } interface IPolygon extends IObject, IPolygonOptions { - initialize(points?: IPoint[], options?: IPolygonOptions): IPolygon; /** * Returns complexity of an instance * @return {Number} complexity of this instance @@ -2323,9 +2751,28 @@ declare module fabric { toSVG(reviver?: Function): string; } interface IPolygonStatic { - fromObject(object): IPolygon; - fromElement(element: SVGElement, options): IPolygon; - new (points: any[], options?: IObjectOptions, skipOffset?: boolean): IPolygon; + /** + * List of attribute names to account for when parsing SVG element (used by `fabric.Polygon.fromElement`) + */ + ATTRIBUTE_NAMES: string[]; + + /** + * Returns Polygon instance from an SVG element + * @param {SVGElement} element Element to parse + * @param {Object} [options] Options object + */ + fromElement(element: SVGElement, options?: IPolygonOptions): IPolygon; + /** + * Returns fabric.Polygon instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): IPolygon; + /** + * Constructor + * @param {Array} points Array of points + * @param {Object} [options] Options object + */ + new (points: { x: number; y: number }[], options?: IObjectOptions, skipOffset?: boolean): IPolygon; prototype: any; } @@ -2366,9 +2813,29 @@ declare module fabric { toSVG(reviver?: Function): string; } interface IPolylineStatic { - fromObject(object): IPolyline; - fromElement(element: SVGElement, options): IPolyline; - new (): IPolyline; + /** + * List of attribute names to account for when parsing SVG element (used by `fabric.Polygon.fromElement`) + */ + ATTRIBUTE_NAMES: string[]; + + /** + * Returns Polyline instance from an SVG element + * @param {SVGElement} element Element to parse + * @param {Object} [options] Options object + */ + fromElement(element: SVGElement, options?: IPolylineOptions): IPolyline; + /** + * Returns fabric.Polyline instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): IPolyline; + /** + * Constructor + * @param {Array} points Array of points (where each point is an object with x and y) + * @param {Object} [options] Options object + * @param {Boolean} [skipOffset] Whether points offsetting should be skipped + */ + new (points: { x: number; y: number }[], options?: IPolylineOptions): IPolyline; prototype: any; } @@ -2407,8 +2874,25 @@ declare module fabric { toSVG(reviver?: Function): string; } interface IRectStatic { - fromElement(element: SVGElement, options: IRectOptions): IRect; - fromObject(object): IRect; + /** + * List of attribute names to account for when parsing SVG element (used by `fabric.Rect.fromElement`) + */ + ATTRIBUTE_NAMES: string[]; + /** + * Returns Rect instance from an SVG element + * @param {SVGElement} element Element to parse + * @param {Object} [options] Options object + */ + fromElement(element: SVGElement, options?: IRectOptions): IRect; + /** + * Returns Rect instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): IRect; + /** + * Constructor + * @param {Object} [options] Options object + */ new (options?: IRectOptions): IRect; prototype: any; } @@ -2580,7 +3064,33 @@ declare module fabric { } interface ITextStatic { - new (text: string, options?: IITextOptions): IText; + /** + * List of attribute names to account for when parsing SVG element (used by `fabric.Text.fromElement`) + */ + ATTRIBUTE_NAMES: string[]; + /** + * Default SVG font size + */ + DEFAULT_SVG_FONT_SIZE: number; + /** + * Constructor + * @param {String} text Text string + * @param {Object} [options] Options object + */ + new (text: string, options?: ITextOptions): IText; + + /** + * Returns fabric.Text instance from an SVG element (not yet implemented) + * @param {SVGElement} element Element to parse + * @param {Object} [options] Options object + */ + fromElement(element: SVGElement, options?: ITextOptions): IText + + /** + * Returns fabric.Text instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): IText; } interface IITextOptions extends IObjectOptions, ITextOptions { @@ -2734,6 +3244,19 @@ declare module fabric { renderSelection(chars: string[], boundaries: any): void; } + interface IITextStatic extends ITextStatic { + /** + * Constructor + * @param {String} text Text string + * @param {Object} [options] Options object + */ + new (text: string, options?: IITextOptions): IIText; + /** + * Returns fabric.IText instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): IIText; + } interface ITriangleOptions extends IObjectOptions { } interface ITriangle extends IObject { @@ -2753,748 +3276,561 @@ declare module fabric { toSVG(reviver?: Function): string; } interface ITriangleStatic { - new (options?: ITriangleOptions): ITriangle; - } - - - interface IPatternOptions { /** - * Repeat property of a pattern (one of repeat, repeat-x, repeat-y or no-repeat) - */ - repeat: string; - - /** - * Pattern horizontal offset from object's left/top corner - */ - offsetX: number; - - /** - * Pattern vertical offset from object's left/top corner - */ - offsetY: number; - /** - * The source for the pattern - */ - source: string|HTMLImageElement; - } - interface IPattern extends IPatternOptions { - new (options?: IPatternOptions): IPattern; - - initialise(options?: IPatternOptions): IPattern; - /** - * Returns an instance of CanvasPattern - */ - toLive(ctx: CanvasRenderingContext2D): IPattern; - - /** - * Returns object representation of a pattern - */ - toObject(): any; - /** - * Returns SVG representation of a pattern - * @param {fabric.Object} object - */ - toSVG(object: IObject): string; - } - interface IPatternStatic { - new (options: IPatternOptions): IPattern; - prototype: any; - } - - interface IBrightnessFilter { - } - interface IInvertFilter { - } - interface IRemoveWhiteFilter { - } - interface IGrayscaleFilter { - } - interface ISepiaFilter { - } - interface ISepia2Filter { - } - interface INoiseFilter { - } - interface IGradientTransparencyFilter { - } - interface IPixelateFilter { - } - interface IConvoluteFilter { - } - interface ICanvasOptions extends IStaticCanvasOptions { - /** - * When true, objects can be transformed by one side (unproportionally) - */ - uniScaleTransform?: boolean; - - /** - * When true, objects use center point as the origin of scale transformation. - * Backwards incompatibility note: This property replaces "centerTransform" (Boolean). - */ - centeredScaling?: boolean; - - /** - * When true, objects use center point as the origin of rotate transformation. - * Backwards incompatibility note: This property replaces "centerTransform" (Boolean). - */ - centeredRotation?: boolean; - - /** - * Indicates that canvas is interactive. This property should not be changed. - */ - interactive?: boolean; - - /** - * Indicates whether group selection should be enabled - */ - selection?: boolean; - - /** - * Color of selection - */ - selectionColor?: string; - - /** - * Default dash array pattern - * If not empty the selection border is dashed - */ - selectionDashArray?: any[]; - - /** - * Color of the border of selection (usually slightly darker than color of selection itself) - */ - selectionBorderColor?: string; - - /** - * Width of a line used in object/group selection - */ - selectionLineWidth?: number; - - /** - * Default cursor value used when hovering over an object on canvas - */ - hoverCursor?: string; - - /** - * Default cursor value used when moving an object on canvas - */ - moveCursor?: string; - - /** - * Default cursor value used for the entire canvas - */ - defaultCursor?: string; - - /** - * Cursor value used during free drawing - */ - freeDrawingCursor?: string; - - /** - * Cursor value used for rotation point - */ - rotationCursor?: string; - - /** - * Default element class that's given to wrapper (div) element of canvas - */ - containerClass?: string; - - /** - * When true, object detection happens on per-pixel basis rather than on per-bounding-box - */ - perPixelTargetFind?: boolean; - - /** - * Number of pixels around target pixel to tolerate (consider active) during object detection - */ - targetFindTolerance?: number; - - /** - * When true, target detection is skipped when hovering over canvas. This can be used to improve performance. - */ - skipTargetFind?: boolean; - - /** - * When true, mouse events on canvas (mousedown/mousemove/mouseup) result in free drawing. - * After mousedown, mousemove creates a shape, - * and then mouseup finalizes it and adds an instance of `fabric.Path` onto canvas. - */ - isDrawingMode?: boolean; - } - interface IStaticCanvasOptions { - /** - * Indicates whether the browser can be scrolled when using a touchscreen and dragging on the canvas - */ - allowTouchScrolling?: boolean; - /** - * Indicates whether this canvas will use image smoothing, this is on by default in browsers - */ - imageSmoothingEnabled?: boolean; - - /** - * Indicates whether objects should remain in current stack position when selected. When false objects are brought to top and rendered as part of the selection group - */ - preserveObjectStacking?: boolean; - - /** - * The transformation (in the format of Canvas transform) which focuses the viewport - */ - viewportTransform?: number[]; - - - - freeDrawingColor?: string; - freeDrawingLineWidth?: number; - - /** - * Background color of canvas instance. - * Should be set via setBackgroundColor - */ - backgroundColor?: string | IPattern; - /** - * Background image of canvas instance. - * Should be set via setBackgroundImage - * Backwards incompatibility note: The "backgroundImageOpacity" and "backgroundImageStretch" properties are deprecated since 1.3.9. - */ - backgroundImage?: IImage; - backgroundImageOpacity?: number; - backgroundImageStretch?: number; - /** - * Function that determines clipping of entire canvas area - * Being passed context as first argument. See clipping canvas area - */ - clipTo?: (context: CanvasRenderingContext2D) => void; - - /** - * Indicates whether object controls (borders/controls) are rendered above overlay image - */ - controlsAboveOverlay?: boolean; - - /** - * Indicates whether toObject/toDatalessObject should include default values - */ - includeDefaultValues?: boolean; - /** - * Overlay color of canvas instance. - * Should be set via setOverlayColor - */ - overlayColor?: string | IPattern; - /** - * Overlay image of canvas instance. - * Should be set via setOverlayImage - * Backwards incompatibility note: The "overlayImageLeft" and "overlayImageTop" properties are deprecated since 1.3.9. - */ - overlayImage?: IImage; - overlayImageLeft?: number; - overlayImageTop?: number; - /** - * Indicates whether add, insertAt and remove should also re-render canvas. - * Disabling this option could give a great performance boost when adding/removing a lot of objects to/from canvas at once - * (followed by a manual rendering after addition/deletion) - */ - renderOnAddRemove?: boolean; - /** - * Indicates whether objects' state should be saved - */ - stateful?: boolean; - } - - - /////////////////////////////////////////////////////////////////////////////// - // Fabric util Interface - ////////////////////////////////////////////////////////////////////////////// - // animations - interface IUtilAnimationOptions { - /** - * Starting value - */ - startValue?: number; - /** - * Ending value - */ - endValue?: number; - /** - * Value to modify the property by + * Constructor + * @param {Object} [options] Options object */ - byValue: number; + new (options?: ITriangleOptions): ITriangle; /** - * Duration of change (in ms) - */ - duration?: number; - /** - * Callback; invoked on every value change - */ - onChange?: Function; - /** - * Callback; invoked when value change is completed - */ - onComplete?: Function - /** - * Easing function - */ - easing?: Function; - } - interface IUtilAnimation { - /** - * Changes value from one to another within certain period of time, invoking callbacks as value is being changed. - * @param {Object} [options] Animation options - */ - animate(options?: IUtilAnimationOptions): void; - /** - * requestAnimationFrame polyfill based on http://paulirish.com/2011/requestanimationframe-for-smart-animating/ - * In order to get a precise start time, `requestAnimFrame` should be called as an entry into the method - * @param {Function} callback Callback to invoke + * Returns Triangle instance from an object representation + * @param {Object} object Object to create an instance from */ - requestAnimFrame(callback: Function): void; + fromObject(object: any): ITriangle; } - // anim_ease - interface anim_ease { - easeInBack(): Function; - easeInBounce(): Function; - easeInCirc(): Function; - easeInCubic(): Function; - easeInElastic(): Function; - easeInExpo(): Function; - easeInOutBack(): Function; - easeInOutBounce(): Function; - easeInOutCirc(): Function; - easeInOutCubic(): Function; - easeInOutElastic(): Function; - easeInOutExpo(): Function; - easeInOutQuad(): Function; - easeInOutQuart(): Function; - easeInOutQuint(): Function; - easeInOutSine(): Function; - easeInQuad(): Function; - easeInQuart(): Function; - easeInQuint(): Function; - easeInSine(): Function; - easeOutBack(): Function; - easeOutBounce(): Function; - easeOutCirc(): Function; - easeOutCubic(): Function; - easeOutElastic(): Function; - easeOutExpo(): Function; - easeOutQuad(): Function; - easeOutQuart(): Function; - easeOutQuint(): Function; - easeOutSine(): Function; + //////////////////////////////////////////////////////////// + // Filters + //////////////////////////////////////////////////////////// + interface IAllFilters { + BaseFilter: { + /** + * Constructor + * @param {Object} [options] Options object + */ + new (options?: any): IBaseFilter; + } } + interface IBaseFilter { + /** + * Sets filter's properties from options + * @param {Object} [options] Options object + */ + setOptions(options?: any): void; + /** + * Returns object representation of an instance + */ + toObject(): any; - interface IUtilArc { /** - * Draws arc - * @param {CanvasRenderingContext2D} ctx - * @param {Number} fx - * @param {Number} fy - * @param {Array} coords + * Returns a JSON representation of an instance */ - drawArc(ctx: CanvasRenderingContext2D, fx: number, fy: number, coords: number[]): void; - /** - * Calculate bounding box of a elliptic-arc - * @param {Number} fx start point of arc - * @param {Number} fy - * @param {Number} rx horizontal radius - * @param {Number} ry vertical radius - * @param {Number} rot angle of horizontal axe - * @param {Number} large 1 or 0, whatever the arc is the big or the small on the 2 points - * @param {Number} sweep 1 or 0, 1 clockwise or counterclockwise direction - * @param {Number} tx end point of arc - * @param {Number} ty - */ - getBoundsOfArc(fx: number, fy: number, rx: number, ry: number, rot: number, large: number, sweep: number, tx: number, ty: number): IPoint[]; - /** - * Calculate bounding box of a beziercurve - * @param {Number} x0 starting point - * @param {Number} y0 - * @param {Number} x1 first control point - * @param {Number} y1 - * @param {Number} x2 secondo control point - * @param {Number} y2 - * @param {Number} x3 end of beizer - * @param {Number} y3 - */ - getBoundsOfCurve(x0: number, y0: number, x1: number, y1: number, x2: number, y2: number, x3: number, y3: number): IPoint[]; - + toJSON(): string; } +} +interface IBrightnessFilter { +} +interface IInvertFilter { +} +interface IRemoveWhiteFilter { +} +interface IGrayscaleFilter { +} +interface ISepiaFilter { +} +interface ISepia2Filter { +} +interface INoiseFilter { +} +interface IGradientTransparencyFilter { +} +interface IPixelateFilter { +} +interface IConvoluteFilter { +} - interface IUtilDomEvent { - /** - * Cross-browser wrapper for getting event's coordinates - * @param {Event} event Event object - * @param {HTMLCanvasElement} upperCanvasEl <canvas> element on which object selection is drawn + +/////////////////////////////////////////////////////////////////////////////// +// Fabric util Interface +////////////////////////////////////////////////////////////////////////////// +interface IUtilAnimationOptions { + /** + * Starting value + */ + startValue?: number; + /** + * Ending value + */ + endValue?: number; + /** + * Value to modify the property by */ - getPointer(event: Event, upperCanvasEl: HTMLCanvasElement): IPoint; + byValue: number; + /** + * Duration of change (in ms) + */ + duration?: number; + /** + * Callback; invoked on every value change + */ + onChange?: Function; + /** + * Callback; invoked when value change is completed + */ + onComplete?: Function + /** + * Easing function + */ + easing?: Function; +} +interface IUtilAnimation { + /** + * Changes value from one to another within certain period of time, invoking callbacks as value is being changed. + * @param {Object} [options] Animation options + */ + animate(options?: IUtilAnimationOptions): void; + /** + * requestAnimationFrame polyfill based on http://paulirish.com/2011/requestanimationframe-for-smart-animating/ + * In order to get a precise start time, `requestAnimFrame` should be called as an entry into the method + * @param {Function} callback Callback to invoke + */ + requestAnimFrame(callback: Function): void; +} - /** - * Adds an event listener to an element +interface IUtilAnimEase { + easeInBack(): Function; + easeInBounce(): Function; + easeInCirc(): Function; + easeInCubic(): Function; + easeInElastic(): Function; + easeInExpo(): Function; + easeInOutBack(): Function; + easeInOutBounce(): Function; + easeInOutCirc(): Function; + easeInOutCubic(): Function; + easeInOutElastic(): Function; + easeInOutExpo(): Function; + easeInOutQuad(): Function; + easeInOutQuart(): Function; + easeInOutQuint(): Function; + easeInOutSine(): Function; + easeInQuad(): Function; + easeInQuart(): Function; + easeInQuint(): Function; + easeInSine(): Function; + easeOutBack(): Function; + easeOutBounce(): Function; + easeOutCirc(): Function; + easeOutCubic(): Function; + easeOutElastic(): Function; + easeOutExpo(): Function; + easeOutQuad(): Function; + easeOutQuart(): Function; + easeOutQuint(): Function; + easeOutSine(): Function; +} + +interface IUtilArc { + /** + * Draws arc + * @param {CanvasRenderingContext2D} ctx + * @param {Number} fx + * @param {Number} fy + * @param {Array} coords + */ + drawArc(ctx: CanvasRenderingContext2D, fx: number, fy: number, coords: number[]): void; + /** + * Calculate bounding box of a elliptic-arc + * @param {Number} fx start point of arc + * @param {Number} fy + * @param {Number} rx horizontal radius + * @param {Number} ry vertical radius + * @param {Number} rot angle of horizontal axe + * @param {Number} large 1 or 0, whatever the arc is the big or the small on the 2 points + * @param {Number} sweep 1 or 0, 1 clockwise or counterclockwise direction + * @param {Number} tx end point of arc + * @param {Number} ty + */ + getBoundsOfArc(fx: number, fy: number, rx: number, ry: number, rot: number, large: number, sweep: number, tx: number, ty: number): IPoint[]; + /** + * Calculate bounding box of a beziercurve + * @param {Number} x0 starting point + * @param {Number} y0 + * @param {Number} x1 first control point + * @param {Number} y1 + * @param {Number} x2 secondo control point + * @param {Number} y2 + * @param {Number} x3 end of beizer + * @param {Number} y3 + */ + getBoundsOfCurve(x0: number, y0: number, x1: number, y1: number, x2: number, y2: number, x3: number, y3: number): IPoint[]; + +} + +interface IUtilDomEvent { + /** + * Cross-browser wrapper for getting event's coordinates + * @param {Event} event Event object + * @param {HTMLCanvasElement} upperCanvasEl <canvas> element on which object selection is drawn + */ + getPointer(event: Event, upperCanvasEl: HTMLCanvasElement): IPoint; + + /** + * Adds an event listener to an element + * @param {HTMLElement} element + * @param {String} eventName + * @param {Function} handler + */ + addListener(element: HTMLElement, eventName: string, handler: Function): void; + + /** + * Removes an event listener from an element + * @param {HTMLElement} element + * @param {String} eventName + * @param {Function} handler + */ + removeListener(element: HTMLElement, eventName: string, handler: Function): void; +} + +interface IUtilDomMisc { + /** + * Takes id and returns an element with that id (if one exists in a document) + * @param {String|HTMLElement} id + */ + getById(id: string|HTMLElement): HTMLElement; + /** + * Converts an array-like object (e.g. arguments or NodeList) to an array + * @param {Object} arrayLike + */ + toArray(arrayLike: any): any[]; + /** + * Creates specified element with specified attributes + * @memberOf fabric.util + * @param {String} tagName Type of an element to create + * @param {Object} [attributes] Attributes to set on an element + * @return {HTMLElement} Newly created element + */ + makeElement(tagName: string, attributes?: any): HTMLElement; + /** + * Adds class to an element + * @param {HTMLElement} element Element to add class to + * @param {String} className Class to add to an element + */ + addClass(element: HTMLElement, classname: string): void; + /** + * Wraps element with another element + * @param {HTMLElement} element Element to wrap + * @param {HTMLElement|String} wrapper Element to wrap with + * @param {Object} [attributes] Attributes to set on a wrapper + */ + wrapElement(element: HTMLElement, wrapper: HTMLElement|string, attributes?: any): HTMLElement; + /** + * Returns element scroll offsets + * @param {HTMLElement} element Element to operate on + * @param {HTMLElement} upperCanvasEl Upper canvas element + */ + getScrollLeftTop(element: HTMLElement, upperCanvasEl: HTMLElement): { left: number; right: number; } + /** + * Returns offset for a given element + * @param {HTMLElement} element Element to get offset for + */ + getElementOffset(element: HTMLElement): { left: number; right: number; } + /** + * Returns style attribute value of a given element + * @param {HTMLElement} element Element to get style attribute for + * @param {String} attr Style attribute to get for element + */ + getElementStyle(elment: HTMLElement, attr: string): string; + /** + * Inserts a script element with a given url into a document; invokes callback, when that script is finished loading + * @memberOf fabric.util + * @param {String} url URL of a script to load + * @param {Function} callback Callback to execute when script is finished loading + */ + getScript(url: string, callback: Function): void; + /** + * Makes element unselectable + * @param {HTMLElement} element Element to make unselectable + */ + makeElementUnselectable(element: HTMLElement): HTMLElement; + /** + * Makes element selectable + * @param {HTMLElement} element Element to make selectable + */ + makeElementSelectable(element: HTMLElement): HTMLElement; +} + +interface IUtilDomRequest { + /** + * Cross-browser abstraction for sending XMLHttpRequest + * @param {String} url URL to send XMLHttpRequest to + * @param {Object} [options] Options object + * @param {String} [options.method="GET"] + * @param {Function} options.onComplete Callback to invoke when request is completed + */ + request(url: string, options?: { method?: string; onComplete: Function }): XMLHttpRequest; +} + +interface IUtilDomStyle { + /** + * Cross-browser wrapper for setting element's style * @param {HTMLElement} element - * @param {String} eventName - * @param {Function} handler + * @param {Object} styles */ - addListener(element: HTMLElement, eventName: string, handler: Function): void; + setStyle(element: HTMLElement, styles: any): HTMLElement; +} - /** - * Removes an event listener from an element - * @param {HTMLElement} element - * @param {String} eventName - * @param {Function} handler +interface IUtilArray { + /** + * Invokes method on all items in a given array + * @param {Array} array Array to iterate over + * @param {String} method Name of a method to invoke */ - removeListener(element: HTMLElement, eventName: string, handler: Function): void; - } - - interface IUtilDomMisc { - /** - * Takes id and returns an element with that id (if one exists in a document) - * @param {String|HTMLElement} id - */ - getById(id: string|HTMLElement): HTMLElement; - /** - * Converts an array-like object (e.g. arguments or NodeList) to an array - * @param {Object} arrayLike - */ - toArray(arrayLike: any): any[]; - /** - * Creates specified element with specified attributes - * @memberOf fabric.util - * @param {String} tagName Type of an element to create - * @param {Object} [attributes] Attributes to set on an element - * @return {HTMLElement} Newly created element - */ - makeElement(tagName: string, attributes?: any): HTMLElement; - /** - * Adds class to an element - * @param {HTMLElement} element Element to add class to - * @param {String} className Class to add to an element - */ - addClass(element: HTMLElement, classname: string): void; - /** - * Wraps element with another element - * @param {HTMLElement} element Element to wrap - * @param {HTMLElement|String} wrapper Element to wrap with - * @param {Object} [attributes] Attributes to set on a wrapper - */ - wrapElement(element: HTMLElement, wrapper: HTMLElement|string, attributes?: any): HTMLElement; - /** - * Returns element scroll offsets - * @param {HTMLElement} element Element to operate on - * @param {HTMLElement} upperCanvasEl Upper canvas element - */ - getScrollLeftTop(element: HTMLElement, upperCanvasEl: HTMLElement): { left: number; right: number; } - /** - * Returns offset for a given element - * @param {HTMLElement} element Element to get offset for - */ - getElementOffset(element: HTMLElement): { left: number; right: number; } - /** - * Returns style attribute value of a given element - * @param {HTMLElement} element Element to get style attribute for - * @param {String} attr Style attribute to get for element - */ - getElementStyle(elment: HTMLElement, attr: string): string; - /** - * Inserts a script element with a given url into a document; invokes callback, when that script is finished loading - * @memberOf fabric.util - * @param {String} url URL of a script to load - * @param {Function} callback Callback to execute when script is finished loading - */ - getScript(url: string, callback: Function): void; - /** - * Makes element unselectable - * @param {HTMLElement} element Element to make unselectable - */ - makeElementUnselectable(element: HTMLElement): HTMLElement; - /** - * Makes element selectable - * @param {HTMLElement} element Element to make selectable - */ - makeElementSelectable(element: HTMLElement): HTMLElement; - } - - interface IUtilDomRequest { - /** - * Cross-browser abstraction for sending XMLHttpRequest - * @param {String} url URL to send XMLHttpRequest to - * @param {Object} [options] Options object - * @param {String} [options.method="GET"] - * @param {Function} options.onComplete Callback to invoke when request is completed - */ - request(url: string, options?: { method?: string; onComplete: Function }): XMLHttpRequest; - } - - interface IUtilDomStyle { - /** - * Cross-browser wrapper for setting element's style - * @param {HTMLElement} element - * @param {Object} styles - */ - setStyle(element: HTMLElement, styles: any): HTMLElement; - } - - interface IUtilArray { - /** - * Invokes method on all items in a given array - * @param {Array} array Array to iterate over - * @param {String} method Name of a method to invoke - */ - invoke(array: any[], method: string): any[]; - /** - * Finds minimum value in array (not necessarily "first" one) - * @param {Array} array Array to iterate over - * @param {String} byProperty - */ - min(array: any[], byProperty: string): any; - /** - * Finds maximum value in array (not necessarily "first" one) + invoke(array: any[], method: string): any[]; + /** + * Finds minimum value in array (not necessarily "first" one) * @param {Array} array Array to iterate over * @param {String} byProperty */ - max(array: any[], byProperty: string): any; - } - - interface IUtilClass { - /** - * Helper for creation of "classes". - * @param {Function} [parent] optional "Class" to inherit from - * @param {Object} [properties] Properties shared by all instances of this class - * (be careful modifying objects defined here as this would affect all instances) - */ - createClass(parent: Function, properties?: any); - /** - * Helper for creation of "classes". - * @param {Object} [properties] Properties shared by all instances of this class - * (be careful modifying objects defined here as this would affect all instances) - */ - createClass(properties?: any); - - } - - interface IUtilObject { - /** - * Copies all enumerable properties of one object to another - * @param {Object} destination Where to copy to - * @param {Object} source Where to copy from - */ - extend(destination: any, source: any): any; - - /** - * Creates an empty object and copies all enumerable properties of another object to it - * @memberOf fabric.util.object - * @param {Object} object Object to clone - * @return {Object} - */ - clone(object: any): any - } - - interface IUtilString { - /** - * Camelizes a string - * @param {String} string String to camelize - */ - camelize(string: string): string; - - /** - * Capitalizes a string - * @param {String} string String to capitalize - * @param {Boolean} [firstLetterOnly] If true only first letter is capitalized - * and other letters stay untouched, if false first letter is capitalized - * and other letters are converted to lowercase. - */ - capitalize(string: string, firstLetterOnly: boolean): string; - - /** - * Escapes XML in a string - * @param {String} string String to escape - */ - escapeXml(string: string): string; - } - - interface IUtilMisc { - /** - * Removes value from an array. - * Presence of value (and its position in an array) is determined via `Array.prototype.indexOf` - * @param {Array} array - * @param {Any} value - */ - removeFromArray(array: any[], value: any): any[]; - - /** - * Returns random number between 2 specified ones. - * @param {Number} min lower limit - * @param {Number} max upper limit - */ - getRandomInt(min: number, max: number): number; - - /** - * Transforms degrees to radians. - * @param {Number} degrees value in degrees - */ - degreesToRadians(degrees: number): number; - - /** - * Transforms radians to degrees. - * @memberOf fabric.util - * @param {Number} radians value in radians - */ - radiansToDegrees(radians: number): number; - - /** - * Rotates `point` around `origin` with `radians` - * @param {fabric.Point} point The point to rotate - * @param {fabric.Point} origin The origin of the rotation - * @param {Number} radians The radians of the angle for the rotation - */ - rotatePoint(point: IPoint, origin: IPoint, radians: number): IPoint; - - /** - * Apply transform t to point p - * @param {fabric.Point} p The point to transform - * @param {Array} t The transform - * @param {Boolean} [ignoreOffset] Indicates that the offset should not be applied - */ - transformPoint(p: IPoint, t: any[], ignoreOffset?: boolean): IPoint - - /** - * Invert transformation t - * @param {Array} t The transform - */ - invertTransform(t: any[]): any[]; - - /** - * A wrapper around Number#toFixed, which contrary to native method returns number, not string. - * @param {Number|String} number number to operate on - * @param {Number} fractionDigits number of fraction digits to "leave" - */ - toFixed(number: number, fractionDigits: number): number; - - /** - * Converts from attribute value to pixel value if applicable. - * Returns converted pixels or original value not converted. - * @param {Number|String} value number to operate on - */ - parseUnit(value: number|string, fontSize?: number): number|string; - - /** - * Function which always returns `false`. - */ - falseFunction(): boolean - - /** - * Returns klass "Class" object of given namespace - * @param {String} type Type of object (eg. 'circle') - * @param {String} namespace Namespace to get klass "Class" object from - */ - getKlass(type: string, namespace: string): any; - - /** - * Returns object of given namespace - * @param {String} namespace Namespace string e.g. 'fabric.Image.filter' or 'fabric' - */ - resolveNamespace(namespace: string): any; - - /** - * Loads image element from given url and passes it to a callback - * @param {String} url URL representing an image - * @param {Function} callback Callback; invoked with loaded image - * @param {Any} [context] Context to invoke callback in - * @param {Object} [crossOrigin] crossOrigin value to set image element to - */ - loadImage(url: string, callback: (image: HTMLImageElement) => {}, context?: any, crossOrigin?: boolean): void; - - /** - * Creates corresponding fabric instances from their object representations - * @param {Array} objects Objects to enliven - * @param {Function} callback Callback to invoke when all objects are created - * @param {String} namespace Namespace to get klass "Class" object from - * @param {Function} reviver Method for further parsing of object elements, called after each fabric object created. - */ - enlivenObjects(objects: any[], callback: Function, namespace: string, reviver?: Function): void; - - /** - * Groups SVG elements (usually those retrieved from SVG document) - * @param {Array} elements SVG elements to group - * @param {Object} [options] Options object - */ - groupSVGElements(elements: any[], options?: any, path?: any): IPathGroup - - /** - * Populates an object with properties of another object - * @param {Object} source Source object - * @param {Object} destination Destination object - * @param {Array} properties Propertie names to include - */ - populateWithProperties(source: any, destination: any, properties: any): void; - - /** - * Draws a dashed line between two points - * - * This method is used to draw dashed line around selection area. - * - * @param {CanvasRenderingContext2D} ctx context - * @param {Number} x start x coordinate - * @param {Number} y start y coordinate - * @param {Number} x2 end x coordinate - * @param {Number} y2 end y coordinate - * @param {Array} da dash array pattern - */ - drawDashedLine(ctx: CanvasRenderingContext2D, x: number, y: number, x2: number, y2: number, da: any[]): void; - - /** - * Creates canvas element and initializes it via excanvas if necessary - * @param {CanvasElement} [canvasEl] optional canvas element to initialize; - * when not given, element is created implicitly - */ - createCanvasElement(canvasEl?: HTMLCanvasElement): HTMLCanvasElement; - - /** - * Creates image element (works on client and node) - */ - createImage(): HTMLImageElement; - - /** - * Creates accessors (getXXX, setXXX) for a "class", based on "stateProperties" array - * @param {Object} klass "Class" to create accessors for - */ - createAccessors(klass: any): any; - - /** - * @param {fabric.Object} receiver Object implementing `clipTo` method - * @param {CanvasRenderingContext2D} ctx Context to clip - */ - clipContext(receiver: IObject, ctx: CanvasRenderingContext2D): void; - - /** - * Multiply matrix A by matrix B to nest transformations - * @param {Array} a First transformMatrix - * @param {Array} b Second transformMatrix - */ - multiplyTransformMatrices(a: any[], b: any[]): any[] - - /** - * Returns string representation of function body - * @param {Function} fn Function to get body of - */ - getFunctionBody(fn: Function): string; - - /** - * Returns true if context has transparent pixel - * at specified location (taking tolerance into account) - * @param {CanvasRenderingContext2D} ctx context - * @param {Number} x x coordinate - * @param {Number} y y coordinate - * @param {Number} tolerance Tolerance - */ - isTransparent(ctx: CanvasRenderingContext2D, x: number, y: number, tolerance: number): boolean; - } - - - interface Util extends IUtilAnimation, IUtilArc, IObservable, IUtilDomEvent, IUtilDomMisc, - IUtilDomRequest, IUtilDomStyle, IUtilClass, IUtilMisc { - ease: anim_ease; - array: IUtilArray; - object: IUtilObject; - string: IUtilString; - } + min(array: any[], byProperty: string): any; + /** + * Finds maximum value in array (not necessarily "first" one) + * @param {Array} array Array to iterate over + * @param {String} byProperty + */ + max(array: any[], byProperty: string): any; +} + +interface IUtilClass { + /** + * Helper for creation of "classes". + * @param {Function} [parent] optional "Class" to inherit from + * @param {Object} [properties] Properties shared by all instances of this class + * (be careful modifying objects defined here as this would affect all instances) + */ + createClass(parent: Function, properties?: any); + /** + * Helper for creation of "classes". + * @param {Object} [properties] Properties shared by all instances of this class + * (be careful modifying objects defined here as this would affect all instances) + */ + createClass(properties?: any); + +} + +interface IUtilObject { + /** + * Copies all enumerable properties of one object to another + * @param {Object} destination Where to copy to + * @param {Object} source Where to copy from + */ + extend(destination: any, source: any): any; + + /** + * Creates an empty object and copies all enumerable properties of another object to it + * @memberOf fabric.util.object + * @param {Object} object Object to clone + * @return {Object} + */ + clone(object: any): any +} + +interface IUtilString { + /** + * Camelizes a string + * @param {String} string String to camelize + */ + camelize(string: string): string; + + /** + * Capitalizes a string + * @param {String} string String to capitalize + * @param {Boolean} [firstLetterOnly] If true only first letter is capitalized + * and other letters stay untouched, if false first letter is capitalized + * and other letters are converted to lowercase. + */ + capitalize(string: string, firstLetterOnly: boolean): string; + + /** + * Escapes XML in a string + * @param {String} string String to escape + */ + escapeXml(string: string): string; +} + +interface IUtilMisc { + /** + * Removes value from an array. + * Presence of value (and its position in an array) is determined via `Array.prototype.indexOf` + * @param {Array} array + * @param {Any} value + */ + removeFromArray(array: any[], value: any): any[]; + + /** + * Returns random number between 2 specified ones. + * @param {Number} min lower limit + * @param {Number} max upper limit + */ + getRandomInt(min: number, max: number): number; + + /** + * Transforms degrees to radians. + * @param {Number} degrees value in degrees + */ + degreesToRadians(degrees: number): number; + + /** + * Transforms radians to degrees. + * @memberOf fabric.util + * @param {Number} radians value in radians + */ + radiansToDegrees(radians: number): number; + + /** + * Rotates `point` around `origin` with `radians` + * @param {fabric.Point} point The point to rotate + * @param {fabric.Point} origin The origin of the rotation + * @param {Number} radians The radians of the angle for the rotation + */ + rotatePoint(point: IPoint, origin: IPoint, radians: number): IPoint; + + /** + * Apply transform t to point p + * @param {fabric.Point} p The point to transform + * @param {Array} t The transform + * @param {Boolean} [ignoreOffset] Indicates that the offset should not be applied + */ + transformPoint(p: IPoint, t: any[], ignoreOffset?: boolean): IPoint + + /** + * Invert transformation t + * @param {Array} t The transform + */ + invertTransform(t: any[]): any[]; + + /** + * A wrapper around Number#toFixed, which contrary to native method returns number, not string. + * @param {Number|String} number number to operate on + * @param {Number} fractionDigits number of fraction digits to "leave" + */ + toFixed(number: number, fractionDigits: number): number; + + /** + * Converts from attribute value to pixel value if applicable. + * Returns converted pixels or original value not converted. + * @param {Number|String} value number to operate on + */ + parseUnit(value: number|string, fontSize?: number): number|string; + + /** + * Function which always returns `false`. + */ + falseFunction(): boolean + + /** + * Returns klass "Class" object of given namespace + * @param {String} type Type of object (eg. 'circle') + * @param {String} namespace Namespace to get klass "Class" object from + */ + getKlass(type: string, namespace: string): any; + + /** + * Returns object of given namespace + * @param {String} namespace Namespace string e.g. 'fabric.Image.filter' or 'fabric' + */ + resolveNamespace(namespace: string): any; + + /** + * Loads image element from given url and passes it to a callback + * @param {String} url URL representing an image + * @param {Function} callback Callback; invoked with loaded image + * @param {Any} [context] Context to invoke callback in + * @param {Object} [crossOrigin] crossOrigin value to set image element to + */ + loadImage(url: string, callback: (image: HTMLImageElement) => {}, context?: any, crossOrigin?: boolean): void; + + /** + * Creates corresponding fabric instances from their object representations + * @param {Array} objects Objects to enliven + * @param {Function} callback Callback to invoke when all objects are created + * @param {String} namespace Namespace to get klass "Class" object from + * @param {Function} reviver Method for further parsing of object elements, called after each fabric object created. + */ + enlivenObjects(objects: any[], callback: Function, namespace: string, reviver?: Function): void; + + /** + * Groups SVG elements (usually those retrieved from SVG document) + * @param {Array} elements SVG elements to group + * @param {Object} [options] Options object + */ + groupSVGElements(elements: any[], options?: any, path?: any): IPathGroup + + /** + * Populates an object with properties of another object + * @param {Object} source Source object + * @param {Object} destination Destination object + * @param {Array} properties Propertie names to include + */ + populateWithProperties(source: any, destination: any, properties: any): void; + + /** + * Draws a dashed line between two points + * + * This method is used to draw dashed line around selection area. + * + * @param {CanvasRenderingContext2D} ctx context + * @param {Number} x start x coordinate + * @param {Number} y start y coordinate + * @param {Number} x2 end x coordinate + * @param {Number} y2 end y coordinate + * @param {Array} da dash array pattern + */ + drawDashedLine(ctx: CanvasRenderingContext2D, x: number, y: number, x2: number, y2: number, da: any[]): void; + + /** + * Creates canvas element and initializes it via excanvas if necessary + * @param {CanvasElement} [canvasEl] optional canvas element to initialize; + * when not given, element is created implicitly + */ + createCanvasElement(canvasEl?: HTMLCanvasElement): HTMLCanvasElement; + + /** + * Creates image element (works on client and node) + */ + createImage(): HTMLImageElement; + + /** + * Creates accessors (getXXX, setXXX) for a "class", based on "stateProperties" array + * @param {Object} klass "Class" to create accessors for + */ + createAccessors(klass: any): any; + + /** + * @param {fabric.Object} receiver Object implementing `clipTo` method + * @param {CanvasRenderingContext2D} ctx Context to clip + */ + clipContext(receiver: IObject, ctx: CanvasRenderingContext2D): void; + + /** + * Multiply matrix A by matrix B to nest transformations + * @param {Array} a First transformMatrix + * @param {Array} b Second transformMatrix + */ + multiplyTransformMatrices(a: any[], b: any[]): any[] + + /** + * Returns string representation of function body + * @param {Function} fn Function to get body of + */ + getFunctionBody(fn: Function): string; + + /** + * Returns true if context has transparent pixel + * at specified location (taking tolerance into account) + * @param {CanvasRenderingContext2D} ctx context + * @param {Number} x x coordinate + * @param {Number} y y coordinate + * @param {Number} tolerance Tolerance + */ + isTransparent(ctx: CanvasRenderingContext2D, x: number, y: number, tolerance: number): boolean; +} + + +interface Util extends IUtilAnimation, IUtilArc, IObservable, IUtilDomEvent, IUtilDomMisc, + IUtilDomRequest, IUtilDomStyle, IUtilClass, IUtilMisc { + ease: IUtilAnimEase; + array: IUtilArray; + object: IUtilObject; + string: IUtilString; +} } From d82b89617e3fa912bae7c8e5d472342d375b48c0 Mon Sep 17 00:00:00 2001 From: hansrwindhoff Date: Fri, 15 May 2015 18:52:06 -0600 Subject: [PATCH 049/179] Update tcomb.d.ts --- tcomb/tcomb.d.ts | 551 ++++++++++++++++++++++++----------------------- 1 file changed, 278 insertions(+), 273 deletions(-) diff --git a/tcomb/tcomb.d.ts b/tcomb/tcomb.d.ts index 3c9197d86..91c004160 100644 --- a/tcomb/tcomb.d.ts +++ b/tcomb/tcomb.d.ts @@ -1,420 +1,425 @@ -// Type definitions for tcomb v0.4 +// Type definitions for tcomb v1.0.3 // Project: http://gcanti.github.io/tcomb/guide/index.html -// Definitions by: Jed Mao +// Definitions by: Jed Mao and Hans Windhoff // Definitions: https://github.com/borisyankov/DefinitelyTyped -declare module tcomb { +declare module TComb { - export var options: { - onFail: (message: string) => void; - }; + export interface tcomb { + format: (format: string, ...values: any[]) => string; + getFunctionName: (fn: Function) => string; + getTypeName: (type: TCombBase) => string; + mixin: (target: {}, source: {}, overwrite?: boolean) => any; + slice: typeof Array.prototype.slice; + shallowCopy: (x: TCombBase) => TCombBase; + update: (instance: any, spec: {}) => TCombBase; + assert: (condition: boolean, message?: string, ...values: any[]) => void; + fail: (message?: string) => void; + Any: Any_Static; + Nil: Str_Static; + Str: Str_Static; + Num: Num_Static; + Bool: Bool_Static; + Arr: Arr_Static; + Obj: Obj_Static; - /** - * Like util.format in Node. - */ - export function format(format: string, ...values: any[]): string; - export function getKind(type: T): string; - /** - * Returns a function's name or displayName if specified; otherwise, - * fallbacks on '>'. - */ - export function getFunctionName(fn: Function): string; - export function getTypeName(type: T): string; - /** - * Safe version of mixin, properties can be overwritten. - */ - export function mixin(target: {}, source: {}, overwrite?: boolean): any; - export var slice: typeof Array.prototype.slice; - export function shallowCopy(x: T): T; - export function update(instance: any, spec: {}): T; - /** - * If an assert fails the debugger kicks in so you can inspect the stack - * and quickly find out what's wrong. - * @param message - Useful for debugging. Formatted with values like util.format in Node. - * @param values - Sequentially inserted into the message. - */ - export function assert(condition: boolean, message?: string, ...values: any[]): void; - export function fail(message?: string): void; + Func: Func_Static; + func: { (domain: TCombBase[], codomain: TCombBase, name?: string) : Func_Static; + (domain: TCombBase, codomain: TCombBase, name?: string) : Func_Static; + } + Err: Err_Static; + Re: Re_Static; + Dat: Dat_Static; + Type: Type_Static; + irreducible: (name: string, is: TypePredicate) => TCombBase; + struct: (props: Object, name?: string) => Struct_Static; - interface T { - meta: { + Union: Union_Static; + Maybe: Maybe_Static; + + enums(map: Object, name?: string): TCombBase; + union(types: TCombBase[], name?: string): Union_Static; + maybe(type: TCombBase, name?: string): Maybe_Static; + + Tuple: Tuple_Static; + tuple:(types: TCombBase[], name?: string)=> Tuple_Static; + + Subtype: Subtype_Static; + + List: List_Static; + list:(type: TCombBase, name?: string)=> List_Static; + + Dict: Dict_Static; + dict:(domain: TCombBase, codomain: TCombBase, name?: string)=> Dict_Static; + + subtype(type: TCombBase, predicate: TypePredicate, name?: string): Subtype_Static; + + } + + + + + export interface TCombBase { + meta: { /** * The type kind, equal to "irreducible" for irreducible types. */ - kind: string; + kind: string; /** * The type name. */ - name: string; - }; - displayName: string; - is(value: any): boolean; - update(instance: any, spec: {}): T; - } + name: string; + }; + displayName: string; + is(value: any): boolean; + update(instance: any, spec: {}): TCombBase; + } - interface TypePredicate { - (x: any): Bool_Instance; - } + export interface TypePredicate { + (x: any): Bool_Instance; + } - interface Any_Instance { - } + export interface Any_Instance { + } - interface Any_Static extends T { - new (value: any): Any_Instance; - (value: any): Any_Instance; - } + export interface Any_Static extends TCombBase { + + new (value: any): Any_Instance; + (value: any): Any_Instance; + } - export var Any: Any_Static; - interface Nil_Instance { - } - interface Nil_Static extends T { - new (value: any): Nil_Instance; - (value: any): Nil_Instance; - } + export interface Nil_Instance { + } - export var Nil: Str_Static; + export interface Nil_Static extends TCombBase { + new (value: any): Nil_Instance; + (value: any): Nil_Instance; + } - interface Str_Instance extends String { - } - interface Str_Static extends T { - new (value: string): Str_Instance; - (value: string): Str_Instance; - meta: { + + export interface Str_Instance extends String { + } + + export interface Str_Static extends TCombBase { + new (value: string): Str_Instance; + (value: string): Str_Instance; + meta: { /** * The type kind, equal to "irreducible" for irreducible types. */ - kind: string; + kind: string; /** * The type name. */ - name: string; + name: string; /** * The type predicate. */ - is: TypePredicate; - }; - } + is: TypePredicate; + }; + } - export var Str: Str_Static; - interface Num_Instance extends Number { - } - interface Num_Static extends T { - new (value: number): Num_Instance; - (value: number): Num_Instance; - } + export interface Num_Instance extends Number { + } - export var Num: Num_Static; + export interface Num_Static extends TCombBase { + new (value: number): Num_Instance; + (value: number): Num_Instance; + } - interface Bool_Instance extends Boolean { - } - interface Bool_Static extends T { - new (value: boolean): Bool_Instance; - (value: boolean): Bool_Instance; - } - export var Bool: Bool_Static; + export interface Bool_Instance extends Boolean { + } - interface Arr_Instance extends Array { - } + export interface Bool_Static extends TCombBase { + new (value: boolean): Bool_Instance; + (value: boolean): Bool_Instance; + } - interface Arr_Static extends T { - new (value: any[]): Arr_Instance; - (value: any[]): Arr_Instance; - } - export var Arr: Arr_Static; - interface Obj_Instance extends Object { - } + export interface Arr_Instance extends Array { + } - interface Obj_Static extends T { - new (value: Object): Obj_Instance; - (value: Object): Obj_Instance; - } + export interface Arr_Static extends TCombBase { + new (value: any[]): Arr_Instance; + (value: any[]): Arr_Instance; + } - export var Obj: Obj_Static; - interface Func_Instance extends Function { - } - interface Func_Static extends T { - new (value: Function): Func_Instance; - (value: Function): Func_Instance; - } + export interface Obj_Instance extends Object { + } - export var Func: Func_Static; + export interface Obj_Static extends TCombBase { - interface Err_Instance extends Error { - } + new (value: Object): Obj_Instance; + (value: Object): Obj_Instance; + } - interface Err_Static extends T { - new (value: Error): Err_Instance; - (value: Error): Err_Instance; - } - export var Err: Err_Static; - interface Re_Instance extends RegExp { - } + export interface Func_Instance extends Function { + } - interface Re_Static extends T { - new (value: RegExp): Re_Instance; - (value: RegExp): Re_Instance; - } + export interface Func_Static extends TCombBase { + new (value: Function): Func_Instance; + (value: Function): Func_Instance; + } - export var Re: Re_Static; - interface Dat_Instance extends Date { - } + export interface Err_Instance extends Error { + } - interface Dat_Static extends T { - new (value: Date): Dat_Instance; - (value: Date): Dat_Instance; - } + export interface Err_Static extends TCombBase { + new (value: Error): Err_Instance; + (value: Error): Err_Instance; + } - export var Dat: Dat_Static; - interface Type_Instance { - } + export interface Re_Instance extends RegExp { + } + + export interface Re_Static extends TCombBase { + new (value: RegExp): Re_Instance; + (value: RegExp): Re_Instance; + } + + + export interface Dat_Instance extends Date { + } + + export interface Dat_Static extends TCombBase { + new (value: Date): Dat_Instance; + (value: Date): Dat_Instance; + } + + export interface Type_Instance { + } + + export interface Type_Static extends TCombBase { + new (value: any): Type_Instance; + (value: any): Type_Instance; + } - interface Type_Static extends T { - new (value: any): Type_Instance; - (value: any): Type_Instance; - } - export var Type: Type_Static; /** * @param name - The type name. * @param is - A predicate. */ - export function irreducible(name: string, is: TypePredicate): T; + /** * @param props - A hash whose keys are the field names and the values are the fields types. * @param name - Useful for debugging purposes. */ - export function struct(props: Object, name?: string): typeof Struct; - export interface Struct_Static extends T { - new (value: any, mutable?: boolean): Struct_Instance; - (value: any, mutable?: boolean): Struct_Instance; - meta: { - kind: string; - name: string; - props: any[]; - }; - /** - * @param mixins - Contains the new props. - * @param name - Useful for debugging purposes. - */ - extend(mixins: Object, name?: string): Struct_Static; - /** - * @param mixins - Contains the new props. - * @param name - Useful for debugging purposes. - */ - extend(mixins: Struct_Static, name?: string): Struct_Static; - /** - * @param mixins - Contains the new props. - * @param name - Useful for debugging purposes. - */ - extend(mixins: Object[], name?: string): Struct_Static; - /** - * @param mixins - Contains the new props. - * @param name - Useful for debugging purposes. - */ - extend(mixins: Struct_Static[], name?: string): Struct_Static; - } - interface Struct_Instance { - } + export interface Struct_Static extends TCombBase { + new (value: any, mutable?: boolean): Struct_Instance; + (value: any, mutable?: boolean): Struct_Instance; + meta: { + kind: string; + name: string; + props: any[]; + }; + /** + * @param mixins - Contains the new props. + * @param name - Useful for debugging purposes. + */ + extend(mixins: Object, name?: string): Struct_Static; + /** + * @param mixins - Contains the new props. + * @param name - Useful for debugging purposes. + */ + extend(mixins: Struct_Static, name?: string): Struct_Static; + /** + * @param mixins - Contains the new props. + * @param name - Useful for debugging purposes. + */ + extend(mixins: Object[], name?: string): Struct_Static; + /** + * @param mixins - Contains the new props. + * @param name - Useful for debugging purposes. + */ + extend(mixins: Struct_Static[], name?: string): Struct_Static; + } - export var Struct: Struct_Static; + interface Struct_Instance { + } /** * @param map - A hash whose keys are the enums (values are free). * @param name - Useful for debugging purposes. */ - export function enums(map: Object, name?: string): T; - export module enums { + + export module enums { /** * @param keys - Array of enums. * @param name - Useful for debugging purposes. */ - export function of(keys: string[], name?: string): T; + export function of(keys: string[], name?: string): TCombBase; /** * @param keys - String of enums separated by spaces. * @param name - Useful for debugging purposes. */ - export function of(keys: string, name?: string): T; - } + export function of(keys: string, name?: string): TCombBase; + } /** * @param name - Useful for debugging purposes. */ - export function union(types: T[], name?: string): Union_Static; - interface Union_Static extends T { - new (value: any, mutable?: boolean): Union_Instance; - (value: any, mutable?: boolean): Union_Instance; - meta: { - kind: string; - name: string; - types: T[]; - }; - dispatch(x: any): T; - } + export interface Union_Static extends TCombBase { + new (value: any, mutable?: boolean): Union_Instance; + (value: any, mutable?: boolean): Union_Instance; + meta: { + kind: string; + name: string; + types: TCombBase[]; + }; + dispatch(x: any): TCombBase; + } - interface Union_Instance { - } + export interface Union_Instance { + } - export var Union: Union_Static; /** * @param type - The wrapped type. * @param name - Useful for debugging purposes. */ - export function maybe(type: T, name?: string): Maybe_Static; - export interface Maybe_Static extends T { - new (value: any, mutable?: boolean): Maybe_Instance; - (value: any, mutable?: boolean): Maybe_Instance; - meta: { - kind: string; - name: string; - typee: T; - }; - } - interface Maybe_Instance { - } - export var Maybe: Maybe_Static; + export interface Maybe_Static extends TCombBase { + new (value: any, mutable?: boolean): Maybe_Instance; + (value: any, mutable?: boolean): Maybe_Instance; + meta: { + kind: string; + name: string; + typee: TCombBase; + }; + } + + interface Maybe_Instance { + } + /** * @param name - Useful for debugging purposes. */ - export function tuple(types: T[], name?: string): Tuple_Static; - interface Tuple_Static extends T { - new (value: any, mutable?: boolean): Tuple_Instance; - (value: any, mutable?: boolean): Tuple_Instance; - meta: { - kind: string; - name: string; - types: T[]; - }; - } + interface Tuple_Static extends TCombBase { + new (value: any, mutable?: boolean): Tuple_Instance; + (value: any, mutable?: boolean): Tuple_Instance; + meta: { + kind: string; + name: string; + types: TCombBase[]; + }; + } - interface Tuple_Instance { - } + interface Tuple_Instance { + } - export var Tuple: Tuple_Static; - /** * Combines old types into a new one. * @param type - A type already defined. * @param name - Useful for debugging purposes. */ - export function subtype(type: T, predicate: TypePredicate, name?: string): typeof Subtype; - interface Subtype_Static extends T { - new (value: any, mutable?: boolean): Subtype_Instance; - (value: any, mutable?: boolean): Subtype_Instance; - meta: { - kind: string; - name: string; - type: T; - predicate: TypePredicate; - }; - } - interface Subtype_Instance { - } + export interface Subtype_Static extends TCombBase { + new (value: any, mutable?: boolean): Subtype_Instance; + (value: any, mutable?: boolean): Subtype_Instance; + meta: { + kind: string; + name: string; + type: TCombBase; + predicate: TypePredicate; + }; + } - export var Subtype: Subtype_Static; + interface Subtype_Instance { + } /** * @param type - The type of list items. * @param name - Useful for debugging purposes. */ - export function list(type: T, name?: string): List_Static; + export function list(type: TCombBase, name?: string): List_Static; - interface List_Static extends T { - new (value: any, mutable?: boolean): List_Instance; - (value: any, mutable?: boolean): List_Instance; - meta: { - kind: string; - name: string; - 'type': T; - }; - } + interface List_Static extends TCombBase { + new (value: any, mutable?: boolean): List_Instance; + (value: any, mutable?: boolean): List_Instance; + meta: { + kind: string; + name: string; + 'type': TCombBase; + }; + } - interface List_Instance { - } - - export var List: List_Static; + interface List_Instance { + } /** * @param domain - The type of keys. * @param codomain - The type of values. * @param name - Useful for debugging purposes. */ - export function dict(domain: T, codomain: T, name?: string): Dict_Static; - interface Dict_Static extends T { - new (value: any, mutable?: boolean): Dict_Instance; - (value: any, mutable?: boolean): Dict_Instance; - meta: { - kind: string; - name: string; - domain: T; - codomain: T; - }; - } - interface Dict_Instance { - } + interface Dict_Static extends TCombBase { + new (value: any, mutable?: boolean): Dict_Instance; + (value: any, mutable?: boolean): Dict_Instance; + meta: { + kind: string; + name: string; + domain: TCombBase; + codomain: TCombBase; + }; + } - export var Dict: Dict_Static; + interface Dict_Instance { + } /** * @param type - The type of the function's argument. * @param codomain - The type of the function's return value. * @param name - Useful for debugging purposes. */ - export function func(domain: T, codomain: T, name?: string): Func_Static; /** * @param type - The list of types of the function's arguments. * @param codomain - The type of the function's return value. * @param name - Useful for debugging purposes. */ - export function func(domain: T[], codomain: T, name?: string): Func_Static; - interface Func_Static extends T { - new (value: any, mutable?: boolean): Func_Instance; - (value: any, mutable?: boolean): Func_Instance; - meta: { - kind: string; - name: string; - domain: any; - codomain: T; - }; - of(fn: Function): Function; - } + interface Func_Static extends TCombBase { + new (value: any, mutable?: boolean): Func_Instance; + (value: any, mutable?: boolean): Func_Instance; + meta: { + kind: string; + name: string; + domain: any; + codomain: TCombBase; + }; + of(fn: Function): Function; + } - interface Func_Instance { - } - - export var Func: Func_Static; + interface Func_Instance { + } } +declare var t: TComb.tcomb; + declare module "tcomb" { - export = tcomb; + export = t; } From 0ac773404b92aa2cf124a5ddffef07f4467d3591 Mon Sep 17 00:00:00 2001 From: hansrwindhoff Date: Fri, 15 May 2015 18:58:34 -0600 Subject: [PATCH 050/179] update defs to v1.0 of tcomb http://gcanti.github.io/tcomb/ --- tcomb/tcomb-tests.ts | 1944 +++++++++++++++++++++++++++++++++++++----- tcomb/tcomb.d.ts | 2 +- 2 files changed, 1725 insertions(+), 221 deletions(-) diff --git a/tcomb/tcomb-tests.ts b/tcomb/tcomb-tests.ts index aeecdcb31..19ca39b3a 100644 --- a/tcomb/tcomb-tests.ts +++ b/tcomb/tcomb-tests.ts @@ -1,288 +1,1792 @@ // ReSharper disable InconsistentNaming // ReSharper disable WrongExpressionStatement +/// +/// +/// -import t = require("tcomb"); +// tests adapted from/for tcomb's test folder -var Str = t.Str; -var Num = t.Num; +'use strict'; +import assert = require('assert'); +var t = require('../index'); + +var Any = t.Any; +var Nil = t.Nil; var Bool = t.Bool; +var Num = t.Num; +var Str = t.Str; var Arr = t.Arr; var Obj = t.Obj; var Func = t.Func; var Err = t.Err; var Re = t.Re; var Dat = t.Dat; -var Nil = t.Nil; -var Any = t.Any; -var Type = t.Type; - var struct = t.struct; +var enums = t.enums; +var union = t.union; var tuple = t.tuple; +var maybe = t.maybe; +var subtype = t.subtype; var list = t.list; var dict = t.dict; -var union = t.union; -var maybe = t.maybe; var func = t.func; -var subtype = t.subtype; +var getTypeName = t.getTypeName; +var mixin = t.mixin; +var format = t.format; -Str.is("a string"); // => true -Str.is(1); // => false +// +// setup +// -Num.is("a string"); // => true -Num.is(1); // => false +var ok = function (x:any) { assert.strictEqual(true, x); }; +var ko = function (x:any) { assert.strictEqual(false, x); }; +var eq = assert.deepEqual; +var throwsWithMessage = function (f:any, message:any) { + assert.throws(f, function (err:any) { + ok(err instanceof Error); + eq(err.message, message); + return true; + }); +}; +var doesNotThrow = assert.doesNotThrow; -Bool.is("a string"); // => true -Bool.is(1); // => false - -Arr.is("a string"); // => true -Arr.is(1); // => false - -Obj.is("a string"); // => true -Obj.is(1); // => false - -Func.is("a string"); // => true -Func.is(1); // => false - -Err.is("a string"); // => true -Err.is(1); // => false - -Re.is("a string"); // => true -Re.is(1); // => false - -Dat.is("a string"); // => true -Dat.is(1); // => false - -Nil.is("a string"); // => true -Nil.is(1); // => false - -Any.is("a string"); // => true -Any.is(1); // => false - -Type.is("a string"); // => true -Type.is(1); // => false - -var assert = t.assert; - -assert(t.Str.is("a string")); // => ok -assert(t.Str.is(1)); // => fail! - -var x = -2; -var min = 0; -// throws "-2 should be greater then 0" -assert(x > min, "%s should be greater then %s", x, min); - -Str("a string"); // => ok - -class Point1 { - x: number; - y: number; - constructor(x: number, y: number) { - this.x = Num(x); - this.y = Num(y); - } -} - -var Foo = t.irreducible("Foo", x => { - return t.Bool(x.hasOwnProperty("bar")); -}); - -Foo.is({ bar: "baz" }); // => true - -// defines a type representing positive numbers -var Positive = t.subtype(t.Num, n => { - return n >= 0; -}, "Positive"); - -Positive.is(1); // => true -Positive.is(-1); // => false - -var Country = t.enums({ - IT: "Italy", - US: "United States" -}, "Country"); - -Country.is("IT"); // => true -Country.is("FR"); // => false - -// values will mirror the keys -Country = t.enums.of("IT US", "Country"); - -// same as - -Country = t.enums(["IT", "US"], "Country"); - -// same as - -Country = t.enums({ - IT: "IT", - US: "US" -}, "Country"); - -var Point = t.struct({ +var noop = function () {}; +var Point = struct({ x: Num, y: Num -}, "Point"); - -// constructor usage, `p` is immutable, new is optional -var p2 = new Point({ x: 1, y: 2 }); - -Point.is(p2); // => true - -// now p is mutable -new Point({ x: 1, y: 2 }, true); - -Point.extend({ z: Num }, "Point3D"); - -// multiple inheritance -var A = struct({}); -var B = struct({}); -var MixinC = {}; -var MixinD = {}; -A.extend([B, MixinC, MixinD]); - -var Rectangle = struct({ - width: Num, - height: Num }); -Rectangle.prototype.getArea = function() { - return this.width * this.height; -}; +describe('update', function () { + + var update = t.update; + var Tuple = tuple([Str, Num]); + var List = list(Num); + var Dict = dict(Str, Num); + + it('should handle $set command', function () { + var instance = 1; + var actual = update(instance, {$set: 2}); + eq(actual, 2); + var instance2 = [1, 2, 3]; + actual = update(instance2, {1: {'$set': 4}}); + eq(instance2, [1, 2, 3]); + eq(actual, [1, 4, 3]); + }); + + it('$set and null value, fix #65', function () { + var NullStruct = struct({a: Num, b: maybe(Num)}); + var instance = new NullStruct({a: 1}); + var updated = update(instance, {b: {$set: 2}}); + eq(instance, {a: 1, b: null}); + eq(updated, {a: 1, b: 2}); + }); + + it('should handle $apply command', function () { + var $apply = function (n:any) { return n + 1; }; + var instance = 1; + var actual = update(instance, {$apply: $apply}); + eq(actual, 2); + var instance2 = [1, 2, 3]; + actual = update(instance2, {1: {'$apply': $apply}}); + eq(instance2, [1, 2, 3]); + eq(actual, [1, 3, 3]); + }); + + it('should handle $unshift command', function () { + var actual = update([1, 2, 3], {'$unshift': [4]}); + eq(actual, [4, 1, 2, 3]); + actual = update([1, 2, 3], {'$unshift': [4, 5]}); + eq(actual, [4, 5, 1, 2, 3]); + actual = update([1, 2, 3], {'$unshift': [[4, 5]]}); + eq(actual, [[4, 5], 1, 2, 3]); + }); + + it('should handle $push command', function () { + var actual = update([1, 2, 3], {'$push': [4]}); + eq(actual, [1, 2, 3, 4]); + actual = update([1, 2, 3], {'$push': [4, 5]}); + eq(actual, [1, 2, 3, 4, 5]); + actual = update([1, 2, 3], {'$push': [[4, 5]]}); + eq(actual, [1, 2, 3, [4, 5]]); + }); + + it('should handle $splice command', function () { + var instance = [1, 2, {a: [12, 17, 15]}]; + var actual = update(instance, {2: {a: {$splice: [[1, 1, 13, 14]]}}}); + eq(instance, [1, 2, {a: [12, 17, 15]}]); + eq(actual, [1, 2, {a: [12, 13, 14, 15]}]); + }); + + it('should handle $remove command', function () { + var instance = {a: 1, b: 2}; + var actual = update(instance, {'$remove': ['a']}); + eq(instance, {a: 1, b: 2}); + eq(actual, {b: 2}); + }); + + it('should handle $swap command', function () { + var instance = [1, 2, 3, 4]; + var actual = update(instance, {'$swap': {from: 1, to: 2}}); + eq(instance, [1, 2, 3, 4]); + eq(actual, [1, 3, 2, 4]); + }); + + describe('structs', function () { + + var instance = new Point({x: 0, y: 1}); + + it('should handle $set command', function () { + var updated = update(instance, {x: {$set: 1}}); + eq(instance, {x: 0, y: 1}); + eq(updated, {x: 1, y: 1}); + }); + + it('should handle $apply command', function () { + var updated = update(instance, {x: {$apply: function (x:any) { + return x + 2; + }}}); + eq(instance, {x: 0, y: 1}); + eq(updated, {x: 2, y: 1}); + }); + + it('should handle $merge command', function () { + var updated = update(instance, {'$merge': {x: 2, y: 2}}); + eq(instance, {x: 0, y: 1}); + eq(updated, {x: 2, y: 2}); + var Nested = struct({ + a: Num, + b: struct({ + c: Num, + d: Num, + e: Num + }) + }); + instance = new Nested({a: 1, b: {c: 2, d: 3, e: 4}}); + updated = update(instance, {b: {'$merge': {c: 5, e: 6}}}); + eq(instance, {a: 1, b: {c: 2, d: 3, e: 4}}); + eq(updated, {a: 1, b: {c: 5, d: 3, e: 6}}); + }); + + }); + + describe('tuples', function () { + + var instance = Tuple(['a', 1]); + + it('should handle $set command', function () { + var updated = update(instance, {0: {$set: 'b'}}); + eq(updated, ['b', 1]); + }); + + }); + + describe('lists', function () { + + var instance = List([1, 2, 3, 4]); + + it('should handle $set command', function () { + var updated = update(instance, {2: {$set: 5}}); + eq(updated, [1, 2, 5, 4]); + }); + + it('should handle $splice command', function () { + var updated = update(instance, {$splice: [[1, 2, 5, 6]]}); + eq(updated, [1, 5, 6, 4]); + }); + + it('should handle $concat command', function () { + var updated = update(instance, {$push: [5]}); + eq(updated, [1, 2, 3, 4, 5]); + updated = update(instance, {$push: [5, 6]}); + eq(updated, [1, 2, 3, 4, 5, 6]); + }); + + it('should handle $prepend command', function () { + var updated = update(instance, {$unshift: [5]}); + eq(updated, [5, 1, 2, 3, 4]); + updated = update(instance, {$unshift: [5, 6]}); + eq(updated, [5, 6, 1, 2, 3, 4]); + }); + + it('should handle $swap command', function () { + var updated = update(instance, {$swap: {from: 1, to: 2}}); + eq(updated, [1, 3, 2, 4]); + }); + + }); + + describe('dicts', function () { + + var instance = Dict({a: 1, b: 2}); + + it('should handle $set command', function () { + var updated = update(instance, {a: {$set: 2}}); + eq(updated, {a: 2, b: 2}); + }); + + it('should handle $remove command', function () { + var updated = update(instance, {$remove: ['a']}); + eq(updated, {b: 2}); + }); + + }); + + describe('memory saving', function () { + + it('should reuse members that are not updated', function () { + var Struct = struct({ + a: Num, + b: Str, + c: tuple([Num, Num]), + }); + var List = list(Struct); + var instance = List([{ + a: 1, + b: 'one', + c: [1000, 1000000] + },{ + a: 2, + b: 'two', + c: [2000, 2000000] + }]); + + var updated = update(instance, { + 1: { + a: {$set: 119} + } + }); + + assert.strictEqual(updated[0], instance[0]); + assert.notStrictEqual(updated[1], instance[1]); + assert.strictEqual(updated[1].c, instance[1].c); + }); + }); + + describe('all together now', function () { + + it('should handle mixed commands', function () { + var Struct = struct({ + a: Num, + b: Tuple, + c: List, + d: Dict + }); + var instance = new Struct({ + a: 1, + b: ['a', 1], + c: [1, 2, 3, 4], + d: {a: 1, b: 2} + }); + var updated = update(instance, { + a: {$set: 1}, + b: {0: {$set: 'b'}}, + c: {2: {$set: 5}}, + d: {$remove: ['a']} + }); + eq(updated, { + a: 1, + b: ['b', 1], + c: [1, 2, 5, 4], + d: {b: 2} + }); + }); + + it('should handle nested structures', function () { + var Struct = struct({ + a: struct({ + b: tuple([ + Str, + list(Num) + ]) + }) + }); + var instance = new Struct({ + a: { + b: ['a', [1, 2, 3]] + } + }); + var updated = update(instance, { + a: {b: {1: {2: {$set: 4}}}} + }); + eq(updated, { + a: { + b: ['a', [1, 2, 4]] + } + }); + }); + + }); -var Cube = Rectangle.extend({ - thickness: Num }); -// typeof Cube.prototype.getArea === 'function' -Cube.prototype.getVolume = function() { - return this.getArea() * this.thickness; -}; +// +// assert +// -var Area = tuple([Num, Num]); +describe('assert', function () { -// constructor usage, `area` is immutable -Area([1, 2]); + var assert = t.assert; -var Path = list(Point); + it('should nor throw when guard is true', function () { + assert(true); + }); -// costructor usage, `path` is immutable -Path([ - { x: 0, y: 0 }, // tcomb hydrates automatically using the `Point` constructor - { x: 1, y: 1 } -]); + it('should throw a default message', function () { + throwsWithMessage(function () { + assert(1 === 2); + }, 'assert failed'); + }); -var Tel = dict(Str, Num); + it('should throw the specified message', function () { + throwsWithMessage(function () { + assert(1 === 2, 'my message'); + }, 'my message'); + }); -// costructor usage, `tel` is immutable -Tel({ jack: 4098, sape: 4139 }); + it('should format the specified message', function () { + throwsWithMessage(function () { + assert(1 === 2, '%s !== %s', 1, 2); + }, '1 !== 2'); + }); -var ReactKey = union([Str, Num]); + it('should handle custom fail behaviour', function () { + var fail = t.fail; + t.fail = function (message) { + try { + throw new Error(message); + } catch (e) { + eq(e.message, 'report error'); + } + }; + doesNotThrow(function () { + assert(1 === 2, 'report error'); + }); + t.fail = fail; + }); -ReactKey.is("a"); // => true -ReactKey.is(1); // => true -ReactKey.is(true); // => false +}); -ReactKey.dispatch = x => { - if (Str.is(x)) return Str; - if (Num.is(x)) return Num; - return Any; -}; +// +// utils +// -// now you can do this without a fail -ReactKey("a"); +describe('format(str, [...])', function () { -// the value of a radio input where null = no selection -var Radio = maybe(Str); + it('should format strings', function () { + eq(format('%s', 'a'), 'a'); + eq(format('%s', 2), '2'); + eq(format('%s === %s', 1, 1), '1 === 1'); + }); -Radio.is("a"); // => true -Radio.is(null); // => true -Radio.is(1); // => false + it('should format JSON', function () { + eq(format('%j', {a: 1}), '{"a":1}'); + }); -// add takes two `Num`s and returns a `Num` -var add = func([Num, Num], Num) - .of((x: number, y: number) => { return x + y; }); + it('should handle undefined formatters', function () { + eq(format('%o', 'a'), '%o a'); + }); -add("Hello", 2); // Raises error: Invalid `Hello` supplied to `Num` -add("Hello"); // Raises error: Invalid `Hello` supplied to `Num` + it('should handle escaping %', function () { + eq(format('%%s'), '%s'); + }); -add(1, 2); // Returns: 3 -add(1)(2); // Returns: 3 + it('should not consume an argument with a single %', function () { + eq(format('%s%', '100'), '100%'); + }); -// An `A` takes a `Str` and returns an `Num` -func(Str, Num); + it('should handle less arguments than placeholders', function () { + eq(format('%s %s', 'a'), 'a %s'); + }); -// A `B` takes a `Func` (which takes a `Str` and returns a `Num`) and returns a `Str`. -func(func(Str, Num), Str); + it('should handle more arguments than placeholders', function () { + eq(format('%s', 'a', 'b', 'c'), 'a b c'); + }); -// An `ExcitedStr` is a `Str` containing an exclamation mark -var ExcitedStr = subtype(Str, s => { return s.indexOf("!") !== -1; }, "ExcitedStr"); + it('should be extensible', function () { + (format).formatters.l = function (x:any) { return x.length; }; + eq(format('%l', ['a', 'b', 'c']), '3'); + }); -// An `Exciter` takes a `Str` and returns an `ExcitedStr` -var Exciter = func(Str, ExcitedStr); +}); -// A `C` takes an `A`, a `B` and a `Str` and returns a `Num` -func([A, B, Str], Num); +describe('mixin(x, y, [overwrite])', function () { -func(A, B).of(() => {}); + it('should mix two objects', function () { + var o1 = {a: 1}; + var o2 = {b: 2}; + var o3 = mixin(o1, o2); + ok(o3 === o1); + eq(o3.a, 1); + eq(o3.b, 2); + }); -var simpleQuestionator = Exciter.of((s: string) => { return s + "?"; }); -var simpleExciter = Exciter.of((s: string) => { return s + "!"; }); + it('should throw if a property already exists', function () { + throwsWithMessage(function () { + var o1 = {a: 1}; + var o2 = {a: 2, b: 2}; + mixin(o1, o2); + }, 'Cannot overwrite property a'); + }); -// Raises error: -// Invalid `Hello?` supplied to `ExcitedStr`, insert a valid value for the subtype -simpleQuestionator("Hello"); + it('should not throw if a property already exists but overwrite = true', function () { + var o1 = {a: 1}; + var o2 = {a: 2, b: 2}; + var o3 = mixin(o1, o2, true); + eq(o3.a, 2); + eq(o3.b, 2); + }); -// Raises error: Invalid `1` supplied to `Str` -simpleExciter(1); + it('should not mix prototype properties', function () { + function F() {} + F.prototype.method = noop; + var source = new (F)(); + var target = {}; + mixin(target, source); + eq((target).method, undefined); + }); -// Returns: "Hello!" -simpleExciter("Hello"); +}); -// We can reasonably suggest that add has the following type signature -// add : Num -> Num -> Num -add = func([Num, Num], Num) - .of((x: number, y: number) => { return x + y }); +describe('getFunctionName(f, [defaultName])', function () { -add("Hello"); // As this raises: "Error: Invalid `Hello` supplied to `Num`" + var getFunctionName = t.getFunctionName; -var add2 = add(2); -add2(1); // And this returns: 3 + it('should return the name of a named function', function () { + eq(getFunctionName(function myfunc(){}), 'myfunc'); + }); -func(A, B).is(x); + it('should return the value of `displayName` if specified', function () { + var f = function myfunc(){}; + (f).displayName = 'mydisplayname'; + eq(getFunctionName(f), 'mydisplayname'); + }); -Exciter.is(simpleExciter); // Returns: true -Exciter.is(simpleQuestionator); // Returns: true + it('should fallback on function arity if nothing is specified', function () { + eq(getFunctionName(function (a:any, b:any, c:any) { return a + b + c; }), ''); + }); -var id = (x: number) => { return x; }; +}); -func([Num, Num], Num).is(func([Num, Num], Num).of(id)); // Returns: true -func([Num, Num], Num).is(func(Num, Num).of(id)); // Returns: false +describe('getTypeName(type)', function () { -var p4 = new Point({x: 1, y: 2}); + var UnnamedStruct = struct({}); + var NamedStruct = struct({}, 'NamedStruct'); + var UnnamedUnion = union([Str, Num]); + var NamedUnion = union([Str, Num], 'NamedUnion'); + var UnnamedMaybe = maybe(Str); + var NamedMaybe = maybe(Str, 'NamedMaybe'); + var UnnamedEnums = enums({a: 'A', b: 'B'}); + var NamedEnums = enums({}, 'NamedEnums'); + var UnnamedTuple = tuple([Str, Num]); + var NamedTuple = tuple([Str, Num], 'NamedTuple'); + var UnnamedSubtype = subtype(Str, function notEmpty(x) { return x !== ''; }); + var NamedSubtype = subtype(Str, function (x) { return x !== ''; }, 'NamedSubtype'); + var UnnamedList = list(Str); + var NamedList = list(Str, 'NamedList'); + var UnnamedDict = dict(Str, Str); + var NamedDict = dict(Str, Str, 'NamedDict'); + var UnnamedFunc = func(Str, Str); + var NamedFunc = func(Str, Str, 'NamedFunc'); -p4 = Point.update(p4, { x: { "$set": 3 } }); // => {x: 3, y: 2} + it('should return the name of a named type', function () { + eq(getTypeName(NamedStruct), 'NamedStruct'); + eq(getTypeName(NamedUnion), 'NamedUnion'); + eq(getTypeName(NamedMaybe), 'NamedMaybe'); + eq(getTypeName(NamedEnums), 'NamedEnums'); + eq(getTypeName(NamedTuple), 'NamedTuple'); + eq(getTypeName(NamedSubtype), 'NamedSubtype'); + eq(getTypeName(NamedList), 'NamedList'); + eq(getTypeName(NamedDict), 'NamedDict'); + eq(getTypeName(NamedFunc), 'NamedFunc'); + }); -var Type2 = dict(Str, Num); -var instance = Type2({ a: 1, b: 2 }); -Type2.update(instance, { $remove: ["a"] }); // => {b: 2} + it('should return a meaningful name of a unnamed type', function () { + eq(getTypeName(UnnamedStruct), '{}'); + eq(getTypeName(UnnamedUnion), 'Str | Num'); + eq(getTypeName(UnnamedMaybe), '?Str'); + eq(getTypeName(UnnamedEnums), '"a" | "b"'); + eq(getTypeName(UnnamedTuple), '[Str, Num]'); + eq(getTypeName(UnnamedSubtype), '{Str | notEmpty}'); + eq(getTypeName(UnnamedList), 'Array'); + eq(getTypeName(UnnamedDict), '{[key:Str]: Str}'); + eq(getTypeName(UnnamedFunc), '(Str) => Str'); + }); -var Type3 = list(Num); -var instance2 = Type3([1, 2, 3, 4]); -Type3.update(instance2, { "$swap": { from: 1, to: 2 } }); // => [1, 3, 2, 4] +}); -t.options.onFail = message => { - return message; -}; +// +// Any +// -t.format("Invalid argument `name` = `%s` supplied to `%s`", 1, "MyType"); +describe('Any', function () { -t.getKind(Str); // => 'irreducible' -t.getKind(list(Str)); // => 'list' + var T = Any; -t.getFunctionName(t.getKind); // => 'getKind' -t.getFunctionName(() => { }); // => '' + describe('constructor', function () { -t.getTypeName(Str); + it('should behave like identity', function () { + eq(Any('a'), 'a'); + }); -t.mixin({ a: 1 }, { b: 2 }); // => {a: 1, b: 2} -t.mixin({ a: 1 }, { a: 2 }); // => fail! + it('should throw if used with new', function () { + throwsWithMessage(function () { + /* jshint ignore:start */ + var x = new (T)(); + /* jshint ignore:end */ + }, 'Operator `new` is forbidden for type `Any`'); + }); + + }); + + describe('#is(x)', function () { + + it('should always return true', function () { + ok(T.is(null)); + ok(T.is(undefined)); + ok(T.is(0)); + ok(T.is(true)); + ok(T.is('')); + ok(T.is([])); + ok(T.is({})); + ok(T.is(noop)); + ok(T.is(/a/)); + ok(T.is(new RegExp('a'))); + ok(T.is(new Error())); + }); + + }); + +}); + +// +// irreducible types +// + +describe('irreducible types constructors', function () { + + [ + {T: Nil, x: null}, + {T: Str, x: 'a'}, + {T: Num, x: 1}, + {T: Bool, x: true}, + {T: Arr, x: []}, + {T: Obj, x: {}}, + {T: Func, x: noop}, + {T: Err, x: new Error()}, + {T: Re, x: /a/}, + {T: Dat, x: new Date()} + ].forEach(function (o) { + + var T = o.T; + var x = o.x; + + it('should accept only valid values', function () { + eq(T(x), x); + }); + + it('should throw if used with new', function () { + throwsWithMessage(function () { + /* jshint ignore:start */ + var x = new (T) (); + /* jshint ignore:end */ + }, 'Operator `new` is forbidden for type `' + getTypeName(T) + '`'); + }); + + }); + +}); + +describe('Nil', function () { + + describe('#is(x)', function () { + + it('should return true when x is null or undefined', function () { + ok(Nil.is(null)); + ok(Nil.is(undefined)); + }); + + it('should return false when x is neither null nor undefined', function () { + ko(Nil.is(0)); + ko(Nil.is(true)); + ko(Nil.is('')); + ko(Nil.is([])); + ko(Nil.is({})); + ko(Nil.is(noop)); + ko(Nil.is(new Error())); + ko(Nil.is(new Date())); + ko(Nil.is(/a/)); + ko(Nil.is(new RegExp('a'))); + }); + + }); + +}); + +describe('Bool', function () { + + describe('#is(x)', function () { + + it('should return true when x is true or false', function () { + ok(Bool.is(true)); + ok(Bool.is(false)); + }); + + it('should return false when x is neither true nor false', function () { + ko(Bool.is(null)); + ko(Bool.is(undefined)); + ko(Bool.is(0)); + ko(Bool.is('')); + ko(Bool.is([])); + ko(Bool.is({})); + ko(Bool.is(noop)); + ko(Bool.is(/a/)); + ko(Bool.is(new RegExp('a'))); + ko(Bool.is(new Error())); + ko(Bool.is(new Date())); + }); + + }); + +}); + +describe('Num', function () { + + describe('#is(x)', function () { + + it('should return true when x is a number', function () { + ok(Num.is(0)); + ok(Num.is(1)); + /* jshint ignore:start */ + ko(Num.is(new Number(1))); + /* jshint ignore:end */ + }); + + it('should return false when x is not a number', function () { + ko(Num.is(NaN)); + ko(Num.is(Infinity)); + ko(Num.is(-Infinity)); + ko(Num.is(null)); + ko(Num.is(undefined)); + ko(Num.is(true)); + ko(Num.is('')); + ko(Num.is([])); + ko(Num.is({})); + ko(Num.is(noop)); + ko(Num.is(/a/)); + ko(Num.is(new RegExp('a'))); + ko(Num.is(new Error())); + ko(Num.is(new Date())); + }); + + }); + +}); + +describe('Str', function () { + + describe('#is(x)', function () { + + it('should return true when x is a string', function () { + ok(Str.is('')); + ok(Str.is('a')); + /* jshint ignore:start */ + ko(Str.is(new String('a'))); + /* jshint ignore:end */ + }); + + it('should return false when x is not a string', function () { + ko(Str.is(NaN)); + ko(Str.is(Infinity)); + ko(Str.is(-Infinity)); + ko(Str.is(null)); + ko(Str.is(undefined)); + ko(Str.is(true)); + ko(Str.is(1)); + ko(Str.is([])); + ko(Str.is({})); + ko(Str.is(noop)); + ko(Str.is(/a/)); + ko(Str.is(new RegExp('a'))); + ko(Str.is(new Error())); + ko(Str.is(new Date())); + }); + + }); + +}); + +describe('Arr', function () { + + describe('#is(x)', function () { + + it('should return true when x is an array', function () { + ok(Arr.is([])); + }); + + it('should return false when x is not an array', function () { + ko(Arr.is(NaN)); + ko(Arr.is(Infinity)); + ko(Arr.is(-Infinity)); + ko(Arr.is(null)); + ko(Arr.is(undefined)); + ko(Arr.is(true)); + ko(Arr.is(1)); + ko(Arr.is('a')); + ko(Arr.is({})); + ko(Arr.is(noop)); + ko(Arr.is(/a/)); + ko(Arr.is(new RegExp('a'))); + ko(Arr.is(new Error())); + ko(Arr.is(new Date())); + }); + + }); + +}); + +describe('Obj', function () { + + describe('#is(x)', function () { + + it('should return true when x is an object', function () { + function A() {} + ok(Obj.is({})); + ok(Obj.is(new (A)())); + }); + + it('should return false when x is not an object', function () { + ko(Obj.is(null)); + ko(Obj.is(undefined)); + ko(Obj.is(0)); + ko(Obj.is('')); + ko(Obj.is([])); + ko(Obj.is(noop)); + }); + + }); + +}); + +describe('Func', function () { + + describe('#is(x)', function () { + + it('should return true when x is a function', function () { + ok(Func.is(noop)); + /* jshint ignore:start */ + ok(Func.is(new Function())); + /* jshint ignore:end */ + }); + + it('should return false when x is not a function', function () { + ko(Func.is(null)); + ko(Func.is(undefined)); + ko(Func.is(0)); + ko(Func.is('')); + ko(Func.is([])); + /* jshint ignore:start */ + ko(Func.is(new String('1'))); + ko(Func.is(new Number(1))); + ko(Func.is(new Boolean())); + /* jshint ignore:end */ + ko(Func.is(/a/)); + ko(Func.is(new RegExp('a'))); + ko(Func.is(new Error())); + ko(Func.is(new Date())); + }); + + }); + +}); + +describe('Err', function () { + + describe('#is(x)', function () { + + it('should return true when x is an error', function () { + ok(Err.is(new Error())); + }); + + it('should return false when x is not an error', function () { + ko(Err.is(null)); + ko(Err.is(undefined)); + ko(Err.is(0)); + ko(Err.is('')); + ko(Err.is([])); + /* jshint ignore:start */ + ko(Err.is(new String('1'))); + ko(Err.is(new Number(1))); + ko(Err.is(new Boolean())); + /* jshint ignore:end */ + ko(Err.is(/a/)); + ko(Err.is(new RegExp('a'))); + ko(Err.is(new Date())); + }); + + }); + +}); + +describe('Re', function () { + + describe('#is(x)', function () { + + it('should return true when x is a regexp', function () { + ok(Re.is(/a/)); + ok(Re.is(new RegExp('a'))); + }); + + it('should return false when x is not a regexp', function () { + ko(Re.is(null)); + ko(Re.is(undefined)); + ko(Re.is(0)); + ko(Re.is('')); + ko(Re.is([])); + /* jshint ignore:start */ + ko(Re.is(new String('1'))); + ko(Re.is(new Number(1))); + ko(Re.is(new Boolean())); + /* jshint ignore:end */ + ko(Re.is(new Error())); + ko(Re.is(new Date())); + }); + + }); + +}); + +describe('Dat', function () { + + describe('#is(x)', function () { + + it('should return true when x is a Dat', function () { + ok(Dat.is(new Date())); + }); + + it('should return false when x is not a Dat', function () { + ko(Dat.is(null)); + ko(Dat.is(undefined)); + ko(Dat.is(0)); + ko(Dat.is('')); + ko(Dat.is([])); + /* jshint ignore:start */ + ko(Dat.is(new String('1'))); + ko(Dat.is(new Number(1))); + ko(Dat.is(new Boolean())); + /* jshint ignore:end */ + ko(Dat.is(new Error())); + ko(Dat.is(/a/)); + ko(Dat.is(new RegExp('a'))); + }); + + }); + +}); + +// +// struct +// + +describe('struct', function () { + + describe('combinator', function () { + + it('should throw if used with wrong arguments', function () { + + throwsWithMessage(function () { + (struct)(); + }, 'Invalid argument `props` = `undefined` supplied to `struct` combinator'); + + throwsWithMessage(function () { + struct({a: null}); + }, 'Invalid argument `props` = `[object Object]` supplied to `struct` combinator'); + + throwsWithMessage(function () { + (struct)({}, 1); + }, 'Invalid argument `name` = `1` supplied to `struct` combinator'); + + }); + + }); + describe('constructor', function () { + + it('should be idempotent', function () { + var T = Point; + var p1 = T({x: 0, y: 0}); + var p2 = T(p1); + eq(Object.isFrozen(p1), true); + eq(Object.isFrozen(p2), true); + eq(p2 === p1, true); + }); + + it('should accept only valid values', function () { + throwsWithMessage(function () { + Point(1); + }, 'Invalid argument `value` = `1` supplied to struct type `{x: Num, y: Num}`'); + }); + + }); + + describe('#is(x)', function () { + + it('should return true when x is an instance of the struct', function () { + var p = new Point({ x: 1, y: 2 }); + ok(Point.is(p)); + }); + + }); + + describe('#update()', function () { + + var Type = struct({name: Str}); + var instance = new Type({name: 'Giulio'}); + + it('should return a new instance', function () { + var newInstance = Type.update(instance, {name: {$set: 'Canti'}}); + ok(Type.is(newInstance)); + eq( ( instance).name, 'Giulio'); + eq(( newInstance).name, 'Canti'); + }); + + }); + + describe('#extend(props, [name])', function () { + + it('should extend an existing struct', function () { + var Point = struct({ + x: Num, + y: Num + }, 'Point'); + var Point3D = Point.extend({z: Num}, 'Point3D'); + eq(getTypeName(Point3D), 'Point3D'); + eq((Point3D).meta.props.x, Num); + eq((Point3D).meta.props.y, Num); + eq((Point3D).meta.props.z, Num); + }); + + it('should handle an array as argument', function () { + var Type = struct({a: Str}, 'Type'); + var Mixin = [{b: Num, c: Bool}]; + var NewType = Type.extend(Mixin, 'NewType'); + eq(getTypeName(NewType), 'NewType'); + eq((NewType).meta.props.a, Str); + eq((NewType).meta.props.b, Num); + eq((NewType).meta.props.c, Bool); + }); + + it('should handle a struct (or list of structs) as argument', function () { + var A = struct({a: Str}, 'A'); + var B = struct({b: Str}, 'B'); + var C = struct({c: Str}, 'C'); + var MixinD = {d: Str}; + var E = A.extend([B, C, MixinD]); + eq(E.meta.props, { + a: Str, + b: Str, + c: Str, + d: Str + }); + }); + + it('should support prototypal inheritance', function () { + var Rectangle = struct({ + w: Num, + h: Num + }, 'Rectangle'); + Rectangle.prototype.area = function () { + return this.w * this.h; + }; + var Cube = Rectangle.extend({ + l: Num + }); + Cube.prototype.volume = function () { + return this.area() * this.l; + }; + + assert('function' === typeof Rectangle.prototype.area); + assert('function' === typeof Cube.prototype.area); + assert(undefined === Rectangle.prototype.volume); + assert('function' === typeof Cube.prototype.volume); + assert(Cube.prototype.constructor === Cube); + + var c = new Cube({w:2, h:2, l:2}); + eq((c).volume(), 8); + }); + + }); + +}); + +// +// enums +// + +describe('enums', function () { + + describe('combinator', function () { + + it('should throw if used with wrong arguments', function () { + + throwsWithMessage(function () { + (enums)(); + }, 'Invalid argument `map` = `undefined` supplied to `enums` combinator'); + + throwsWithMessage(function () { + (enums)({}, 1); + }, 'Invalid argument `name` = `1` supplied to `enums` combinator'); + + }); + + }); + + describe('constructor', function () { + + var T = enums({a: 0}, 'T'); + + it('should throw if used with new', function () { + throwsWithMessage(function () { + /* jshint ignore:start */ + var x = new (T)('a'); + /* jshint ignore:end */ + }, 'Operator `new` is forbidden for type `T`'); + }); + + it('should accept only valid values', function () { + eq((T)('a'), 'a'); + throwsWithMessage(function () { + (T)('b'); + }, 'Invalid argument `value` = `b` supplied to enums type `T`, expected one of ["a"]'); + }); + + }); + + describe('#is(x)', function () { + + var Direction = enums({ + North: 0, + East: 1, + South: 2, + West: 3, + 1: 'North-East', + 2.5: 'South-East' + }); + + it('should return true when x is an instance of the enum', function () { + ok(Direction.is('North')); + ok(Direction.is(1)); + ok(Direction.is('1')); + ok(Direction.is(2.5)); + }); + + it('should return false when x is not an instance of the enum', function () { + ko(Direction.is('North-East')); + ko(Direction.is(2)); + }); + + }); + + describe('#of(keys)', function () { + + it('should return an enum', function () { + var Size = (enums).of(['large', 'small', 1, 10.9]); ///!!! + ok(Size.meta.map.large === 'large'); + ok(Size.meta.map.small === 'small'); + ok(Size.meta.map['1'] === 1); + ok(Size.meta.map[10.9] === 10.9); + }); + + it('should handle a string', function () { + var Size = (enums).of('large small 10'); + ok(Size.meta.map.large === 'large'); + ok(Size.meta.map.small === 'small'); + ok(Size.meta.map['10'] === '10'); + ok(Size.meta.map[10] === '10'); + }); + + }); + +}); + +// +// union +// + +describe('union', function () { + + var Circle = struct({ + center: Point, + radius: Num + }, 'Circle'); + + var Rectangle = struct({ + a: Point, + b: Point + }); + + var Shape = union([Circle, Rectangle], 'Shape'); + + Shape.dispatch = function (values) { + assert(Obj.is(values)); + return values.hasOwnProperty('center') ? + Circle : + Rectangle; + }; + + describe('combinator', function () { + + it('should throw if used with wrong arguments', function () { + + throwsWithMessage(function () { + (union)(); + }, 'Invalid argument `types` = `undefined` supplied to `union` combinator'); + + throwsWithMessage(function () { + union([]); + }, 'Invalid argument `types` = `` supplied to `union` combinator, provide at least two types'); + + throwsWithMessage(function () { + union([Circle]); + }, 'Invalid argument `types` = `Circle` supplied to `union` combinator, provide at least two types'); + + throwsWithMessage(function () { + (union)([Circle, Point], 1); + }, 'Invalid argument `name` = `1` supplied to `union` combinator'); + + }); + + }); + + describe('constructor', function () { + + it('should throw when dispatch() is not implemented', function () { + throwsWithMessage(function () { + var T = union([Str, Num], 'T'); + T.dispatch = null; + T(1); + }, 'Unimplemented `dispatch()` function for union type `T`'); + }); + + it('should have a default dispatch() implementation', function () { + var T = union([Str, Num], 'T'); + eq(T(1), 1); + }); + + it('should throw when dispatch() does not return a type', function () { + throwsWithMessage(function () { + var T = union([Str, Num], 'T'); + T(true); + }, 'The `dispatch()` function of union type `T` returns no type constructor'); + }); + + it('should build instances when dispatch() is implemented', function () { + var circle = Shape({center: {x: 0, y: 0}, radius: 10}); + ok(Circle.is(circle)); + }); + + it('should throw if used with new and union types are not instantiables with new', function () { + throwsWithMessage(function () { + var T = union([Str, Num], 'T'); + T.dispatch = function () { return Str; }; + /* jshint ignore:start */ + var x = new T('a'); + /* jshint ignore:end */ + }, 'Operator `new` is forbidden for type `T`'); + }); + + it('should not throw if used with new and union types are instantiables with new', function () { + doesNotThrow(function () { + Shape({center: {x: 0, y: 0}, radius: 10}); + }); + }); + + it('should be idempotent', function () { + var p1 = Shape({center: {x: 0, y: 0}, radius: 10}); + var p2 = Shape(p1); + eq(Object.isFrozen(p1), true); + eq(Object.isFrozen(p2), true); + eq(p2 === p1, true); + }); + + }); + + describe('#is(x)', function () { + + it('should return true when x is an instance of the union', function () { + var p = new Circle({center: { x: 0, y: 0 }, radius: 10}); + ok(Shape.is(p)); + }); + + }); + +}); + +// +// maybe +// + +describe('maybe', function () { + + describe('combinator', function () { + + it('should throw if used with wrong arguments', function () { + + throwsWithMessage(function () { + (maybe)(); + }, 'Invalid argument `type` = `undefined` supplied to `maybe` combinator'); + + throwsWithMessage(function () { + (maybe)(Point, 1); + }, 'Invalid argument `name` = `1` supplied to `maybe` combinator'); + + }); + + it('should be idempotent', function () { + var MaybeStr = maybe(Str); + ok(maybe(MaybeStr) === MaybeStr); + }); + + it('should be noop with Any', function () { + ok(maybe(Any) === Any); + }); + + it('should be noop with Nil', function () { + ok((maybe)(Nil) === Nil); + }); + + }); + + describe('constructor', function () { + + it('should throw if used with new', function () { + throwsWithMessage(function () { + /* jshint ignore:start */ + var T = maybe(Str, 'T'); + var x = new (T)(); + /* jshint ignore:end */ + }, 'Operator `new` is forbidden for type `T`'); + }); + + it('should coerce values', function () { + var T = maybe(Point); + eq(T(null), null); + eq(T(undefined), null); + ok(Point.is(T({x: 0, y: 0}))); + }); + + it('should be idempotent', function () { + var T = maybe(Point); + var p1 = T({x: 0, y: 0}); + var p2 = T(p1); + eq(Object.isFrozen(p1), true); + eq(Object.isFrozen(p2), true); + eq(p2 === p1, true); + }); + + }); + + describe('#is(x)', function () { + + it('should return true when x is an instance of the maybe', function () { + var Radio = maybe(Str); + ok(Radio.is('a')); + ok(Radio.is(null)); + ok(Radio.is(undefined)); + }); + + }); + +}); + +// +// tuple +// + +describe('tuple', function () { + + var Area = tuple([Num, Num], 'Area'); + + describe('combinator', function () { + + it('should throw if used with wrong arguments', function () { + + throwsWithMessage(function () { + (tuple)(); + }, 'Invalid argument `types` = `undefined` supplied to `tuple` combinator'); + + throwsWithMessage(function () { + (tuple)([Point, Point], 1); + }, 'Invalid argument `name` = `1` supplied to `tuple` combinator'); + + }); + + }); + + describe('constructor', function () { + + var S = struct({}, 'S'); + var T = tuple([S, S], 'T'); + + it('should coerce values', function () { + var t = T([{}, {}]); + ok(S.is(t[0])); + ok(S.is(t[1])); + }); + + it('should accept only valid values', function () { + + throwsWithMessage(function () { + T(1); + }, 'Invalid argument `value` = `1` supplied to tuple type `T`, expected an `Arr` of length `2`'); + + throwsWithMessage(function () { + T([1, 1]); + }, 'Invalid argument `value` = `1` supplied to struct type `S`'); + + }); + + it('should be idempotent', function () { + var T = tuple([Str, Num]); + var p1 = T(['a', 1]); + var p2 = T(p1); + eq(Object.isFrozen(p1), true); + eq(Object.isFrozen(p2), true); + eq(p2 === p1, true); + }); + + }); + + describe('#is(x)', function () { + + it('should return true when x is an instance of the tuple', function () { + ok(Area.is([1, 2])); + }); + + it('should return false when x is not an instance of the tuple', function () { + ko(Area.is([1])); + ko(Area.is([1, 2, 3])); + ko(Area.is([1, 'a'])); + }); + + it('should not depend on `this`', function () { + ok([[1, 2]].every(Area.is)); + }); + + }); + + describe('#update()', function () { + + var Type = tuple([Str, Num]); + var instance = Type(['a', 1]); + + it('should return a new instance', function () { + var newInstance = Type.update(instance, {0: {$set: 'b'}}); + assert(Type.is(newInstance)); + assert(instance[0] === 'a'); + assert(newInstance[0] === 'b'); + }); + + }); + +}); + +// +// list +// + +describe('list', function () { + + describe('combinator', function () { + + it('should throw if used with wrong arguments', function () { + + throwsWithMessage(function () { + (list)(); + }, 'Invalid argument `type` = `undefined` supplied to `list` combinator'); + + throwsWithMessage(function () { + (list)(Point, 1); + }, 'Invalid argument `name` = `1` supplied to `list` combinator'); + + }); + + }); + + describe('constructor', function () { + + var S = struct({}, 'S'); + var T = list(S, 'T'); + + it('should coerce values', function () { + var t = T([{}]); + ok(S.is(t[0])); + }); + + it('should accept only valid values', function () { + + throwsWithMessage(function () { + T(1); + }, 'Invalid argument `value` = `1` supplied to list type `T`'); + + throwsWithMessage(function () { + T([1]); + }, 'Invalid argument `value` = `1` supplied to struct type `S`'); + + }); + + it('should be idempotent', function () { + var T = list(Num); + var p1 = T([1, 2]); + var p2 = T(p1); + eq(Object.isFrozen(p1), true); + eq(Object.isFrozen(p2), true); + eq(p2 === p1, true); + }); + + }); + + describe('#is(x)', function () { + + var Path = list(Point); + var p1 = new Point({x: 0, y: 0}); + var p2 = new Point({x: 1, y: 1}); + + it('should return true when x is a list', function () { + ok(Path.is([p1, p2])); + }); + + it('should not depend on `this`', function () { + ok([[p1, p2]].every(Path.is)); + }); + + }); + + describe('#update()', function () { + + var Type = list(Str); + var instance = Type(['a', 'b']); + + it('should return a new instance', function () { + var newInstance = Type.update(instance, {'$push': ['c']}); + assert(Type.is(newInstance)); + assert((instance).length === 2); + assert((newInstance).length === 3); + }); + + }); + +}); + +// +// subtype +// + +describe('subtype', function () { + + var True = function () { return true; }; + + describe('combinator', function () { + + it('should throw if used with wrong arguments', function () { + + throwsWithMessage(function () { + (subtype)(); + }, 'Invalid argument `type` = `undefined` supplied to `subtype` combinator'); + + throwsWithMessage(function () { + subtype(Point, null); + }, 'Invalid argument `predicate` = `null` supplied to `subtype` combinator'); + + throwsWithMessage(function () { + (subtype)(Point, True, 1); + }, 'Invalid argument `name` = `1` supplied to `subtype` combinator'); + + }); + + }); + + describe('constructor', function () { + + it('should throw if used with new and a type that is not instantiable with new', function () { + throwsWithMessage(function () { + /* jshint ignore:start */ + var T = subtype(Str, function () { return true; }, 'T'); + var x = new( T)(); + /* jshint ignore:end */ + }, 'Operator `new` is forbidden for type `T`'); + }); + + it('should coerce values', function () { + var T = subtype(Point, function () { return true; }); + var p = T({x: 0, y: 0}); + ok(Point.is(p)); + }); + + it('should accept only valid values', function () { + var predicate = function (p:any) { return p.x > 0; }; + var T = subtype(Point, predicate, 'T'); + throwsWithMessage(function () { + T({x: 0, y: 0}); + }, 'Invalid argument `value` = `[object Object]` supplied to subtype type `T`'); + }); + + }); + + describe('#is(x)', function () { + + var Positive = subtype(Num, function (n) { + return n >= 0; + }); + + it('should return true when x is a subtype', function () { + ok(Positive.is(1)); + }); + + it('should return false when x is not a subtype', function () { + ko(Positive.is(-1)); + }); + + }); + + describe('#update()', function () { + + var Type = subtype(Str, function (s) { return s.length > 2; }); + var instance = Type('abc'); + + it('should return a new instance', function () { + var newInstance = Type.update(instance, {'$set': 'bca'}); + assert(Type.is(newInstance)); + eq(newInstance, 'bca'); + }); + + }); + +}); + +// +// dict +// + +describe('dict', function () { + + describe('combinator', function () { + + it('should throw if used with wrong arguments', function () { + + throwsWithMessage(function () { + (dict)(); + }, 'Invalid argument `domain` = `undefined` supplied to `dict` combinator'); + + throwsWithMessage(function () { + (dict)(Str); + }, 'Invalid argument `codomain` = `undefined` supplied to `dict` combinator'); + + throwsWithMessage(function () { + (dict)(Str, Point, 1); + }, 'Invalid argument `name` = `1` supplied to `dict` combinator'); + + }); + + }); + + describe('constructor', function () { + + var S = struct({}, 'S'); + var Domain = subtype(Str, function (x) { + return x !== 'forbidden'; + }, 'Domain'); + var T = dict(Domain, S, 'T'); + + it('should coerce values', function () { + var t = T({a: {}}); + ok(S.is((t).a)); + }); + + it('should accept only valid values', function () { + + throwsWithMessage(function () { + T(1); + }, 'Invalid argument `value` = `1` supplied to dict type `T`'); + + throwsWithMessage(function () { + T({a: 1}); + }, 'Invalid argument `value` = `1` supplied to struct type `S`'); + + throwsWithMessage(function () { + T({forbidden: {}}); + }, 'Invalid argument `value` = `forbidden` supplied to subtype type `Domain`'); + + }); + + it('should be idempotent', function () { + var T = dict(Str, Str); + var p1 = T({a: 'a', b: 'b'}); + var p2 = T(p1); + eq(Object.isFrozen(p1), true); + eq(Object.isFrozen(p2), true); + eq(p2 === p1, true); + }); + + }); + + describe('#is(x)', function () { + + var T = dict(Str, Point); + var p1 = new Point({x: 0, y: 0}); + var p2 = new Point({x: 1, y: 1}); + + it('should return true when x is a list', function () { + ok(T.is({a: p1, b: p2})); + }); + + it('should not depend on `this`', function () { + ok([{a: p1, b: p2}].every(T.is)); + }); + + }); + + describe('#update()', function () { + + var Type = dict(Str, Str); + var instance = Type({p1: 'a', p2: 'b'}); + + it('should return a new instance', function () { + var newInstance = Type.update(instance, {p2: {$set: 'c'}}); + ok(Type.is(newInstance)); + eq((instance).p2, 'b'); + eq((newInstance).p2, 'c'); + }); + + }); + +}); + +// +// func +// + +describe('func', function () { + + it('should handle a no types', function () { + var T = func([], Str); + eq(T.meta.domain.length, 0); + var getGreeting = T.of(function () { return 'Hi'; }); + eq(getGreeting(), 'Hi'); + }); + + it('should handle a single type', function () { + var T = func(Num, Num); + eq(T.meta.domain.length, 1); + ok(T.meta.domain[0] === Num); + }); + + it('should automatically instrument a function', function () { + var T = func(Num, Num); + var f = function () { return 'hi'; }; + ok(T.is(T(f))); + }); + + describe('of', function () { + + it('should check the arguments', function () { + + var T = func([Num, Num], Num); + var sum = T.of(function (a:any, b:any) { + return a + b; + }); + eq(sum(1, 2), 3); + + throwsWithMessage(function () { + sum(1, 2, 3); + }, 'Invalid argument `value` = `1,2,3` supplied to tuple type `[Num, Num]`, expected an `Arr` of length `2`'); + + throwsWithMessage(function () { + sum('a', 2); + }, 'Invalid argument `value` = `a` supplied to irreducible type `Num`'); + + }); + + it('should check the return value', function () { + + var T = func([Num, Num], Num); + var sum = T.of(function () { + return 'a'; + }); + + throwsWithMessage(function () { + sum(1, 2); + }, 'Invalid argument `value` = `a` supplied to irreducible type `Num`'); + + }); + + it('should preserve `this`', function () { + var o = {name: 'giulio'}; + (o).getTypeName = func([], Str).of(function () { + return this.name; + }); + eq((o).getTypeName(), 'giulio'); + }); + + it('should handle function types', function () { + var A = func([Str], Str); + var B = func([Str, A], Str); + + var f = A.of(function (s:any) { + return s + '!'; + }); + var g = B.of(function (str:any, strAction:any) { + return strAction(str); + }); + + eq(g('hello', f), 'hello!'); + }); + + it('should be idempotent', function () { + var f = function (s:any) { return s; }; + var g = func([Str], Str).of(f); + var h = func([Str], Str).of(g); + ok(h === g); + }); + + }); + + describe('currying', function () { + + it('should curry functions', function () { + var Type = func([Num, Num, Num], Num); + var sum = Type.of(function (a:any, b:any, c:any) { + return a + b + c; + }); + eq(sum(1, 2, 3), 6); + eq(sum(1, 2)(3), 6); + eq(sum(1)(2, 3), 6); + eq(sum(1)(2)(3), 6); + + // important: the curried function must be of the correct type + var CurriedType = func([Num, Num], Num); + var sum1 = sum(1); + eq(sum1(2, 3), 6); + eq(sum1(2)(3), 6); + ok(CurriedType.is(sum1)); + }); + + it('should throw if partial arguments are wrong', function () { + + var T = func([Num, Num], Num); + var sum = T.of(function (a:any, b:any) { + return a + b; + }); + + throwsWithMessage(function () { + sum('a'); + }, 'Invalid argument `value` = `a` supplied to irreducible type `Num`'); + + throwsWithMessage(function () { + var sum1 = sum(1); + sum1('a'); + }, 'Invalid argument `value` = `a` supplied to irreducible type `Num`'); + + }); + + }); + +}); diff --git a/tcomb/tcomb.d.ts b/tcomb/tcomb.d.ts index 91c004160..91add803a 100644 --- a/tcomb/tcomb.d.ts +++ b/tcomb/tcomb.d.ts @@ -83,7 +83,7 @@ declare module TComb { } export interface Any_Static extends TCombBase { - + new (value: any): Any_Instance; (value: any): Any_Instance; } From 4f5c7c2d00aad3b37cd115536087d22e56c38d65 Mon Sep 17 00:00:00 2001 From: hansrwindhoff Date: Fri, 15 May 2015 23:26:09 -0600 Subject: [PATCH 051/179] fix travis errors --- tcomb/tcomb-tests.ts | 16 ++++++++-------- tcomb/tcomb.d.ts | 9 ++++++--- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/tcomb/tcomb-tests.ts b/tcomb/tcomb-tests.ts index 19ca39b3a..3a27ffc7f 100644 --- a/tcomb/tcomb-tests.ts +++ b/tcomb/tcomb-tests.ts @@ -256,9 +256,9 @@ describe('update', function () { } }); - assert.strictEqual(updated[0], instance[0]); - assert.notStrictEqual(updated[1], instance[1]); - assert.strictEqual(updated[1].c, instance[1].c); + assert.strictEqual(( updated)[0], ( instance)[0]); + assert.notStrictEqual(( updated)[1], ( instance)[1]); + assert.strictEqual(( updated)[1].c, ( instance)[1].c); }); }); @@ -1328,8 +1328,8 @@ describe('tuple', function () { it('should coerce values', function () { var t = T([{}, {}]); - ok(S.is(t[0])); - ok(S.is(t[1])); + ok(S.is(( t)[0])); + ok(S.is(( t)[1])); }); it('should accept only valid values', function () { @@ -1381,8 +1381,8 @@ describe('tuple', function () { it('should return a new instance', function () { var newInstance = Type.update(instance, {0: {$set: 'b'}}); assert(Type.is(newInstance)); - assert(instance[0] === 'a'); - assert(newInstance[0] === 'b'); + assert(( instance)[0] === 'a'); + assert(( newInstance)[0] === 'b'); }); }); @@ -1418,7 +1418,7 @@ describe('list', function () { it('should coerce values', function () { var t = T([{}]); - ok(S.is(t[0])); + ok(S.is(( t)[0])); }); it('should accept only valid values', function () { diff --git a/tcomb/tcomb.d.ts b/tcomb/tcomb.d.ts index 91add803a..1c8825061 100644 --- a/tcomb/tcomb.d.ts +++ b/tcomb/tcomb.d.ts @@ -1,10 +1,13 @@ // Type definitions for tcomb v1.0.3 // Project: http://gcanti.github.io/tcomb/guide/index.html -// Definitions by: Jed Mao and Hans Windhoff +// Definitions by: Jed Mao +// and Hans Windhoff // Definitions: https://github.com/borisyankov/DefinitelyTyped - declare module TComb { + export interface NumbersOnly { + [idx:number]:string; + } export interface tcomb { format: (format: string, ...values: any[]) => string; getFunctionName: (fn: Function) => string; @@ -12,7 +15,7 @@ declare module TComb { mixin: (target: {}, source: {}, overwrite?: boolean) => any; slice: typeof Array.prototype.slice; shallowCopy: (x: TCombBase) => TCombBase; - update: (instance: any, spec: {}) => TCombBase; + update: (instance: any, spec: {} ) => TCombBase; assert: (condition: boolean, message?: string, ...values: any[]) => void; fail: (message?: string) => void; Any: Any_Static; From c1a834f1298899f1546416ac5568dd0df8d6d12b Mon Sep 17 00:00:00 2001 From: hansrwindhoff Date: Fri, 15 May 2015 23:28:56 -0600 Subject: [PATCH 052/179] only one line for definitions by --- tcomb/tcomb.d.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tcomb/tcomb.d.ts b/tcomb/tcomb.d.ts index 1c8825061..fcee4d48c 100644 --- a/tcomb/tcomb.d.ts +++ b/tcomb/tcomb.d.ts @@ -1,7 +1,6 @@ // Type definitions for tcomb v1.0.3 // Project: http://gcanti.github.io/tcomb/guide/index.html -// Definitions by: Jed Mao -// and Hans Windhoff +// Definitions by: Hans Windhoff // Definitions: https://github.com/borisyankov/DefinitelyTyped declare module TComb { From 0335eae167b77bb95a6119a3f41770f3fc4cda79 Mon Sep 17 00:00:00 2001 From: hansrwindhoff Date: Fri, 15 May 2015 23:47:02 -0600 Subject: [PATCH 053/179] lines --- tcomb/tcomb.d.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tcomb/tcomb.d.ts b/tcomb/tcomb.d.ts index fcee4d48c..8af914ab5 100644 --- a/tcomb/tcomb.d.ts +++ b/tcomb/tcomb.d.ts @@ -3,10 +3,6 @@ // Definitions by: Hans Windhoff // Definitions: https://github.com/borisyankov/DefinitelyTyped declare module TComb { - - export interface NumbersOnly { - [idx:number]:string; - } export interface tcomb { format: (format: string, ...values: any[]) => string; getFunctionName: (fn: Function) => string; From 14e5d8e09df6ab514c7179afe08adf91c243b965 Mon Sep 17 00:00:00 2001 From: Tat Date: Sat, 16 May 2015 12:45:11 +0530 Subject: [PATCH 054/179] adding the type definitions for the DataStream.js library --- DataStream.js/DataStream.js-tests.ts | 180 +++++ DataStream.js/DataStream.js.d.ts | 937 +++++++++++++++++++++++++++ 2 files changed, 1117 insertions(+) create mode 100644 DataStream.js/DataStream.js-tests.ts create mode 100644 DataStream.js/DataStream.js.d.ts diff --git a/DataStream.js/DataStream.js-tests.ts b/DataStream.js/DataStream.js-tests.ts new file mode 100644 index 000000000..71bb08537 --- /dev/null +++ b/DataStream.js/DataStream.js-tests.ts @@ -0,0 +1,180 @@ +/// + +var buf = new ArrayBuffer(100); +var ds = new DataStream(buf); +ds = new DataStream(buf, 10); +ds = new DataStream(buf, 10, DataStream.BIG_ENDIAN); + +ds.save('somefile.ext'); +ds.dynamicSize = true; + +for (var i=0; i +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare class DataStream { + + /** + Big-endian const to use as default endianness. + */ + static BIG_ENDIAN: boolean; + + /** + Little-endian const to use as default endianness. + */ + static LITTLE_ENDIAN: boolean; + + /** + DataStream reads scalars, arrays and structs of data from an ArrayBuffer. + It's like a file-like DataView on steroids. + + @param {ArrayBuffer} arrayBuffer ArrayBuffer to read from. + */ + constructor(arrayBuffer: ArrayBuffer); + + /** + DataStream reads scalars, arrays and structs of data from an ArrayBuffer. + It's like a file-like DataView on steroids. + + @param arrayBuffer ArrayBuffer to read from. + @param byteOffset Offset from arrayBuffer beginning for the DataStream. + */ + constructor(arrayBuffer: ArrayBuffer, byteOffset: number); + + /** + DataStream reads scalars, arrays and structs of data from an ArrayBuffer. + It's like a file-like DataView on steroids. + + @param arrayBuffer ArrayBuffer to read from. + @param byteOffset Offset from arrayBuffer beginning for the DataStream. + @param endianness DataStream.BIG_ENDIAN or DataStream.LITTLE_ENDIAN (the default). + */ + constructor(arrayBuffer: ArrayBuffer, byteOffset: number, endianness: boolean); + + /** + Saves the DataStream contents to the given filename. + Uses Chrome's anchor download property to initiate download. + * + @param filename Filename to save as. + @return nothing + */ + save(filename: string): void; + + /** + Whether to extend DataStream buffer when trying to write beyond its size. + If set, the buffer is reallocated to twice its current size until the + requested write fits the buffer. + */ + dynamicSize: boolean; + + /** + Returns the byte length of the DataStream object. + */ + byteLength: number; + + /** + Set/get the backing ArrayBuffer of the DataStream object. + The setter updates the DataView to point to the new buffer. + */ + buffer: ArrayBuffer; + + /** + Set/get the byteOffset of the DataStream object. + The setter updates the DataView to point to the new byteOffset. + */ + byteOffset: number; + + /** + Set/get the backing DataView of the DataStream object. + The setter updates the buffer and byteOffset to point to the DataView values. + */ + dataView: Object; + + /** + Sets the DataStream read/write position to given position. + Clamps between 0 and DataStream length. + * + @param pos Position to seek to. + @return nothing + */ + seek(pos: number): void; + + /** + Returns true if the DataStream seek pointer is at the end of buffer and + there's no more data to read. + * + @return true if the seek pointer is at the end of the buffer. + */ + isEof(): boolean; + + /** + Maps an Int32Array into the DataStream buffer, swizzling it to native + endianness in-place. The current offset from the start of the buffer needs to + be a multiple of element size, just like with typed array views. + * + Nice for quickly reading in data. Warning: potentially modifies the buffer + contents. + * + @param length Number of elements to map. + @return Int32Array to the DataStream backing buffer. + */ + mapInt32Array(length: number): Int32Array; + + /** + Maps an Int32Array into the DataStream buffer, swizzling it to native + endianness in-place. The current offset from the start of the buffer needs to + be a multiple of element size, just like with typed array views. + * + Nice for quickly reading in data. Warning: potentially modifies the buffer + contents. + * + @param length Number of elements to map. + @param e Endianness of the data to read. + @return Int32Array to the DataStream backing buffer. + */ + mapInt32Array(length: number, e: boolean): Int32Array; + + /** + Maps an Int16Array into the DataStream buffer, swizzling it to native + endianness in-place. The current offset from the start of the buffer needs to + be a multiple of element size, just like with typed array views. + * + Nice for quickly reading in data. Warning: potentially modifies the buffer + contents. + * + @param length Number of elements to map. + @return Int16Array to the DataStream backing buffer. + */ + mapInt16Array(length: number): Int16Array; + + /** + Maps an Int16Array into the DataStream buffer, swizzling it to native + endianness in-place. The current offset from the start of the buffer needs to + be a multiple of element size, just like with typed array views. + * + Nice for quickly reading in data. Warning: potentially modifies the buffer + contents. + * + @param length Number of elements to map. + @param e Endianness of the data to read. + @return Int16Array to the DataStream backing buffer. + */ + mapInt16Array(length: number, e: boolean): Int16Array; + + /** + Maps an Int8Array into the DataStream buffer. + * + Nice for quickly reading in data. + * + @param length Number of elements to map. + @return Int8Array to the DataStream backing buffer. + */ + mapInt8Array(length: number): Int8Array; + + /** + Maps a Uint32Array into the DataStream buffer, swizzling it to native + endianness in-place. The current offset from the start of the buffer needs to + be a multiple of element size, just like with typed array views. + * + Nice for quickly reading in data. Warning: potentially modifies the buffer + contents. + * + @param length Number of elements to map. + @return Uint32Array to the DataStream backing buffer. + */ + mapUint32Array(length: number): Uint32Array; + + /** + Maps a Uint32Array into the DataStream buffer, swizzling it to native + endianness in-place. The current offset from the start of the buffer needs to + be a multiple of element size, just like with typed array views. + * + Nice for quickly reading in data. Warning: potentially modifies the buffer + contents. + * + @param length Number of elements to map. + @param e Endianness of the data to read. + @return Uint32Array to the DataStream backing buffer. + */ + mapUint32Array(length: number, e: boolean): Uint32Array; + + /** + Maps a Uint16Array into the DataStream buffer, swizzling it to native + endianness in-place. The current offset from the start of the buffer needs to + be a multiple of element size, just like with typed array views. + * + Nice for quickly reading in data. Warning: potentially modifies the buffer + contents. + * + @param length Number of elements to map. + @return Uint16Array to the DataStream backing buffer. + */ + mapUint16Array(length: number): Uint16Array; + + /** + Maps a Uint16Array into the DataStream buffer, swizzling it to native + endianness in-place. The current offset from the start of the buffer needs to + be a multiple of element size, just like with typed array views. + * + Nice for quickly reading in data. Warning: potentially modifies the buffer + contents. + * + @param length Number of elements to map. + @param e Endianness of the data to read. + @return Uint16Array to the DataStream backing buffer. + */ + mapUint16Array(length: number, e: boolean): Uint16Array; + + /** + Maps a Uint8Array into the DataStream buffer. + * + Nice for quickly reading in data. + * + @param length Number of elements to map. + @return Uint8Array to the DataStream backing buffer. + */ + mapUint8Array(length: number): Uint8Array; + + /** + Maps a Float64Array into the DataStream buffer, swizzling it to native + endianness in-place. The current offset from the start of the buffer needs to + be a multiple of element size, just like with typed array views. + * + Nice for quickly reading in data. Warning: potentially modifies the buffer + contents. + * + @param length Number of elements to map. + @return Float64Array to the DataStream backing buffer. + */ + mapFloat64Array(length: number): Float64Array; + + /** + Maps a Float64Array into the DataStream buffer, swizzling it to native + endianness in-place. The current offset from the start of the buffer needs to + be a multiple of element size, just like with typed array views. + * + Nice for quickly reading in data. Warning: potentially modifies the buffer + contents. + * + @param length Number of elements to map. + @param e Endianness of the data to read. + @return Float64Array to the DataStream backing buffer. + */ + mapFloat64Array(length: number, e: boolean): Float64Array; + + /** + Maps a Float32Array into the DataStream buffer, swizzling it to native + endianness in-place. The current offset from the start of the buffer needs to + be a multiple of element size, just like with typed array views. + * + Nice for quickly reading in data. Warning: potentially modifies the buffer + contents. + * + @param length Number of elements to map. + @return Float32Array to the DataStream backing buffer. + */ + mapFloat32Array(length: number): Float32Array; + + /** + Maps a Float32Array into the DataStream buffer, swizzling it to native + endianness in-place. The current offset from the start of the buffer needs to + be a multiple of element size, just like with typed array views. + * + Nice for quickly reading in data. Warning: potentially modifies the buffer + contents. + * + @param length Number of elements to map. + @param e Endianness of the data to read. + @return Float32Array to the DataStream backing buffer. + */ + mapFloat32Array(length: number, e: boolean): Float32Array; + + /** + Reads an Int32Array of desired length and endianness from the DataStream. + * + @param length Number of elements to map. + @return The read Int32Array. + */ + readInt32Array(length: number): Int32Array; + + /** + Reads an Int32Array of desired length and endianness from the DataStream. + * + @param length Number of elements to map. + @param e Endianness of the data to read. + @return The read Int32Array. + */ + readInt32Array(length: number, e: boolean): Int32Array; + + /** + Reads an Int16Array of desired length and endianness from the DataStream. + * + @param length Number of elements to map. + @return The read Int16Array. + */ + readInt16Array(length: number): Int16Array; + + /** + Reads an Int16Array of desired length and endianness from the DataStream. + * + @param length Number of elements to map. + @param e Endianness of the data to read. + @return The read Int16Array. + */ + readInt16Array(length: number, e: boolean): Int16Array; + + /** + Reads an Int8Array of desired length from the DataStream. + * + @param length Number of elements to map. + @return The read Int8Array. + */ + readInt8Array(length: number): Int8Array; + + /** + Reads an Uint32Array of desired length and endianness from the DataStream. + * + @param length Number of elements to map. + @return The read Uint32Array. + */ + readUint32Array(length: number): Uint32Array; + + /** + Reads an Uint32Array of desired length and endianness from the DataStream. + * + @param length Number of elements to map. + @param e Endianness of the data to read. + @return The read Uint32Array. + */ + readUint32Array(length: number, e: boolean): Uint32Array; + + /** + Reads an Uint16Array of desired length and endianness from the DataStream. + * + @param length Number of elements to map. + @return The read Uint16Array. + */ + readUint16Array(length: number): Uint16Array; + + /** + Reads an Uint16Array of desired length and endianness from the DataStream. + * + @param length Number of elements to map. + @param e Endianness of the data to read. + @return The read Uint16Array. + */ + readUint16Array(length: number, e: boolean): Uint16Array; + + /** + Reads an Uint8Array of desired length from the DataStream. + * + @param length Number of elements to map. + @return The read Uint8Array. + */ + readUint8Array(length: number): Uint8Array; + + /** + Reads a Float64Array of desired length and endianness from the DataStream. + * + @param length Number of elements to map. + @param e Endianness of the data to read. + @return The read Float64Array. + */ + readFloat64Array(length: number, e: boolean): Float64Array; + + /** + Reads a Float64Array of desired length and endianness from the DataStream. + * + @param length Number of elements to map. + @return The read Float64Array. + */ + readFloat64Array(length: number): Float64Array; + + /** + Reads a Float32Array of desired length and endianness from the DataStream. + * + @param length Number of elements to map. + @param e Endianness of the data to read. + @return The read Float32Array. + */ + readFloat32Array(length: number, e: boolean): Float32Array; + + /** + Reads a Float32Array of desired length and endianness from the DataStream. + * + @param length Number of elements to map. + @return The read Float32Array. + */ + readFloat32Array(length: number): Float32Array; + + /** + Writes an Int32Array of specified endianness to the DataStream. + * + @param arr The array to write. + @param e Endianness of the data to write. + */ + writeInt32Array(arr: Int32Array, e: boolean): void; + + /** + Writes an Int32Array of specified endianness to the DataStream. + * + @param arr The array to write. + */ + writeInt32Array(arr: Int32Array): void; + + /** + Writes an Int16Array of specified endianness to the DataStream. + * + @param arr The array to write. + @param e Endianness of the data to write. + */ + writeInt16Array(arr: Int16Array, e: boolean): void; + + /** + Writes an Int16Array of specified endianness to the DataStream. + * + @param arr The array to write. + */ + writeInt16Array(arr: Int16Array): void; + + /** + Writes an Int8Array to the DataStream. + * + @param arr The array to write. + */ + writeInt8Array(arr: Int8Array): void; + + /** + Writes an Uint32Array of specified endianness to the DataStream. + * + @param arr The array to write. + @param e Endianness of the data to write. + */ + writeUint32Array(arr: Uint32Array, e: boolean): void; + + /** + Writes an Uint32Array of specified endianness to the DataStream. + * + @param arr The array to write. + */ + writeUint32Array(arr: Uint32Array): void; + + /** + Writes an Uint16Array of specified endianness to the DataStream. + * + @param arr The array to write. + @param e Endianness of the data to write. + */ + writeUint16Array(arr: Uint16Array, e: boolean): void; + + /** + Writes an Uint16Array of specified endianness to the DataStream. + * + @param arr The array to write. + */ + writeUint16Array(arr: Uint16Array): void; + + /** + Writes an Uint8Array to the DataStream. + * + @param arr The array to write. + */ + writeUint8Array(arr: Uint8Array): void; + + /** + Writes a Float64Array of specified endianness to the DataStream. + * + @param arr The array to write. + */ + writeFloat64Array(arr: Float64Array): void; + + /** + Writes a Float64Array of specified endianness to the DataStream. + * + @param arr The array to write. + @param e Endianness of the data to write. + */ + writeFloat64Array(arr: Float64Array, e: boolean): void; + + /** + Writes a Float32Array of specified endianness to the DataStream. + * + @param arr The array to write. + */ + writeFloat32Array(arr: Float32Array): void; + + /** + Writes a Float32Array of specified endianness to the DataStream. + * + @param arr The array to write. + @param e Endianness of the data to write. + */ + writeFloat32Array(arr: Float32Array, e: boolean): void; + + /** + Reads a 32-bit int from the DataStream with the desired endianness. + * + @return The read number. + */ + readInt32(): number; + + /** + Reads a 32-bit int from the DataStream with the desired endianness. + * + @param e Endianness of the number. + @return The read number. + */ + readInt32(e: boolean): number; + + /** + Reads a 16-bit int from the DataStream with the desired endianness. + * + @return The read number. + */ + readInt16(): number; + + /** + Reads a 16-bit int from the DataStream with the desired endianness. + * + @param e Endianness of the number. + @return The read number. + */ + readInt16(e: boolean): number; + + /** + Reads an 8-bit int from the DataStream. + * + @return The read number. + */ + readInt8(): number; + + /** + Reads a 32-bit unsigned int from the DataStream with the desired endianness. + * + @return The read number. + */ + readUint32(): number; + + /** + Reads a 32-bit unsigned int from the DataStream with the desired endianness. + * + @param e Endianness of the number. + @return The read number. + */ + readUint32(e: boolean): number; + + /** + Reads a 16-bit unsigned int from the DataStream with the desired endianness. + * + @return The read number. + */ + readUint16(): number; + + /** + Reads a 16-bit unsigned int from the DataStream with the desired endianness. + * + @param e Endianness of the number. + @return The read number. + */ + readUint16(e: boolean): number; + + /** + Reads an 8-bit unsigned intfrom the DataStream. + * + @return The read number. + */ + readUint8(): number; + + /** + Reads a 32-bit float from the DataStream with the desired endianness. + * + @return The read number. + */ + readFloat32(): number; + + /** + Reads a 32-bit float from the DataStream with the desired endianness. + * + @param e Endianness of the number. + @return The read number. + */ + readFloat32(e: boolean): number; + + /** + Reads a 64-bit float from the DataStream with the desired endianness. + * + @return The read number. + */ + readFloat64(): number; + + /** + Reads a 64-bit float from the DataStream with the desired endianness. + * + @param e Endianness of the number. + @return The read number. + */ + readFloat64(e: boolean): number; + + /** + Writes a 32-bit int to the DataStream with the desired endianness. + * + @param v Number to write. + */ + writeInt32(v: number): void; + + /** + Writes a 32-bit int to the DataStream with the desired endianness. + * + @param v Number to write. + @param e Endianness of the number. + */ + writeInt32(v: number, e: boolean): void; + + /** + Writes a 16-bit int to the DataStream with the desired endianness. + * + @param v Number to write. + */ + writeInt16(v: number): void; + + /** + Writes a 16-bit int to the DataStream with the desired endianness. + * + @param v Number to write. + @param e Endianness of the number. + */ + writeInt16(v: number, e: boolean): void; + + /** + Writes an 8-bit int to the DataStream. + * + @param v Number to write. + */ + writeInt8(v: number): void; + + /** + Writes a 32-bit undigned int to the DataStream with the desired endianness. + * + @param v Number to write. + */ + writeUint32(v: number): void; + + /** + Writes a 32-bit undigned int to the DataStream with the desired endianness. + * + @param v Number to write. + @param e Endianness of the number. + */ + writeUint32(v: number, e: boolean): void; + + /** + Writes a 16-bit undigned int to the DataStream with the desired endianness. + * + @param v Number to write. + */ + writeUint16(v: number): void; + + /** + Writes a 16-bit undigned int to the DataStream with the desired endianness. + * + @param v Number to write. + @param e Endianness of the number. + */ + writeUint16(v: number, e: boolean): void; + + /** + Writes an 8-bit undigned int to the DataStream. + * + @param v Number to write. + */ + writeUint8(v: number): void; + + /** + Writes a 32-bit float to the DataStream with the desired endianness. + * + @param v Number to write. + */ + writeFloat32(v: number): void; + + /** + Writes a 32-bit float to the DataStream with the desired endianness. + * + @param v Number to write. + @param e Endianness of the number. + */ + writeFloat32(v: number, e: boolean): void; + + /** + Writes a 64-bit float to the DataStream with the desired endianness. + * + @param v Number to write. + */ + writeFloat64(v: number): void; + + /** + Writes a 64-bit float to the DataStream with the desired endianness. + * + @param v Number to write. + @param e Endianness of the number. + */ + writeFloat64(v: number, e: boolean): void; + + /** + Reads a struct of data from the DataStream. The struct is defined as + a flat array of [name, type]-pairs. See the example below: + * + ds.readStruct([ + 'headerTag', 'uint32', // Uint32 in DataStream endianness. + 'headerTag2', 'uint32be', // Big-endian Uint32. + 'headerTag3', 'uint32le', // Little-endian Uint32. + 'array', ['[]', 'uint32', 16], // Uint32Array of length 16. + 'array2Length', 'uint32', + 'array2', ['[]', 'uint32', 'array2Length'] // Uint32Array of length array2Length + ]); + * + The possible values for the type are as follows: + * + // Number types + // Unsuffixed number types use DataStream endianness. + // To explicitly specify endianness, suffix the type with + // 'le' for little-endian or 'be' for big-endian, + // e.g. 'int32be' for big-endian int32. + 'uint8' -- 8-bit unsigned int + 'uint16' -- 16-bit unsigned int + 'uint32' -- 32-bit unsigned int + 'int8' -- 8-bit int + 'int16' -- 16-bit int + 'int32' -- 32-bit int + 'float32' -- 32-bit float + 'float64' -- 64-bit float + * + // String types + 'cstring' -- ASCII string terminated by a zero byte. + 'string:N' -- ASCII string of length N, where N is a literal integer. + 'string:variableName' -- ASCII string of length $variableName, + where 'variableName' is a previously parsed number in the current struct. + 'string,CHARSET:N' -- String of byteLength N encoded with given CHARSET. + 'u16string:N' -- UCS-2 string of length N in DataStream endianness. + 'u16stringle:N' -- UCS-2 string of length N in little-endian. + 'u16stringbe:N' -- UCS-2 string of length N in big-endian. + * + // Complex types + [name, type, name_2, type_2, ..., name_N, type_N] -- Struct + function(dataStream, struct) {} -- Callback function to read and return data. + {get: function(dataStream, struct) {}, + set: function(dataStream, struct) {}} + -- Getter/setter functions to read and return data, handy for using the same + struct definition for reading and writing structs. + ['[]', type, length] -- Array of given type and length. The length can be either + a number, a string that references a previously-read + field, or a callback function(struct, dataStream, type){}. + If length is '*', reads in as many elements as it can. + * + @param structDefinition Struct definition object. + @return The read struct. Null if failed to read struct. + */ + readStruct(structDefinition: any[]): Object; + + /** + Writes a struct to the DataStream. Takes a structDefinition that gives the + types and a struct object that gives the values. Refer to readStruct for the + structure of structDefinition. + * + @param structDefinition Type definition of the struct. + @param struct The struct data object. + */ + writeStruct(structDefinition: Object, struct: Object): void; + + /** + Read UCS-2 string of desired length and endianness from the DataStream. + * + @param length The length of the string to read. + @return The read string. + */ + readUCS2String(length: number): string; + + /** + Read UCS-2 string of desired length and endianness from the DataStream. + * + @param length The length of the string to read. + @param endianness The endianness of the string data in the DataStream. + @return The read string. + */ + readUCS2String(length: number, endianness: boolean): string; + + /** + Write a UCS-2 string of desired endianness to the DataStream. The + lengthOverride argument lets you define the number of characters to write. + If the string is shorter than lengthOverride, the extra space is padded with + zeroes. + * + @param str The string to write. + */ + writeUCS2String(str: string): void; + + /** + Write a UCS-2 string of desired endianness to the DataStream. The + lengthOverride argument lets you define the number of characters to write. + If the string is shorter than lengthOverride, the extra space is padded with + zeroes. + * + @param str The string to write. + @param endianness The endianness to use for the written string data. + */ + writeUCS2String(str: string, endianness: boolean): void; + + /** + Write a UCS-2 string of desired endianness to the DataStream. The + lengthOverride argument lets you define the number of characters to write. + If the string is shorter than lengthOverride, the extra space is padded with + zeroes. + * + @param str The string to write. + @param endianness The endianness to use for the written string data. + @param lengthOverride The number of characters to write. + */ + writeUCS2String(str: string, endianness: boolean, lengthOverride: number): void; + + /** + Read a string of desired length and encoding from the DataStream. + * + @param length The length of the string to read in bytes. + @return The read string. + */ + readString(length: number): string; + + /** + Read a string of desired length and encoding from the DataStream. + * + @param length The length of the string to read in bytes. + @param encoding The encoding of the string data in the DataStream. Defaults to ASCII. + @return The read string. + */ + readString(length: number, encoding: string): string; + + /** + Writes a string of desired length and encoding to the DataStream. + * + @param s The string to write. + */ + writeString(s: string): void; + + /** + Writes a string of desired length and encoding to the DataStream. + * + @param s The string to write. + @param encoding The encoding for the written string data. Defaults to ASCII. + */ + writeString(s: string, encoding: string): void; + + /** + Writes a string of desired length and encoding to the DataStream. + * + @param s The string to write. + @param encoding The encoding for the written string data. Defaults to ASCII. + @param length The number of characters to write. + */ + writeString(s: string, encoding: string, length: number): void; + + /** + Read null-terminated string of desired length from the DataStream. Truncates + the returned string so that the null byte is not a part of it. + * + @return The read string. + */ + readCString(): string; + + /** + Read null-terminated string of desired length from the DataStream. Truncates + the returned string so that the null byte is not a part of it. + * + @param length The length of the string to read. + @return The read string. + */ + readCString(length: number): string; + + /** + Writes a null-terminated string to DataStream and zero-pads it to length + bytes. If length is not given, writes the string followed by a zero. + If string is longer than length, the written part of the string does not have + a trailing zero. + * + @param s The string to write. + */ + writeCString(s: string): void; + + /** + Writes a null-terminated string to DataStream and zero-pads it to length + bytes. If length is not given, writes the string followed by a zero. + If string is longer than length, the written part of the string does not have + a trailing zero. + * + @param s The string to write. + @param length The number of characters to write. + */ + writeCString(s: string, length: number): void; + + /** + Reads an object of type t from the DataStream, passing struct as the thus-far + read struct to possible callbacks that refer to it. Used by readStruct for + reading in the values, so the type is one of the readStruct types. + * + @param t Type of the object to read. + @return Returns the object on successful read, null on unsuccessful. + */ + readType(t: Object): Object; + + /** + Reads an object of type t from the DataStream, passing struct as the thus-far + read struct to possible callbacks that refer to it. Used by readStruct for + reading in the values, so the type is one of the readStruct types. + * + @param t Type of the object to read. + @param struct Struct to refer to when resolving length references and for calling callbacks. + @return Returns the object on successful read, null on unsuccessful. + */ + readType(t: Object, struct: Object): Object; + + /** + Writes object v of type t to the DataStream. + * + @param t Type of data to write. + @param v Value of data to write. + @param struct Struct to pass to write callback functions. + */ + writeType(t: Object, v: Object, struct: Object): void; +} From 1c92de76a28d1703bdccb9a5a515f3be005d39a8 Mon Sep 17 00:00:00 2001 From: satoru kimura Date: Sat, 16 May 2015 18:58:05 +0900 Subject: [PATCH 055/179] Updated to three.js r71. --- threejs/three.d.ts | 185 ++++++++++++++++++++++++++++++--------------- 1 file changed, 123 insertions(+), 62 deletions(-) diff --git a/threejs/three.d.ts b/threejs/three.d.ts index 7c4aca592..d87541145 100644 --- a/threejs/three.d.ts +++ b/threejs/three.d.ts @@ -1,4 +1,4 @@ -// Type definitions for three.js r70 +// Type definitions for three.js r71 // Project: http://mrdoob.github.com/three.js/ // Definitions by: Kon , Satoru Kimura // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -129,6 +129,7 @@ declare module THREE { export var IntType: TextureDataType; export var UnsignedIntType: TextureDataType; export var FloatType: TextureDataType; + export var HalfFloatType: TextureDataType; // Pixel types export enum PixelType { } @@ -159,6 +160,12 @@ declare module THREE { export var RGBA_PVRTC_4BPPV1_Format: CompressedPixelFormat; export var RGBA_PVRTC_2BPPV1_Format: CompressedPixelFormat; + // log handlers + export function warn(message?: any, ...optionalParams: any[]): void; + export function error(message?: any, ...optionalParams: any[]): void; + export function log(message?: any, ...optionalParams: any[]): void; + + // Cameras //////////////////////////////////////////////////////////////////////////////////////// /** @@ -364,7 +371,7 @@ declare module THREE { length: number; copyAt(index1: number, attribute: BufferAttribute, index2: number): void; - set(value: number): BufferAttribute; + set(value: number, offset?: number): BufferAttribute; setX(index: number, x: number): BufferAttribute; setY(index: number, y: number): BufferAttribute; setZ(index: number, z: number): BufferAttribute; @@ -456,8 +463,7 @@ declare module THREE { */ applyMatrix(matrix: Matrix4): void; - // this method is currently empty. - center(): void; + center(): Vector3; fromGeometry( geometry: Geometry, settings?: any ): BufferGeometry; @@ -488,7 +494,7 @@ declare module THREE { */ computeTangents(): void; - computeOffsets(indexBufferSize: number): void; + computeOffsets(size: number): void; merge(geometry: BufferGeometry, offset: number): BufferGeometry; normalizeNormals(): void; reorderBuffers(indexBuffer: number, indexMap: number[], vertexCount: number): void; @@ -569,6 +575,17 @@ declare module THREE { getDelta(): number; } + export class DynamicBufferAttribute extends BufferAttribute{ + constructor(array: any, itemSize: number); + + updateRange: { + offset: number; + count: number; + } + + clone(): DynamicBufferAttribute; + } + /** * JavaScript events for custom objects * @@ -1065,6 +1082,8 @@ declare module THREE { */ frustumCulled: boolean; + renderOrder: number; + /** * An object that can be used to store custom data about the Object3d. It should not hold references to functions as these will not be cloned. */ @@ -1193,23 +1212,21 @@ declare module THREE { remove(object: Object3D): void; /* deprecated */ - getChildByName( name: string, recursive?: boolean ): Object3D; + getChildByName( name: string ): Object3D; /** * Searches through the object's children and returns the first with a matching id, optionally recursive. * @param id Unique number of the object instance - * @param recursive Boolean whether to search through the children's children. Default is false. */ - getObjectById(id: string, recursive: boolean): Object3D; + getObjectById(id: string): Object3D; /** * Searches through the object's children and returns the first with a matching name, optionally recursive. * @param name String to match to the children's Object3d.name property. - * @param recursive Boolean whether to search through the children's children. Default is false. */ - getObjectByName(name: string, recursive?: boolean): Object3D; + getObjectByName(name: string): Object3D; - getObjectByProperty( name: string, value: string, recursive?: boolean ): Object3D; + getObjectByProperty( name: string, value: string ): Object3D; getWorldPosition(optionalTarget?: Vector3): Vector3; getWorldQuaternion(optionalTarget?: Quaternion): Quaternion; @@ -1521,7 +1538,7 @@ declare module THREE { * scene.add( light ); */ export class PointLight extends Light { - constructor(hex?: number, intensity?: number, distance?: number); + constructor(hex?: number, intensity?: number, distance?: number, decay?: number); /* * Light's intensity. @@ -1535,6 +1552,8 @@ declare module THREE { */ distance: number; + decay: number; + clone(): PointLight; } @@ -1554,7 +1573,7 @@ declare module THREE { * scene.add( spotLight ); */ export class SpotLight extends Light { - constructor(hex?: number, intensity?: number, distance?: number, angle?: number, exponent?: number); + constructor(hex?: number, intensity?: number, distance?: number, angle?: number, exponent?: number, decay?: number); /** * Spotlight focus points at target.position. @@ -1586,6 +1605,8 @@ declare module THREE { */ exponent: number; + decay: number; + /** * If set to true light will cast dynamic shadows. Warning: This is expensive and requires tweaking to get shadows looking right. * Default — false. @@ -1744,9 +1765,7 @@ declare module THREE { parse(json: any): BufferGeometry; } - export class Cache{ - constructor(); - + export interface Cache{ files: any[]; add(key: string, file: any): void; @@ -1754,6 +1773,7 @@ declare module THREE { remove(key: string): void; clear(): void; } + export var Cache:Cache; export class CompressedTextureLoader{ constructor(); @@ -1856,14 +1876,18 @@ declare module THREE { constructor(manager?: LoadingManager); manager: LoadingManager; - crossOrigin: string; + texturePass: string; - load(url: string, onLoad: (object: Object3D) => void): void; + load(url: string, onLoad?: (object: Object3D) => void): void; + setTexturePath( value: string ): void; setCrossOrigin(crossOrigin: string): void; - parse(json: any): T; + parse(json: any, onLoad?: (object: Object3D) => void): T; parseGeometries(json: any): any[]; // Array of BufferGeometry or Geometry or Geometry2. - parseMaterials(json: any): Material[]; // Array of Classes that inherits from Matrial. + parseMaterials(json: any, textures: Texture[]): Material[]; // Array of Classes that inherits from Matrial. + parseImages( json: any, onLoad: () => void ): any[]; + parseTextures( json: any, images: any ): Texture[]; parseObject(data: any, geometries: any[], materials: Material[]): T; + } /** @@ -1976,6 +2000,10 @@ declare module THREE { */ blendEquation: BlendingEquation; + blendSrcAlpha: number; + blendDstAlpha: number; + blendEquationAlpha: number; + /** * Whether to have depth test enabled when rendering this material. Default is true. */ @@ -1987,6 +2015,8 @@ declare module THREE { */ depthWrite: boolean; + colorWrite: boolean; + /** * Whether to use polygon offset. Default is false. This corresponds to the POLYGON_OFFSET_FILL WebGL feature. */ @@ -2026,6 +2056,7 @@ declare module THREE { setValues(values: Object): void; toJSON(): any; clone(material?:Material): Material; + update(): void; dispose(): void; // EventDispatcher mixins @@ -2156,7 +2187,6 @@ declare module THREE { export interface MeshLambertMaterialParameters extends MaterialParameters{ color?: number; - ambient?: number; emissive?: number; wrapAround?: boolean; wrapRGB?: Vector3; @@ -2183,7 +2213,6 @@ declare module THREE { export class MeshLambertMaterial extends Material { constructor(parameters?: MeshLambertMaterialParameters); color: Color; - ambient: Color; emissive: Color; wrapAround: boolean; wrapRGB: Vector3; @@ -2210,7 +2239,6 @@ declare module THREE { } export interface MeshNormalMaterialParameters extends MaterialParameters{ - shading?: Shading; wireframe?: boolean; wireframeLinewidth?: number; morphTargets?: boolean; @@ -2219,7 +2247,6 @@ declare module THREE { export class MeshNormalMaterial extends Material { constructor(parameters?: MeshNormalMaterialParameters); - shading: Shading; wireframe: boolean; wireframeLinewidth: number; morphTargets: boolean; @@ -2229,7 +2256,6 @@ declare module THREE { export interface MeshPhongMaterialParameters extends MaterialParameters{ color?: number; // diffuse - ambient?: number; emissive?: number; specular?: number; shininess?: number; @@ -2264,7 +2290,6 @@ declare module THREE { constructor(parameters?: MeshPhongMaterialParameters); color: Color; // diffuse - ambient: Color; emissive: Color; specular: Color; shininess: number; @@ -2531,13 +2556,13 @@ declare module THREE { * Copies given color making conversion from gamma to linear space. * @param color Color to copy. */ - copyGammaToLinear(color: Color): Color; + copyGammaToLinear(color: Color, gammaFactor?: number): Color; /** * Copies given color making conversion from linear to gamma space. * @param color Color to copy. */ - copyLinearToGamma(color: Color): Color; + copyLinearToGamma(color: Color, gammaFactor?: number): Color; /** * Converts this color from gamma to linear space. @@ -2577,7 +2602,7 @@ declare module THREE { lerp(color: Color, alpha: number): Color; equals(color: Color): boolean; fromArray(rgb: number[]): Color; - toArray(): number[]; + toArray(array?: number[], offset?: number): number[]; /** * Clones this color. @@ -2751,7 +2776,7 @@ declare module THREE { reorder(newOrder: string): Euler; equals(euler: Euler): boolean; fromArray(xyzo: any[]): Euler; - toArray(): any[]; + toArray(array?: number[], offset?: number): number[]; toVector3(optionalResult?: Vector3): Vector3; onChange: () => void; @@ -2860,6 +2885,8 @@ declare module THREE { radToDeg(radians: number): number; isPowerOfTwo(value: number): boolean; + + nextPowerOfTwo(value: number): number; } /** @@ -3558,8 +3585,8 @@ declare module THREE { /** * Sets this vector to a + b. */ - addVectors(a: Vector2, b: Vector2): Vector2; addScalar(s: number): Vector2; + addVectors(a: Vector2, b: Vector2): Vector2; /** * Subtracts v from this vector. @@ -3635,6 +3662,9 @@ declare module THREE { setLength(l: number): Vector2; lerp(v: Vector2, alpha: number): Vector2; + + lerpVectors(v1: Vector2, v2: Vector2, alpha: number): Vector2; + /** * Checks for strict equality of this vector and v. */ @@ -3717,6 +3747,8 @@ declare module THREE { */ sub(a: Vector3): Vector3; + subScalar( s: number ): Vector3; + /** * Sets this vector to a - b. */ @@ -3790,6 +3822,8 @@ declare module THREE { setLength(l: number): Vector3; lerp(v: Vector3, alpha: number): Vector3; + lerpVectors(v1: Vector3, v2: Vector3, alpha: number): Vector3; + /** * Sets this vector to cross product of itself and v. */ @@ -3896,6 +3930,8 @@ declare module THREE { */ sub(v: Vector4): Vector4; + subScalar(s: number): Vector4; + /** * Sets this vector to a - b. */ @@ -3969,6 +4005,8 @@ declare module THREE { */ lerp(v: Vector4, alpha: number): Vector4; + lerpVectors(v1: Vector4, v2: Vector4, alpha: number): Vector4; + /** * Checks for strict equality of this vector and v. */ @@ -3989,7 +4027,7 @@ declare module THREE { // Objects ////////////////////////////////////////////////////////////////////////////////// export class Bone extends Object3D { - constructor(belongsToSkin: SkinnedMesh); + constructor(skin: SkinnedMesh); skin: SkinnedMesh; } @@ -4291,6 +4329,8 @@ declare module THREE { */ sortObjects: boolean; + gammaFactor: number; + /** * Default is false. */ @@ -4480,7 +4520,7 @@ declare module THREE { uploadTexture(texture: Texture): void; setTexture(texture: Texture, slot: number): void; setRenderTarget(renderTarget: RenderTarget): void; - + readRenderTargetPixels( renderTarget: RenderTarget, x: number, y: number, width: number, height: number, buffer: any ): void; } export interface RenderTarget { @@ -4539,6 +4579,7 @@ declare module THREE { export interface ShaderChunk { [name: string]: string; + common: string; alphamap_fragment: string; alphamap_pars_fragment: string; alphatest_fragment: string; @@ -4613,6 +4654,7 @@ declare module THREE { normal: Shader; normalmap: Shader; cube: Shader; + equirect: Shader; depthRGBA: Shader; }; @@ -4655,6 +4697,40 @@ declare module THREE { constructor(gl: any, type: string, string: string); } + interface WebGLStateInstance{ + new ( gl: any, paramThreeToGL: Function ): void; + initAttributes(): void; + enableAttribute(attribute: string): void; + disableUnusedAttributes(): void; + setBlending( blending: number, blendEquation: number, blendSrc: number, blendDst: number, blendEquationAlpha: number, blendSrcAlpha: number, blendDstAlpha: number ): void; + setDepthTest( depthTest: number ): void; + setDepthWrite( depthWrite: number ): void; + setColorWrite( colorWrite: number ): void; + setDoubleSided( doubleSided: number ): void; + setFlipSided( flipSided: number ): void; + setLineWidth( width: number ): void; + setPolygonOffset(polygonoffset: number, factor: number, units: number): void; + reset(): void; + } + interface WebGLStateStatic{ + ( gl: any, paramThreeToGL: Function ): WebGLStateInstance; + } + export var WebGLState: WebGLStateStatic; + + + interface WebGLTexturesInstance{ + new (webgglcontext: any): WebGLTexturesInstance; + + get(texture: Texture): any; // it will return result of gl.createTexture(). + create(texture: Texture): any; // it will return result of gl.createTexture(). + delete(texture: Texture): void; + } + interface WebGLTexturesStatic{ + (webgglcontext: any): WebGLTexturesInstance; + } + export var WebGLTextures: WebGLTexturesStatic; + + // Renderers / WebGL / Plugins ///////////////////////////////////////////////////////////////////// export interface RendererPlugin { init(renderer: WebGLRenderer): void; @@ -4821,29 +4897,7 @@ declare module THREE { export class Texture { constructor( - image: any, // HTMLImageElement or HTMLCanvasElement ( or HTMLVideoElement) - mapping?: Mapping, - wrapS?: Wrapping, - wrapT?: Wrapping, - magFilter?: TextureFilter, - minFilter?: TextureFilter, - format?: PixelFormat, - type?: TextureDataType, - anisotropy?: number - ); - constructor( - image: HTMLCanvasElement, - mapping?: Mapping, - wrapS?: Wrapping, - wrapT?: Wrapping, - magFilter?: TextureFilter, - minFilter?: TextureFilter, - format?: PixelFormat, - type?: TextureDataType, - anisotropy?: number - ); - constructor( - image: HTMLImageElement, + image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, mapping?: Mapping, wrapS?: Wrapping, wrapT?: Wrapping, @@ -4857,6 +4911,7 @@ declare module THREE { id: number; uuid: string; name: string; + sourceFile: string; image: any; // HTMLImageElement or ImageData ; mipmaps: ImageData[]; mapping: Mapping; @@ -4992,14 +5047,13 @@ declare module THREE { isPlaying: boolean; loop: boolean; weight: number; - keyTypes: string[]; interpolationType: number; play(startTime?: number, weight?: number): void; stop(): void; reset(): void; resetBlendWeights(): void; - update(deltaTimeMS: number): void; + update(delta: number): void; getNextKeyWith(type: string, h: number, key: number): KeyFrame; getPrevKeyWith(type: string, h: number, key: number): KeyFrame; } @@ -5022,7 +5076,7 @@ declare module THREE { constructor(data: any); root: Mesh; - data: Object; + data: AnimationData; hierarchy: KeyFrames[]; currentTime: number; timeScale: number; @@ -5051,7 +5105,7 @@ declare module THREE { play(): void; pause(): void; - update(deltaTimeMS: number): void; + update(delta: number): void; } // Extras / Audio ///////////////////////////////////////////////////////////////////// @@ -5063,11 +5117,18 @@ declare module THREE { source: AudioBufferSourceNode; gain: GainNode; panner: PannerNode; + autoplay: boolean; + startTime: number; + isPlaying: boolean; load(file: string): Audio; + play(): void; + pause(): void; + stop(): void; setLoop(value: boolean): void; setRefDistance(value: number): void; setRolloffFactor(value: number): void; + setVolume(value: number): void; updateMatrixWorld(force?: boolean): void; } @@ -5646,7 +5707,7 @@ declare module THREE { } export class EdgesHelper extends Line { - constructor(object: Object3D, hex?: number); + constructor(object: Object3D, hex?: number, thresholdAngle?: number); } @@ -5669,7 +5730,7 @@ declare module THREE { setColors(colorCenterLine: number, colorGrid: number): void; } export class HemisphereLightHelper extends Object3D { - constructor(light: Light, sphereSize: number, arrowLength: number, domeSize: number); + constructor(light: Light, sphereSize: number); light: Light; colors: Color[]; From 64097df03eb0a3491e2eb2886aed77481f0dfa44 Mon Sep 17 00:00:00 2001 From: hansrwindhoff Date: Sat, 16 May 2015 08:07:10 -0600 Subject: [PATCH 056/179] mention Jed Mao in header --- tcomb/tcomb.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tcomb/tcomb.d.ts b/tcomb/tcomb.d.ts index 8af914ab5..c189a6a0f 100644 --- a/tcomb/tcomb.d.ts +++ b/tcomb/tcomb.d.ts @@ -2,6 +2,8 @@ // Project: http://gcanti.github.io/tcomb/guide/index.html // Definitions by: Hans Windhoff // Definitions: https://github.com/borisyankov/DefinitelyTyped + +// Original Definitions by: Jed Mao declare module TComb { export interface tcomb { format: (format: string, ...values: any[]) => string; From 36e72c193f73c23e9d2762bb256b32a9df659297 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Eichler?= Date: Sat, 16 May 2015 16:31:13 +0200 Subject: [PATCH 057/179] added missing ObjectId methods, changed Document _id property from string to ObjectId --- mongoose/mongoose-tests.ts | 11 ++++++++++- mongoose/mongoose.d.ts | 10 ++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/mongoose/mongoose-tests.ts b/mongoose/mongoose-tests.ts index 1c8b804d6..9c221b5ca 100644 --- a/mongoose/mongoose-tests.ts +++ b/mongoose/mongoose-tests.ts @@ -364,5 +364,14 @@ schema.virtual('display_name') .get(function(): string { return this.name; }) .set((value: string): void => {}); -var id : mongoose.Types.ObjectId; +var id: mongoose.Types.ObjectId = new mongoose.Types.ObjectId('foo'); +var id2: mongoose.Types.ObjectId = new mongoose.Types.ObjectId(123); +var id2: mongoose.Types.ObjectId = mongoose.Types.ObjectId.createFromTime(123); +var id2: mongoose.Types.ObjectId = mongoose.Types.ObjectId.createFromHexString('foo'); var s = id.toHexString(); +var valid = id.isValid(); +var eq = id.equals(id2); + +var kitty1 = new Kitty({}); +var kitty2 = new Kitty({}); +var kittyEq = kitty1._id.equals(kitty2._id); \ No newline at end of file diff --git a/mongoose/mongoose.d.ts b/mongoose/mongoose.d.ts index fedd8fec6..33fa66aba 100644 --- a/mongoose/mongoose.d.ts +++ b/mongoose/mongoose.d.ts @@ -79,7 +79,13 @@ declare module "mongoose" { } export module Types { export class ObjectId { - toHexString(): string; + constructor(id: string|number); + toHexString(): string; + equals(other: ObjectId): boolean; + getTimestamp(): Date; + isValid(): boolean; + static createFromTime(time: number): ObjectId; + static createFromHexString(hexString: string): ObjectId; } } @@ -374,7 +380,7 @@ declare module "mongoose" { export interface Document { id?: string; - _id: string; + _id: Types.ObjectId; equals(doc: Document): boolean; get(path: string, type?: new(...args: any[]) => any): any; From 12b79812d6cdff92d863c07f78dce39b57a73772 Mon Sep 17 00:00:00 2001 From: YuichiNukiyama Date: Sun, 17 May 2015 09:45:40 +0000 Subject: [PATCH 058/179] Update localForage to 1.2 localForage has been Changed since last year.So, I update localforage.d.ts to 1.3. --- localForage/localForage-tests.ts | 86 +++++++++++++++++++++---------- localForage/localForage.d.ts | Bin 834 -> 4444 bytes 2 files changed, 60 insertions(+), 26 deletions(-) diff --git a/localForage/localForage-tests.ts b/localForage/localForage-tests.ts index f1a416dcf..5267dc798 100644 --- a/localForage/localForage-tests.ts +++ b/localForage/localForage-tests.ts @@ -1,34 +1,68 @@ /// -declare var localForage: lf.ILocalForage -declare var callback: lf.ICallback -declare var promise: lf.IPromise +declare var localForage: lf.ILocalForage; +declare var callback: lf.ICallback; +declare var iterateCallback: lf.IIterateCallback; +declare var errorCallback: lf.IErrorCallback; +declare var keyCallback: lf.IKeyCallback; +declare var keysCallback: lf.IKeysCallback; +declare var numberCallback: lf.INumberCallback; +declare var promise: lf.IPromise; () => { - localForage.clear() - localForage.length - localForage.key(0) + localForage.clear((err: any) => { + var newError: any = err; + }); + + localforage.iterate((str: string, key: string, num: number) => { + var newStr: string = str; + var newKey: string = key; + var newNum: number = num; + }); + + localForage.length((err: any, num: number) => { + var newError: any = err; + var newNumber: number = num; + }); + + localForage.key(0,(err: any, value: string) => { + var newError: any = err; + var newValue: string = value; + }); + + localforage.keys((err: any, keys: Array) => { + var newError: any = err; + var newArray: Array = keys; + }); + + localForage.getItem("key",(err: any, str: string) => { + var newError: any = err; + var newStr: string = str + }); + + localForage.getItem("key").then((err: any, str: string) => { + var newError: any = err; + var newStr: string = str + }); - localForage.getItem("key", (str: string) => { - var newStr: string = str - }) - localForage.getItem("key").then((str: string) => { - var newStr: string = str - }) + localForage.setItem("key", "value",(err: any, str: string) => { + var newError: any = err; + var newStr: string = str + }); + + localForage.setItem("key", "value").then((err: any, str: string) => { + var newError: any = err; + var newStr: string = str; + }); - localForage.setItem("key", "value", (str: string) => { - var newStr: string = str - }) - localForage.setItem("key", "value").then((str: string) => { - var newStr: string = str - }) + localForage.removeItem("key",(err: any) => { + var newError: any = err; + }); + + localForage.removeItem("key").then((err: any, str: string) => { + var newError: any = err; + var newStr: string = str + }); - localForage.removeItem("key", (str: string) => { - var newStr: string = str - }) - localForage.removeItem("key").then((str: string) => { - var newStr: string = str - }) - - promise.then(callback) + promise.then(callback); } diff --git a/localForage/localForage.d.ts b/localForage/localForage.d.ts index c3d0371d005f4eb662bc972e63364bf9e0796eff..6cef3a9ea7ee22b54b15c43b5f6dff793ce9b361 100644 GIT binary patch literal 4444 zcmb_fU2oGs5ZoUE(!G%&REtjus45{SC@K_G`og1=IBmdjB0DV&sDB-px%KrN$5-qo zirhP&?c3Se+1=~kKaoUYkm;}Z4?-0__=YwKJtWGH)hYc4aa&M+^17&LOQpDQGZ@g(R@<%l&I}=zM*|!Gr@g^SCsPDtp0lukz@Air0 zA%1>ew{Ea%vE#&QX@-?0qNI9_F^{2~*v6Cm)2k)?$$^{L z&#*={^Q$@j#<+&of3jxq9komk_X6mmhIKNS;JaLU;DqW=Es7ELWE2N-h-cJ(E^lkk z`}U1XJfk8v8M&RQfyJ7am`%wUvr|zRFvr;i@I^P=EwDBP7II5gG$+U%wNI4Y{3oN# z7-gs*eo#nBioJx@PR1nw(}>6Ika|CFEy-Eb5{K z-LY5hJiuPeu`3(p3~`u28RUlQY}U#Vp09SSlR6hEV#HW`E~r_@hu1|tx9+A7<)jE^ zhk9K6$LH6bvqQb6H_nf01f1^$uCE6fn8#`|vI$rP$!mUyMyGpquvG2G$4 z>37mi_1jPtVgGRYsb|bCa)nH>f2dEa!R+>|Th%)2c+jqEEJH(^{aT^91M{c=+68`O zQ0us3mi2{C(=tC@C9dZ~DDRk+%wV^lMvzr(URug9qq>=Ss&wWX&mv2F%W5@44EtF7 ziRY^QYOgTxf%wu+F|6;exLEJV89Ox95zhR2Oxsn#c2-p%1JN_s%(9Y5X~FpZtFzm? z&R3|!^=6)?*g1ShrGCP>6N+h5U*)N+8m};)zRQvA)17mCcO<*y{lx0lpNpLSz4xxB zReRfJ2Ja?1%ole`^EnlcQ9Zl2JsEYe-!2N*=rH~S#%$d@>o(_T^C`CnhIsCyr>u%A zt4kj()oQ46w?Wh96cxf&$HBT3j^4E7g4wSB3s$=kJ*oEAZG1YkoHd=5L!Q)G-p2Y7 zVzznuYHQhZc#Meiv`J>F)xQsoxoX=c!is0}Y}6eQ|Hn4+#22k3^~kX7Sf m&x$VSs=E1%zV1BUrKXy?UNc6mshNb%V0BM#@6n9#wfqC2gQyw+ literal 834 zcmbV}-AcqT5QXpi6mw?R4i*!7m)qIZY<_cbJzoyiiO!^bX`S>v zGi%$Cu@_Z8#1mO2kSpd8v=yyFP!+sp5RWv`yP%TFnER*F3} zysoj&r4hKLU|LmrlJPZ#;&!~o4}A8U zKx0c07ow%d2pmlOlu5@_i}8nlwfj-z8)JvscKF|b)AWSZF55>w! T$*=5jfC(BJH2Lp)*=4&o+j9m8 From 33cc02c18267117df0978f2b18e3a131bbf75e40 Mon Sep 17 00:00:00 2001 From: YuichiNukiyama Date: Sun, 17 May 2015 10:10:13 +0000 Subject: [PATCH 059/179] modified a few bug --- localForage/localForage-tests.ts | 4 ++-- localForage/localForage.d.ts | Bin 4444 -> 4468 bytes 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/localForage/localForage-tests.ts b/localForage/localForage-tests.ts index 5267dc798..1e1ab4dd5 100644 --- a/localForage/localForage-tests.ts +++ b/localForage/localForage-tests.ts @@ -14,7 +14,7 @@ declare var promise: lf.IPromise; var newError: any = err; }); - localforage.iterate((str: string, key: string, num: number) => { + localForage.iterate((str: string, key: string, num: number) => { var newStr: string = str; var newKey: string = key; var newNum: number = num; @@ -30,7 +30,7 @@ declare var promise: lf.IPromise; var newValue: string = value; }); - localforage.keys((err: any, keys: Array) => { + localForage.keys((err: any, keys: Array) => { var newError: any = err; var newArray: Array = keys; }); diff --git a/localForage/localForage.d.ts b/localForage/localForage.d.ts index 6cef3a9ea7ee22b54b15c43b5f6dff793ce9b361..42c738d1f29b1864d09568abd06aba9ae8110d22 100644 GIT binary patch delta 39 xcmV+?0NDTBBJ?7#Y7dj(3 Date: Sun, 17 May 2015 10:55:38 +0000 Subject: [PATCH 060/179] change --- localForage/localForage-tests.ts | 2 +- localForage/localForage.d.ts | Bin 4468 -> 2384 bytes 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/localForage/localForage-tests.ts b/localForage/localForage-tests.ts index 1e1ab4dd5..15638c1cb 100644 --- a/localForage/localForage-tests.ts +++ b/localForage/localForage-tests.ts @@ -1,4 +1,4 @@ -/// +/// declare var localForage: lf.ILocalForage; declare var callback: lf.ICallback; diff --git a/localForage/localForage.d.ts b/localForage/localForage.d.ts index 42c738d1f29b1864d09568abd06aba9ae8110d22..e6ccdfd59b4054fc3883858a60425e62b7233d27 100644 GIT binary patch literal 2384 zcmb7FZEn**5WUL$BdwxX1&V~JDj^EUDij3$!_T!nPL`~9quq6=K}bCa9DpBA?-r&IV;Q38jHYRPL>vW8C&dXQ79G&ePqOSO*LSQNFZIwt^n z=a>nm5lWR;0znk;js69CaY?iamLVi>wlbVto^B#sRCIXQ#=8?7!UrtX8V%qYbq!0b zq0p)XyC9vJWhpZ_1&y}SlFK=83swPxR1irpf?1pefKl(131oUgEfFcpmN6tRwO0B? zdp?L^t+=bpQ=zXr(z1sJ)>3 zhtwLu>NS!Gq>p4JQ7cFdN60CagOVhXf#htrDil1SPa<=?ia}Ooih2q?mCmv52>k~e zL38QZkW2*cwduNek3KHE-zFkpZZUYauT3O~X%z9rI2L^dswf1P2%ZH@_zY)Wq?_v> z0_EH;ZmxeG?AEJ^>GQkr*W6-wFG1#7gXMO<9UoeH5Ioh4hM&nCOto4GPW#}b(`YKu z4t&?2kS8RCkEC)TSCl4|1-znGOks|e#;cqhz!$Qoc893nLWCIojp=d-FDAV-tz0k~ zUCo1oI*?5BlaL3N+#sdwljtLJF5p()FSw*8_PVy4v1zLe82dGi;c`6py)fge=-kY8 z&y(2h=f>7X7N)&1`VI!Qb%Sufoed)l7W182({`ulRWyyMoH2OPbRd;@gD|kZI;+-z9s~a~JjdKOPq@!2kdN literal 4468 zcmb_fU2oGs5ZoUE(!G%&REtjus45{SC@K_G`og1=IBmdoA}1{ksDB-px%Ks&i(Tv{ zvK*h!_TKF5?C$07pGYDxaw;pCOM=lDzZ02Cj&q4~hS37^6O0O6KjHcd^C^y49@u9o z=0>j z5v;pa6wCT5?;3Cq;ThK)1K%aq8Dl)hbp#X(e3N6H1osOdO00+bE%7~-D|sx>a6Xrp z@3FF}+@7By_$VxLTF$Y?3?4?ZZZ`pMtDE?a zv3lPy#v>cQ0wZIY9s^}+?^49t$Zx!9aOFWYC_59ZG_r3EZmU#u&#?PHf{z{^`{c{uIDX z>}Qyxn)%fXzcJ3C^`ER6d`B(Q!@UM{QO!IVOz>SHJ#a$xrxwKsHW|f%9O4r6?u`3(p9C65?401zt)@$Vm&sRIvNytTt7%|qK3u@N!;dK$_*4^}>oGco% zLp@&n$LH6bvqQb6H_nf01f1^$uCE6fn8#`|vI$rP$!mUyMyGpquvF|=^s z^gHRM`fXDcVgGRY2{UFFxk9GcKh!7IV0L@ft!kZhJZRT7mZ71|eyz~7z&u(2?HmUg z)H?2%Wqsk(w9HReiNkzo$~$HyGuYYF2(pUJ%9V1AsBUJSDxLYpy~q;ZvRY+`VIOlp z@m#fE?G*+-5MSCUhM|4M#d=51*rBP8=FAUc+O7(=TUGTj5Z!}imX$=x6^!q{I=a2< ze1%F}Z{}`_ox^uj>Zdt(nqpelSGg;z#;ci6-{r{m>CQR6JCa@Ueqwd&_eD(=LJ{Vul$hPdyer>u%A zt4kj()oN4aZiA-HE~*Jzh=X;hIeOEQ3ue3i7p!(8dQ$DJ+xT>7Ijh?%H+d4Wyv^!I zh}q`utL@63!(&98yG=4vt^V6%+uSF0N5}u$M&4MaWB9wjhVcNMk Date: Sun, 17 May 2015 11:00:04 +0000 Subject: [PATCH 061/179] fix linefield --- localForage/localForage.d.ts | 74 +++++++++++++++++++++++++++++++++++- 1 file changed, 73 insertions(+), 1 deletion(-) diff --git a/localForage/localForage.d.ts b/localForage/localForage.d.ts index e6ccdfd59..14bd6aedb 100644 --- a/localForage/localForage.d.ts +++ b/localForage/localForage.d.ts @@ -1 +1,73 @@ -// Type definitions for Mozilla's localForage
// Project: https://github.com/mozilla/localforage
// Definitions by: david pichsenmeister , Yuichi Nukiyama
// Definitions: https://github.com/borisyankov/DefinitelyTyped

declare module lf {
 interface ILocalForage {
 /**
 * Removes every key from the database, returning it to a blank slate.
 */
 clear(callback: IErrorCallback): void
 /**
 * Iterate over all value/key pairs in datastore.
 */
 iterate(iterateCallback: IIterateCallback): void
 /**
 * Get the name of a key based on its ID.
 */
 key(keyIndex: number, callback: IKeyCallback): void
 /**
 * Get the list of all keys in the datastore.
 */
 keys(callback: IKeysCallback): void;
 /**
 * Gets the number of keys in the offline store (i.e. its “length”).
 */
 length(callback: INumberCallback): void
 /**
 * Gets an item from the storage library and supplies the result to a callback.
 * If the key does not exist, getItem() will return null.
 */
 getItem(key: string, callback: ICallback): void
 getItem(key: string): IPromise
 /**
 * Saves data to an offline store.
 */
 setItem(key: string, value: T, callback: ICallback): void
 setItem(key: string, value: T): IPromise
 /**
 * Removes the value of a key from the offline store.
 */
 removeItem(key: string, callback: IErrorCallback): void
 removeItem(key: string): IPromise
 }

 interface ICallback {
 (err: any, value: T): void
 }

 interface IIterateCallback {
 (value: T, key: string, iterationNumber: number): void
 }

 interface IErrorCallback {
 (err: any): void
 }

 interface IKeyCallback {
 (err: any, keyName: string): void
 }

 interface IKeysCallback {
 (err: any, keys: Array): void
 }

 interface INumberCallback {
 (err: any, numberOfKeys: number): void
 }

 interface IPromise {
 then(callback: ICallback): void
 }
} \ No newline at end of file +// Type definitions for Mozilla's localForage +// Project: https://github.com/mozilla/localforage +// Definitions by: david pichsenmeister , Yuichi Nukiyama +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module lf { + interface ILocalForage { + /** + * Removes every key from the database, returning it to a blank slate. + */ + clear(callback: IErrorCallback): void + /** + * Iterate over all value/key pairs in datastore. + */ + iterate(iterateCallback: IIterateCallback): void + /** + * Get the name of a key based on its ID. + */ + key(keyIndex: number, callback: IKeyCallback): void + /** + * Get the list of all keys in the datastore. + */ + keys(callback: IKeysCallback): void; + /** + * Gets the number of keys in the offline store (i.e. its “length”). + */ + length(callback: INumberCallback): void + /** + * Gets an item from the storage library and supplies the result to a callback. + * If the key does not exist, getItem() will return null. + */ + getItem(key: string, callback: ICallback): void + getItem(key: string): IPromise + /** + * Saves data to an offline store. + */ + setItem(key: string, value: T, callback: ICallback): void + setItem(key: string, value: T): IPromise + /** + * Removes the value of a key from the offline store. + */ + removeItem(key: string, callback: IErrorCallback): void + removeItem(key: string): IPromise + } + + interface ICallback { + (err: any, value: T): void + } + + interface IIterateCallback { + (value: T, key: string, iterationNumber: number): void + } + + interface IErrorCallback { + (err: any): void + } + + interface IKeyCallback { + (err: any, keyName: string): void + } + + interface IKeysCallback { + (err: any, keys: Array): void + } + + interface INumberCallback { + (err: any, numberOfKeys: number): void + } + + interface IPromise { + then(callback: ICallback): void + } +} \ No newline at end of file From 6500933c82b4e8c48feb6f7069d3093eff31a948 Mon Sep 17 00:00:00 2001 From: YuichiNukiyama Date: Sun, 17 May 2015 11:02:48 +0000 Subject: [PATCH 062/179] fix2 --- localForage/localForage.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/localForage/localForage.d.ts b/localForage/localForage.d.ts index 14bd6aedb..e39ec73c6 100644 --- a/localForage/localForage.d.ts +++ b/localForage/localForage.d.ts @@ -1,6 +1,6 @@ // Type definitions for Mozilla's localForage // Project: https://github.com/mozilla/localforage -// Definitions by: david pichsenmeister , Yuichi Nukiyama +// Definitions by: david pichsenmeister ,Yuichi Nukiyama // Definitions: https://github.com/borisyankov/DefinitelyTyped declare module lf { From ef5547827ca46d0b62f718fc3fe5f80666c7bd6a Mon Sep 17 00:00:00 2001 From: YuichiNukiyama Date: Sun, 17 May 2015 11:05:24 +0000 Subject: [PATCH 063/179] fix3 --- localForage/localForage.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/localForage/localForage.d.ts b/localForage/localForage.d.ts index e39ec73c6..cb518a70e 100644 --- a/localForage/localForage.d.ts +++ b/localForage/localForage.d.ts @@ -1,6 +1,6 @@ // Type definitions for Mozilla's localForage // Project: https://github.com/mozilla/localforage -// Definitions by: david pichsenmeister ,Yuichi Nukiyama +// Definitions by: yuichi,david pichsenmeister // Definitions: https://github.com/borisyankov/DefinitelyTyped declare module lf { From c1e3d3654997f36dd063e4035582cd445081f25d Mon Sep 17 00:00:00 2001 From: YuichiNukiyama Date: Sun, 17 May 2015 11:08:11 +0000 Subject: [PATCH 064/179] FIX4 --- localForage/localForage.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/localForage/localForage.d.ts b/localForage/localForage.d.ts index cb518a70e..b5c40dd61 100644 --- a/localForage/localForage.d.ts +++ b/localForage/localForage.d.ts @@ -1,6 +1,6 @@ // Type definitions for Mozilla's localForage // Project: https://github.com/mozilla/localforage -// Definitions by: yuichi,david pichsenmeister +// Definitions by: yuichi david pichsenmeister // Definitions: https://github.com/borisyankov/DefinitelyTyped declare module lf { From 241e3f2fc7609a8de1d343862ae48fe779c1281b Mon Sep 17 00:00:00 2001 From: Chris Wrench Date: Mon, 18 May 2015 08:35:03 +0100 Subject: [PATCH 065/179] Fix issue with Polygon and MultiPolygon contructors --- 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 fa11a71ce..fe4e7459c 100644 --- a/googlemaps/google.maps.d.ts +++ b/googlemaps/google.maps.d.ts @@ -208,7 +208,7 @@ declare module google.maps { } /***** Data *****/ - export class Data extends MVCObject { + 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[]; @@ -308,14 +308,14 @@ declare module google.maps { } export class Polygon extends Data.Geometry { - constructor(elements: LinearRing[]|LatLng[]); // TODO LatLngLiteral + constructor(elements: LinearRing[]|LatLng[][]); // TODO LatLngLiteral getArray(): LinearRing[]; getAt(n: number): LinearRing; getLength(): number; } export class MultiPolygon extends Data.Geometry { - constructor(elements: Data.Polygon[]|LinearRing[]|LatLng[][]); // TODO LatLngLiteral + constructor(elements: Data.Polygon[]|LinearRing[][]|LatLng[][][]); // TODO LatLngLiteral getArray(): Data.Polygon[]; getAt(n: number): Data.Polygon; getLength(): number; From 4f0c99114ff344aa5637b20bf681c521ec9bef92 Mon Sep 17 00:00:00 2001 From: Aleksey Blokhin Date: Mon, 18 May 2015 10:57:53 +0300 Subject: [PATCH 066/179] Method signature fixed. --- angular-translate/angular-translate.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/angular-translate/angular-translate.d.ts b/angular-translate/angular-translate.d.ts index b191bf455..141804791 100644 --- a/angular-translate/angular-translate.d.ts +++ b/angular-translate/angular-translate.d.ts @@ -27,7 +27,7 @@ declare module angular.translate { } interface IPartialLoader { - addPart(name : string, priority : number) : T; + addPart(name : string, priority? : number) : T; setPart(lang : string, part : string, table : ITranslationTable) : T; deletePart(name : string) : T; isPartAvailable(name : string) : boolean; From b0289ac7a3657dbe8babf7691eabf9f404c832d3 Mon Sep 17 00:00:00 2001 From: Guillaume Mouron Date: Mon, 18 May 2015 12:07:28 +0200 Subject: [PATCH 067/179] Insert and append can take functions returning a DOM element This is specified in the d3 documentation : - append : https://github.com/mbostock/d3/wiki/Selections#append - insert : https://github.com/mbostock/d3/wiki/Selections#insert Also visible in the code : https://github.com/mbostock/d3/blob/master/d3.js#L802 and https://github.com/mbostock/d3/blob/master/d3.js#L818 --- d3/d3.d.ts | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/d3/d3.d.ts b/d3/d3.d.ts index e1d501e0b..0bf3d599d 100644 --- a/d3/d3.d.ts +++ b/d3/d3.d.ts @@ -787,8 +787,18 @@ declare module D3 { (valueFunction: (data: T, index: number) => any): _Selection; }; - append: (name: string) => _Selection; - insert: (name: string, before: string) => _Selection; + append: { + (name: string): _Selection; + (elementFunction: (data: T, index: number) => any): _Selection; + } + + insert: { + (name: string, before: string): _Selection; + (insertElementFunction: (data: T, index: number) => any, before: string): _Selection; + (name: string, beforeElementFunction: (data: T, index: number) => any): _Selection; + (insertElementFunction: (data: T, index: number) => any, beforeElementFunction: (data: T, index: number) => any): _Selection; + } + remove: () => _Selection; empty: () => boolean; @@ -874,8 +884,18 @@ declare module D3 { export interface Selection extends _Selection { } export interface _EnterSelection { - append: (name: string) => _Selection; - insert: (name: string, before?: string) => _Selection; + append: { + (name: string): _Selection; + (elementFunction: (data: T, index: number) => any): _Selection; + } + + insert: { + (name: string, before?: string): _Selection; + (insertElementFunction: (data: T, index: number) => any, before?: string): _Selection; + (name: string, beforeElementFunction?: (data: T, index: number) => any): _Selection; + (insertElementFunction: (data: T, index: number) => any, beforeElementFunction?: (data: T, index: number) => any): _Selection; + } + select: (selector: string) => _Selection; empty: () => boolean; node: () => Element; From 708a29cbf53e29996c8dfcdccabb2b7bad153534 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Eichler?= Date: Mon, 18 May 2015 14:49:55 +0200 Subject: [PATCH 068/179] fixed Model.create method returned Promise type --- mongoose/mongoose.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mongoose/mongoose.d.ts b/mongoose/mongoose.d.ts index 33fa66aba..29e167dcd 100644 --- a/mongoose/mongoose.d.ts +++ b/mongoose/mongoose.d.ts @@ -143,7 +143,7 @@ declare module "mongoose" { aggregate(aggregation1: Object, aggregation2: Object, aggregation3: Object, callback: (err: any, res: T[]) => void): Promise; count(conditions: Object, callback?: (err: any, count: number) => void): Query; - create(doc: Object, fn?: (err: any, res: T) => void): Promise; + create(doc: Object, fn?: (err: any, res: T) => void): Promise; create(doc1: Object, doc2: Object, fn?: (err: any, res1: T, res2: T) => void): Promise; create(doc1: Object, doc2: Object, doc3: Object, fn?: (err: any, res1: T, res2: T, res3: T) => void): Promise; discriminator(name: string, schema: Schema): Model; From c8d056a361f9d4e77ce40950e6088bf064bdcf16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Eichler?= Date: Mon, 18 May 2015 14:53:28 +0200 Subject: [PATCH 069/179] added test for fixed create method --- mongoose/mongoose-tests.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mongoose/mongoose-tests.ts b/mongoose/mongoose-tests.ts index 9c221b5ca..de68f006a 100644 --- a/mongoose/mongoose-tests.ts +++ b/mongoose/mongoose-tests.ts @@ -146,6 +146,9 @@ Model.remove((err: any, res: IActor[]) => {}); Model.save((err: any, res: IActor, numberAffected: number) => {}); Model.create({ type: 'jelly bean' }, { type: 'snickers' }, (err: any, res1: IActor, res2: IActor) => {}); Model.create({ type: 'jawbreaker' }); +Model.create({ type: 'muffin' }).then(function (res) { + res.name; +}); Model.distinct('url', { clicks: {$gt: 100}}, (err: any, result: IActor[]) => {}); Model.distinct('url'); From 639337b32bed76f70e1e7918c4ad076c4492e1ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Eichler?= Date: Mon, 18 May 2015 14:57:14 +0200 Subject: [PATCH 070/179] fixed *withMatch methods incorrectly requiring SinonMatcher type arguments --- sinon/sinon-tests.ts | 13 +++++++++++++ sinon/sinon.d.ts | 14 +++++++------- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/sinon/sinon-tests.ts b/sinon/sinon-tests.ts index ccc9819e5..ca916788d 100644 --- a/sinon/sinon-tests.ts +++ b/sinon/sinon-tests.ts @@ -76,6 +76,18 @@ function testEight() { sinon.match.typeOf("object").and(sinon.match.has("pages")); } +function testNine() { + var callback = sinon.stub().returns(42); + callback({ x: 5, y: 5 }); + callback.calledWithMatch({ x: 5 }); + callback.alwaysCalledWithMatch({ y: 5 }); + callback.neverCalledWithMatch({ x: 6 }); + callback.notCalledWithMatch({ x: 6 }); + sinon.assert.calledWithMatch(callback, { x: 5 }); + sinon.assert.alwaysCalledWithMatch(callback, { y: 5 }); + sinon.assert.neverCalledWithMatch(callback, { x: 6 }); +} + function testSandbox() { var sandbox = sinon.sandbox.create(); if (sandbox.spy().called) { @@ -96,3 +108,4 @@ testFive(); testSix(); testSeven(); testEight(); +testNine(); diff --git a/sinon/sinon.d.ts b/sinon/sinon.d.ts index 7dc5bc1d6..6440dda90 100644 --- a/sinon/sinon.d.ts +++ b/sinon/sinon.d.ts @@ -15,9 +15,9 @@ declare module Sinon { calledOn(obj: any): boolean; calledWith(...args: any[]): boolean; calledWithExactly(...args: any[]): boolean; - calledWithMatch(...args: SinonMatcher[]): boolean; + calledWithMatch(...args: any[]): boolean; notCalledWith(...args: any[]): boolean; - notCalledWithMatch(...args: SinonMatcher[]): boolean; + notCalledWithMatch(...args: any[]): boolean; returned(value: any): boolean; threw(): boolean; threw(type: string): boolean; @@ -64,9 +64,9 @@ declare module Sinon { alwaysCalledOn(obj: any): boolean; alwaysCalledWith(...args: any[]): boolean; alwaysCalledWithExactly(...args: any[]): boolean; - alwaysCalledWithMatch(...args: SinonMatcher[]): boolean; + alwaysCalledWithMatch(...args: any[]): boolean; neverCalledWith(...args: any[]): boolean; - neverCalledWithMatch(...args: SinonMatcher[]): boolean; + neverCalledWithMatch(...args: any[]): boolean; alwaysThrew(): boolean; alwaysThrew(type: string): boolean; alwaysThrew(obj: any): boolean; @@ -307,9 +307,9 @@ declare module Sinon { neverCalledWith(spy: SinonSpy, ...args: any[]): void; calledWithExactly(spy: SinonSpy, ...args: any[]): void; alwaysCalledWithExactly(spy: SinonSpy, ...args: any[]): void; - calledWithMatch(spy: SinonSpy, ...args: SinonMatcher[]): void; - alwaysCalledWithMatch(spy: SinonSpy, ...args: SinonMatcher[]): void; - neverCalledWithMatch(spy: SinonSpy, ...args: SinonMatcher[]): void; + calledWithMatch(spy: SinonSpy, ...args: any[]): void; + alwaysCalledWithMatch(spy: SinonSpy, ...args: any[]): void; + neverCalledWithMatch(spy: SinonSpy, ...args: any[]): void; threw(spy: SinonSpy): void; threw(spy: SinonSpy, exception: string): void; threw(spy: SinonSpy, exception: any): void; From 0be19e02aaf6dd73b990e87eff159934728609dc Mon Sep 17 00:00:00 2001 From: Joseph Livecchi Date: Mon, 18 May 2015 11:27:02 -0400 Subject: [PATCH 071/179] Finished converting fabric.d.ts to version 1.5.x * Finished converting all of the fabric.d.ts file to the latest version, 1.5.x * Updated the fabricjs-tests.ts with the new api changes --- fabricjs/fabricjs-tests.ts | 1910 +++++++++-------- fabricjs/fabricjs.d.ts | 4126 +++++++++++++++++++++--------------- 2 files changed, 3397 insertions(+), 2639 deletions(-) diff --git a/fabricjs/fabricjs-tests.ts b/fabricjs/fabricjs-tests.ts index e59212d80..c3dfd8d6d 100644 --- a/fabricjs/fabricjs-tests.ts +++ b/fabricjs/fabricjs-tests.ts @@ -1,1065 +1,1063 @@ /// function sample1() { - var canvas = new fabric.Canvas('c', { - hoverCursor: 'pointer', - selection: false, + var canvas = new fabric.Canvas('c', { + hoverCursor: 'pointer', + selection: false, + }); + + canvas.on('object:moving', function(e: fabric.IEvent) { + e.target.opacity = 0.5; + }); + canvas.on('object:modified', function(e: fabric.IEvent) { + e.target.opacity = 1; + }); + + for (var i = 0, len = 15; i < len; i++) { + fabric.Image.fromURL('../assets/ladybug.png', function(img) { + img.set({ + left: fabric.util.getRandomInt(0, 600), + top: fabric.util.getRandomInt(0, 500), + angle: fabric.util.getRandomInt(0, 90) + }); + + img.perPixelTargetFind = true; + // img.targetFindTolerance = 4; + img.hasControls = img.hasBorders = false; + + img.scale(fabric.util.getRandomInt(50, 100) / 100); + + canvas.add(img); }); - - canvas.on({ - 'object:moving': function (e) { - (e.target).opacity = 0.5; - }, - 'object:modified': function (e) { - (e.target).opacity = 1; - } - }); - - for (var i = 0, len = 15; i < len; i++) { - fabric.Image.fromURL('../assets/ladybug.png', function (img) { - img.set({ - left: fabric.util.getRandomInt(0, 600), - top: fabric.util.getRandomInt(0, 500), - angle: fabric.util.getRandomInt(0, 90) - }); - - img.perPixelTargetFind = true; - // img.targetFindTolerance = 4; - img.hasControls = img.hasBorders = false; - - img.scale(fabric.util.getRandomInt(50, 100) / 100); - - canvas.add(img); - }); - } + } } function sample2() { - var dot, i, - t1, t2, - startTimer = function () { - t1 = new Date().getTime(); - return t1; - }, - stopTimer = function () { - t2 = new Date().getTime(); - return t2 - t1; - }, - getRandomInt = fabric.util.getRandomInt, - rainbow = ["#ffcc66", "#ccff66", "#66ccff", "#ff6fcf", "#ff6666"], - rainbowEnd = rainbow.length - 1; + var dot, i, + t1, t2, + startTimer = function() { + t1 = new Date().getTime(); + return t1; + }, + stopTimer = function() { + t2 = new Date().getTime(); + return t2 - t1; + }, + getRandomInt = fabric.util.getRandomInt, + rainbow = ["#ffcc66", "#ccff66", "#66ccff", "#ff6fcf", "#ff6666"], + rainbowEnd = rainbow.length - 1; - // - // Rendering canvas #1 - // - var canvas1 = new fabric.Canvas('c1', { backgroundColor: "#000" }), - results1 = document.getElementById('results-c1'); + // + // Rendering canvas #1 + // + var canvas1 = new fabric.Canvas('c1', { backgroundColor: "#000" }), + results1 = document.getElementById('results-c1'); - startTimer(); - for (i = 100; i >= 0; i--) { - dot = new fabric.Circle({ - left: getRandomInt(0, 400), - top: getRandomInt(0, 350), - radius: 3, - fill: rainbow[getRandomInt(0, rainbowEnd)] - }); - canvas1.add(dot); - } - results1.innerHTML = 'Regular rendering of 100 elements in ' + stopTimer() + 'ms'; + startTimer(); + for (i = 100; i >= 0; i--) { + dot = new fabric.Circle({ + left: getRandomInt(0, 400), + top: getRandomInt(0, 350), + radius: 3, + fill: rainbow[getRandomInt(0, rainbowEnd)] + }); + canvas1.add(dot); + } + results1.innerHTML = 'Regular rendering of 100 elements in ' + stopTimer() + 'ms'; - // - // Rendering canvas #2 - // - var canvas2 = new fabric.Canvas('c2', { backgroundColor: "#000", renderOnAddition: false }), - results2 = document.getElementById('results-c2'); + // + // Rendering canvas #2 + // + var canvas2 = new fabric.Canvas('c2', { backgroundColor: "#000", renderOnAddition: false }), + results2 = document.getElementById('results-c2'); - startTimer(); - for (i = 1000; i >= 0; i--) { - dot = new fabric.Circle({ - left: getRandomInt(0, 400), - top: getRandomInt(0, 350), - radius: 3, - fill: rainbow[getRandomInt(0, rainbowEnd)] - }); - canvas2.add(dot); - } - canvas2.renderAll(); // Note, calling renderAll() is important in this case - results2.innerHTML = 'Rendering 1000 elements using canvas.renderOnAddition = false in ' + stopTimer() + 'ms'; + startTimer(); + for (i = 1000; i >= 0; i--) { + dot = new fabric.Circle({ + left: getRandomInt(0, 400), + top: getRandomInt(0, 350), + radius: 3, + fill: rainbow[getRandomInt(0, rainbowEnd)] + }); + canvas2.add(dot); + } + canvas2.renderAll(); // Note, calling renderAll() is important in this case + results2.innerHTML = 'Rendering 1000 elements using canvas.renderOnAddition = false in ' + stopTimer() + 'ms'; } function sample3() { - var $ = function (id) {return document.getElementById(id) }; + var $ = function(id) { return document.getElementById(id) }; - function applyFilter(index, filter) { - var obj = canvas.getActiveObject(); - obj.filters[index] = filter; - obj.applyFilters(canvas.renderAll.bind(canvas)); - } - - function applyFilterValue(index, prop, value) { - var obj = canvas.getActiveObject(); - if (obj.filters[index]) { - obj.filters[index][prop] = value; - obj.applyFilters(canvas.renderAll.bind(canvas)); - } - } - - var canvas = new fabric.Canvas('c', { backgroundImage: '../lib/bg.png' }), - f = fabric.Image.filters; - - canvas.on({ - 'object:selected': function () { - fabric.util.toArray(document.getElementsByTagName('input')).forEach(function (el) { el.disabled = false; }) - - var filters = ['grayscale', 'invert', 'remove-white', 'sepia', 'sepia2', 'brightness', - 'noise', 'gradient-transparency', 'pixelate', 'blur', 'sharpen']; - - for (var i = 0; i < filters.length; i++) { - var checkBox = $(filters[i]); - var image = canvas.getActiveObject(); - checkBox.checked = !!image.filters[i]; - } - }, - 'selection:cleared': function () { - fabric.util.toArray(document.getElementsByTagName('input')).forEach(function (el) { el.disabled = true; }) + function applyFilter(index, filter) { + var obj = canvas.getActiveObject(); + obj.filters[index] = filter; + obj.applyFilters(canvas.renderAll.bind(canvas)); } - }); - fabric.Image.fromURL('../assets/printio.png', function (img) { - var oImg = img.set({ left: 300, top: 300, angle: -15 }).scale(0.9); - canvas.add(oImg).renderAll(); - canvas.setActiveObject(oImg); - }); + function applyFilterValue(index, prop, value) { + var obj = canvas.getActiveObject(); + if (obj.filters[index]) { + obj.filters[index][prop] = value; + obj.applyFilters(canvas.renderAll.bind(canvas)); + } + } - $('grayscale').onclick = function () { - applyFilter(0, this.checked && new f.Grayscale()); - }; - $('invert').onclick = function () { - applyFilter(1, this.checked && new f.Invert()); - }; - $('remove-white').onclick = function () { - applyFilter(2, this.checked && new f.RemoveWhite({ - threshold: ($('remove-white-threshold')).value, - distance: ($('remove-white-distance')).value - })); - }; - $('remove-white-threshold').onchange = function () { - applyFilterValue(2, 'threshold', this.value); - }; - $('remove-white-distance').onchange = function () { - applyFilterValue(2, 'distance', this.value); - }; - $('sepia').onclick = function () { - applyFilter(3, this.checked && new f.Sepia()); - }; - $('sepia2').onclick = function () { - applyFilter(4, this.checked && new f.Sepia2()); - }; - $('brightness').onclick = function () { - applyFilter(5, this.checked && new f.Brightness({ - brightness: parseInt(($('brightness-value')).value, 10) - })); - }; - $('brightness-value').onchange = function () { - applyFilterValue(5, 'brightness', parseInt(this.value, 10)); - }; - $('noise').onclick = function () { - applyFilter(6, this.checked && new f.Noise({ - noise: parseInt(($('noise-value')).value, 10) - })); - }; - $('noise-value').onchange = function () { - applyFilterValue(6, 'noise', parseInt(this.value, 10)); - }; - $('gradient-transparency').onclick = function () { - applyFilter(7, this.checked && new f.GradientTransparency({ - threshold: parseInt(($('gradient-transparency-value')).value, 10) - })); - }; - $('gradient-transparency-value').onchange = function () { - applyFilterValue(7, 'threshold', parseInt(this.value, 10)); - }; - $('pixelate').onclick = function () { - applyFilter(8, this.checked && new f.Pixelate({ - blocksize: parseInt(($('pixelate-value')).value, 10) - })); - }; - $('pixelate-value').onchange = function () { - applyFilterValue(8, 'blocksize', parseInt(this.value, 10)); - }; - $('blur').onclick = function () { - applyFilter(9, this.checked && new f.Convolute({ - matrix: [1 / 9, 1 / 9, 1 / 9, - 1 / 9, 1 / 9, 1 / 9, - 1 / 9, 1 / 9, 1 / 9] - })); - }; - $('sharpen').onclick = function () { - applyFilter(10, this.checked && new f.Convolute({ - matrix: [0, -1, 0, - -1, 5, -1, - 0, -1, 0] - })); - }; - $('emboss').onclick = function () { - applyFilter(11, this.checked && new f.Convolute({ - matrix: [1, 1, 1, - 1, 0.7, -1, - -1, -1, -1] - })); - }; + var canvas = new fabric.Canvas('c', { backgroundImage: '../lib/bg.png' }), + f = fabric.Image.filters; + + canvas.on({ + 'object:selected': function() { + fabric.util.toArray(document.getElementsByTagName('input')).forEach(function(el) { el.disabled = false; }) + + var filters = ['grayscale', 'invert', 'remove-white', 'sepia', 'sepia2', 'brightness', + 'noise', 'gradient-transparency', 'pixelate', 'blur', 'sharpen']; + + for (var i = 0; i < filters.length; i++) { + var checkBox = $(filters[i]); + var image = canvas.getActiveObject(); + checkBox.checked = !!image.filters[i]; + } + }, + 'selection:cleared': function() { + fabric.util.toArray(document.getElementsByTagName('input')).forEach(function(el) { el.disabled = true; }) + } + }); + + fabric.Image.fromURL('../assets/printio.png', function(img) { + var oImg = img.set({ left: 300, top: 300, angle: -15 }).scale(0.9); + canvas.add(oImg).renderAll(); + canvas.setActiveObject(oImg); + }); + + $('grayscale').onclick = function() { + applyFilter(0, this.checked && new f.Grayscale()); + }; + $('invert').onclick = function() { + applyFilter(1, this.checked && new f.Invert()); + }; + $('remove-white').onclick = function() { + applyFilter(2, this.checked && new f.RemoveWhite({ + threshold: parseInt(($('remove-white-threshold')).value), + distance: parseInt(($('remove-white-distance')).value) + })); + }; + $('remove-white-threshold').onchange = function() { + applyFilterValue(2, 'threshold', this.value); + }; + $('remove-white-distance').onchange = function() { + applyFilterValue(2, 'distance', this.value); + }; + $('sepia').onclick = function() { + applyFilter(3, this.checked && new f.Sepia()); + }; + $('sepia2').onclick = function() { + applyFilter(4, this.checked && new f.Sepia2()); + }; + $('brightness').onclick = function() { + applyFilter(5, this.checked && new f.Brightness({ + brightness: parseInt(($('brightness-value')).value, 10) + })); + }; + $('brightness-value').onchange = function() { + applyFilterValue(5, 'brightness', parseInt(this.value, 10)); + }; + $('noise').onclick = function() { + applyFilter(6, this.checked && new f.Noise({ + noise: parseInt(($('noise-value')).value, 10) + })); + }; + $('noise-value').onchange = function() { + applyFilterValue(6, 'noise', parseInt(this.value, 10)); + }; + $('gradient-transparency').onclick = function() { + applyFilter(7, this.checked && new f.GradientTransparency({ + threshold: parseInt(($('gradient-transparency-value')).value, 10) + })); + }; + $('gradient-transparency-value').onchange = function() { + applyFilterValue(7, 'threshold', parseInt(this.value, 10)); + }; + $('pixelate').onclick = function() { + applyFilter(8, this.checked && new f.Pixelate({ + blocksize: parseInt(($('pixelate-value')).value, 10) + })); + }; + $('pixelate-value').onchange = function() { + applyFilterValue(8, 'blocksize', parseInt(this.value, 10)); + }; + $('blur').onclick = function() { + applyFilter(9, this.checked && new f.Convolute({ + matrix: [1 / 9, 1 / 9, 1 / 9, + 1 / 9, 1 / 9, 1 / 9, + 1 / 9, 1 / 9, 1 / 9] + })); + }; + $('sharpen').onclick = function() { + applyFilter(10, this.checked && new f.Convolute({ + matrix: [0, -1, 0, + -1, 5, -1, + 0, -1, 0] + })); + }; + $('emboss').onclick = function() { + applyFilter(11, this.checked && new f.Convolute({ + matrix: [1, 1, 1, + 1, 0.7, -1, + -1, -1, -1] + })); + }; } function sample4() { - var canvas = new fabric.Canvas('c'); - var $ = function (id) { return document.getElementById(id); }; + var canvas = new fabric.Canvas('c'); + var $ = function(id) { return document.getElementById(id); }; - var rect = new fabric.Rect({ - width: 100, - height: 100, - top: 150, - left: 150, - fill: 'rgba(255,0,0,0.5)' - }); + var rect = new fabric.Rect({ + width: 100, + height: 100, + top: 150, + left: 150, + fill: 'rgba(255,0,0,0.5)' + }); - canvas.add(rect); + canvas.add(rect); - var angleControl = $('angle-control'); - angleControl.onchange = function () { - rect.setAngle(this.value).setCoords(); - canvas.renderAll(); - }; + var angleControl = $('angle-control'); + angleControl.onchange = function() { + rect.setAngle(this.value).setCoords(); + canvas.renderAll(); + }; - var scaleControl = $('scale-control'); - scaleControl.onchange = function () { - rect.scale(this.value).setCoords(); - canvas.renderAll(); - }; + var scaleControl = $('scale-control'); + scaleControl.onchange = function() { + rect.scale(this.value).setCoords(); + canvas.renderAll(); + }; - var topControl = $('top-control'); - topControl.onchange = function () { - rect.setTop(this.value).setCoords(); - canvas.renderAll(); - }; + var topControl = $('top-control'); + topControl.onchange = function() { + rect.setTop(this.value).setCoords(); + canvas.renderAll(); + }; - var leftControl = $('left-control'); - leftControl.onchange = function () { - rect.setLeft(this.value).setCoords(); - canvas.renderAll(); - }; + var leftControl = $('left-control'); + leftControl.onchange = function() { + rect.setLeft(this.value).setCoords(); + canvas.renderAll(); + }; - function updateControls() { + function updateControls() { - scaleControl.value = rect.getScaleX().toString(); - angleControl.value = rect.getAngle().toString(); - leftControl.value = rect.getLeft().toString(); - topControl.value = rect.getTop().toString(); - } - canvas.on({ - 'object:moving': updateControls, - 'object:scaling': updateControls, - 'object:resizing': updateControls - }); + scaleControl.value = rect.getScaleX().toString(); + angleControl.value = rect.getAngle().toString(); + leftControl.value = rect.getLeft().toString(); + topControl.value = rect.getTop().toString(); + } + canvas.on({ + 'object:moving': updateControls, + 'object:scaling': updateControls, + 'object:resizing': updateControls + }); } module fabric { - export interface CircleWithLineInfos extends ICircle { - line1?: ILine; - line2?: ILine; - line3?: ILine; - line4?: ILine; - } + export interface CircleWithLineInfos extends ICircle { + line1?: ILine; + line2?: ILine; + line3?: ILine; + line4?: ILine; + } } function sample5() { - var makeCircle = function (left: number, top: number, line1?: fabric.ILine, line2?: fabric.ILine, line3?: fabric.ILine, line4?: fabric.ILine): fabric.ICircle { - var c = new fabric.Circle({ - left: left, - top: top, - strokeWidth: 5, - radius: 12, - fill: '#fff', - stroke: '#666' - }); - - c.line1 = line1; - c.line2 = line2; - c.line3 = line3; - c.line4 = line4; - c.hasControls = c.hasBorders = false; - return c; - } - -function makeLine(coords: number[]) { - return new fabric.Line(coords, { - fill: 'red', - strokeWidth: 5, - selectable: false - }); - } - - var canvas = new fabric.Canvas('c', { selection: false }); - - var line = makeLine([250, 125, 250, 175]), - line2 = makeLine([250, 175, 250, 250]), - line3 = makeLine([250, 250, 300, 350]), - line4 = makeLine([250, 250, 200, 350]), - line5 = makeLine([250, 175, 175, 225]), - line6 = makeLine([250, 175, 325, 225]); - - canvas.add(line, line2, line3, line4, line5, line6); - - canvas.add( - makeCircle(line.x1, line.y1, null, line), - makeCircle(line.x2, line.y2, line, line2, line5, line6), - makeCircle(line2.x2, line2.y2, line2, line3, line4), - makeCircle(line3.x2, line3.y2, line3), - makeCircle(line4.x2, line4.y2, line4), - makeCircle(line5.x2, line5.y2, line5), - makeCircle(line6.x2, line6.y2, line6) - ); - - canvas.on('object:moving', function (e) { - var p = e.target; - p.line1 && p.line1.set({ 'x2': p.left, 'y2': p.top }); - p.line2 && p.line2.set({ 'x1': p.left, 'y1': p.top }); - p.line3 && p.line3.set({ 'x1': p.left, 'y1': p.top }); - p.line4 && p.line4.set({ 'x1': p.left, 'y1': p.top }); - canvas.renderAll(); + var makeCircle = function(left: number, top: number, line1?: fabric.ILine, line2?: fabric.ILine, line3?: fabric.ILine, line4?: fabric.ILine): fabric.ICircle { + var c = new fabric.Circle({ + left: left, + top: top, + strokeWidth: 5, + radius: 12, + fill: '#fff', + stroke: '#666' }); + + c.line1 = line1; + c.line2 = line2; + c.line3 = line3; + c.line4 = line4; + c.hasControls = c.hasBorders = false; + return c; + } + + function makeLine(coords: number[]) { + return new fabric.Line(coords, { + fill: 'red', + strokeWidth: 5, + selectable: false + }); + } + + var canvas = new fabric.Canvas('c', { selection: false }); + + var line = makeLine([250, 125, 250, 175]), + line2 = makeLine([250, 175, 250, 250]), + line3 = makeLine([250, 250, 300, 350]), + line4 = makeLine([250, 250, 200, 350]), + line5 = makeLine([250, 175, 175, 225]), + line6 = makeLine([250, 175, 325, 225]); + + canvas.add(line, line2, line3, line4, line5, line6); + + canvas.add( + makeCircle(line.x1, line.y1, null, line), + makeCircle(line.x2, line.y2, line, line2, line5, line6), + makeCircle(line2.x2, line2.y2, line2, line3, line4), + makeCircle(line3.x2, line3.y2, line3), + makeCircle(line4.x2, line4.y2, line4), + makeCircle(line5.x2, line5.y2, line5), + makeCircle(line6.x2, line6.y2, line6) + ); + + canvas.on('object:moving', function(e) { + var p = e.target; + p.line1 && p.line1.set({ 'x2': p.left, 'y2': p.top }); + p.line2 && p.line2.set({ 'x1': p.left, 'y1': p.top }); + p.line3 && p.line3.set({ 'x1': p.left, 'y1': p.top }); + p.line4 && p.line4.set({ 'x1': p.left, 'y1': p.top }); + canvas.renderAll(); + }); } function sample6() { - var canvas = new fabric.Canvas('c'); - fabric.loadSVGFromURL('../assets/135.svg', function (objects) { - var obj = objects[0].scale(0.25); - canvas.centerObject(obj); - canvas.add(obj); + var canvas = new fabric.Canvas('c'); + fabric.loadSVGFromURL('../assets/135.svg', function(objects) { + var obj = objects[0].scale(0.25); + canvas.centerObject(obj); + canvas.add(obj); - canvas.add(obj.clone().set({ left: 100, top: 100, angle: -15 })); - canvas.add(obj.clone().set({ left: 480, top: 100, angle: 15 })); - canvas.add(obj.clone().set({ left: 100, top: 400, angle: -15 })); - canvas.add(obj.clone().set({ left: 480, top: 400, angle: 15 })); + canvas.add(obj.clone(() => {}).set({ left: 100, top: 100, angle: -15 })); + canvas.add(obj.clone(() => {}).set({ left: 480, top: 100, angle: 15 })); + canvas.add(obj.clone(() => {}).set({ left: 100, top: 400, angle: -15 })); + canvas.add(obj.clone(() => {}).set({ left: 480, top: 400, angle: 15 })); - canvas.on('mouse:move', function (options) { - var p = canvas.getPointer(options.e); + canvas.on('mouse:move', function(options) { + var p = canvas.getPointer(options.e); - canvas.forEachObject(function (obj) { - var distX = Math.abs(p.x - obj.left), - distY = Math.abs(p.y - obj.top), - dist = Math.round(Math.sqrt(Math.pow(distX, 2) + Math.pow(distY, 2))); - obj.setOpacity(1 / (dist / 20)); - }); - - }); + canvas.forEachObject(function(obj) { + var distX = Math.abs(p.x - obj.left), + distY = Math.abs(p.y - obj.top), + dist = Math.round(Math.sqrt(Math.pow(distX, 2) + Math.pow(distY, 2))); + obj.setOpacity(1 / (dist / 20)); + }); }); + + }); } module fabric { - export interface ImageWithInfo extends IImage { - movingLeft: boolean; - } + export interface ImageWithInfo extends IImage { + movingLeft: boolean; + } } function sample7() { - var canvas = new fabric.Canvas('c', { selection: false }); + var canvas = new fabric.Canvas('c', { selection: false }); - setInterval(function () { - fabric.Image.fromURL('../assets/ladybug.png', function (obj) { - var img = obj; - img.set('left', fabric.util.getRandomInt(200, 600)).set('top', -50); - img.movingLeft = !!Math.round(Math.random()); - canvas.add(img); - }); - }, 1000); - - - var animate = (function animate() { - canvas.forEachObject(function (obj) { - var img = obj; - img.left += (img.movingLeft ? -1 : 1); - img.top += 1; - if (img.left > 900 || img.top > 500) { - canvas.remove(img); - } - else { - img.setAngle(img.getAngle() + 2); - } - }); - canvas.renderAll(); - window.requestAnimationFrame(animate); + setInterval(function() { + fabric.Image.fromURL('../assets/ladybug.png', function(obj) { + var img = obj; + img.set('left', fabric.util.getRandomInt(200, 600)).set('top', -50); + img.movingLeft = !!Math.round(Math.random()); + canvas.add(img); }); + }, 1000); - animate(); + + var animate = (function animate() { + canvas.forEachObject(function(obj) { + var img = obj; + img.left += (img.movingLeft ? -1 : 1); + img.top += 1; + if (img.left > 900 || img.top > 500) { + canvas.remove(img); + } + else { + img.setAngle(img.getAngle() + 2); + } + }); + canvas.renderAll(); + window.requestAnimationFrame(animate); + }); + + animate(); } function sample8() { - function pad(str: string, length: number): string { - while (str.length < length) { - str = '0' + str; - } - return str; - }; + function pad(str: string, length: number): string { + while (str.length < length) { + str = '0' + str; + } + return str; + }; - var getRandomInt = fabric.util.getRandomInt; + var getRandomInt = fabric.util.getRandomInt; - function getRandomColor() { - return ( - pad(getRandomInt(0, 255).toString(16), 2) + - pad(getRandomInt(0, 255).toString(16), 2) + - pad(getRandomInt(0, 255).toString(16), 2) - ); + function getRandomColor() { + return ( + pad(getRandomInt(0, 255).toString(16), 2) + + pad(getRandomInt(0, 255).toString(16), 2) + + pad(getRandomInt(0, 255).toString(16), 2) + ); + } + + function getRandomNum(min: number, max: number): number { + return Math.random() * (max - min) + min; + } + + if (/(iPhone|iPod|iPad)/i.test(navigator.userAgent)) { + fabric.Object.prototype.cornersize = 30; + } + + var canvas = new fabric.Canvas('canvas'); + // canvas.controlsAboveOverlay = true; + + function updateComplexity() { + setTimeout(function() { + var element = document.getElementById('complexity').childNodes[1]; + element.innerHTML = ' ' + canvas.complexity(); + }, 100); + } + + document.getElementById('commands').onclick = function(ev: any) { + var ev: any = ev || window.event; + + if (ev.preventDefault) { + ev.preventDefault() + } + else if (ev.returnValue) { + ev.returnValue = false; } - function getRandomNum(min: number, max: number): number { - return Math.random() * (max - min) + min; + var element: any = ev.target || ev.srcElement; + if (element.nodeName.toLowerCase() === 'strong') { + element = element.parentNode; } - if (/(iPhone|iPod|iPad)/i.test(navigator.userAgent)) { - fabric.Object.prototype.cornersize = 30; - } - - var canvas = new fabric.Canvas('canvas'); - // canvas.controlsAboveOverlay = true; - - function updateComplexity() { - setTimeout(function () { - var element = document.getElementById('complexity').childNodes[1]; - element.innerHTML = ' ' + canvas.complexity(); - }, 100); - } - - document.getElementById('commands').onclick = function (ev: any) { - var ev: any = ev || window.event; - - if (ev.preventDefault) { - ev.preventDefault() - } - else if (ev.returnValue) { - ev.returnValue = false; - } - - var element: any = ev.target || ev.srcElement; - if (element.nodeName.toLowerCase() === 'strong') { - element = element.parentNode; - } - - var className = element.className, - offset = 50, - left = fabric.util.getRandomInt(0 + offset, 700 - offset), - top = fabric.util.getRandomInt(0 + offset, 500 - offset), - angle = fabric.util.getRandomInt(-20, 40), - width = fabric.util.getRandomInt(30, 50), - opacity = (function (min, max) { return Math.random() * (max - min) + min; })(0.5, 1); + var className = element.className, + offset = 50, + left = fabric.util.getRandomInt(0 + offset, 700 - offset), + top = fabric.util.getRandomInt(0 + offset, 500 - offset), + angle = fabric.util.getRandomInt(-20, 40), + width = fabric.util.getRandomInt(30, 50), + opacity = (function(min, max) { return Math.random() * (max - min) + min; })(0.5, 1); - switch (className) { - case 'rect': - canvas.add(new fabric.Rect({ - left: left, - top: top, - fill: '#' + getRandomColor(), - width: 50, - height: 50, - opacity: 0.8 - })); - break; + switch (className) { + case 'rect': + canvas.add(new fabric.Rect({ + left: left, + top: top, + fill: '#' + getRandomColor(), + width: 50, + height: 50, + opacity: 0.8 + })); + break; - case 'circle': - canvas.add(new fabric.Circle({ - left: left, - top: top, - fill: '#' + getRandomColor(), - radius: 50, - opacity: 0.8 - })); - break; + case 'circle': + canvas.add(new fabric.Circle({ + left: left, + top: top, + fill: '#' + getRandomColor(), + radius: 50, + opacity: 0.8 + })); + break; - case 'triangle': - canvas.add(new fabric.Triangle({ - left: left, - top: top, - fill: '#' + getRandomColor(), - width: 50, - height: 50, - opacity: 0.8 - })); - break; + case 'triangle': + canvas.add(new fabric.Triangle({ + left: left, + top: top, + fill: '#' + getRandomColor(), + width: 50, + height: 50, + opacity: 0.8 + })); + break; - case 'image1': - fabric.Image.fromURL('../assets/pug.jpg', function (image) { - image.set({ - left: left, - top: top, - angle: angle, - padding: 10, - cornersize: 10 - }); - image.scale(getRandomNum(0.1, 0.25)).setCoords(); - canvas.add(image); - }); - break; + case 'image1': + fabric.Image.fromURL('../assets/pug.jpg', function(image) { + image.set({ + left: left, + top: top, + angle: angle, + padding: 10, + cornersize: 10 + }); + image.scale(getRandomNum(0.1, 0.25)).setCoords(); + canvas.add(image); + }); + break; - case 'image2': - fabric.Image.fromURL('../assets/logo.png', function (image) { - image.set({ - left: left, - top: top, - angle: angle, - padding: 10, - cornersize: 10 - }); - image.scale(getRandomNum(0.1, 1)).setCoords(); - canvas.add(image); - updateComplexity(); - }); - break; + case 'image2': + fabric.Image.fromURL('../assets/logo.png', function(image) { + image.set({ + left: left, + top: top, + angle: angle, + padding: 10, + cornersize: 10 + }); + image.scale(getRandomNum(0.1, 1)).setCoords(); + canvas.add(image); + updateComplexity(); + }); + break; - case 'shape': - var id = element.id, match; - if (match = /\d+$/.exec(id)) { - fabric.loadSVGFromURL('../assets/' + match[0] + '.svg', function (objects, options) { - var loadedObject = fabric.util.groupSVGElements(objects, options); + case 'shape': + var id = element.id, match; + if (match = /\d+$/.exec(id)) { + fabric.loadSVGFromURL('../assets/' + match[0] + '.svg', function(objects, options) { + var loadedObject = fabric.util.groupSVGElements(objects, options); - loadedObject.set({ - left: left, - top: top, - angle: angle, - padding: 10, - cornersize: 10 - }); - loadedObject/*.scaleToWidth(300)*/.setCoords(); - - // loadedObject.hasRotatingPoint = true; - - canvas.add(loadedObject); - updateComplexity(); - canvas.calcOffset(); - }); - } - break; - - case 'clear': - if (confirm('Are you sure?')) { - canvas.clear(); - } - } - updateComplexity(); - }; - - document.getElementById('execute').onclick = function () { - var code = (document.getElementById('canvas-console')).value; - if (!(/^\s+$/).test(code)) { - eval(code); - } - }; - - - document.getElementById('rasterize').onclick = function () { - if (!fabric.Canvas.supports('toDataURL')) { - alert('This browser doesn\'t provide means to serialize canvas to an image'); - } - else { - window.open(canvas.toDataURL('png')); - } - }; - - var removeSelectedEl = document.getElementById('remove-selected'); - removeSelectedEl.onclick = function () { - var activeObject = canvas.getActiveObject(), - activeGroup = canvas.getActiveGroup(); - if (activeObject) { - canvas.remove(activeObject); - } - else if (activeGroup) { - var objectsInGroup = activeGroup.getObjects(); - canvas.discardActiveGroup(); - objectsInGroup.forEach(function (object) { - canvas.remove(object); + loadedObject.set({ + left: left, + top: top, + angle: angle, + padding: 10, + cornersize: 10 }); - } - }; + loadedObject/*.scaleToWidth(300)*/.setCoords(); - var supportsInputOfType = function (type) { - return function () { - var el = document.createElement('input'); - try { - el.type = type; - } - catch (err) { } - return el.type === type; - }; - }; - - var supportsSlider = supportsInputOfType('range'), - supportsColorpicker = supportsInputOfType('color'); - - if (supportsSlider()) { - (function () { - var controls = document.getElementById('controls'); - - var sliderLabel = document.createElement('label'); - sliderLabel.htmlFor = 'opacity'; - sliderLabel.innerHTML = 'Opacity: '; - - var slider = document.createElement('input'); - - try { slider.type = 'range'; } catch (err) { } - - slider.id = 'opacity'; - slider.value = "100"; - - controls.appendChild(sliderLabel); - controls.appendChild(slider); + // loadedObject.hasRotatingPoint = true; + canvas.add(loadedObject); + updateComplexity(); canvas.calcOffset(); + }); + } + break; - slider.onchange = function () { - var activeObject = canvas.getActiveObject(), - activeGroup = canvas.getActiveGroup(); - - if (activeObject || activeGroup) { - (activeObject || activeGroup).setOpacity(parseInt(this.value, 10) / 100); - canvas.renderAll(); - } - }; - })(); + case 'clear': + if (confirm('Are you sure?')) { + canvas.clear(); + } } + updateComplexity(); + }; - if (supportsColorpicker()) { - (function () { - var controls = document.getElementById('controls'); - - var label = document.createElement('label'); - label.htmlFor = 'color'; - label.innerHTML = 'Color: '; - label.style.marginLeft = '10px'; - - var colorpicker = document.createElement('input'); - colorpicker.type = 'color'; - colorpicker.id = 'color'; - colorpicker.style.width = '40px'; - - controls.appendChild(label); - controls.appendChild(colorpicker); - - canvas.calcOffset(); - - colorpicker.onchange = function () { - var activeObject = canvas.getActiveObject(), - activeGroup = canvas.getActiveGroup(); - - if (activeObject || activeGroup) { - (activeObject || activeGroup).setFill(this.value); - canvas.renderAll(); - } - }; - })(); + document.getElementById('execute').onclick = function() { + var code = (document.getElementById('canvas-console')).value; + if (!(/^\s+$/).test(code)) { + eval(code); } + }; - var lockHorizontallyEl = document.getElementById('lock-horizontally'); - lockHorizontallyEl.onclick = function () { - var activeObject: any = canvas.getActiveObject(); - if (activeObject) { - activeObject.lockMovementX = !activeObject.lockMovementX; - lockHorizontallyEl.innerHTML = activeObject.lockMovementX - ? 'Unlock horizontal movement' - : 'Lock horizontal movement'; - } - }; - var lockVerticallyEl = document.getElementById('lock-vertically'); - lockVerticallyEl.onclick = function () { - var activeObject: any = canvas.getActiveObject(); - if (activeObject) { - activeObject.lockMovementY = !activeObject.lockMovementY; - lockVerticallyEl.innerHTML = activeObject.lockMovementY - ? 'Unlock vertical movement' - : 'Lock vertical movement'; - } - }; - - var lockScalingXEl = document.getElementById('lock-scaling-x'); - lockScalingXEl.onclick = function () { - var activeObject: any = canvas.getActiveObject(); - if (activeObject) { - activeObject.lockScalingX = !activeObject.lockScalingX; - lockScalingXEl.innerHTML = activeObject.lockScalingX - ? 'Unlock horizontal scaling' - : 'Lock horizontal scaling'; - } - }; - - var lockScalingYEl = document.getElementById('lock-scaling-y'); - lockScalingYEl.onclick = function () { - var activeObject: any = canvas.getActiveObject(); - if (activeObject) { - activeObject.lockScalingY = !activeObject.lockScalingY; - lockScalingYEl.innerHTML = activeObject.lockScalingY - ? 'Unlock vertical scaling' - : 'Lock vertical scaling'; - } - }; - - var lockRotationEl = document.getElementById('lock-rotation'); - lockRotationEl.onclick = function () { - var activeObject: any = canvas.getActiveObject(); - if (activeObject) { - activeObject.lockRotation = !activeObject.lockRotation; - lockRotationEl.innerHTML = activeObject.lockRotation - ? 'Unlock rotation' - : 'Lock rotation'; - } - }; - - var gradientifyBtn = document.getElementById('gradientify'); - - var activeObjectButtons = [ - lockHorizontallyEl, - lockVerticallyEl, - lockScalingXEl, - lockScalingYEl, - lockRotationEl, - removeSelectedEl, - gradientifyBtn - ]; - - var opacityEl = document.getElementById('opacity'); - if (opacityEl) { - activeObjectButtons.push(opacityEl); + document.getElementById('rasterize').onclick = function() { + if (!fabric.Canvas.supports('toDataURL')) { + alert('This browser doesn\'t provide means to serialize canvas to an image'); } - var colorEl = document.getElementById('color'); - if (colorEl) { - activeObjectButtons.push(colorEl); + else { + window.open(canvas.toDataURL('png')); } + }; + + var removeSelectedEl = document.getElementById('remove-selected'); + removeSelectedEl.onclick = function() { + var activeObject = canvas.getActiveObject(), + activeGroup = canvas.getActiveGroup(); + if (activeObject) { + canvas.remove(activeObject); + } + else if (activeGroup) { + var objectsInGroup = activeGroup.getObjects(); + canvas.discardActiveGroup(); + objectsInGroup.forEach(function(object) { + canvas.remove(object); + }); + } + }; + + var supportsInputOfType = function(type) { + return function() { + var el = document.createElement('input'); + try { + el.type = type; + } + catch (err) { } + return el.type === type; + }; + }; + + var supportsSlider = supportsInputOfType('range'), + supportsColorpicker = supportsInputOfType('color'); + + if (supportsSlider()) { + (function() { + var controls = document.getElementById('controls'); + + var sliderLabel = document.createElement('label'); + sliderLabel.htmlFor = 'opacity'; + sliderLabel.innerHTML = 'Opacity: '; + + var slider = document.createElement('input'); + + try { slider.type = 'range'; } catch (err) { } + + slider.id = 'opacity'; + slider.value = "100"; + + controls.appendChild(sliderLabel); + controls.appendChild(slider); + + canvas.calcOffset(); + + slider.onchange = function() { + var activeObject = canvas.getActiveObject(), + activeGroup = canvas.getActiveGroup(); + + if (activeObject || activeGroup) { + (activeObject || activeGroup).setOpacity(parseInt(this.value, 10) / 100); + canvas.renderAll(); + } + }; + })(); + } + + if (supportsColorpicker()) { + (function() { + var controls = document.getElementById('controls'); + + var label = document.createElement('label'); + label.htmlFor = 'color'; + label.innerHTML = 'Color: '; + label.style.marginLeft = '10px'; + + var colorpicker = document.createElement('input'); + colorpicker.type = 'color'; + colorpicker.id = 'color'; + colorpicker.style.width = '40px'; + + controls.appendChild(label); + controls.appendChild(colorpicker); + + canvas.calcOffset(); + + colorpicker.onchange = function() { + var activeObject = canvas.getActiveObject(), + activeGroup = canvas.getActiveGroup(); + + if (activeObject || activeGroup) { + (activeObject || activeGroup).setFill(this.value); + canvas.renderAll(); + } + }; + })(); + } + + var lockHorizontallyEl = document.getElementById('lock-horizontally'); + lockHorizontallyEl.onclick = function() { + var activeObject: any = canvas.getActiveObject(); + if (activeObject) { + activeObject.lockMovementX = !activeObject.lockMovementX; + lockHorizontallyEl.innerHTML = activeObject.lockMovementX + ? 'Unlock horizontal movement' + : 'Lock horizontal movement'; + } + }; + + var lockVerticallyEl = document.getElementById('lock-vertically'); + lockVerticallyEl.onclick = function() { + var activeObject: any = canvas.getActiveObject(); + if (activeObject) { + activeObject.lockMovementY = !activeObject.lockMovementY; + lockVerticallyEl.innerHTML = activeObject.lockMovementY + ? 'Unlock vertical movement' + : 'Lock vertical movement'; + } + }; + + var lockScalingXEl = document.getElementById('lock-scaling-x'); + lockScalingXEl.onclick = function() { + var activeObject: any = canvas.getActiveObject(); + if (activeObject) { + activeObject.lockScalingX = !activeObject.lockScalingX; + lockScalingXEl.innerHTML = activeObject.lockScalingX + ? 'Unlock horizontal scaling' + : 'Lock horizontal scaling'; + } + }; + + var lockScalingYEl = document.getElementById('lock-scaling-y'); + lockScalingYEl.onclick = function() { + var activeObject: any = canvas.getActiveObject(); + if (activeObject) { + activeObject.lockScalingY = !activeObject.lockScalingY; + lockScalingYEl.innerHTML = activeObject.lockScalingY + ? 'Unlock vertical scaling' + : 'Lock vertical scaling'; + } + }; + + var lockRotationEl = document.getElementById('lock-rotation'); + lockRotationEl.onclick = function() { + var activeObject: any = canvas.getActiveObject(); + if (activeObject) { + activeObject.lockRotation = !activeObject.lockRotation; + lockRotationEl.innerHTML = activeObject.lockRotation + ? 'Unlock rotation' + : 'Lock rotation'; + } + }; + + var gradientifyBtn = document.getElementById('gradientify'); + + var activeObjectButtons = [ + lockHorizontallyEl, + lockVerticallyEl, + lockScalingXEl, + lockScalingYEl, + lockRotationEl, + removeSelectedEl, + gradientifyBtn + ]; + + var opacityEl = document.getElementById('opacity'); + if (opacityEl) { + activeObjectButtons.push(opacityEl); + } + var colorEl = document.getElementById('color'); + if (colorEl) { + activeObjectButtons.push(colorEl); + } + + for (var i = activeObjectButtons.length; i--;) { + activeObjectButtons[i].disabled = true; + } + + canvas.on('object:selected', onObjectSelected); + canvas.on('group:selected', onObjectSelected); + + function onObjectSelected(e) { + var selectedObject = e.target; for (var i = activeObjectButtons.length; i--;) { - activeObjectButtons[i].disabled = true; + activeObjectButtons[i].disabled = false; } - canvas.on('object:selected', onObjectSelected); - canvas.on('group:selected', onObjectSelected); + lockHorizontallyEl.innerHTML = (selectedObject.lockMovementX ? 'Unlock horizontal movement' : 'Lock horizontal movement'); + lockVerticallyEl.innerHTML = (selectedObject.lockMovementY ? 'Unlock vertical movement' : 'Lock vertical movement'); + lockScalingXEl.innerHTML = (selectedObject.lockScalingX ? 'Unlock horizontal scaling' : 'Lock horizontal scaling'); + lockScalingYEl.innerHTML = (selectedObject.lockScalingY ? 'Unlock vertical scaling' : 'Lock vertical scaling'); + lockRotationEl.innerHTML = (selectedObject.lockRotation ? 'Unlock rotation' : 'Lock rotation'); + } - function onObjectSelected(e) { - var selectedObject = e.target; - - for (var i = activeObjectButtons.length; i--;) { - activeObjectButtons[i].disabled = false; - } - - lockHorizontallyEl.innerHTML = (selectedObject.lockMovementX ? 'Unlock horizontal movement' : 'Lock horizontal movement'); - lockVerticallyEl.innerHTML = (selectedObject.lockMovementY ? 'Unlock vertical movement' : 'Lock vertical movement'); - lockScalingXEl.innerHTML = (selectedObject.lockScalingX ? 'Unlock horizontal scaling' : 'Lock horizontal scaling'); - lockScalingYEl.innerHTML = (selectedObject.lockScalingY ? 'Unlock vertical scaling' : 'Lock vertical scaling'); - lockRotationEl.innerHTML = (selectedObject.lockRotation ? 'Unlock rotation' : 'Lock rotation'); + canvas.on('selection:cleared', function(e) { + for (var i = activeObjectButtons.length; i--;) { + activeObjectButtons[i].disabled = true; } + }); - canvas.on('selection:cleared', function (e) { - for (var i = activeObjectButtons.length; i--;) { - activeObjectButtons[i].disabled = true; - } + var drawingModeEl = document.getElementById('drawing-mode'), + drawingOptionsEl = document.getElementById('drawing-mode-options'), + drawingColorEl = document.getElementById('drawing-color'), + drawingLineWidthEl = document.getElementById('drawing-line-width'); + + drawingModeEl.onclick = function() { + var canvasWithDrawingMode: any = canvas; + canvasWithDrawingMode.isDrawingMode = !canvasWithDrawingMode.isDrawingMode; + if (canvasWithDrawingMode.isDrawingMode) { + drawingModeEl.innerHTML = 'Cancel drawing mode'; + drawingModeEl.className = 'is-drawing'; + drawingOptionsEl.style.display = ''; + } + else { + drawingModeEl.innerHTML = 'Enter drawing mode'; + drawingModeEl.className = ''; + drawingOptionsEl.style.display = 'none'; + } + }; + + canvas.on('path:created', function() { + updateComplexity(); + }); + + drawingColorEl.onchange = function() { + canvas.freeDrawingColor = drawingColorEl.value; + }; + drawingLineWidthEl.onchange = function() { + canvas.freeDrawingLineWidth = parseInt(drawingLineWidthEl.value, 10) || 1; // disallow 0, NaN, etc. + }; + + canvas.freeDrawingColor = drawingColorEl.value; + canvas.freeDrawingLineWidth = parseInt(drawingLineWidthEl.value, 10) || 1; + + + var text = 'Lorem ipsum dolor sit amet,\nconsectetur adipisicing elit,\nsed do eiusmod tempor incididunt\nut labore et dolore magna aliqua.\n' + + 'Ut enim ad minim veniam,\nquis nostrud exercitation ullamco\nlaboris nisi ut aliquip ex ea commodo consequat.'; + + document.getElementById('add-text').onclick = function() { + var textSample = new fabric.Text(text.slice(0, getRandomInt(0, text.length)), { + left: getRandomInt(350, 400), + top: getRandomInt(350, 400), + fontFamily: 'helvetica', + angle: getRandomInt(-10, 10), + fill: '#' + getRandomColor(), + scaleX: 0.5, + scaleY: 0.5, + fontWeight: '' }); + canvas.add(textSample); + updateComplexity(); + }; - var drawingModeEl = document.getElementById('drawing-mode'), - drawingOptionsEl = document.getElementById('drawing-mode-options'), - drawingColorEl = document.getElementById('drawing-color'), - drawingLineWidthEl = document.getElementById('drawing-line-width'); - drawingModeEl.onclick = function () { - var canvasWithDrawingMode: any = canvas; - canvasWithDrawingMode.isDrawingMode = !canvasWithDrawingMode.isDrawingMode; - if (canvasWithDrawingMode.isDrawingMode) { - drawingModeEl.innerHTML = 'Cancel drawing mode'; - drawingModeEl.className = 'is-drawing'; - drawingOptionsEl.style.display = ''; + document.onkeydown = function(e) { + var obj = canvas.getActiveObject() || canvas.getActiveGroup(); + if (obj && e.keyCode === 8) { + // this is horrible. need to fix, so that unified interface can be used + if (obj.type === 'group') { + // var groupObjects = obj.getObjects(); + // canvas.discardActiveGroup(); + // groupObjects.forEach(function(obj) { + // canvas.remove(obj); + // }); + } + else { + //canvas.remove(obj); + } + canvas.renderAll(); + // return false; + } + }; + + setTimeout(function() { + canvas.calcOffset(); + }, 100); + + if (document.location.search.indexOf('guidelines') > -1) { + //initCenteringGuidelines(canvas); + //initAligningGuidelines(canvas); + } + + gradientifyBtn.onclick = function() { + var obj = canvas.getActiveObject(); + if (obj) { + obj.setGradient("fill", { + x2: (getRandomInt(0, 1) ? 0 : obj.width), + y2: (getRandomInt(0, 1) ? 0 : obj.height), + colorStops: { + 0: '#' + getRandomColor(), + 1: '#' + getRandomColor() + } + }); + canvas.renderAll(); + } + }; + + var textEl = document.getElementById('text'); + if (textEl) { + textEl.onfocus = function() { + var activeObject = canvas.getActiveObject(); + + if (activeObject && activeObject.type === 'text') { + this.value = (activeObject).text; + } + }; + textEl.onkeyup = function(e) { + var activeObject = canvas.getActiveObject(); + if (activeObject) { + if (!this.value) { + canvas.discardActiveObject(); } else { - drawingModeEl.innerHTML = 'Enter drawing mode'; - drawingModeEl.className = ''; - drawingOptionsEl.style.display = 'none'; + (activeObject).text = this.value; } + canvas.renderAll(); + } }; + } - canvas.on('path:created', function () { - updateComplexity(); + var cmdUnderlineBtn = document.getElementById('text-cmd-underline'); + if (cmdUnderlineBtn) { + activeObjectButtons.push(cmdUnderlineBtn); + cmdUnderlineBtn.disabled = true; + cmdUnderlineBtn.onclick = function() { + var activeObject = canvas.getActiveObject(); + if (activeObject && activeObject.type === 'text') { + activeObject.textDecoration = (activeObject.textDecoration == 'underline' ? '' : 'underline'); + this.className = activeObject.textDecoration ? 'selected' : ''; + canvas.renderAll(); + } + }; + } + + var cmdLinethroughBtn = document.getElementById('text-cmd-linethrough'); + if (cmdLinethroughBtn) { + activeObjectButtons.push(cmdLinethroughBtn); + cmdLinethroughBtn.disabled = true; + cmdLinethroughBtn.onclick = function() { + var activeObject = canvas.getActiveObject(); + if (activeObject && activeObject.type === 'text') { + activeObject.textDecoration = (activeObject.textDecoration == 'line-through' ? '' : 'line-through'); + this.className = activeObject.textDecoration ? 'selected' : ''; + canvas.renderAll(); + } + }; + } + + var cmdOverlineBtn = document.getElementById('text-cmd-overline'); + if (cmdOverlineBtn) { + activeObjectButtons.push(cmdOverlineBtn); + cmdOverlineBtn.disabled = true; + cmdOverlineBtn.onclick = function() { + var activeObject = canvas.getActiveObject(); + if (activeObject && activeObject.type === 'text') { + activeObject.textDecoration = (activeObject.textDecoration == 'overline' ? '' : 'overline'); + this.className = activeObject.textDecoration ? 'selected' : ''; + canvas.renderAll(); + } + }; + } + + var cmdBoldBtn = document.getElementById('text-cmd-bold'); + if (cmdBoldBtn) { + activeObjectButtons.push(cmdBoldBtn); + cmdBoldBtn.disabled = true; + cmdBoldBtn.onclick = function() { + var activeObject = canvas.getActiveObject(); + if (activeObject && activeObject.type === 'text') { + activeObject.fontWeight = (activeObject.fontWeight == 'bold' ? '' : 'bold'); + this.className = activeObject.fontWeight ? 'selected' : ''; + canvas.renderAll(); + } + }; + } + + var cmdItalicBtn = document.getElementById('text-cmd-italic'); + if (cmdItalicBtn) { + activeObjectButtons.push(cmdItalicBtn); + cmdItalicBtn.disabled = true; + cmdItalicBtn.onclick = function() { + var activeObject = canvas.getActiveObject(); + if (activeObject && activeObject.type === 'text') { + activeObject.fontStyle = (activeObject.fontStyle == 'italic' ? '' : 'italic'); + this.className = activeObject.fontStyle ? 'selected' : ''; + canvas.renderAll(); + } + }; + } + + var cmdShadowBtn = document.getElementById('text-cmd-shadow'); + if (cmdShadowBtn) { + activeObjectButtons.push(cmdShadowBtn); + cmdShadowBtn.disabled = true; + cmdShadowBtn.onclick = function() { + var activeObject = canvas.getActiveObject(); + if (activeObject && activeObject.type === 'text') { + activeObject.shadow = !activeObject.shadow ? 'rgba(0,0,0,0.2) 2px 2px 10px' : ''; + this.className = activeObject.shadow ? 'selected' : ''; + canvas.renderAll(); + } + }; + } + + var textAlignSwitch = document.getElementById('text-align'); + if (textAlignSwitch) { + activeObjectButtons.push(textAlignSwitch); + textAlignSwitch.disabled = true; + textAlignSwitch.onchange = function() { + var activeObject = canvas.getActiveObject(); + if (activeObject && activeObject.type === 'text') { + activeObject.textAlign = this.value.toLowerCase(); + canvas.renderAll(); + } + }; + } + + var fontFamilySwitch = document.getElementById('font-family'); + if (fontFamilySwitch) { + activeObjectButtons.push(fontFamilySwitch); + fontFamilySwitch.disabled = true; + fontFamilySwitch.onchange = function() { + var activeObject = canvas.getActiveObject(); + if (activeObject && activeObject.type === 'text') { + activeObject.fontFamily = this.value; + canvas.renderAll(); + } + }; + } + + var bgColorField = document.getElementById('text-bg-color'); + if (bgColorField) { + bgColorField.onchange = function() { + var activeObject = canvas.getActiveObject(); + if (activeObject && activeObject.type === 'text') { + activeObject.backgroundColor = this.value; + canvas.renderAll(); + } + }; + } + + var strokeColorField = document.getElementById('text-stroke-color'); + if (strokeColorField) { + strokeColorField.onchange = function() { + var activeObject = canvas.getActiveObject(); + if (activeObject && activeObject.type === 'text') { + activeObject.stroke = this.value; + canvas.renderAll(); + } + }; + } + + if (supportsSlider) { + (function() { + var container = document.getElementById('text-controls'); + var slider = document.createElement('input'); + var label = document.createElement('label'); + label.innerHTML = 'Line height: '; + try { slider.type = 'range'; } catch (err) { } + slider.min = "0"; + slider.max = "10"; + slider.step = "0.1"; + slider.value = "1.5"; + container.appendChild(label); + label.appendChild(slider); + slider.title = "Line height"; + slider.onchange = function() { + var activeObject = canvas.getActiveObject(); + if (activeObject && activeObject.type === 'text') { + activeObject.lineHeight = this.value; + canvas.renderAll(); + } + }; + + canvas.on('object:selected', function(e: fabric.IEvent) { + slider.value = String((e.target).lineHeight ); + }); + })(); + } + + document.getElementById('load-svg').onclick = function() { + var svg = (document.getElementById('svg-console')).value; + fabric.loadSVGFromString(svg, function(objects, options) { + var obj = fabric.util.groupSVGElements(objects, options); + canvas.add(obj).centerObject(obj).renderAll(); + obj.setCoords(); }); - - drawingColorEl.onchange = function () { - canvas.freeDrawingColor = drawingColorEl.value; - }; - drawingLineWidthEl.onchange = function () { - canvas.freeDrawingLineWidth = parseInt(drawingLineWidthEl.value, 10) || 1; // disallow 0, NaN, etc. - }; - - canvas.freeDrawingColor = drawingColorEl.value; - canvas.freeDrawingLineWidth = parseInt(drawingLineWidthEl.value, 10) || 1; - - - var text = 'Lorem ipsum dolor sit amet,\nconsectetur adipisicing elit,\nsed do eiusmod tempor incididunt\nut labore et dolore magna aliqua.\n' + - 'Ut enim ad minim veniam,\nquis nostrud exercitation ullamco\nlaboris nisi ut aliquip ex ea commodo consequat.'; - - document.getElementById('add-text').onclick = function () { - var textSample = new fabric.Text(text.slice(0, getRandomInt(0, text.length)), { - left: getRandomInt(350, 400), - top: getRandomInt(350, 400), - fontFamily: 'helvetica', - angle: getRandomInt(-10, 10), - fill: '#' + getRandomColor(), - scaleX: 0.5, - scaleY: 0.5, - fontWeight: '' - }); - canvas.add(textSample); - updateComplexity(); - }; - - - document.onkeydown = function (e) { - var obj = canvas.getActiveObject() || canvas.getActiveGroup(); - if (obj && e.keyCode === 8) { - // this is horrible. need to fix, so that unified interface can be used - if (obj.type === 'group') { - // var groupObjects = obj.getObjects(); - // canvas.discardActiveGroup(); - // groupObjects.forEach(function(obj) { - // canvas.remove(obj); - // }); - } - else { - //canvas.remove(obj); - } - canvas.renderAll(); - // return false; - } - }; - - setTimeout(function () { - canvas.calcOffset(); - }, 100); - - if (document.location.search.indexOf('guidelines') > -1) { - //initCenteringGuidelines(canvas); - //initAligningGuidelines(canvas); - } - - gradientifyBtn.onclick = function () { - var obj = canvas.getActiveObject(); - if (obj) { - obj.setGradientFill({ - x2: (getRandomInt(0, 1) ? 0 : obj.width), - y2: (getRandomInt(0, 1) ? 0 : obj.height), - colorStops: { - 0: '#' + getRandomColor(), - 1: '#' + getRandomColor() - } - }); - canvas.renderAll(); - } - }; - - var textEl = document.getElementById('text'); - if (textEl) { - textEl.onfocus = function () { - var activeObject = canvas.getActiveObject(); - - if (activeObject && activeObject.type === 'text') { - this.value = (activeObject).text; - } - }; - textEl.onkeyup = function (e) { - var activeObject = canvas.getActiveObject(); - if (activeObject) { - if (!this.value) { - canvas.discardActiveObject(); - } - else { - (activeObject).text = this.value; - } - canvas.renderAll(); - } - }; - } - - var cmdUnderlineBtn = document.getElementById('text-cmd-underline'); - if (cmdUnderlineBtn) { - activeObjectButtons.push(cmdUnderlineBtn); - cmdUnderlineBtn.disabled = true; - cmdUnderlineBtn.onclick = function () { - var activeObject = canvas.getActiveObject(); - if (activeObject && activeObject.type === 'text') { - activeObject.textDecoration = (activeObject.textDecoration == 'underline' ? '' : 'underline'); - this.className = activeObject.textDecoration ? 'selected' : ''; - canvas.renderAll(); - } - }; - } - - var cmdLinethroughBtn = document.getElementById('text-cmd-linethrough'); - if (cmdLinethroughBtn) { - activeObjectButtons.push(cmdLinethroughBtn); - cmdLinethroughBtn.disabled = true; - cmdLinethroughBtn.onclick = function () { - var activeObject = canvas.getActiveObject(); - if (activeObject && activeObject.type === 'text') { - activeObject.textDecoration = (activeObject.textDecoration == 'line-through' ? '' : 'line-through'); - this.className = activeObject.textDecoration ? 'selected' : ''; - canvas.renderAll(); - } - }; - } - - var cmdOverlineBtn = document.getElementById('text-cmd-overline'); - if (cmdOverlineBtn) { - activeObjectButtons.push(cmdOverlineBtn); - cmdOverlineBtn.disabled = true; - cmdOverlineBtn.onclick = function () { - var activeObject = canvas.getActiveObject(); - if (activeObject && activeObject.type === 'text') { - activeObject.textDecoration = (activeObject.textDecoration == 'overline' ? '' : 'overline'); - this.className = activeObject.textDecoration ? 'selected' : ''; - canvas.renderAll(); - } - }; - } - - var cmdBoldBtn = document.getElementById('text-cmd-bold'); - if (cmdBoldBtn) { - activeObjectButtons.push(cmdBoldBtn); - cmdBoldBtn.disabled = true; - cmdBoldBtn.onclick = function () { - var activeObject = canvas.getActiveObject(); - if (activeObject && activeObject.type === 'text') { - activeObject.fontWeight = (activeObject.fontWeight == 'bold' ? '' : 'bold'); - this.className = activeObject.fontWeight ? 'selected' : ''; - canvas.renderAll(); - } - }; - } - - var cmdItalicBtn = document.getElementById('text-cmd-italic'); - if (cmdItalicBtn) { - activeObjectButtons.push(cmdItalicBtn); - cmdItalicBtn.disabled = true; - cmdItalicBtn.onclick = function () { - var activeObject = canvas.getActiveObject(); - if (activeObject && activeObject.type === 'text') { - activeObject.fontStyle = (activeObject.fontStyle == 'italic' ? '' : 'italic'); - this.className = activeObject.fontStyle ? 'selected' : ''; - canvas.renderAll(); - } - }; - } - - var cmdShadowBtn = document.getElementById('text-cmd-shadow'); - if (cmdShadowBtn) { - activeObjectButtons.push(cmdShadowBtn); - cmdShadowBtn.disabled = true; - cmdShadowBtn.onclick = function () { - var activeObject = canvas.getActiveObject(); - if (activeObject && activeObject.type === 'text') { - activeObject.textShadow = !activeObject.textShadow ? 'rgba(0,0,0,0.2) 2px 2px 10px' : ''; - this.className = activeObject.textShadow ? 'selected' : ''; - canvas.renderAll(); - } - }; - } - - var textAlignSwitch = document.getElementById('text-align'); - if (textAlignSwitch) { - activeObjectButtons.push(textAlignSwitch); - textAlignSwitch.disabled = true; - textAlignSwitch.onchange = function () { - var activeObject = canvas.getActiveObject(); - if (activeObject && activeObject.type === 'text') { - activeObject.textAlign = this.value.toLowerCase(); - canvas.renderAll(); - } - }; - } - - var fontFamilySwitch = document.getElementById('font-family'); - if (fontFamilySwitch) { - activeObjectButtons.push(fontFamilySwitch); - fontFamilySwitch.disabled = true; - fontFamilySwitch.onchange = function () { - var activeObject = canvas.getActiveObject(); - if (activeObject && activeObject.type === 'text') { - activeObject.fontFamily = this.value; - canvas.renderAll(); - } - }; - } - - var bgColorField = document.getElementById('text-bg-color'); - if (bgColorField) { - bgColorField.onchange = function () { - var activeObject = canvas.getActiveObject(); - if (activeObject && activeObject.type === 'text') { - activeObject.backgroundColor = this.value; - canvas.renderAll(); - } - }; - } - - var strokeColorField = document.getElementById('text-stroke-color'); - if (strokeColorField) { - strokeColorField.onchange = function () { - var activeObject = canvas.getActiveObject(); - if (activeObject && activeObject.type === 'text') { - activeObject.strokeStyle = this.value; - canvas.renderAll(); - } - }; - } - - if (supportsSlider) { - (function () { - var container = document.getElementById('text-controls'); - var slider = document.createElement('input'); - var label = document.createElement('label'); - label.innerHTML = 'Line height: '; - try { slider.type = 'range'; } catch (err) { } - slider.min = "0"; - slider.max = "10"; - slider.step = "0.1"; - slider.value = "1.5"; - container.appendChild(label); - label.appendChild(slider); - slider.title = "Line height"; - slider.onchange = function () { - var activeObject = canvas.getActiveObject(); - if (activeObject && activeObject.type === 'text') { - activeObject.lineHeight = this.value; - canvas.renderAll(); - } - }; - - canvas.on('object:selected', function (e) { - slider.value = e.target.lineHeight; - }); - })(); - } - - document.getElementById('load-svg').onclick = function () { - var svg = (document.getElementById('svg-console')).value; - fabric.loadSVGFromString(svg, function (objects, options) { - var obj = fabric.util.groupSVGElements(objects, options); - canvas.add(obj).centerObject(obj).renderAll(); - obj.setCoords(); - }); - }; + }; } function sample9() { - var canvas = new fabric.Canvas('c'); - canvas.setBackgroundImage('yolo.jpg', () => {"a"}, {opacity: 45}); - canvas.setBackgroundImage('yolo.jpg', () => {"a"}); + var canvas = new fabric.Canvas('c'); + canvas.setBackgroundImage('yolo.jpg',() => { "a" }, { opacity: 45 }); + canvas.setBackgroundImage('yolo.jpg',() => { "a" }); } diff --git a/fabricjs/fabricjs.d.ts b/fabricjs/fabricjs.d.ts index 048c915df..503b8c7db 100644 --- a/fabricjs/fabricjs.d.ts +++ b/fabricjs/fabricjs.d.ts @@ -1,8 +1,12 @@ // Type definitions for FabricJS v1.5.0 // Project: http://fabricjs.com/ -// Definitions by: Oliver Klemencic , edited by Joseph Livecchi +// Definitions by: Oliver Klemencic , Joseph Livecchi // Definitions: https://github.com/borisyankov/DefinitelyTyped +/* tslint:disable:no-unused-variable */ +/* tslint:disable:whitespace */ +/* tslint:disable:typedef */ + // Support AMD require declare module "fabric" { export = fabric; @@ -32,61 +36,62 @@ declare module fabric { */ function createSVGFontFacesMarkup(objects: IObject[]): string; /** - * Takes string corresponding to an SVG document, and parses it into a set of fabric objects - * @param {String} string - * @param {Function} callback - * @param {Function} [reviver] Method for further parsing of SVG elements, called after each fabric object created. - */ - function loadSVGFromString(string: string, callback: (results: IObject[], options) => void, reviver?: (el, obj) => void); + * Takes string corresponding to an SVG document, and parses it into a set of fabric objects + * @param {String} string + * @param {Function} callback + * @param {Function} [reviver] Method for further parsing of SVG elements, called after each fabric object created. + */ + function loadSVGFromString(string: string, callback: (results: IObject[], options: any) => void, reviver?: Function); /** - * Takes url corresponding to an SVG document, and parses it into a set of fabric objects. Note that SVG is fetched via XMLHttpRequest, so it needs to conform to SOP (Same Origin Policy) - * @param {String} url - * @param {Function} callback - * @param {Function} [reviver] Method for further parsing of SVG elements, called after each fabric object created. - */ - function loadSVGFromURL(url, callback: (results: IObject[], options) => void, reviver?: (el, obj) => void); + * Takes url corresponding to an SVG document, and parses it into a set of fabric objects. + * Note that SVG is fetched via XMLHttpRequest, so it needs to conform to SOP (Same Origin Policy) + * @param {String} url + * @param {Function} callback + * @param {Function} [reviver] Method for further parsing of SVG elements, called after each fabric object created. + */ + function loadSVGFromURL(url: string, callback: (results: IObject[], options: any) => void, reviver?: Function); /** - * Returns CSS rules for a given SVG document - * @param {SVGDocument} doc SVG document to parse - */ + * Returns CSS rules for a given SVG document + * @param {SVGDocument} doc SVG document to parse + */ function getCSSRules(doc: SVGElement): any; - function parseElements(elements: any[], callback, options, reviver); + function parseElements(elements: any[], callback: Function, options: any, reviver?: Function); /** - * Parses "points" attribute, returning an array of values - * @param {String} points points attribute string - */ + * Parses "points" attribute, returning an array of values + * @param {String} points points attribute string + */ function parsePointsAttribute(points: string): any[]; /** - * Parses "style" attribute, retuning an object with values - * @param {SVGElement} element Element to parse - */ + * Parses "style" attribute, retuning an object with values + * @param {SVGElement} element Element to parse + */ function parseStyleAttribute(element: SVGElement): any; /** - * Transforms an array of svg elements to corresponding fabric.* instances - * @param {Array} elements Array of elements to parse - * @param {Function} callback Being passed an array of fabric instances (transformed from SVG elements) - * @param {Object} [options] Options object - * @param {Function} [reviver] Method for further parsing of SVG elements, called after each fabric object created. - */ + * Transforms an array of svg elements to corresponding fabric.* instances + * @param {Array} elements Array of elements to parse + * @param {Function} callback Being passed an array of fabric instances (transformed from SVG elements) + * @param {Object} [options] Options object + * @param {Function} [reviver] Method for further parsing of SVG elements, called after each fabric object created. + */ function parseElements(elements: any[], callback: Function, options?: any, reviver?: Function): void; /** - * Returns an object of attributes' name/value, given element and an array of attribute names; - * Parses parent "g" nodes recursively upwards. - * @param {DOMElement} element Element to parse - * @param {Array} attributes Array of attributes to parse - */ + * Returns an object of attributes' name/value, given element and an array of attribute names; + * Parses parent "g" nodes recursively upwards. + * @param {DOMElement} element Element to parse + * @param {Array} attributes Array of attributes to parse + */ function parseAttributes(elemen: HTMLElement, attributes: string[], svgUid?: string): { [key: string]: string } /** - * Parses an SVG document, returning all of the gradient declarations found in it - * @param {SVGDocument} doc SVG document to parse - */ + * Parses an SVG document, returning all of the gradient declarations found in it + * @param {SVGDocument} doc SVG document to parse + */ function getGradientDefs(doc: SVGElement): { [key: string]: any }; /** - * Parses a short font declaration, building adding its properties to a style object - * @param {String} value font declaration - * @param {Object} oStyle definition - */ + * Parses a short font declaration, building adding its properties to a style object + * @param {String} value font declaration + * @param {Object} oStyle definition + */ function parseFontDeclaration(value: string, oStyle: any): void; /** * Parses an SVG document, converts it to an array of corresponding fabric.* instances and passes them to a callback @@ -94,7 +99,7 @@ declare module fabric { * @param {Function} callback Callback to call when parsing is finished; It's being passed an array of elements (parsed from a document). * @param {Function} [reviver] Method for further parsing of SVG elements, called after each fabric object created. */ - function parseSVGDocument(doc: SVGElement, callback: (results, options) => void, reviver?: (el, obj) => void); + function parseSVGDocument(doc: SVGElement, callback: (results: IObject[], options: any) => void, reviver?: Function); /** * Parses "transform" attribute, returning an array of values * @param {String} attributeValue String containing attribute value @@ -104,14 +109,13 @@ declare module fabric { // fabric Log // --------------- /** - * Wrapper around `console.log` (when available) - */ - function log(values); + * Wrapper around `console.log` (when available) + */ + function log(...values: any[]); /** - * Wrapper around `console.warn` (when available) - */ - function warn(values); - + * Wrapper around `console.warn` (when available) + */ + function warn(...values: any[]); //////////////////////////////////////////////////// // Classes @@ -122,25 +126,25 @@ declare module fabric { var Color: IColorStatic; var Pattern: IPatternStatic; var Intersection: IIntersectionStatic; - var Point: IPointStatic + var Point: IPointStatic; var Circle: ICircleStatic; var Ellipse: IEllipseStatic; var Group: IGroupStatic; - var Image: IImageStatic + var Image: IImageStatic; var Line: ILineStatic; var Object: IObjectStatic; var Path: IPathStatic; - var PathGroup: IPathGroupStatic - var Polygon: IPolygonStatic + var PathGroup: IPathGroupStatic; + var Polygon: IPolygonStatic; var Polyline: IPolylineStatic; var Rect: IRectStatic; var Shadow: IShadowStatic; var Text: ITextStatic; var IText: IITextStatic; - var Triangle: ITriangleStatic + var Triangle: ITriangleStatic; - var util: Util; + var util: IUtil; /////////////////////////////////////////////////////////////////////////////// // Data Object Interfaces - These intrface are not specific part of fabric, @@ -148,32 +152,32 @@ declare module fabric { ////////////////////////////////////////////////////////////////////////////// interface IDataURLOptions { /** - * The format of the output image. Either "jpeg" or "png" - */ + * The format of the output image. Either "jpeg" or "png" + */ format?: string; /** - * Quality level (0..1). Only used for jpeg - */ + * Quality level (0..1). Only used for jpeg + */ quality?: number; /** - * Multiplier to scale by - */ + * Multiplier to scale by + */ multiplier?: number; /** - * Cropping left offset. Introduced in v1.2.14 - */ + * Cropping left offset. Introduced in v1.2.14 + */ left?: number; /** - * Cropping top offset. Introduced in v1.2.14 - */ + * Cropping top offset. Introduced in v1.2.14 + */ top?: number; /** - * Cropping width. Introduced in v1.2.14 - */ + * Cropping width. Introduced in v1.2.14 + */ width?: number; /** - * Cropping height. Introduced in v1.2.14 - */ + * Cropping height. Introduced in v1.2.14 + */ height?: number; } @@ -184,169 +188,164 @@ declare module fabric { interface IFillOptions { /** - * options.source Pattern source - */ - source: string|HTMLImageElement; + * options.source Pattern source + */ + source: string | HTMLImageElement; /** - * Repeat property of a pattern (one of repeat, repeat-x, repeat-y or no-repeat) - */ + * Repeat property of a pattern (one of repeat, repeat-x, repeat-y or no-repeat) + */ repeat?: string; /** - * Pattern horizontal offset from object's left/top corner - */ + * Pattern horizontal offset from object's left/top corner + */ offsetX?: number; /** - * Pattern vertical offset from object's left/top corner - */ + * Pattern vertical offset from object's left/top corner + */ offsetY?: number; } - interface IToSVGOptions { /** - * If true xml tag is not included - */ + * If true xml tag is not included + */ suppressPreamble: boolean; /** - * SVG viewbox object - */ + * SVG viewbox object + */ viewBox: IViewBox; /** - * Encoding of SVG output - */ + * Encoding of SVG output + */ encoding: string; } interface IViewBox { /** - * x-cooridnate of viewbox - */ + * x-cooridnate of viewbox + */ x: number; /** - * y-coordinate of viewbox - */ + * y-coordinate of viewbox + */ y: number; /** - * Width of viewbox - */ + * Width of viewbox + */ width: number; - /**Height of viewbox */ + /** + * Height of viewbox + */ height: number; } - - interface IFilter { - new (): IFilter; - new (options: any): IFilter; - } - - interface IEventList { - [index: string]: (e: Event) => void; - } - /////////////////////////////////////////////////////////////////////////////// // Mixins Interfaces ////////////////////////////////////////////////////////////////////////////// interface ICollection { /** - * Adds objects to collection, then renders canvas (if `renderOnAddRemove` is not `false`) - * Objects should be instances of (or inherit from) fabric.Object - * @param {...fabric.Object} object Zero or more fabric instances - */ + * Adds objects to collection, then renders canvas (if `renderOnAddRemove` is not `false`) + * Objects should be instances of (or inherit from) fabric.Object + * @param {...fabric.Object} object Zero or more fabric instances + */ add(...object: IObject[]): T; /** - * Inserts an object into collection at specified index, then renders canvas (if `renderOnAddRemove` is not `false`) - * An object should be an instance of (or inherit from) fabric.Object - * @param {Object} object Object to insert - * @param {Number} index Index to insert object at - * @param {Boolean} nonSplicing When `true`, no splicing (shifting) of objects occurs - * @return {Self} thisArg - * @chainable - */ + * Inserts an object into collection at specified index, then renders canvas (if `renderOnAddRemove` is not `false`) + * An object should be an instance of (or inherit from) fabric.Object + * @param {Object} object Object to insert + * @param {Number} index Index to insert object at + * @param {Boolean} nonSplicing When `true`, no splicing (shifting) of objects occurs + * @return {Self} thisArg + * @chainable + */ insertAt(object: IObject, index: number, nonSplicing: boolean): T; /** - * Removes objects from a collection, then renders canvas (if `renderOnAddRemove` is not `false`) - * @param {...fabric.Object} object Zero or more fabric instances - * @return {Self} thisArg - * @chainable - */ + * Removes objects from a collection, then renders canvas (if `renderOnAddRemove` is not `false`) + * @param {...fabric.Object} object Zero or more fabric instances + * @return {Self} thisArg + * @chainable + */ remove(...object: IObject[]): T; /** - * Executes given function for each object in this group - * @param {Function} callback - * @param {Object} context Context (aka thisObject) - * @return {Self} thisArg - */ + * Executes given function for each object in this group + * @param {Function} callback + * @param {Object} context Context (aka thisObject) + * @return {Self} thisArg + */ forEachObject(callback: (element: IObject, index: number, array: IObject[]) => any, context?: any): T; /** - * Returns an array of children objects of this instance - * Type parameter introduced in 1.3.10 - * @param {String} [type] When specified, only objects of this type are returned - * @return {Array} - */ + * Returns an array of children objects of this instance + * Type parameter introduced in 1.3.10 + * @param {String} [type] When specified, only objects of this type are returned + * @return {Array} + */ getObjects(type?: string): IObject[]; - /** - * Returns object at specified index - * @param {Number} index - * @return {Self} thisArg - */ + * Returns object at specified index + * @param {Number} index + * @return {Self} thisArg + */ item(index: number): T; /** - * Returns true if collection contains no objects - * @return {Boolean} true if collection is empty - */ + * Returns true if collection contains no objects + * @return {Boolean} true if collection is empty + */ isEmpty(): boolean; /** - * Returns a size of a collection (i.e: length of an array containing its objects) - * @return {Number} Collection size - */ + * Returns a size of a collection (i.e: length of an array containing its objects) + * @return {Number} Collection size + */ size(): number; /** - * Returns true if collection contains an object - * @param {Object} object Object to check against - * @return {Boolean} `true` if collection contains an object - */ + * Returns true if collection contains an object + * @param {Object} object Object to check against + * @return {Boolean} `true` if collection contains an object + */ contains(object: IObject): boolean; /** - * Returns number representation of a collection complexity - * @return {Number} complexity - */ + * Returns number representation of a collection complexity + * @return {Number} complexity + */ complexity(): number; } interface IObservable { /** * Observes specified event - * @deprecated `observe` deprecated since 0.8.34 (use `on` instead) - * @param {String|Object} eventName Event name (eg. 'after:render') or object with key/value pairs (eg. {'after:render': handler, 'selection:cleared': handler}) - * @param {Function} handler Function that receives a notification when an event of the specified type occurs + * @param eventName Event name (eg. 'after:render') + * @param handler Function that receives a notification when an event of the specified type occurs */ - on(eventName: string|any, handler: (e: IEvent) => any): T; + on(eventName: string, handler: (e: IEvent) => any): T; + /** - * Fires event with an optional options object - * @deprecated `fire` deprecated since 1.0.7 (use `trigger` instead) - * @param {String} eventName Event name to fire - * @param {Object} [options] Options object - */ + * Observes specified event + * @param eventName Object with key/value pairs (eg. {'after:render': handler, 'selection:cleared': handler}) + */ + on(eventName: {[key:string] : Function}): T; + /** + * Fires event with an optional options object + * @deprecated `fire` deprecated since 1.0.7 (use `trigger` instead) + * @param {String} eventName Event name to fire + * @param {Object} [options] Options object + */ trigger(eventName: string, options?: any): T; /** * Stops event observing for a particular event handler. Calling this method * without arguments removes all handlers for all events * @deprecated `stopObserving` deprecated since 0.8.34 (use `off` instead) - * @param {String|Object} eventName Event name (eg. 'after:render') or object with key/value pairs (eg. {'after:render': handler, 'selection:cleared': handler}) - * @param {Function} handler Function to be deleted from EventListeners + * @param eventName Event name (eg. 'after:render') or object with key/value pairs (eg. {'after:render': handler, 'selection:cleared': handler}) + * @param handler Function to be deleted from EventListeners */ - off(eventName: string|any, handler: (e) => any): T; + off(eventName: string|any, handler: (e: IEvent) => any): T; } // animation mixin @@ -384,204 +383,204 @@ declare module fabric { } interface IObjectAnimation { /** - * Animates object's properties - * object.animate('left', ..., {duration: ...}); - * @param property Property to animate - * @param value Value to animate property - * @param options The animation options - */ - animate(property: string, value: number | string, options?: IAnimationOptions): IObject; + * Animates object's properties + * object.animate('left', ..., {duration: ...}); + * @param property Property to animate + * @param value Value to animate property + * @param options The animation options + */ + animate(property: string, value: number|string, options?: IAnimationOptions): IObject; /** - * Animates object's properties - * object.animate({ left: ..., top: ... }, { duration: ... }); - * @param properties Properties to animate - * @param value Options object - */ + * Animates object's properties + * object.animate({ left: ..., top: ... }, { duration: ... }); + * @param properties Properties to animate + * @param value Options object + */ animate(properties: any, options?: IAnimationOptions): IObject; } interface IAnimationOptions { /** - * Allows to specify starting value of animatable property (if we don't want current value to be used). - */ + * Allows to specify starting value of animatable property (if we don't want current value to be used). + */ from?: string|number; /** - * Defaults to 500 (ms). Can be used to change duration of an animation. - */ + * Defaults to 500 (ms). Can be used to change duration of an animation. + */ duration?: number; /** - * Callback; invoked on every value change - */ + * Callback; invoked on every value change + */ onChange?: Function; /** - * Callback; invoked when value change is completed - */ - onComplete?: Function + * Callback; invoked when value change is completed + */ + onComplete?: Function; + /** - * Easing function. Default: fabric.util.ease.easeInSine - */ + * Easing function. Default: fabric.util.ease.easeInSine + */ easing?: Function; /** * Value to modify the property by, default: end - start */ by?: number; } - /////////////////////////////////////////////////////////////////////////////// // General Fabric Interfaces ////////////////////////////////////////////////////////////////////////////// interface IColor { /** - * Returns source of this color (where source is an array representation; ex: [200, 200, 100, 1]) - */ + * Returns source of this color (where source is an array representation; ex: [200, 200, 100, 1]) + */ getSource(): number[]; /** - * Sets source of this color (where source is an array representation; ex: [200, 200, 100, 1]) - */ + * Sets source of this color (where source is an array representation; ex: [200, 200, 100, 1]) + */ setSource(source: number[]); /** - * Returns color represenation in RGB format ex: rgb(0-255,0-255,0-255) - */ + * Returns color represenation in RGB format ex: rgb(0-255,0-255,0-255) + */ toRgb(): string; /** - * Returns color represenation in RGBA format ex: rgba(0-255,0-255,0-255,0-1) - */ + * Returns color represenation in RGBA format ex: rgba(0-255,0-255,0-255,0-1) + */ toRgba(): string; /** - * Returns color represenation in HSL format ex: hsl(0-360,0%-100%,0%-100%) - */ + * Returns color represenation in HSL format ex: hsl(0-360,0%-100%,0%-100%) + */ toHsl(): string; /** - * Returns color represenation in HSLA format ex: hsla(0-360,0%-100%,0%-100%,0-1) - */ + * Returns color represenation in HSLA format ex: hsla(0-360,0%-100%,0%-100%,0-1) + */ toHsla(): string; /** - * Returns color represenation in HEX format ex: FF5555 - */ + * Returns color represenation in HEX format ex: FF5555 + */ toHex(): string; /** - * Gets value of alpha channel for this color - */ + * Gets value of alpha channel for this color + */ getAlpha(): number; /** - * Sets value of alpha channel for this color - * @param {Number} alpha Alpha value 0-1 - */ + * Sets value of alpha channel for this color + * @param {Number} alpha Alpha value 0-1 + */ setAlpha(alpha: number); /** - * Transforms color to its grayscale representation - */ + * Transforms color to its grayscale representation + */ toGrayscale(): IColor; /** - * Transforms color to its black and white representation - * @param {Number} threshold - */ + * Transforms color to its black and white representation + * @param {Number} threshold + */ toBlackWhite(threshold: number): IColor; /** - * Overlays color with another color - * @param {String|fabric.Color} otherColor - */ + * Overlays color with another color + * @param {String|fabric.Color} otherColor + */ overlayWith(otherColor: string|IColor): IColor; } interface IColorStatic { /** - * Color class - * The purpose of Color is to abstract and encapsulate common color operations; - * @param {String} color optional in hex or rgb(a) format - */ + * Color class + * The purpose of Color is to abstract and encapsulate common color operations; + * @param {String} color optional in hex or rgb(a) format + */ new (color?: string): IColor; /** - * Returns new color object, when given a color in RGB format - * @param {String} color Color value ex: rgb(0-255,0-255,0-255) - */ - fromRgb(color): IColor + * Returns new color object, when given a color in RGB format + * @param {String} color Color value ex: rgb(0-255,0-255,0-255) + */ + fromRgb(color: string): IColor; /** - * Returns new color object, when given a color in RGBA format - * @param {String} color Color value ex: rgb(0-255,0-255,0-255) - */ - fromRgba(color): IColor + * Returns new color object, when given a color in RGBA format + * @param {String} color Color value ex: rgb(0-255,0-255,0-255) + */ + fromRgba(color: string): IColor; /** - * Returns array represenatation (ex: [100, 100, 200, 1]) of a color that's in RGB or RGBA format - * @param {String} color Color value ex: rgb(0-255,0-255,0-255), rgb(0%-100%,0%-100%,0%-100%) - */ + * Returns array represenatation (ex: [100, 100, 200, 1]) of a color that's in RGB or RGBA format + * @param {String} color Color value ex: rgb(0-255,0-255,0-255), rgb(0%-100%,0%-100%,0%-100%) + */ sourceFromRgb(color: string): number[]; /** - * Returns new color object, when given a color in HSL format - * @param {String} color Color value ex: hsl(0-260,0%-100%,0%-100%) - */ - fromHsl(color: string): IColor + * Returns new color object, when given a color in HSL format + * @param {String} color Color value ex: hsl(0-260,0%-100%,0%-100%) + */ + fromHsl(color: string): IColor; /** - * Returns new color object, when given a color in HSLA format - * @param {String} color Color value ex: hsl(0-260,0%-100%,0%-100%) - */ - fromHsla(color: string): IColor + * Returns new color object, when given a color in HSLA format + * @param {String} color Color value ex: hsl(0-260,0%-100%,0%-100%) + */ + fromHsla(color: string): IColor; /** - * Returns array represenatation (ex: [100, 100, 200, 1]) of a color that's in HSL or HSLA format. - * @param {String} color Color value ex: hsl(0-360,0%-100%,0%-100%) or hsla(0-360,0%-100%,0%-100%, 0-1) - */ + * Returns array represenatation (ex: [100, 100, 200, 1]) of a color that's in HSL or HSLA format. + * @param {String} color Color value ex: hsl(0-360,0%-100%,0%-100%) or hsla(0-360,0%-100%,0%-100%, 0-1) + */ sourceFromHsl(color: string): number[]; /** - * Returns new color object, when given a color in HEX format - * @param {String} color Color value ex: FF5555 - */ - fromHex(color: string): IColor + * Returns new color object, when given a color in HEX format + * @param {String} color Color value ex: FF5555 + */ + fromHex(color: string): IColor; /** - * Returns array represenatation (ex: [100, 100, 200, 1]) of a color that's in HEX format - * @param {String} color ex: FF5555 - */ + * Returns array represenatation (ex: [100, 100, 200, 1]) of a color that's in HEX format + * @param {String} color ex: FF5555 + */ sourceFromHex(color: string): number[]; /** - * Returns new color object, when given color in array representation (ex: [200, 100, 100, 0.5]) - * @param {Array} source - */ + * Returns new color object, when given color in array representation (ex: [200, 100, 100, 0.5]) + * @param {Array} source + */ fromSource(source: number[]): IColor; prototype: any; } interface IGradientOptions { /** - * @param {String} [options.type] Type of gradient 'radial' or 'linear' - */ + * @param {String} [options.type] Type of gradient 'radial' or 'linear' + */ type?: string; /** - * x-coordinate of start point - */ + * x-coordinate of start point + */ x1?: number; /** - * y-coordinate of start point - */ + * y-coordinate of start point + */ y1?: number; /** - * x-coordinate of end point - */ + * x-coordinate of end point + */ x2?: number; /** - * y-coordinate of end point - */ + * y-coordinate of end point + */ y2?: number; /** - * Radius of start point (only for radial gradients) - */ + * Radius of start point (only for radial gradients) + */ r1?: number; /** - * Radius of end point (only for radial gradients) - */ + * Radius of end point (only for radial gradients) + */ r2?: number; /** - * Color stops object eg. {0:string; 1:string; - */ + * Color stops object eg. {0:string; 1:string; + */ colorStops?: any; } interface IGradient extends IGradientOptions { @@ -626,12 +625,12 @@ declare module fabric { interface IIntersection { /** - * Appends a point to intersection - */ + * Appends a point to intersection + */ appendPoint(point: IPoint); /** - * Appends points to intersection - */ + * Appends points to intersection + */ appendPoints(points: IPoint[]); } interface IIntersectionStatic { @@ -640,41 +639,41 @@ declare module fabric { */ new (status?: string); /** - * Checks if polygon intersects another polygon - */ + * Checks if polygon intersects another polygon + */ intersectPolygonPolygon(points1: IPoint[], points2: IPoint[]): IIntersection; /** - * Checks if line intersects polygon - */ - intersectLinePolygon(a1: IPoint, a2: IPoint, points: IPoint[]): IIntersection + * Checks if line intersects polygon + */ + intersectLinePolygon(a1: IPoint, a2: IPoint, points: IPoint[]): IIntersection; /** - * Checks if one line intersects another - */ - intersectLineLine(a1: IPoint, a2: IPoint, b1: IPoint, b2: IPoint): IIntersection + * Checks if one line intersects another + */ + intersectLineLine(a1: IPoint, a2: IPoint, b1: IPoint, b2: IPoint): IIntersection; /** - * Checks if polygon intersects rectangle - */ + * Checks if polygon intersects rectangle + */ intersectPolygonRectangle(points: IPoint[], r1: number, r2: number): IIntersection; } interface IPatternOptions { /** - * Repeat property of a pattern (one of repeat, repeat-x, repeat-y or no-repeat) - */ + * Repeat property of a pattern (one of repeat, repeat-x, repeat-y or no-repeat) + */ repeat: string; /** - * Pattern horizontal offset from object's left/top corner - */ + * Pattern horizontal offset from object's left/top corner + */ offsetX: number; /** - * Pattern vertical offset from object's left/top corner - */ + * Pattern vertical offset from object's left/top corner + */ offsetY: number; /** - * The source for the pattern - */ + * The source for the pattern + */ source: string|HTMLImageElement; } interface IPattern extends IPatternOptions { @@ -682,18 +681,18 @@ declare module fabric { initialise(options?: IPatternOptions): IPattern; /** - * Returns an instance of CanvasPattern - */ + * Returns an instance of CanvasPattern + */ toLive(ctx: CanvasRenderingContext2D): IPattern; /** - * Returns object representation of a pattern - */ + * Returns object representation of a pattern + */ toObject(): any; /** - * Returns SVG representation of a pattern - * @param {fabric.Object} object - */ + * Returns SVG representation of a pattern + * @param {fabric.Object} object + */ toSVG(object: IObject): string; } interface IPatternStatic { @@ -705,239 +704,216 @@ declare module fabric { x: number; y: number; /** - * Adds another point to this one and returns another one - * @param {fabric.Point} that - * @return {fabric.Point} new Point instance with added values - */ + * Adds another point to this one and returns another one + * @param {fabric.Point} that + */ add(that: IPoint): IPoint; /** - * Adds another point to this one - * @param {fabric.Point} that - * @return {fabric.Point} thisArg - */ + * Adds another point to this one + * @param {fabric.Point} that + */ addEquals(that: IPoint): IPoint; /** - * Adds value to this point and returns a new one - * @param {Number} scalar - * @return {fabric.Point} new Point with added value - */ + * Adds value to this point and returns a new one + * @param {Number} scalar + */ scalarAdd(scalar: number): IPoint; /** - * Adds value to this point - * @param {Number} scalar - * @return {fabric.Point} thisArg - */ + * Adds value to this point + * @param {Number} scalar + */ scalarAddEquals(scalar: number): IPoint; /** - * Subtracts another point from this point and returns a new one - * @param {fabric.Point} that - * @return {fabric.Point} new Point object with subtracted values - */ - subtract(that: IPoint): IPoint + * Subtracts another point from this point and returns a new one + * @param {fabric.Point} that + */ + subtract(that: IPoint): IPoint; /** - * Subtracts another point from this point - * @param {fabric.Point} that - * @return {fabric.Point} thisArg - */ - subtractEquals(that): IPoint; + * Subtracts another point from this point + * @param {fabric.Point} that + */ + subtractEquals(that: IPoint): IPoint; /** - * Subtracts value from this point and returns a new one - * @param {Number} scalar - * @return {fabric.Point} - */ + * Subtracts value from this point and returns a new one + * @param {Number} scalar + */ scalarSubtract(scalar: number): IPoint; /** - * Subtracts value from this point - * @param {Number} scalar - * @return {fabric.Point} thisArg - */ + * Subtracts value from this point + * @param {Number} scalar + */ scalarSubtractEquals(scalar: number): IPoint; /** - * Miltiplies this point by a value and returns a new one - * @param {Number} scalar - * @return {fabric.Point} - */ + * Miltiplies this point by a value and returns a new one + * @param {Number} scalar + */ multiply(scalar: number): IPoint; /** - * Miltiplies this point by a value - * @param {Number} scalar - * @return {fabric.Point} thisArg - */ - multiplyEquals(scalar): IPoint; + * Miltiplies this point by a value + * @param {Number} scalar + */ + multiplyEquals(scalar: number): IPoint; /** - * Divides this point by a value and returns a new one - * @param {Number} scalar - * @return {fabric.Point} - */ - divide(scalar): IPoint; + * Divides this point by a value and returns a new one + * @param {Number} scalar + */ + divide(scalar: number): IPoint; /** - * Divides this point by a value - * @param {Number} scalar - * @return {fabric.Point} thisArg - */ + * Divides this point by a value + * @param {Number} scalar + */ divideEquals(scalar: number): IPoint; /** - * Returns true if this point is equal to another one - * @param {fabric.Point} that - * @return {Boolean} - */ + * Returns true if this point is equal to another one + * @param {fabric.Point} that + */ eq(that: IPoint): IPoint; /** - * Returns true if this point is less than another one - * @param {fabric.Point} that - * @return {Boolean} - */ + * Returns true if this point is less than another one + * @param {fabric.Point} that + */ lt(that: IPoint): IPoint; /** - * Returns true if this point is less than or equal to another one - * @param {fabric.Point} that - * @return {Boolean} - */ + * Returns true if this point is less than or equal to another one + * @param {fabric.Point} that + */ lte(that: IPoint): IPoint; /** - * Returns true if this point is greater another one - * @param {fabric.Point} that - * @return {Boolean} - */ + * Returns true if this point is greater another one + * @param {fabric.Point} that + */ gt(that: IPoint): IPoint; /** - * Returns true if this point is greater than or equal to another one - * @param {fabric.Point} that - * @return {Boolean} - */ + * Returns true if this point is greater than or equal to another one + * @param {fabric.Point} that + */ gte(that: IPoint): IPoint; /** - * Returns new point which is the result of linear interpolation with this one and another one - * @param {fabric.Point} that - * @param {Number} t - * @return {fabric.Point} - */ - lerp(that, t: number): IPoint; + * Returns new point which is the result of linear interpolation with this one and another one + * @param {fabric.Point} that + * @param {Number} t + */ + lerp(that: IPoint, t: number): IPoint; /** - * Returns distance from this point and another one - * @param {fabric.Point} that - * @return {Number} - */ + * Returns distance from this point and another one + * @param {fabric.Point} that + */ distanceFrom(that: IPoint): number; /** - * Returns the point between this point and another one - * @param {fabric.Point} that - * @return {fabric.Point} - */ + * Returns the point between this point and another one + * @param {fabric.Point} that + */ midPointFrom(that: IPoint): IPoint; /** - * Returns a new point which is the min of this and another one - * @param {fabric.Point} that - * @return {fabric.Point} - */ + * Returns a new point which is the min of this and another one + * @param {fabric.Point} that + */ min(that: IPoint): IPoint; /** - * Returns a new point which is the max of this and another one - * @param {fabric.Point} that - * @return {fabric.Point} - */ + * Returns a new point which is the max of this and another one + * @param {fabric.Point} that + */ max(that: IPoint): IPoint; /** - * Returns string representation of this point - * @return {String} - */ + * Returns string representation of this point + */ toString(): string; /** - * Sets x/y of this point - * @param {Number} x - * @param {Number} y - */ - setXY(x, y: IPoint): IPoint; + * Sets x/y of this point + * @param {Number} x + * @param {Number} y + */ + setXY(x:number, y: number): IPoint; /** - * Sets x/y of this point from another point - * @param {fabric.Point} that - */ + * Sets x/y of this point from another point + * @param {fabric.Point} that + */ setFromPoint(that: IPoint): IPoint; /** - * Swaps x/y of this point and another point - * @param {fabric.Point} that - */ + * Swaps x/y of this point and another point + * @param {fabric.Point} that + */ swap(that: IPoint): IPoint; } interface IPointStatic { - new (x, y): IPoint; + new (x: number, y: number): IPoint; prototype: any; } interface IShadowOptions { /** - * Whether the shadow should affect stroke operations - */ + * Whether the shadow should affect stroke operations + */ affectStrike: boolean; /** - * Shadow blur - */ + * Shadow blur + */ blur: number; /** - * Shadow color - */ + * Shadow color + */ color: string; /** - * Indicates whether toObject should include default values - */ + * Indicates whether toObject should include default values + */ includeDefaultValues: boolean; /** - * Shadow horizontal offset - */ + * Shadow horizontal offset + */ offsetX: number; /** - * Shadow vertical offset - */ + * Shadow vertical offset + */ offsetY: number; } interface IShadow extends IShadowOptions { initialize(options?: IShadowOptions|string): IShadow; /** - * Returns object representation of a shadow - */ + * Returns object representation of a shadow + */ toObject(): IObject; /** - * Returns a string representation of an instance, CSS3 text-shadow declaration - */ + * Returns a string representation of an instance, CSS3 text-shadow declaration + */ toString(): string; /** - * Returns SVG representation of a shadow - * @param {fabric.Object} object - */ + * Returns SVG representation of a shadow + * @param {fabric.Object} object + */ toSVG(object: IObject): string; /** - * Regex matching shadow offsetX, offsetY and blur, Static - */ + * Regex matching shadow offsetX, offsetY and blur, Static + */ reOffsetsAndBlur: RegExp } interface IShadowStatic { - new (options?: IShadowOptions): IShadow + new (options?: IShadowOptions): IShadow; reOffsetsAndBlur: RegExp; } @@ -946,381 +922,421 @@ declare module fabric { ////////////////////////////////////////////////////////////////////////////// interface ICanvasDimensions { /** - * Width of canvas element - */ + * Width of canvas element + */ width: number; /** - * Height of canvas element - */ + * Height of canvas element + */ height: number; } interface ICanvasDimensionsOptions { /** - * Set the given dimensions only as canvas backstore dimensions - */ + * Set the given dimensions only as canvas backstore dimensions + */ backstoreOnly?: boolean; /** - * Set the given dimensions only as css dimensions - */ + * Set the given dimensions only as css dimensions + */ cssOnly?: boolean; } interface IStaticCanvasOptions { /** - * Indicates whether the browser can be scrolled when using a touchscreen and dragging on the canvas - */ + * Indicates whether the browser can be scrolled when using a touchscreen and dragging on the canvas + */ allowTouchScrolling?: boolean; /** - * Indicates whether this canvas will use image smoothing, this is on by default in browsers - */ + * Indicates whether this canvas will use image smoothing, this is on by default in browsers + */ imageSmoothingEnabled?: boolean; /** - * Indicates whether objects should remain in current stack position when selected. When false objects are brought to top and rendered as part of the selection group - */ + * Indicates whether objects should remain in current stack position when selected. + * When false objects are brought to top and rendered as part of the selection group + */ preserveObjectStacking?: boolean; /** - * The transformation (in the format of Canvas transform) which focuses the viewport - */ + * The transformation (in the format of Canvas transform) which focuses the viewport + */ viewportTransform?: number[]; - - freeDrawingColor?: string; freeDrawingLineWidth?: number; /** - * Background color of canvas instance. - * Should be set via setBackgroundColor - */ - backgroundColor?: string | IPattern; + * Background color of canvas instance. + * Should be set via setBackgroundColor + */ + backgroundColor?: string|IPattern; /** - * Background image of canvas instance. - * Should be set via setBackgroundImage - * Backwards incompatibility note: The "backgroundImageOpacity" and "backgroundImageStretch" properties are deprecated since 1.3.9. - */ - backgroundImage?: IImage; + * Background image of canvas instance. + * Should be set via setBackgroundImage + * Backwards incompatibility note: The "backgroundImageOpacity" and "backgroundImageStretch" properties are deprecated since 1.3.9. + */ + backgroundImage?: IImage | string; backgroundImageOpacity?: number; backgroundImageStretch?: number; /** - * Function that determines clipping of entire canvas area - * Being passed context as first argument. See clipping canvas area - */ + * Function that determines clipping of entire canvas area + * Being passed context as first argument. See clipping canvas area + */ clipTo?: (context: CanvasRenderingContext2D) => void; /** - * Indicates whether object controls (borders/controls) are rendered above overlay image - */ + * Indicates whether object controls (borders/controls) are rendered above overlay image + */ controlsAboveOverlay?: boolean; /** - * Indicates whether toObject/toDatalessObject should include default values - */ + * Indicates whether toObject/toDatalessObject should include default values + */ includeDefaultValues?: boolean; /** - * Overlay color of canvas instance. - * Should be set via setOverlayColor - */ - overlayColor?: string | IPattern; + * Overlay color of canvas instance. + * Should be set via setOverlayColor + */ + overlayColor?: string|IPattern; /** - * Overlay image of canvas instance. - * Should be set via setOverlayImage - * Backwards incompatibility note: The "overlayImageLeft" and "overlayImageTop" properties are deprecated since 1.3.9. - */ + * Overlay image of canvas instance. + * Should be set via setOverlayImage + * Backwards incompatibility note: The "overlayImageLeft" and "overlayImageTop" properties are deprecated since 1.3.9. + */ overlayImage?: IImage; overlayImageLeft?: number; overlayImageTop?: number; /** - * Indicates whether add, insertAt and remove should also re-render canvas. - * Disabling this option could give a great performance boost when adding/removing a lot of objects to/from canvas at once - * (followed by a manual rendering after addition/deletion) - */ + * Indicates whether add, insertAt and remove should also re-render canvas. + * Disabling this option could give a great performance boost when adding/removing a lot of objects to/from canvas at once + * (followed by a manual rendering after addition/deletion) + */ renderOnAddRemove?: boolean; /** - * Indicates whether objects' state should be saved - */ + * Indicates whether objects' state should be saved + */ stateful?: boolean; } interface IStaticCanvas extends IObservable, IStaticCanvasOptions, ICollection, ICanvasAnimation { /** - * Calculates canvas element offset relative to the document - * This method is also attached as "resize" event handler of window - */ + * Calculates canvas element offset relative to the document + * This method is also attached as "resize" event handler of window + */ calcOffset(): IStaticCanvas; /** - * Sets {@link fabric.StaticCanvas#overlayImage|overlay image} for this canvas - * @param {(fabric.Image|String)} image fabric.Image instance or URL of an image to set overlay to - * @param {Function} callback callback to invoke when image is loaded and set as an overlay - * @param {Object} [options] Optional options to set for the {@link fabric.Image|overlay image}. - */ - setOverlayImage(image: IImage | string, callback: Function, options?: IObjectOptions): IStaticCanvas; + * Sets {@link fabric.StaticCanvas#overlayImage|overlay image} for this canvas + * @param {(fabric.Image|String)} image fabric.Image instance or URL of an image to set overlay to + * @param {Function} callback callback to invoke when image is loaded and set as an overlay + * @param {Object} [options] Optional options to set for the {@link fabric.Image|overlay image}. + */ + setOverlayImage(image: IImage|string, callback: Function, options?: IObjectOptions): IStaticCanvas; /** - * Sets {@link fabric.StaticCanvas#backgroundImage|background image} for this canvas - * @param {(fabric.Image|String)} image fabric.Image instance or URL of an image to set background to - * @param {Function} callback Callback to invoke when image is loaded and set as background - * @param {Object} [options] Optional options to set for the {@link fabric.Image|background image}. - */ + * Sets {@link fabric.StaticCanvas#backgroundImage|background image} for this canvas + * @param {(fabric.Image|String)} image fabric.Image instance or URL of an image to set background to + * @param {Function} callback Callback to invoke when image is loaded and set as background + * @param {Object} [options] Optional options to set for the {@link fabric.Image|background image}. + */ setBackgroundImage(image: IImage|string, callback: Function, options?: IObjectOptions): IStaticCanvas; /** - * Sets {@link fabric.StaticCanvas#overlayColor|background color} for this canvas - * @param {(String|fabric.Pattern)} overlayColor Color or pattern to set background color to - * @param {Function} callback Callback to invoke when background color is set - */ + * Sets {@link fabric.StaticCanvas#overlayColor|background color} for this canvas + * @param {(String|fabric.Pattern)} overlayColor Color or pattern to set background color to + * @param {Function} callback Callback to invoke when background color is set + */ setOverlayColor(overlayColor: string|IPattern, callback: Function): IStaticCanvas; /** - * Sets {@link fabric.StaticCanvas#backgroundColor|background color} for this canvas - * @param {(String|fabric.Pattern)} backgroundColor Color or pattern to set background color to - * @param {Function} callback Callback to invoke when background color is set - */ + * Sets {@link fabric.StaticCanvas#backgroundColor|background color} for this canvas + * @param {(String|fabric.Pattern)} backgroundColor Color or pattern to set background color to + * @param {Function} callback Callback to invoke when background color is set + */ setBackgroundColor(backgroundColor: string|IPattern, callback: Function): IStaticCanvas; /** - * Returns canvas width (in px) - */ + * Returns canvas width (in px) + */ getWidth(): number; /** - * Returns canvas height (in px) - */ + * Returns canvas height (in px) + */ getHeight(): number; /** - * Sets width of this canvas instance - * @param {Number|String} value Value to set width to - * @param {Object} [options] Options object - */ + * Sets width of this canvas instance + * @param {Number|String} value Value to set width to + * @param {Object} [options] Options object + */ setWidth(value: number|string, options?: ICanvasDimensionsOptions): IStaticCanvas /** - * Sets height of this canvas instance - * @param {Number|String} value Value to set height to - * @param {Object} [options] Options object - */ - setHeight(value: number|string, options?: ICanvasDimensionsOptions): IStaticCanvas + * Sets height of this canvas instance + * @param {Number|String} value Value to set height to + * @param {Object} [options] Options object + */ + setHeight(value: number|string, options?: ICanvasDimensionsOptions): IStaticCanvas; /** - * Sets dimensions (width, height) of this canvas instance. when options.cssOnly flag active you should also supply the unit of measure (px/%/em) - * @param {Object} dimensions Object with width/height properties - * @param {Object} [options] Options object - */ + * Sets dimensions (width, height) of this canvas instance. when options.cssOnly flag active you should also supply the unit of measure (px/%/em) + * @param {Object} dimensions Object with width/height properties + * @param {Object} [options] Options object + */ setDimensions(dimensions: ICanvasDimensions, options?: ICanvasDimensionsOptions): IStaticCanvas; - + /** - * Returns canvas zoom level - */ + * Returns canvas zoom level + */ getZoom(): number; /** - * Sets viewport transform of this canvas instance - * @param {Array} vpt the transform in the form of context.transform - */ + * Sets viewport transform of this canvas instance + * @param {Array} vpt the transform in the form of context.transform + */ setViewportTransform(vpt: number[]): IStaticCanvas; - /** - * Sets zoom level of this canvas instance, zoom centered around point - * @param {fabric.Point} point to zoom with respect to - * @param {Number} value to set zoom to, less than 1 zooms out - */ + * Sets zoom level of this canvas instance, zoom centered around point + * @param {fabric.Point} point to zoom with respect to + * @param {Number} value to set zoom to, less than 1 zooms out + */ zoomToPoint(point: IPoint, value: number): IStaticCanvas; /** - * Sets zoom level of this canvas instance - * @param {Number} value to set zoom to, less than 1 zooms out - */ + * Sets zoom level of this canvas instance + * @param {Number} value to set zoom to, less than 1 zooms out + */ setZoom(value: number): IStaticCanvas; /** - * Pan viewport so as to place point at top left corner of canvas - * @param {fabric.Point} point to move to - */ + * Pan viewport so as to place point at top left corner of canvas + * @param {fabric.Point} point to move to + */ absolutePan(point: IPoint): IStaticCanvas; /** - * Pans viewpoint relatively - * @param {fabric.Point} point (position vector) to move by - */ + * Pans viewpoint relatively + * @param {fabric.Point} point (position vector) to move by + */ relativePan(point: IPoint): IStaticCanvas; /** - * Returns element corresponding to this instance - */ + * Returns element corresponding to this instance + */ getElement(): HTMLCanvasElement; /** - * Returns currently selected object, if any - */ + * Returns currently selected object, if any + */ getActiveObject(): IObject; /** - * Returns currently selected group of object, if any - */ + * Returns currently selected group of object, if any + */ getActiveGroup(): IGroup; /** - * Clears specified context of canvas element - * @param {CanvasRenderingContext2D} ctx Context to clear - * @chainable - */ + * Clears specified context of canvas element + * @param {CanvasRenderingContext2D} ctx Context to clear + * @chainable + */ clearContext(ctx: CanvasRenderingContext2D): IStaticCanvas; /** - * Returns context of canvas where objects are drawn - */ + * Returns context of canvas where objects are drawn + */ getContext(): CanvasRenderingContext2D; /** - * Clears all contexts (background, main, top) of an instance - */ + * Clears all contexts (background, main, top) of an instance + */ clear(): IStaticCanvas; /** - * Renders both the top canvas and the secondary container canvas. - * @param {Boolean} [allOnTop] Whether we want to force all images to be rendered on the top canvas - * @chainable - */ + * Renders both the top canvas and the secondary container canvas. + * @param {Boolean} [allOnTop] Whether we want to force all images to be rendered on the top canvas + * @chainable + */ renderAll(allOnTop?: boolean): IStaticCanvas; /** - * Method to render only the top canvas. - * Also used to render the group selection box. - * @chainable - */ + * Method to render only the top canvas. + * Also used to render the group selection box. + * @chainable + */ renderTop(): IStaticCanvas; /** - * Returns coordinates of a center of canvas. - * Returned value is an object with top and left properties - */ - getCenter(): { top: number; left: number; } - + * Returns coordinates of a center of canvas. + * Returned value is an object with top and left properties + */ + getCenter(): { top: number; left: number; }; /** - * Centers object horizontally. - * You might need to call `setCoords` on an object after centering, to update controls area. - * @param {fabric.Object} object Object to center horizontally - */ + * Centers object horizontally. + * You might need to call `setCoords` on an object after centering, to update controls area. + * @param {fabric.Object} object Object to center horizontally + */ centerObjectH(object: IObject): IStaticCanvas; /** - * Centers object vertically. - * You might need to call `setCoords` on an object after centering, to update controls area. - * @param {fabric.Object} object Object to center vertically - */ + * Centers object vertically. + * You might need to call `setCoords` on an object after centering, to update controls area. + * @param {fabric.Object} object Object to center vertically + */ centerObjectV(object: IObject): IStaticCanvas; /** - * Centers object vertically and horizontally. - * You might need to call `setCoords` on an object after centering, to update controls area. - * @param {fabric.Object} object Object to center vertically and horizontally - */ + * Centers object vertically and horizontally. + * You might need to call `setCoords` on an object after centering, to update controls area. + * @param {fabric.Object} object Object to center vertically and horizontally + */ centerObject(object: IObject): IStaticCanvas; /** - * Returs dataless JSON representation of canvas - * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output - */ + * Returs dataless JSON representation of canvas + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + */ toDatalessJSON(propertiesToInclude?: any[]): string; /** - * Returns object representation of canvas - * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output - */ - toObject(propertiesToInclude?: any[]): any; + * Returns object representation of canvas + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + */ + toObject(propertiesToInclude?: any[]): any; /** - * Returns dataless object representation of canvas - * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output - */ + * Returns dataless object representation of canvas + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + */ toDatalessObject(propertiesToInclude?: any[]): any; /** - * When true, getSvgTransform() will apply the StaticCanvas.viewportTransform to the SVG transformation. When true, - * a zoomed canvas will then produce zoomed SVG output. - */ + * When true, getSvgTransform() will apply the StaticCanvas.viewportTransform to the SVG transformation. When true, + * a zoomed canvas will then produce zoomed SVG output. + */ svgViewportTransformation: boolean; /** - * Returns SVG representation of canvas - * @param {Object} [options] Options object for SVG output - * @param {Function} [reviver] Method for further parsing of svg elements, called after each fabric object converted into svg representation. - */ + * Returns SVG representation of canvas + * @param {Object} [options] Options object for SVG output + * @param {Function} [reviver] Method for further parsing of svg elements, called after each fabric object converted into svg representation. + */ toSVG(options: IToSVGOptions, reviver?: Function): string; /** - * Moves an object to the bottom of the stack of drawn objects - * @param {fabric.Object} object Object to send to back - * @chainable - */ + * Moves an object to the bottom of the stack of drawn objects + * @param {fabric.Object} object Object to send to back + * @chainable + */ sendToBack(object: IObject): IStaticCanvas; /** - * Moves an object to the top of the stack of drawn objects - * @param {fabric.Object} object Object to send - * @chainable - */ + * Moves an object to the top of the stack of drawn objects + * @param {fabric.Object} object Object to send + * @chainable + */ bringToFront(object: IObject): IStaticCanvas; /** - * Moves an object down in stack of drawn objects - * @param {fabric.Object} object Object to send - * @param {Boolean} [intersecting] If `true`, send object behind next lower intersecting object - * @chainable - */ + * Moves an object down in stack of drawn objects + * @param {fabric.Object} object Object to send + * @param {Boolean} [intersecting] If `true`, send object behind next lower intersecting object + * @chainable + */ sendBackwards(object: IObject): IStaticCanvas; /** - * Moves an object up in stack of drawn objects - * @param {fabric.Object} object Object to send - * @param {Boolean} [intersecting] If `true`, send object in front of next upper intersecting object - * @chainable - */ + * Moves an object up in stack of drawn objects + * @param {fabric.Object} object Object to send + * @param {Boolean} [intersecting] If `true`, send object in front of next upper intersecting object + * @chainable + */ bringForward(object: IObject): IStaticCanvas; /** - * Moves an object to specified level in stack of drawn objects - * @param {fabric.Object} object Object to send - * @param {Number} index Position to move to - * @chainable - */ + * Moves an object to specified level in stack of drawn objects + * @param {fabric.Object} object Object to send + * @param {Number} index Position to move to + * @chainable + */ moveTo(object: IObject, index: number): IStaticCanvas; /** - * Clears a canvas element and removes all event listeners - */ + * Clears a canvas element and removes all event listeners + */ dispose(): IStaticCanvas; /** - * Returns a string representation of an instance - */ + * Returns a string representation of an instance + */ toString(): string; /** - * Provides a way to check support of some of the canvas methods - * (either those of HTMLCanvasElement itself, or rendering context) - * - * @param {String} methodName Method to check support for; - * Could be one of "getImageData", "toDataURL", "toDataURLWithQuality" or "setLineDash" - * @return {Boolean | null} `true` if method is supported (or at least exists), - * `null` if canvas element or context can not be initialized - */ - supports(methodName: string): boolean; - EMPTY_JSON: string; + * Exports canvas element to a dataurl image. Note that when multiplier is used, cropping is scaled appropriately + * @param {Object} [options] Options object + */ + toDataURL(options?: IDataURLOptions): string; - // methods + /** + * Provides a way to check support of some of the canvas methods + * (either those of HTMLCanvasElement itself, or rendering context) + * @param {String} methodName Method to check support for; Could be one of "getImageData", "toDataURL", "toDataURLWithQuality" or "setLineDash" + * @return {Boolean | null} `true` if method is supported (or at least exists), null` if canvas element or context can not be initialized + */ + supports(methodName: string): boolean; + + /** + * Populates canvas with data from the specified JSON. + * JSON format must conform to the one of toJSON formats + * @param {String|Object} json JSON string or object + * @param {Function} callback Callback, invoked when json is parsed + * and corresponding objects (e.g: {@link fabric.Image}) + * are initialized + * @param {Function} [reviver] Method for further parsing of JSON elements, called after each fabric object created. + */ + loadFromJSON(json: string|any, callback: Function, reviver?: Function): ICanvas; + /** + * Clones canvas instance + * @param {Object} [callback] Receives cloned instance as a first argument + * @param {Array} [properties] Array of properties to include in the cloned canvas and children + */ + clone(callback: (canvas: IStaticCanvas) => any, properties?: any[]): void; + + /** + * Clones canvas instance without cloning existing data. + * This essentially copies canvas dimensions, clipping properties, etc. + * but leaves data empty (so that you can populate it with your own) + * @param {Object} [callback] Receives cloned instance as a first argument + */ + cloneWithoutData(callback: (canvas: IStaticCanvas) => any): void; + + /** + * Callback; invoked right before object is about to be scaled/rotated + */ onBeforeScaleRotate(target: IObject); - toGrayscale(propertiesToInclude: any[]): string; + + // Functions from object straighten mixin + // -------------------------------------------------------------------------------------------------------------------------------- + + /** + * Straightens object, then rerenders canvas + * @param {fabric.Object} object Object to straighten + */ + straightenObject(object: IObject): IStaticCanvas + + /** + * Same as straightenObject, but animated + * @param {fabric.Object} object Object to straighten + */ + fxStraightenObject(object: IObject): IStaticCanvas } interface IStaticCanvasStatic { /** - * Constructor - * @param {HTMLElement|String} element element to initialize instance on - * @param {Object} [options] Options object - */ - new (element: HTMLCanvasElement | string, options?: ICanvasOptions): IStaticCanvas; + * Constructor + * @param {HTMLElement|String} element element to initialize instance on + * @param {Object} [options] Options object + */ + new (element: HTMLCanvasElement|string, options?: ICanvasOptions): IStaticCanvas; EMPTY_JSON: string; /** @@ -1339,219 +1355,212 @@ declare module fabric { interface ICanvasOptions extends IStaticCanvasOptions { /** - * When true, objects can be transformed by one side (unproportionally) - */ + * When true, objects can be transformed by one side (unproportionally) + */ uniScaleTransform?: boolean; /** - * When true, objects use center point as the origin of scale transformation. - * Backwards incompatibility note: This property replaces "centerTransform" (Boolean). - */ + * When true, objects use center point as the origin of scale transformation. + * Backwards incompatibility note: This property replaces "centerTransform" (Boolean). + */ centeredScaling?: boolean; /** - * When true, objects use center point as the origin of rotate transformation. - * Backwards incompatibility note: This property replaces "centerTransform" (Boolean). - */ + * When true, objects use center point as the origin of rotate transformation. + * Backwards incompatibility note: This property replaces "centerTransform" (Boolean). + */ centeredRotation?: boolean; /** - * Indicates that canvas is interactive. This property should not be changed. - */ + * Indicates that canvas is interactive. This property should not be changed. + */ interactive?: boolean; /** - * Indicates whether group selection should be enabled - */ + * Indicates whether group selection should be enabled + */ selection?: boolean; /** - * Color of selection - */ + * Color of selection + */ selectionColor?: string; /** - * Default dash array pattern - * If not empty the selection border is dashed - */ + * Default dash array pattern + * If not empty the selection border is dashed + */ selectionDashArray?: any[]; /** - * Color of the border of selection (usually slightly darker than color of selection itself) - */ + * Color of the border of selection (usually slightly darker than color of selection itself) + */ selectionBorderColor?: string; /** - * Width of a line used in object/group selection - */ + * Width of a line used in object/group selection + */ selectionLineWidth?: number; /** - * Default cursor value used when hovering over an object on canvas - */ + * Default cursor value used when hovering over an object on canvas + */ hoverCursor?: string; /** - * Default cursor value used when moving an object on canvas - */ + * Default cursor value used when moving an object on canvas + */ moveCursor?: string; /** - * Default cursor value used for the entire canvas - */ + * Default cursor value used for the entire canvas + */ defaultCursor?: string; /** - * Cursor value used during free drawing - */ + * Cursor value used during free drawing + */ freeDrawingCursor?: string; /** - * Cursor value used for rotation point - */ + * Cursor value used for rotation point + */ rotationCursor?: string; /** - * Default element class that's given to wrapper (div) element of canvas - */ + * Default element class that's given to wrapper (div) element of canvas + */ containerClass?: string; /** - * When true, object detection happens on per-pixel basis rather than on per-bounding-box - */ + * When true, object detection happens on per-pixel basis rather than on per-bounding-box + */ perPixelTargetFind?: boolean; /** - * Number of pixels around target pixel to tolerate (consider active) during object detection - */ + * Number of pixels around target pixel to tolerate (consider active) during object detection + */ targetFindTolerance?: number; /** - * When true, target detection is skipped when hovering over canvas. This can be used to improve performance. - */ + * When true, target detection is skipped when hovering over canvas. This can be used to improve performance. + */ skipTargetFind?: boolean; /** - * When true, mouse events on canvas (mousedown/mousemove/mouseup) result in free drawing. - * After mousedown, mousemove creates a shape, - * and then mouseup finalizes it and adds an instance of `fabric.Path` onto canvas. - */ + * When true, mouse events on canvas (mousedown/mousemove/mouseup) result in free drawing. + * After mousedown, mousemove creates a shape, + * and then mouseup finalizes it and adds an instance of `fabric.Path` onto canvas. + */ isDrawingMode?: boolean; } interface ICanvas extends IStaticCanvas, ICanvasOptions { - // constructors - new (element: HTMLCanvasElement|string, options: ICanvasOptions): ICanvas; - _objects: IObject[]; - // fields - freeDrawingColor: string; - freeDrawingLineWidth: number; - /** - * Checks if point is contained within an area of given object - * @param {Event} e Event object - * @param {fabric.Object} target Object to test against - */ + * Checks if point is contained within an area of given object + * @param {Event} e Event object + * @param {fabric.Object} target Object to test against + */ containsPoint(e: Event, target: IObject): boolean; /** - * Deactivates all objects on canvas, removing any active group or object - * @return {fabric.Canvas} thisArg - */ + * Deactivates all objects on canvas, removing any active group or object + * @return {fabric.Canvas} thisArg + */ deactivateAll(): ICanvas; /** - * Deactivates all objects and dispatches appropriate events - * @param {Event} [e] Event (passed along when firing) - * @return {fabric.Canvas} thisArg - */ + * Deactivates all objects and dispatches appropriate events + * @param {Event} [e] Event (passed along when firing) + * @return {fabric.Canvas} thisArg + */ deactivateAllWithDispatch(e?: Event): ICanvas; /** - * Discards currently active group - * @param {Event} [e] Event (passed along when firing) - * @return {fabric.Canvas} thisArg - */ + * Discards currently active group + * @param {Event} [e] Event (passed along when firing) + * @return {fabric.Canvas} thisArg + */ discardActiveGroup(e?: Event): ICanvas; /** - * Discards currently active object - * @param {Event} [e] Event (passed along when firing) - * @return {fabric.Canvas} thisArg - * @chainable - */ + * Discards currently active object + * @param {Event} [e] Event (passed along when firing) + * @return {fabric.Canvas} thisArg + * @chainable + */ discardActiveObject(e?: Event): ICanvas; /** - * Draws objects' controls (borders/controls) - * @param {CanvasRenderingContext2D} ctx Context to render controls on - */ + * Draws objects' controls (borders/controls) + * @param {CanvasRenderingContext2D} ctx Context to render controls on + */ drawControls(ctx: CanvasRenderingContext2D): void; - drawDashedLine(ctx: CanvasRenderingContext2D, x: number, y: number, x2: number, y2: number, dashArray: number[]): ICanvas; /** - * Method that determines what object we are clicking on - * @param {Event} e mouse event - * @param {Boolean} skipGroup when true, group is skipped and only objects are traversed through - */ + * Method that determines what object we are clicking on + * @param {Event} e mouse event + * @param {Boolean} skipGroup when true, group is skipped and only objects are traversed through + */ findTarget(e: MouseEvent, skipGroup: boolean): ICanvas; /** - * Returns currently active group - * @return {fabric.Group} Current group - */ + * Returns currently active group + * @return {fabric.Group} Current group + */ getActiveGroup(): IGroup; /** - * Returns currently active object - * @return {fabric.Object} active object - */ + * Returns currently active object + * @return {fabric.Object} active object + */ getActiveObject(): IObject; /** - * Returns pointer coordinates relative to canvas. - * @param {Event} e - * @return {Object} object with "x" and "y" number values - */ + * Returns pointer coordinates relative to canvas. + * @param {Event} e + * @return {Object} object with "x" and "y" number values + */ getPointer(e: Event, ignoreZoom?: boolean, upperCanvasEl?: CanvasRenderingContext2D): { x: number; y: number; }; /** - * Returns context of canvas where object selection is drawn - * @return {CanvasRenderingContext2D} - */ + * Returns context of canvas where object selection is drawn + * @return {CanvasRenderingContext2D} + */ getSelectionContext(): CanvasRenderingContext2D; /** - * Returns element on which object selection is drawn - * @return {HTMLCanvasElement} - */ + * Returns element on which object selection is drawn + * @return {HTMLCanvasElement} + */ getSelectionElement(): HTMLCanvasElement; /** - * Returns true if object is transparent at a certain location - * @param {fabric.Object} target Object to check - * @param {Number} x Left coordinate - * @param {Number} y Top coordinate - */ + * Returns true if object is transparent at a certain location + * @param {fabric.Object} target Object to check + * @param {Number} x Left coordinate + * @param {Number} y Top coordinate + */ isTargetTransparent(target: IObject, x: number, y: number): boolean; /** - * Sets active group to a speicified one - * @param {fabric.Group} group Group to set as a current one - * @param {Event} [e] Event (passed along when firing) - */ + * Sets active group to a speicified one + * @param {fabric.Group} group Group to set as a current one + * @param {Event} [e] Event (passed along when firing) + */ setActiveGroup(group: IGroup, e?: Event): ICanvas; /** - * Sets given object as the only active object on canvas - * @param {fabric.Object} object Object to set as an active one - * @param {Event} [e] Event (passed along when firing "object:selected") - */ + * Sets given object as the only active object on canvas + * @param {fabric.Object} object Object to set as an active one + * @param {Event} [e] Event (passed along when firing "object:selected") + */ setActiveObject(object: IObject, e?: Event): ICanvas; /** - * Set the cursor type of the canvas element - * @param {String} value Cursor type of the canvas element. - * @see http://www.w3.org/TR/css3-ui/#cursor - */ + * Set the cursor type of the canvas element + * @param {String} value Cursor type of the canvas element. + * @see http://www.w3.org/TR/css3-ui/#cursor + */ setCursor(value: string): void; - - loadFromJSON(json, callback: () => void): void; - loadFromDatalessJSON(json, callback: () => void): void; + /** + * Removes all event listeners + */ + removeListeners(): void } interface ICanvasStatic { /** - * Constructor - * @param {HTMLElement|String} element element to initialize instance on - * @param {Object} [options] Options object - */ + * Constructor + * @param {HTMLElement|String} element element to initialize instance on + * @param {Object} [options] Options object + */ new (element: HTMLCanvasElement | string, options?: ICanvasOptions): ICanvas; EMPTY_JSON: string; @@ -1569,8 +1578,6 @@ declare module fabric { toJSON(propertiesToInclude?: any[]): string; } - - /////////////////////////////////////////////////////////////////////////////// // Shape Interfaces ////////////////////////////////////////////////////////////////////////////// @@ -1591,17 +1598,15 @@ declare module fabric { endAngle?: number; } interface ICircle extends IObject, ICircleOptions { - initialize(options?: ICircleOptions): ICircle; - /** * Returns complexity of an instance * @return {Number} complexity of this instance */ complexity(): number; /** - * Returns horizontal radius of an object (according to how an object is scaled) - * @return {Number} - */ + * Returns horizontal radius of an object (according to how an object is scaled) + * @return {Number} + */ getRadiusX(): number; /** * Returns vertical radius of an object (according to how an object is scaled) @@ -1629,14 +1634,14 @@ declare module fabric { } interface ICircleStatic { /** - * List of attribute names to account for when parsing SVG element (used by {@link fabric.Circle.fromElement}) - */ + * List of attribute names to account for when parsing SVG element (used by {@link fabric.Circle.fromElement}) + */ ATTRIBUTE_NAMES: string[]; /** - * Returns Circle instance from an SVG element - * @param {SVGElement} element Element to parse - * @param {Object} [options] Options object - */ + * Returns Circle instance from an SVG element + * @param {SVGElement} element Element to parse + * @param {Object} [options] Options object + */ fromElement(element: SVGElement, options: ICircleOptions): ICircle; /** * Returns Circle instance from an object representation @@ -1652,8 +1657,8 @@ declare module fabric { interface IEllipseOptions extends IObjectOptions { /** - * Horizontal radius - */ + * Horizontal radius + */ rx?: number; /** * Vertical radius @@ -1661,7 +1666,6 @@ declare module fabric { ry?: number; } interface IEllipse extends IObject, IEllipseOptions { - initialize(options?: IEllipseOptions): IEllipse; /** * Returns horizontal radius of an object (according to how an object is scaled) * @return {Number} @@ -1694,8 +1698,8 @@ declare module fabric { interface IEllipseStatic { new (options?: IEllipseOptions): IEllipse; /** - * List of attribute names to account for when parsing SVG element (used by {@link fabric.Ellipse.fromElement}) - */ + * List of attribute names to account for when parsing SVG element (used by {@link fabric.Ellipse.fromElement}) + */ ATTRIBUTE_NAMES: string[]; /** @@ -1703,7 +1707,7 @@ declare module fabric { * @param {SVGElement} element Element to parse * @param {Object} [options] Options object */ - fromElement(element: SVGElement, options?: IEllipseOptions): IEllipse + fromElement(element: SVGElement, options?: IEllipseOptions): IEllipse; /** * Returns Ellipse instance from an object representation @@ -1713,9 +1717,6 @@ declare module fabric { } interface IGroup extends IObject, ICollection { - initialize(objects?: IObject[], options?: IObjectOptions): any; - type: string; - activateAllObjects(): IGroup; /** * Adds an object to a group; Then recalculates group's dimension, position. @@ -1724,23 +1725,23 @@ declare module fabric { * @chainable */ addWithUpdate(object: IObject): IGroup; - containsPoint(point): boolean; + containsPoint(point: IPoint): boolean; /** - * Destroys a group (restoring state of its objects) - * @return {fabric.Group} thisArg - * @chainable - */ + * Destroys a group (restoring state of its objects) + * @return {fabric.Group} thisArg + * @chainable + */ destroy(): IGroup; /** - * Returns requested property - * @param {String} prop Property to get - * @return {Any} - */ + * Returns requested property + * @param {String} prop Property to get + * @return {Any} + */ get(prop: string): any; /** - * Checks whether this group was moved (since `saveCoords` was called last) - * @return {Boolean} true if an object was moved (since fabric.Group#saveCoords was called) - */ + * Checks whether this group was moved (since `saveCoords` was called last) + * @return {Boolean} true if an object was moved (since fabric.Group#saveCoords was called) + */ hasMoved(): boolean; /** * Removes an object from a group; Then recalculates group's dimension, position. @@ -1755,11 +1756,11 @@ declare module fabric { */ render(ctx: CanvasRenderingContext2D): void; /** - * Removes objects from a collection, then renders canvas (if `renderOnAddRemove` is not `false`) - * @param {...fabric.Object} object Zero or more fabric instances - * @return {Self} thisArg - * @chainable - */ + * Removes objects from a collection, then renders canvas (if `renderOnAddRemove` is not `false`) + * @param {...fabric.Object} object Zero or more fabric instances + * @return {Self} thisArg + * @chainable + */ remove(...object: IObject[]): IGroup; /** * Saves coordinates of this instance (to be used together with `hasMoved`) @@ -1774,7 +1775,6 @@ declare module fabric { * @chainable */ setObjectsCoords(): IGroup; - toGrayscale(): IGroup; /** * Returns object representation of an instance * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output @@ -1836,14 +1836,14 @@ declare module fabric { /** * Image filter array */ - filters: IFilter[]; + filters: IBaseFilter[]; } interface IImage extends IObject, IImageOptions { initialize(element?: string|HTMLImageElement, options?: IImageOptions); /** - * Applies filters assigned to this image (from "filters" array) - * @param {Function} callback Callback is invoked when all filters have been applied and new image is generated - */ + * Applies filters assigned to this image (from "filters" array) + * @param {Function} callback Callback is invoked when all filters have been applied and new image is generated + */ applyFilters(callback: Function); /** * Returns a clone of an instance @@ -1874,18 +1874,18 @@ declare module fabric { render(ctx: CanvasRenderingContext2D, noTransform: boolean); /** - * Sets image element for this instance to a specified one. - * If filters defined they are applied to new image. - * You might need to call `canvas.renderAll` and `object.setCoords` after replacing, to render new image and update controls area. - * @param {HTMLImageElement} element - * @param {Function} [callback] Callback is invoked when all filters have been applied and new image is generated - * @param {Object} [options] Options object - */ + * Sets image element for this instance to a specified one. + * If filters defined they are applied to new image. + * You might need to call `canvas.renderAll` and `object.setCoords` after replacing, to render new image and update controls area. + * @param {HTMLImageElement} element + * @param {Function} [callback] Callback is invoked when all filters have been applied and new image is generated + * @param {Object} [options] Options object + */ setElement(element: HTMLImageElement, callback: Function, options: IImageOptions): IImage; /** * Sets crossOrigin value (on an instance and corresponding image element) */ - setCrossOrigin(value): IImage; + setCrossOrigin(value: string): IImage; /** * Returns object representation of an instance * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output @@ -1919,30 +1919,30 @@ declare module fabric { */ new (element: HTMLImageElement, objObjects: IObjectOptions): IImage; /** - * Creates an instance of fabric.Image from an URL string - * @param {String} url URL to create an image from - * @param {Function} [callback] Callback to invoke when image is created (newly created image is passed as a first argument) - * @param {Object} [imgOptions] Options object - */ + * Creates an instance of fabric.Image from an URL string + * @param {String} url URL to create an image from + * @param {Function} [callback] Callback to invoke when image is created (newly created image is passed as a first argument) + * @param {Object} [imgOptions] Options object + */ fromURL(url: string, callback?: (image: IImage) => any, objObjects?: IObjectOptions): IImage; /** - * Creates an instance of fabric.Image from its object representation - * @static - * @param {Object} object Object to create an instance from - * @param {Function} [callback] Callback to invoke when an image instance is created - */ + * Creates an instance of fabric.Image from its object representation + * @static + * @param {Object} object Object to create an instance from + * @param {Function} [callback] Callback to invoke when an image instance is created + */ fromObject(object: any, callback: (image: IImage) => {}): void; /** - * Returns Image instance from an SVG element - * @param {SVGElement} element Element to parse - * @param {Function} callback Callback to execute when fabric.Image object is created - * @param {Object} [options] Options object - */ + * Returns Image instance from an SVG element + * @param {SVGElement} element Element to parse + * @param {Function} callback Callback to execute when fabric.Image object is created + * @param {Object} [options] Options object + */ fromElement(element: SVGElement, callback: Function, options?: IImageOptions): void; prototype: any; /** - * Default CSS class name for canvas - */ + * Default CSS class name for canvas + */ CSS_CANVAS: string; filters: IAllFilters @@ -1990,16 +1990,16 @@ declare module fabric { interface ILineStatic { ATTRIBUTE_NAMES: string[]; /** - * Returns fabric.Line instance from an SVG element - * @param {SVGElement} element Element to parse - * @param {Object} [options] Options object - */ + * Returns fabric.Line instance from an SVG element + * @param {SVGElement} element Element to parse + * @param {Object} [options] Options object + */ fromElement(element: SVGElement, options?: ILineOptions): ILine; /** - * Returns fabric.Line instance from an object representation - * @param {Object} object Object to create an instance from - */ - fromObject(object): ILine; + * Returns fabric.Line instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): ILine; prototype: any; /** * Constructor @@ -2011,294 +2011,292 @@ declare module fabric { interface IObjectOptions { /** - * Type of an object (rect, circle, path, etc.). - * Note that this property is meant to be read-only and not meant to be modified. - * If you modify, certain parts of Fabric (such as JSON loading) won't work correctly. - */ + * Type of an object (rect, circle, path, etc.). + * Note that this property is meant to be read-only and not meant to be modified. + * If you modify, certain parts of Fabric (such as JSON loading) won't work correctly. + */ type?: string; /** - * Horizontal origin of transformation of an object (one of "left", "right", "center") - */ + * Horizontal origin of transformation of an object (one of "left", "right", "center") + */ originX?: string; /** - * Vertical origin of transformation of an object (one of "top", "bottom", "center") - */ + * Vertical origin of transformation of an object (one of "top", "bottom", "center") + */ originY?: string; /** - * Top position of an object. Note that by default it's relative to object center. You can change this by setting originY={top/center/bottom} - */ + * Top position of an object. Note that by default it's relative to object center. You can change this by setting originY={top/center/bottom} + */ top?: number; /** - * Left position of an object. Note that by default it's relative to object center. You can change this by setting originX={left/center/right} - */ + * Left position of an object. Note that by default it's relative to object center. You can change this by setting originX={left/center/right} + */ left?: number; /** - * Object width - */ + * Object width + */ width?: number; /** - * Object height - */ + * Object height + */ height?: number; /** - * Object scale factor (horizontal) - */ + * Object scale factor (horizontal) + */ scaleX?: number; /** - * Object scale factor (vertical) - */ + * Object scale factor (vertical) + */ scaleY?: number; /** - * When true, an object is rendered as flipped horizontally - */ + * When true, an object is rendered as flipped horizontally + */ flipX?: boolean; /** - * When true, an object is rendered as flipped vertically - */ + * When true, an object is rendered as flipped vertically + */ flipY?: boolean; /** - * Opacity of an object - */ + * Opacity of an object + */ opacity?: number; /** - * Angle of rotation of an object (in degrees) - */ + * Angle of rotation of an object (in degrees) + */ angle?: number; /** - * Size of object's controlling corners (in pixels) - */ + * Size of object's controlling corners (in pixels) + */ cornerSize?: number; /** - * When true, object's controlling corners are rendered as transparent inside (i.e. stroke instead of fill) - */ + * When true, object's controlling corners are rendered as transparent inside (i.e. stroke instead of fill) + */ transparentCorners?: boolean; /** - * Default cursor value used when hovering over this object on canvas - */ + * Default cursor value used when hovering over this object on canvas + */ hoverCursor?: string; /** - * Padding between object and its controlling borders (in pixels) - */ + * Padding between object and its controlling borders (in pixels) + */ padding?: number; /** - * Color of controlling borders of an object (when it's active) - */ + * Color of controlling borders of an object (when it's active) + */ borderColor?: string; /** - * Color of controlling corners of an object (when it's active) - */ + * Color of controlling corners of an object (when it's active) + */ cornerColor?: string; /** - * When true, this object will use center point as the origin of transformation - * when being scaled via the controls. - * Backwards incompatibility note: This property replaces "centerTransform" (Boolean). - */ + * When true, this object will use center point as the origin of transformation + * when being scaled via the controls. + * Backwards incompatibility note: This property replaces "centerTransform" (Boolean). + */ centeredScaling?: boolean; /** - * When true, this object will use center point as the origin of transformation - * when being rotated via the controls. - * Backwards incompatibility note: This property replaces "centerTransform" (Boolean). - */ + * When true, this object will use center point as the origin of transformation + * when being rotated via the controls. + * Backwards incompatibility note: This property replaces "centerTransform" (Boolean). + */ centeredRotation?: boolean; /** - * Color of object's fill - */ + * Color of object's fill + */ fill?: string; /** - * Fill rule used to fill an object - * accepted values are nonzero, evenodd - * Backwards incompatibility note: This property was used for setting globalCompositeOperation until v1.4.12 (use `fabric.Object#globalCompositeOperation` instead) - */ + * Fill rule used to fill an object + * accepted values are nonzero, evenodd + * Backwards incompatibility note: This property was used for setting globalCompositeOperation until v1.4.12, use `globalCompositeOperation` instead + */ fillRule?: string; /** - * Composite rule used for canvas globalCompositeOperation - */ + * Composite rule used for canvas globalCompositeOperation + */ globalCompositeOperation?: string; /** - * Background color of an object. Only works with text objects at the moment. - */ + * Background color of an object. Only works with text objects at the moment. + */ backgroundColor?: string; /** - * When defined, an object is rendered via stroke and this property specifies its color - */ + * When defined, an object is rendered via stroke and this property specifies its color + */ stroke?: string; /** - * Width of a stroke used to render this object - */ + * Width of a stroke used to render this object + */ strokeWidth?: number; /** - * Array specifying dash pattern of an object's stroke (stroke must be defined) - */ + * Array specifying dash pattern of an object's stroke (stroke must be defined) + */ strokeDashArray?: any[]; /** - * Line endings style of an object's stroke (one of "butt", "round", "square") - */ + * Line endings style of an object's stroke (one of "butt", "round", "square") + */ strokeLineCap?: string; /** - * Corner style of an object's stroke (one of "bevil", "round", "miter") - */ + * Corner style of an object's stroke (one of "bevil", "round", "miter") + */ strokeLineJoin?: string; /** - * Maximum miter length (used for strokeLineJoin = "miter") of an object's stroke - */ + * Maximum miter length (used for strokeLineJoin = "miter") of an object's stroke + */ strokeMiterLimit?: number; /** - * Shadow object representing shadow of this shape - */ + * Shadow object representing shadow of this shape + */ shadow?: IShadow|string; /** - * Opacity of object's controlling borders when object is active and moving - */ + * Opacity of object's controlling borders when object is active and moving + */ borderOpacityWhenMoving?: number; /** - * Scale factor of object's controlling borders - */ + * Scale factor of object's controlling borders + */ borderScaleFactor?: number; /** - * Transform matrix (similar to SVG's transform matrix) - */ + * Transform matrix (similar to SVG's transform matrix) + */ transformMatrix?: any[]; /** - * Minimum allowed scale value of an object - */ + * Minimum allowed scale value of an object + */ minScaleLimit?: number; /** - * When set to `false`, an object can not be selected for modification (using either point-click-based or group-based selection). - * But events still fire on it. - */ + * When set to `false`, an object can not be selected for modification (using either point-click-based or group-based selection). + * But events still fire on it. + */ selectable?: boolean; /** - * When set to `false`, an object can not be a target of events. All events propagate through it. Introduced in v1.3.4 - */ + * When set to `false`, an object can not be a target of events. All events propagate through it. Introduced in v1.3.4 + */ evented?: boolean; /** - * When set to `false`, an object is not rendered on canvas - */ + * When set to `false`, an object is not rendered on canvas + */ visible?: boolean; /** - * When set to `false`, object's controls are not displayed and can not be used to manipulate object - */ + * When set to `false`, object's controls are not displayed and can not be used to manipulate object + */ hasControls?: boolean; /** - * When set to `false`, object's controlling borders are not rendered - */ + * When set to `false`, object's controlling borders are not rendered + */ hasBorders?: boolean; /** - * When set to `false`, object's controlling rotating point will not be visible or selectable - */ + * When set to `false`, object's controlling rotating point will not be visible or selectable + */ hasRotatingPoint?: boolean; /** - * Offset for object's controlling rotating point (when enabled via `hasRotatingPoint`) - */ + * Offset for object's controlling rotating point (when enabled via `hasRotatingPoint`) + */ rotatingPointOffset?: number; /** - * When set to `true`, objects are "found" on canvas on per-pixel basis rather than according to bounding box - */ + * When set to `true`, objects are "found" on canvas on per-pixel basis rather than according to bounding box + */ perPixelTargetFind?: boolean; /** - * When `false`, default object's values are not included in its serialization - */ + * When `false`, default object's values are not included in its serialization + */ includeDefaultValues?: boolean; /** - * Function that determines clipping of an object (context is passed as a first argument) - * Note that context origin is at the object's center point (not left/top corner) - * @type Function - */ + * Function that determines clipping of an object (context is passed as a first argument) + * Note that context origin is at the object's center point (not left/top corner) + * @type Function + */ clipTo?: Function; /** - * When `true`, object horizontal movement is locked - */ + * When `true`, object horizontal movement is locked + */ lockMovementX?: boolean; /** - * When `true`, object vertical movement is locked - */ + * When `true`, object vertical movement is locked + */ lockMovementY?: boolean; /** - * When `true`, object rotation is locked - */ + * When `true`, object rotation is locked + */ lockRotation?: boolean; /** - * When `true`, object horizontal scaling is locked - */ + * When `true`, object horizontal scaling is locked + */ lockScalingX?: boolean; /** - * When `true`, object vertical scaling is locked - */ + * When `true`, object vertical scaling is locked + */ lockScalingY?: boolean; /** - * When `true`, object non-uniform scaling is locked - */ + * When `true`, object non-uniform scaling is locked + */ lockUniScaling?: boolean; /** - * When `true`, object cannot be flipped by scaling into negative values - */ + * When `true`, object cannot be flipped by scaling into negative values + */ lockScalingFlip?: boolean; /** - * Not used by fabric, just for convenience - */ + * Not used by fabric, just for convenience + */ name?: string; /** - * Not used by fabric, just for convenience - */ + * Not used by fabric, just for convenience + */ data?: any; } interface IObject extends IObservable, IObjectOptions, IObjectAnimation { - - getCurrentWidth(): number; getCurrentHeight(): number; @@ -2310,7 +2308,6 @@ declare module fabric { getBorderScaleFactor(): number; - getCornersize(): number; setCornersize(value: number): IObject; @@ -2356,216 +2353,420 @@ declare module fabric { setWidth(value: number): IObject; /* * Sets object's properties from options - * @param {Object} [options] Options object - */ + * @param {Object} [options] Options object + */ setOptions(options: any): void; /** - * Transforms context when rendering an object - * @param {CanvasRenderingContext2D} ctx Context - * @param {Boolean} fromLeft When true, context is transformed to object's top/left corner. This is used when rendering text on Node - */ + * Transforms context when rendering an object + * @param {CanvasRenderingContext2D} ctx Context + * @param {Boolean} fromLeft When true, context is transformed to object's top/left corner. This is used when rendering text on Node + */ transform(ctx: CanvasRenderingContext2D, fromLeft: boolean): void; /** - * Returns an object representation of an instance - * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output - */ - toObject(propertiesToInclude?: any[]): any; + * Returns an object representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + */ + toObject(propertiesToInclude?: any[]): any; /** - * Returns (dataless) object representation of an instance - * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output - */ + * Returns (dataless) object representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + */ toDatalessObject(propertiesToInclude?: any[]): any; /** - * Returns a string representation of an instance - */ + * Returns a string representation of an instance + */ toString(): string; /** - * Basic getter - * @param {String} property Property name - */ + * Basic getter + * @param {String} property Property name + */ get(property: string): any; /** - * Sets property to a given value. When changing position/dimension -related properties (left, top, scale, angle, etc.) `set` does not update position of object's borders/controls. - * If you need to update those, call `setCoords()`. - * @param {String|Object} key Property name or object (if object, iterate over the object properties) - * @param {Object|Function} value Property value (if function, the value is passed into it and its return value is used as a new one) - */ - set(key: string|any, value: any|Function): IObject; + * Sets property to a given value. + * When changing position/dimension -related properties (left, top, scale, angle, etc.) `set` does not update position of object's borders/controls. + * If you need to update those, call `setCoords()`. + * @param {String} key Property name + * @param {Object|Function} value Property value (if function, the value is passed into it and its return value is used as a new one) + */ + set(key: string, value: any|Function): IObject; + /** + * Sets property to a given value. + * When changing position/dimension -related properties (left, top, scale, angle, etc.) `set` does not update position of object's borders/controls. + * If you need to update those, call `setCoords()`. + * @param Object key Property object, iterate over the object properties + */ + set(key: any): IObject; /** - * Toggles specified property from `true` to `false` or from `false` to `true` - * @param {String} property Property to toggle - */ + * Toggles specified property from `true` to `false` or from `false` to `true` + * @param {String} property Property to toggle + */ toggle(property: string): IObject; /** - * Sets sourcePath of an object - * @param {String} value Value to set sourcePath to - */ - setSourcePath(value): IObject + * Sets sourcePath of an object + * @param {String} value Value to set sourcePath to + */ + setSourcePath(value: string): IObject; /** - * Retrieves viewportTransform from Object's canvas if possible - * @method getViewportTransform - * @memberOf fabric.Object.prototype - */ + * Retrieves viewportTransform from Object's canvas if possible + */ getViewportTransform(): boolean; - /** - * Renders an object on a specified context - * @param {CanvasRenderingContext2D} ctx Context to render on - * @param {Boolean} [noTransform] When true, context is not transformed - */ + * Renders an object on a specified context + * @param {CanvasRenderingContext2D} ctx Context to render on + * @param {Boolean} [noTransform] When true, context is not transformed + */ render(ctx: CanvasRenderingContext2D, noTransform?: boolean): void; /** - * Clones an instance - * @param {Function} callback Callback is invoked with a clone as a first argument - * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output - */ + * Clones an instance + * @param {Function} callback Callback is invoked with a clone as a first argument + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + */ clone(callback: Function, propertiesToInclude?: any[]): IObject; /** - * Creates an instance of fabric.Image out of an object - * @param {Function} callback callback, invoked with an instance as a first argument - */ + * Creates an instance of fabric.Image out of an object + * @param {Function} callback callback, invoked with an instance as a first argument + */ cloneAsImage(callback: (image: IImage) => any): IObject; - /** - * Converts an object into a data-url-like string - * @param options Options object - */ + * Converts an object into a data-url-like string + * @param options Options object + */ toDataURL(options: IDataURLOptions): string; /** - * Returns true if specified type is identical to the type of an instance - * @param {String} type Type to check against - */ + * Returns true if specified type is identical to the type of an instance + * @param {String} type Type to check against + */ isType(type: string): boolean; /** - * Returns complexity of an instance - */ + * Returns complexity of an instance + */ complexity(): number; /** - * Returns a JSON representation of an instance - * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output - */ + * Returns a JSON representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + */ toJSON(propertiesToInclude?: any[]): any; - - /** - * Sets gradient (fill or stroke) of an object - * Backwards incompatibility note: This method was named "setGradientFill" until v1.1.0 - * @param {String} property Property name 'stroke' or 'fill' - * @param {Object} [options] Options object - */ - setGradient(property: string, options: IGradientOptions): IObject; - + * Sets gradient (fill or stroke) of an object + * Backwards incompatibility note: This method was named "setGradientFill" until v1.1.0 + * @param {String} property Property name 'stroke' or 'fill' + * @param {Object} [options] Options object + */ + setGradient(property: string, options: IGradientOptions): IObject; /** - * Sets pattern fill of an object - * @param {Object} options Options object - */ + * Sets pattern fill of an object + * @param {Object} options Options object + */ setPatternFill(options: IFillOptions): IObject; /** - * Sets shadow of an object - * @param {String} [options] Options object or string (e.g. "2px 2px 10px rgba(0,0,0,0.2)") - */ + * Sets shadow of an object + * @param {String} [options] Options object or string (e.g. "2px 2px 10px rgba(0,0,0,0.2)") + */ setShadow(options?: string): IObject; /** - * Sets shadow of an object - * @param [options] Options object - */ + * Sets shadow of an object + * @param [options] Options object + */ setShadow(options: IShadow): IObject; /** - * Sets "color" of an instance (alias of `set('fill', …)`) - * @param {String} color Color value - */ + * Sets "color" of an instance (alias of `set('fill', …)`) + * @param {String} color Color value + */ setColor(color: string): IObject; /** - * Sets "angle" of an instance - * @param {Number} angle Angle value - */ - setAngle(angle: number): IObject + * Sets "angle" of an instance + * @param {Number} angle Angle value + */ + setAngle(angle: number): IObject; /** - * Sets "angle" of an instance - * @param {Number} angle Angle value - */ - rotate(angle: number): IObject + * Sets "angle" of an instance + * @param {Number} angle Angle value + */ + rotate(angle: number): IObject; /** - * Centers object horizontally on canvas to which it was added last. - * You might need to call `setCoords` on an object after centering, to update controls area. - */ + * Centers object horizontally on canvas to which it was added last. + * You might need to call `setCoords` on an object after centering, to update controls area. + */ centerH(): void; /** - * Centers object vertically on canvas to which it was added last. - * You might need to call `setCoords` on an object after centering, to update controls area. - */ + * Centers object vertically on canvas to which it was added last. + * You might need to call `setCoords` on an object after centering, to update controls area. + */ centerV(): void; /** - * Centers object vertically and horizontally on canvas to which is was added last - * You might need to call `setCoords` on an object after centering, to update controls area. - */ + * Centers object vertically and horizontally on canvas to which is was added last + * You might need to call `setCoords` on an object after centering, to update controls area. + */ center(): void; /** - * Removes object from canvas to which it was added last - */ + * Removes object from canvas to which it was added last + */ remove(): IObject; /** - * Returns coordinates of a pointer relative to an object - * @param {Event} e Event to operate upon - * @param {Object} [pointer] Pointer to operate upon (instead of event) - */ + * Returns coordinates of a pointer relative to an object + * @param {Event} e Event to operate upon + * @param {Object} [pointer] Pointer to operate upon (instead of event) + */ getLocalPointer(e: Event, pointer: any): any; - // methods - bringForward(intersecting?: boolean): IObject; - bringToFront(): IObject; - drawBorders(context: CanvasRenderingContext2D): IObject; - drawCorners(context: CanvasRenderingContext2D): IObject; - getBoundingRect(): { left: number; top: number; width: number; height: number }; - getBoundingRectHeight(): number; - getBoundingRectWidth(): number; - getSvgStyles(): string; - getSvgTransform(): string; - hasStateChanged(): boolean; - initialize(options: any); - intersectsWithObject(other: IObject): boolean; - intersectsWithRect(selectionTL: any, selectionBR: any): boolean; - isActive(): boolean; - isContainedWithinObject(other: IObject): boolean; - isContainedWithinRect(selectionTL: any, selectionBR: any): boolean; - saveState(): IObject; - scale(value: number): IObject; - scaleToHeight(value: number): IObject; - scaleToWidth(value: number): IObject; - sendBackwards(intersecting?: boolean): IObject; - sendToBack(): IObject; - - setActive(active: boolean): IObject; - setCoords(); + /** + * Sets object's properties from options + * @param {Object} [options] Options object + */ setOptions(options: any); + /** + * Sets sourcePath of an object + * @param {String} value Value to set sourcePath to + */ setSourcePath(value: string): IObject; - toGrayscale(): IObject; + // functions from object svg export mixin + // ----------------------------------------------------------------------------------------------------------------------------------- + /** + * Returns styles-string for svg-export + */ + getSvgStyles(): string; + /** + * Returns transform-string for svg-export + */ + getSvgTransform(): string; + /** + * Returns transform-string for svg-export from the transform matrix of single elements + */ + getSvgTransformMatrix(): string; + + // functions from stateful mixin + // ----------------------------------------------------------------------------------------------------------------------------------- + /** + * Returns true if object state (one of its state properties) was changed + */ + hasStateChanged(): boolean; + /** + * Saves state of an object + * @param {Object} [options] Object with additional `stateProperties` array to include when saving state + * @return {fabric.Object} thisArg + */ + saveState(options?: { stateProperties: any[] }): IObject; + /** + * Setups state of an object + */ + setupState(): IObject; + // functions from object straightening mixin + // ----------------------------------------------------------------------------------------------------------------------------------- + /** + * Straightens an object (rotating it from current angle to one of 0, 90, 180, 270, etc. depending on which is closer) + */ + straighten(): IObject; + /** + * Same as straighten but with animation + * @param {Object} callbacks Object with callback functions + * @param {Function} [callbacks.onComplete] Invoked on completion + * @param {Function} [callbacks.onChange] Invoked on every step of animation + */ + fxStraighten(callbacks: { onComplete?: Function; onChange: Function }): IObject; + + // functions from object stacking mixin + // ----------------------------------------------------------------------------------------------------------------------------------- + /** + * Moves an object up in stack of drawn objects + * @param {Boolean} [intersecting] If `true`, send object in front of next upper intersecting object + */ + bringForward(intersecting?: boolean): IObject; + /** + * Moves an object to the top of the stack of drawn objects + */ + bringToFront(): IObject; + /** + * Moves an object down in stack of drawn objects + * @param {Boolean} [intersecting] If `true`, send object behind next lower intersecting object + */ + sendBackwards(intersecting?: boolean): IObject; + /** + * Moves an object to the bottom of the stack of drawn objects + */ + sendToBack(): IObject; + /** + * Moves an object to specified level in stack of drawn objects + * @param {Number} index New position of object + */ + moveTo(index: number): IObject; + + // functions from object origin mixin + // ----------------------------------------------------------------------------------------------------------------------------------- + /** + * Translates the coordinates from origin to center coordinates (based on the object's dimensions) + * @param {fabric.Point} point The point which corresponds to the originX and originY params + * @param {String} originX Horizontal origin: 'left', 'center' or 'right' + * @param {String} originY Vertical origin: 'top', 'center' or 'bottom' + */ + translateToCenterPoint(point: IPoint, originX: string, originY: string): IPoint; + + /** + * Translates the coordinates from center to origin coordinates (based on the object's dimensions) + * @param {fabric.Point} center The point which corresponds to center of the object + * @param {String} originX Horizontal origin: 'left', 'center' or 'right' + * @param {String} originY Vertical origin: 'top', 'center' or 'bottom' + */ + translateToOriginPoint(center: IPoint, originX: string, originY: string): IPoint; + /** + * Returns the real center coordinates of the object + */ + getCenterPoint(): IPoint; + + /** + * Returns the coordinates of the object as if it has a different origin + * @param {String} originX Horizontal origin: 'left', 'center' or 'right' + * @param {String} originY Vertical origin: 'top', 'center' or 'bottom' + */ + getPointByOrigin(): IPoint; + + /** + * Returns the point in local coordinates + * @param {fabric.Point} point The point relative to the global coordinate system + * @param {String} originX Horizontal origin: 'left', 'center' or 'right' + * @param {String} originY Vertical origin: 'top', 'center' or 'bottom' + */ + toLocalPoint(point: IPoint, originX: string, originY: string): IPoint; + + /** + * Sets the position of the object taking into consideration the object's origin + * @param {fabric.Point} pos The new position of the object + * @param {String} originX Horizontal origin: 'left', 'center' or 'right' + * @param {String} originY Vertical origin: 'top', 'center' or 'bottom' + * @return {void} + */ + setPositionByOrigin(pos: IPoint, originX: string, originY: string): void; + + /** + * @param {String} to One of 'left', 'center', 'right' + */ + adjustPosition(to: string): void; + + // functions from interactivity mixin + // ----------------------------------------------------------------------------------------------------------------------------------- + /**- + * Draws borders of an object's bounding box. + * Requires public properties: width, height + * Requires public options: padding, borderColor + * @param {CanvasRenderingContext2D} ctx Context to draw on + */ + drawBorders(context: CanvasRenderingContext2D): IObject; + + /** + * Draws corners of an object's bounding box. + * Requires public properties: width, height + * Requires public options: cornerSize, padding + * @param {CanvasRenderingContext2D} ctx Context to draw on + */ + drawCorners(context: CanvasRenderingContext2D): IObject; + + /** + * Returns true if the specified control is visible, false otherwise. + * @param {String} controlName The name of the control. Possible values are 'tl', 'tr', 'br', 'bl', 'ml', 'mt', 'mr', 'mb', 'mtr'. + */ + isControlVisible(controlName: string): boolean; + /** + * Sets the visibility of the specified control. + * @param {String} controlName The name of the control. Possible values are 'tl', 'tr', 'br', 'bl', 'ml', 'mt', 'mr', 'mb', 'mtr'. + * @param {Boolean} visible true to set the specified control visible, false otherwise + */ + setControlVisible(controlName: string, visible: boolean): IObject; + + /** + * Sets the visibility state of object controls. + * @param {Object} [options] Options object + */ + setControlsVisibility(options?: { + bl?: boolean; + br?: boolean; + mb?: boolean; + ml?: boolean; + mr?: boolean; + mt?: boolean; + tl?: boolean; + tr?: boolean; + mtr?: boolean; }): IObject; + + // functions from geometry mixin + // ------------------------------------------------------------------------------------------------------------------------------- + /** + * Sets corner position coordinates based on current angle, width and height + * See https://github.com/kangax/fabric.js/wiki/When-to-call-setCoords + */ + setCoords(): IObject; + /** + * Returns coordinates of object's bounding rectangle (left, top, width, height) + * @return {Object} Object with left, top, width, height properties + */ + getBoundingRect(): { left: number; top: number; width: number; height: number }; + /** + * Checks if object is fully contained within area of another object + * @param {Object} other Object to test + */ + isContainedWithinObject(other: IObject): boolean; + /** + * Checks if object is fully contained within area formed by 2 points + * @param {Object} pointTL top-left point of area + * @param {Object} pointBR bottom-right point of area + */ + isContainedWithinRect(pointTL: any, pointBR: any): boolean; + /** + * Checks if point is inside the object + * @param {fabric.Point} point Point to check against + */ + containsPoint(point: IPoint): boolean; + /** + * Scales an object (equally by x and y) + * @param {Number} value Scale factor + * @return {fabric.Object} thisArg + */ + scale(value: number): IObject; + /** + * Scales an object to a given height, with respect to bounding box (scaling by x/y equally) + * @param {Number} value New height value + */ + scaleToHeight(value: number): IObject; + /** + * Scales an object to a given width, with respect to bounding box (scaling by x/y equally) + * @param {Number} value New width value + */ + scaleToWidth(value: number): IObject; + /** + * Checks if object intersects with another object + * @param {Object} other Object to test + */ + intersectsWithObject(other: IObject): boolean; + /** + * Checks if object intersects with an area formed by 2 points + * @param {Object} pointTL top-left point of area + * @param {Object} pointBR bottom-right point of area + */ + intersectsWithRect(pointTL: any, pointBR: any): boolean; } interface IObjectStatic { prototype: any; @@ -2661,9 +2862,9 @@ declare module fabric { */ isSameColor(): boolean; /** - * Renders this group on a specified context - * @param {CanvasRenderingContext2D} ctx Context to render this instance on - */ + * Renders this group on a specified context + * @param {CanvasRenderingContext2D} ctx Context to render this instance on + */ render(ctx: CanvasRenderingContext2D); /** * Returns dataless object representation of this path group @@ -2671,12 +2872,11 @@ declare module fabric { * @return {Object} dataless object representation of an instance */ toDatalessObject(propertiesToInclude?: any[]): any; - toGrayscale(): IPathGroup; /** - * Returns object representation of this path group - * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output - * @return {Object} object representation of an instance - */ + * Returns object representation of this path group + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} object representation of an instance + */ toObject(propertiesToInclude?: any[]): any; /** * Returns a string representation of this path group @@ -2696,7 +2896,7 @@ declare module fabric { getObjects(): IPath[]; } interface IPathGroupStatic { - fromObject(object): IPathGroup; + fromObject(object: any): IPathGroup; /** * Constructor * @param {Array} paths @@ -2704,12 +2904,12 @@ declare module fabric { */ new (paths: IPath[], options?: IObjectOptions): IPathGroup; /** - * Creates fabric.PathGroup instance from an object representation - * @static - * @memberOf fabric.PathGroup - * @param {Object} object Object to create an instance from - * @param {Function} callback Callback to invoke when an fabric.PathGroup instance is created - */ + * Creates fabric.PathGroup instance from an object representation + * @static + * @memberOf fabric.PathGroup + * @param {Object} object Object to create an instance from + * @param {Function} callback Callback to invoke when an fabric.PathGroup instance is created + */ fromObject(object: any, callback: (group: IPathGroup) => any): void; prototype: any; } @@ -2718,7 +2918,7 @@ declare module fabric { /** * Points array */ - points?: IPoint[] + points?: IPoint[]; /** * Minimum X from points values, necessary to offset points @@ -2752,8 +2952,8 @@ declare module fabric { } interface IPolygonStatic { /** - * List of attribute names to account for when parsing SVG element (used by `fabric.Polygon.fromElement`) - */ + * List of attribute names to account for when parsing SVG element (used by `fabric.Polygon.fromElement`) + */ ATTRIBUTE_NAMES: string[]; /** @@ -2763,9 +2963,9 @@ declare module fabric { */ fromElement(element: SVGElement, options?: IPolygonOptions): IPolygon; /** - * Returns fabric.Polygon instance from an object representation - * @param {Object} object Object to create an instance from - */ + * Returns fabric.Polygon instance from an object representation + * @param {Object} object Object to create an instance from + */ fromObject(object: any): IPolygon; /** * Constructor @@ -2780,7 +2980,7 @@ declare module fabric { /** * Points array */ - points?: IPoint[] + points?: IPoint[]; /** * Minimum X from points values, necessary to offset points @@ -2814,8 +3014,8 @@ declare module fabric { } interface IPolylineStatic { /** - * List of attribute names to account for when parsing SVG element (used by `fabric.Polygon.fromElement`) - */ + * List of attribute names to account for when parsing SVG element (used by `fabric.Polygon.fromElement`) + */ ATTRIBUTE_NAMES: string[]; /** @@ -2825,9 +3025,9 @@ declare module fabric { */ fromElement(element: SVGElement, options?: IPolylineOptions): IPolyline; /** - * Returns fabric.Polyline instance from an object representation - * @param {Object} object Object to create an instance from - */ + * Returns fabric.Polyline instance from an object representation + * @param {Object} object Object to create an instance from + */ fromObject(object: any): IPolyline; /** * Constructor @@ -2875,19 +3075,19 @@ declare module fabric { } interface IRectStatic { /** - * List of attribute names to account for when parsing SVG element (used by `fabric.Rect.fromElement`) - */ + * List of attribute names to account for when parsing SVG element (used by `fabric.Rect.fromElement`) + */ ATTRIBUTE_NAMES: string[]; /** - * Returns Rect instance from an SVG element - * @param {SVGElement} element Element to parse - * @param {Object} [options] Options object - */ + * Returns Rect instance from an SVG element + * @param {SVGElement} element Element to parse + * @param {Object} [options] Options object + */ fromElement(element: SVGElement, options?: IRectOptions): IRect; /** - * Returns Rect instance from an object representation - * @param {Object} object Object to create an instance from - */ + * Returns Rect instance from an object representation + * @param {Object} object Object to create an instance from + */ fromObject(object: any): IRect; /** * Constructor @@ -2907,8 +3107,8 @@ declare module fabric { */ fontWeight?: number|string; /** - * Font family - */ + * Font family + */ fontFamily?: string; /** * Text decoration Possible values?: "", "underline", "overline" or "line-through". @@ -2927,9 +3127,9 @@ declare module fabric { */ lineHeight?: number; /** - * When defined, an object is rendered via stroke and this property specifies its color. - * Backwards incompatibility note?: This property was named "strokeStyle" until v1.1.6 - */ + * When defined, an object is rendered via stroke and this property specifies its color. + * Backwards incompatibility note?: This property was named "strokeStyle" until v1.1.6 + */ stroke?: string; /** * Shadow object representing shadow of this shape. @@ -2938,8 +3138,6 @@ declare module fabric { shadow?: IShadow|string; /** * Background color of text lines - * @type String - * @default */ textBackgroundColor?: string; @@ -2948,18 +3146,13 @@ declare module fabric { text?: string; } interface IText extends IObject, ITextOptions { - - - initialize(text: string, options?: IITextOptions): IText; /** * Returns complexity of an instance - * @return {Number} complexity */ complexity(): number; /** - * Returns string representation of an instance - * @return {String} String representation of text object - */ + * Returns string representation of an instance + */ toString(): string; /** * Renders text instance on a specified context @@ -2968,15 +3161,12 @@ declare module fabric { render(ctx: CanvasRenderingContext2D, noTransform: boolean); /** * Returns object representation of an instance - * @method toObject * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output - * @return {Object} object representation of an instance */ toObject(propertiesToInclude?: any[]): IObject; /** * Returns SVG representation of an instance * @param {Function} [reviver] Method for further parsing of svg representation. - * @return {String} svg representation of an instance */ toSVG(reviver?: Function): string; /** @@ -2987,14 +3177,13 @@ declare module fabric { * Sets object's fontSize * @param {Number} fontSize Font size (in pixels) */ - setFontSize(fontSize): IText; + setFontSize(fontSize: number): IText; /** * Retrieves object's fontWeight */ getFontWeight(): number|string; /** * Sets object's fontWeight - * @method setFontWeight * @param {(Number|String)} fontWeight Font weight */ setFontWeight(fontWeight: string|number): IText; @@ -3061,12 +3250,11 @@ declare module fabric { * @param {String} textBackgroundColor Text background color */ setTextBackgroundColor(textBackgroundColor: string): IText; - } interface ITextStatic { /** - * List of attribute names to account for when parsing SVG element (used by `fabric.Text.fromElement`) - */ + * List of attribute names to account for when parsing SVG element (used by `fabric.Text.fromElement`) + */ ATTRIBUTE_NAMES: string[]; /** * Default SVG font size @@ -3084,8 +3272,7 @@ declare module fabric { * @param {SVGElement} element Element to parse * @param {Object} [options] Options object */ - fromElement(element: SVGElement, options?: ITextOptions): IText - + fromElement(element: SVGElement, options?: ITextOptions): IText; /** * Returns fabric.Text instance from an object representation * @param {Object} object Object to create an instance from @@ -3156,11 +3343,9 @@ declare module fabric { caching?: boolean; } interface IIText extends IObject, IText, IITextOptions { - initialize(text?: string, options?: IITextOptions): IText; - /** - * Returns true if object has no styling - */ + * Returns true if object has no styling + */ isEmptyStyles(): boolean; render(ctx: CanvasRenderingContext2D, noTransform: boolean); /** @@ -3183,11 +3368,11 @@ declare module fabric { */ setSelectionEnd(index: number): void; /** - * Gets style of a current selection/cursor (at the start position) - * @param {Number} [startIndex] Start index to get styles at - * @param {Number} [endIndex] End index to get styles at - * @return {Object} styles Style object at a specified (or current) index - */ + * Gets style of a current selection/cursor (at the start position) + * @param {Number} [startIndex] Start index to get styles at + * @param {Number} [endIndex] End index to get styles at + * @return {Object} styles Style object at a specified (or current) index + */ getSelectionStyles(startIndex: number, endIndex: number): any; /** * Sets style of a current selection @@ -3198,8 +3383,8 @@ declare module fabric { setSelectionStyles(styles: any): IText; /** - * Renders cursor or selection (depending on what exists) - */ + * Renders cursor or selection (depending on what exists) + */ renderCursorOrSelection(): void; /** @@ -3211,7 +3396,7 @@ declare module fabric { * Returns complete style of char at the current cursor * @param {Number} lineIndex Line index * @param {Number} charIndex Char index - * @return {Object} Character style + * @return {Object} Character style */ getCurrentCharStyle(lineIndex: number, charIndex: number): any; @@ -3234,15 +3419,166 @@ declare module fabric { * Renders cursor * @param {Object} boundaries */ - renderCursor(boundaries): void; + renderCursor(boundaries: any): void; /** - * Renders text selection - * @param {Array} chars Array of characters - * @param {Object} boundaries Object with left/top/leftOffset/topOffset - */ + * Renders text selection + * @param {Array} chars Array of characters + * @param {Object} boundaries Object with left/top/leftOffset/topOffset + */ renderSelection(chars: string[], boundaries: any): void; + // functions from itext behavior mixin + // ------------------------------------------------------------------------------------------------------------------------ + /** + * Initializes all the interactive behavior of IText + */ + initBehavior(): void; + + /** + * Initializes "selected" event handler + */ + initSelectedHandler(): void; + + /** + * Initializes "added" event handler + */ + initAddedHandler(): void; + + initRemovedHandler(): void; + + /** + * Initializes delayed cursor + */ + initDelayedCursor(restart: boolean): void; + + /** + * Aborts cursor animation and clears all timeouts + */ + abortCursorAnimation(): void; + + /** + * Selects entire text + */ + selectAll(): void; + + /** + * Returns selected text + */ + getSelectedText(): string; + + /** + * Find new selection index representing start of current word according to current selection index + * @param {Number} startFrom Surrent selection index + * @return {Number} New selection index + */ + findWordBoundaryLeft(startFrom: number): number; + + /** + * Find new selection index representing end of current word according to current selection index + * @param {Number} startFrom Current selection index + * @return {Number} New selection index + */ + findWordBoundaryRight(startFrom: number): number; + + /** + * Find new selection index representing start of current line according to current selection index + * @param {Number} startFrom Current selection index + */ + findLineBoundaryLeft(startFrom: number): number; + + /** + * Find new selection index representing end of current line according to current selection index + * @param {Number} startFrom Current selection index + */ + findLineBoundaryRight(startFrom: number): number; + + /** + * Returns number of newlines in selected text + */ + getNumNewLinesInSelectedText(): number; + + /** + * Finds index corresponding to beginning or end of a word + * @param {Number} selectionStart Index of a character + * @param {Number} direction: 1 or -1 + */ + searchWordBoundary(selectionStart: number, direction: number): number; + + /** + * Selects a word based on the index + * @param {Number} selectionStart Index of a character + */ + selectWord(selectionStart: number): void; + /** + * Selects a line based on the index + * @param {Number} selectionStart Index of a character + */ + selectLine(selectionStart: number): void; + + /** + * Enters editing state + */ + enterEditing(): IIText; + + /** + * Initializes "mousemove" event handler + */ + initMouseMoveHandler(): void; + /** + * Exits from editing state + * @return {fabric.IText} thisArg + * @chainable + */ + exitEditing(): IIText; + + /** + * Inserts a character where cursor is (replacing selection if one exists) + * @param {String} _chars Characters to insert + */ + insertChars(_chars: string, useCopiedStyle?: boolean): void; + /** + * Inserts new style object + * @param {Number} lineIndex Index of a line + * @param {Number} charIndex Index of a char + * @param {Boolean} isEndOfLine True if it's end of line + */ + insertNewlineStyleObject(lineIndex: number, charIndex: number, isEndOfLine: boolean): void; + + /** + * Inserts style object for a given line/char index + * @param {Number} lineIndex Index of a line + * @param {Number} charIndex Index of a char + * @param {Object} [style] Style object to insert, if given + */ + insertCharStyleObject(lineIndex: number, charIndex: number, isEndOfLine: boolean): void; + + /** + * Inserts style object(s) + * @param {String} _chars Characters at the location where style is inserted + * @param {Boolean} isEndOfLine True if it's end of line + * @param {Boolean} [useCopiedStyle] Style to insert + */ + insertStyleObjects(_chars: string, isEndOfLine: boolean, useCopiedStyle?: boolean): void; + + /** + * Shifts line styles up or down + * @param {Number} lineIndex Index of a line + * @param {Number} offset Can be -1 or +1 + */ + shiftLineStyles(lineIndex: number, offset: number): void; + + /** + * Removes style object + * @param {Boolean} isBeginningOfLine True if cursor is at the beginning of line + * @param {Number} [index] Optional index. When not given, current selectionStart is used. + */ + removeStyleObject(isBeginningOfLine: boolean, index?: number): void; + /** + * Inserts new line + */ + insertNewline(): void; + } interface IITextStatic extends ITextStatic { /** @@ -3252,16 +3588,14 @@ declare module fabric { */ new (text: string, options?: IITextOptions): IIText; /** - * Returns fabric.IText instance from an object representation - * @param {Object} object Object to create an instance from - */ + * Returns fabric.IText instance from an object representation + * @param {Object} object Object to create an instance from + */ fromObject(object: any): IIText; } interface ITriangleOptions extends IObjectOptions { } interface ITriangle extends IObject { - initialize(options: IObjectOptions): ITriangle; - /** * Returns complexity of an instance * @return {Number} complexity of this instance @@ -3282,9 +3616,9 @@ declare module fabric { */ new (options?: ITriangleOptions): ITriangle; /** - * Returns Triangle instance from an object representation - * @param {Object} object Object to create an instance from - */ + * Returns Triangle instance from an object representation + * @param {Object} object Object to create an instance from + */ fromObject(object: any): ITriangle; } @@ -3298,7 +3632,200 @@ declare module fabric { * @param {Object} [options] Options object */ new (options?: any): IBaseFilter; - } + }; + Blend: { + /** + * Constructor + * @param {Object} [options] Options object + */ + new (options?: { color?: string; mode?: string; alpha?: number; image?: IImage }): IBlendFilter; + /** + * Returns filter instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): IBlendFilter + }; + Brightness: { + /** + * Constructor + * @param {Object} [options] Options object + * @param {Number} [options.brightness=0] Value to brighten the image up (0..255) + */ + new (options?: { brightness: number }): IBrightnessFilter; + /** + * Returns filter instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): IBrightnessFilter + }; + Convolute: { + /** + * Constructor + * @param {Object} [options] Options object + * @param {Boolean} [options.opaque=false] Opaque value (true/false) + * @param {Array} [options.matrix] Filter matrix + */ + new (options?: { opaque?: boolean; matrix?: number[] }): IConvoluteFilter; + /** + * Returns filter instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): IConvoluteFilter + }; + GradientTransparency: { + /** + * Constructor + * @param {Object} [options] Options object + * @param {Number} [options.threshold=100] Threshold value + */ + new (options?: { threshold?: number; }): IGradientTransparencyFilter; + /** + * Returns filter instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): IGradientTransparencyFilter + }; + Grayscale: { + /** + * Constructor + * @param {Object} [options] Options object + */ + new (options?: any): IGrayscaleFilter; + /** + * Returns filter instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): IGrayscaleFilter + }; + Invert: { + /** + * Constructor + * @param {Object} [options] Options object + */ + new (options?: any): IInvertFilter; + /** + * Returns filter instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): IInvertFilter + }; + Mask: { + /** + * Constructor + * @param {Object} [options] Options object + * @param {fabric.Image} [options.mask] Mask image object + * @param {Number} [options.channel=0] Rgb channel (0, 1, 2 or 3) + */ + new (options?: { mask?: IImage; channel: number; }): IMaskFilter; + /** + * Returns filter instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): IMaskFilter + }; + Multiply: { + /** + * Constructor + * @param {Object} [options] Options object + * @param {Number} [options.color=#000000] Color to multiply the image pixels with + */ + new (options?: { color: string; }): IMultiplyFilter; + /** + * Returns filter instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): IMultiplyFilter + }; + Noise: { + /** + * Constructor + * @param {Object} [options] Options object + * @param {Number} [options.noise=0] Noise value + */ + new (options?: { noise: number; }): INoiseFilter; + /** + * Returns filter instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): INoiseFilter + }; + Pixelate: { + /** + * Constructor + * @param {Object} [options] Options object + * @param {Number} [options.blocksize=4] Blocksize for pixelate + */ + new (options?: { blocksize?: number; }): IPixelateFilter; + /** + * Returns filter instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): IPixelateFilter + }; + RemoveWhite: { + /** + * Constructor + * @param {Object} [options] Options object + * @param {Number} [options.threshold=30] Threshold value + * @param {Number} [options.distance=20] Distance value + */ + new (options?: { threshold?: number; distance?: number; }): IRemoveWhiteFilter; + /** + * Returns filter instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): IRemoveWhiteFilter + }; + Resize: { + /** + * Constructor + * @param {Object} [options] Options object + */ + new (options?: any): IResizeFilter; + /** + * Returns filter instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): IResizeFilter + }; + Sepia2: { + /** + * Constructor + * @param {Object} [options] Options object + */ + new (options?: any): ISepia2Filter; + /** + * Returns filter instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): ISepia2Filter + }; + Sepia: { + /** + * Constructor + * @param {Object} [options] Options object + */ + new (options?: any): ISepiaFilter; + /** + * Returns filter instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): ISepiaFilter + }; + Tint: { + /** + * Constructor + * @param {Object} [options] Options object + * @param {String} [options.color=#000000] Color to tint the image with + * @param {Number} [options.opacity] Opacity value that controls the tint effect's transparency (0..1) + */ + new (options?: { color?: string; opacity?: number; }): ITintFilter; + /** + * Returns filter instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): ITintFilter + }; } interface IBaseFilter { /** @@ -3309,528 +3836,761 @@ declare module fabric { /** * Returns object representation of an instance */ - toObject(): any; - + toObject(): any; /** * Returns a JSON representation of an instance */ toJSON(): string; } -} -interface IBrightnessFilter { -} -interface IInvertFilter { -} -interface IRemoveWhiteFilter { -} -interface IGrayscaleFilter { -} -interface ISepiaFilter { -} -interface ISepia2Filter { -} -interface INoiseFilter { -} -interface IGradientTransparencyFilter { -} -interface IPixelateFilter { -} -interface IConvoluteFilter { -} - - -/////////////////////////////////////////////////////////////////////////////// -// Fabric util Interface -////////////////////////////////////////////////////////////////////////////// -interface IUtilAnimationOptions { - /** - * Starting value - */ - startValue?: number; - /** - * Ending value - */ - endValue?: number; - /** - * Value to modify the property by - */ - byValue: number; - /** - * Duration of change (in ms) - */ - duration?: number; - /** - * Callback; invoked on every value change - */ - onChange?: Function; - /** - * Callback; invoked when value change is completed - */ - onComplete?: Function - /** - * Easing function - */ - easing?: Function; -} -interface IUtilAnimation { - /** - * Changes value from one to another within certain period of time, invoking callbacks as value is being changed. - * @param {Object} [options] Animation options - */ - animate(options?: IUtilAnimationOptions): void; - /** - * requestAnimationFrame polyfill based on http://paulirish.com/2011/requestanimationframe-for-smart-animating/ - * In order to get a precise start time, `requestAnimFrame` should be called as an entry into the method - * @param {Function} callback Callback to invoke - */ - requestAnimFrame(callback: Function): void; -} - -interface IUtilAnimEase { - easeInBack(): Function; - easeInBounce(): Function; - easeInCirc(): Function; - easeInCubic(): Function; - easeInElastic(): Function; - easeInExpo(): Function; - easeInOutBack(): Function; - easeInOutBounce(): Function; - easeInOutCirc(): Function; - easeInOutCubic(): Function; - easeInOutElastic(): Function; - easeInOutExpo(): Function; - easeInOutQuad(): Function; - easeInOutQuart(): Function; - easeInOutQuint(): Function; - easeInOutSine(): Function; - easeInQuad(): Function; - easeInQuart(): Function; - easeInQuint(): Function; - easeInSine(): Function; - easeOutBack(): Function; - easeOutBounce(): Function; - easeOutCirc(): Function; - easeOutCubic(): Function; - easeOutElastic(): Function; - easeOutExpo(): Function; - easeOutQuad(): Function; - easeOutQuart(): Function; - easeOutQuint(): Function; - easeOutSine(): Function; -} - -interface IUtilArc { - /** - * Draws arc - * @param {CanvasRenderingContext2D} ctx - * @param {Number} fx - * @param {Number} fy - * @param {Array} coords - */ - drawArc(ctx: CanvasRenderingContext2D, fx: number, fy: number, coords: number[]): void; - /** - * Calculate bounding box of a elliptic-arc - * @param {Number} fx start point of arc - * @param {Number} fy - * @param {Number} rx horizontal radius - * @param {Number} ry vertical radius - * @param {Number} rot angle of horizontal axe - * @param {Number} large 1 or 0, whatever the arc is the big or the small on the 2 points - * @param {Number} sweep 1 or 0, 1 clockwise or counterclockwise direction - * @param {Number} tx end point of arc - * @param {Number} ty - */ - getBoundsOfArc(fx: number, fy: number, rx: number, ry: number, rot: number, large: number, sweep: number, tx: number, ty: number): IPoint[]; - /** - * Calculate bounding box of a beziercurve - * @param {Number} x0 starting point - * @param {Number} y0 - * @param {Number} x1 first control point - * @param {Number} y1 - * @param {Number} x2 secondo control point - * @param {Number} y2 - * @param {Number} x3 end of beizer - * @param {Number} y3 - */ - getBoundsOfCurve(x0: number, y0: number, x1: number, y1: number, x2: number, y2: number, x3: number, y3: number): IPoint[]; - -} - -interface IUtilDomEvent { - /** - * Cross-browser wrapper for getting event's coordinates - * @param {Event} event Event object - * @param {HTMLCanvasElement} upperCanvasEl <canvas> element on which object selection is drawn - */ - getPointer(event: Event, upperCanvasEl: HTMLCanvasElement): IPoint; - - /** - * Adds an event listener to an element - * @param {HTMLElement} element - * @param {String} eventName - * @param {Function} handler - */ - addListener(element: HTMLElement, eventName: string, handler: Function): void; - - /** - * Removes an event listener from an element - * @param {HTMLElement} element - * @param {String} eventName - * @param {Function} handler - */ - removeListener(element: HTMLElement, eventName: string, handler: Function): void; -} - -interface IUtilDomMisc { - /** - * Takes id and returns an element with that id (if one exists in a document) - * @param {String|HTMLElement} id - */ - getById(id: string|HTMLElement): HTMLElement; - /** - * Converts an array-like object (e.g. arguments or NodeList) to an array - * @param {Object} arrayLike - */ - toArray(arrayLike: any): any[]; - /** - * Creates specified element with specified attributes - * @memberOf fabric.util - * @param {String} tagName Type of an element to create - * @param {Object} [attributes] Attributes to set on an element - * @return {HTMLElement} Newly created element - */ - makeElement(tagName: string, attributes?: any): HTMLElement; - /** - * Adds class to an element - * @param {HTMLElement} element Element to add class to - * @param {String} className Class to add to an element - */ - addClass(element: HTMLElement, classname: string): void; - /** - * Wraps element with another element - * @param {HTMLElement} element Element to wrap - * @param {HTMLElement|String} wrapper Element to wrap with - * @param {Object} [attributes] Attributes to set on a wrapper - */ - wrapElement(element: HTMLElement, wrapper: HTMLElement|string, attributes?: any): HTMLElement; - /** - * Returns element scroll offsets - * @param {HTMLElement} element Element to operate on - * @param {HTMLElement} upperCanvasEl Upper canvas element - */ - getScrollLeftTop(element: HTMLElement, upperCanvasEl: HTMLElement): { left: number; right: number; } - /** - * Returns offset for a given element - * @param {HTMLElement} element Element to get offset for - */ - getElementOffset(element: HTMLElement): { left: number; right: number; } - /** - * Returns style attribute value of a given element - * @param {HTMLElement} element Element to get style attribute for - * @param {String} attr Style attribute to get for element - */ - getElementStyle(elment: HTMLElement, attr: string): string; - /** - * Inserts a script element with a given url into a document; invokes callback, when that script is finished loading - * @memberOf fabric.util - * @param {String} url URL of a script to load - * @param {Function} callback Callback to execute when script is finished loading - */ - getScript(url: string, callback: Function): void; - /** - * Makes element unselectable - * @param {HTMLElement} element Element to make unselectable - */ - makeElementUnselectable(element: HTMLElement): HTMLElement; - /** - * Makes element selectable - * @param {HTMLElement} element Element to make selectable - */ - makeElementSelectable(element: HTMLElement): HTMLElement; -} - -interface IUtilDomRequest { - /** - * Cross-browser abstraction for sending XMLHttpRequest - * @param {String} url URL to send XMLHttpRequest to - * @param {Object} [options] Options object - * @param {String} [options.method="GET"] - * @param {Function} options.onComplete Callback to invoke when request is completed - */ - request(url: string, options?: { method?: string; onComplete: Function }): XMLHttpRequest; -} - -interface IUtilDomStyle { - /** - * Cross-browser wrapper for setting element's style - * @param {HTMLElement} element - * @param {Object} styles - */ - setStyle(element: HTMLElement, styles: any): HTMLElement; -} - -interface IUtilArray { - /** - * Invokes method on all items in a given array - * @param {Array} array Array to iterate over - * @param {String} method Name of a method to invoke - */ - invoke(array: any[], method: string): any[]; - /** - * Finds minimum value in array (not necessarily "first" one) - * @param {Array} array Array to iterate over - * @param {String} byProperty - */ - min(array: any[], byProperty: string): any; - /** - * Finds maximum value in array (not necessarily "first" one) - * @param {Array} array Array to iterate over - * @param {String} byProperty - */ - max(array: any[], byProperty: string): any; -} - -interface IUtilClass { - /** - * Helper for creation of "classes". - * @param {Function} [parent] optional "Class" to inherit from - * @param {Object} [properties] Properties shared by all instances of this class - * (be careful modifying objects defined here as this would affect all instances) - */ - createClass(parent: Function, properties?: any); - /** - * Helper for creation of "classes". - * @param {Object} [properties] Properties shared by all instances of this class - * (be careful modifying objects defined here as this would affect all instances) - */ - createClass(properties?: any); - -} - -interface IUtilObject { - /** - * Copies all enumerable properties of one object to another - * @param {Object} destination Where to copy to - * @param {Object} source Where to copy from - */ - extend(destination: any, source: any): any; - - /** - * Creates an empty object and copies all enumerable properties of another object to it - * @memberOf fabric.util.object - * @param {Object} object Object to clone - * @return {Object} - */ - clone(object: any): any -} - -interface IUtilString { - /** - * Camelizes a string - * @param {String} string String to camelize - */ - camelize(string: string): string; - - /** - * Capitalizes a string - * @param {String} string String to capitalize - * @param {Boolean} [firstLetterOnly] If true only first letter is capitalized - * and other letters stay untouched, if false first letter is capitalized - * and other letters are converted to lowercase. - */ - capitalize(string: string, firstLetterOnly: boolean): string; - - /** - * Escapes XML in a string - * @param {String} string String to escape - */ - escapeXml(string: string): string; -} - -interface IUtilMisc { - /** - * Removes value from an array. - * Presence of value (and its position in an array) is determined via `Array.prototype.indexOf` - * @param {Array} array - * @param {Any} value - */ - removeFromArray(array: any[], value: any): any[]; - - /** - * Returns random number between 2 specified ones. - * @param {Number} min lower limit - * @param {Number} max upper limit - */ - getRandomInt(min: number, max: number): number; - - /** - * Transforms degrees to radians. - * @param {Number} degrees value in degrees - */ - degreesToRadians(degrees: number): number; - - /** - * Transforms radians to degrees. - * @memberOf fabric.util - * @param {Number} radians value in radians - */ - radiansToDegrees(radians: number): number; - - /** - * Rotates `point` around `origin` with `radians` - * @param {fabric.Point} point The point to rotate - * @param {fabric.Point} origin The origin of the rotation - * @param {Number} radians The radians of the angle for the rotation - */ - rotatePoint(point: IPoint, origin: IPoint, radians: number): IPoint; - - /** - * Apply transform t to point p - * @param {fabric.Point} p The point to transform - * @param {Array} t The transform - * @param {Boolean} [ignoreOffset] Indicates that the offset should not be applied - */ - transformPoint(p: IPoint, t: any[], ignoreOffset?: boolean): IPoint - - /** - * Invert transformation t - * @param {Array} t The transform - */ - invertTransform(t: any[]): any[]; - - /** - * A wrapper around Number#toFixed, which contrary to native method returns number, not string. - * @param {Number|String} number number to operate on - * @param {Number} fractionDigits number of fraction digits to "leave" - */ - toFixed(number: number, fractionDigits: number): number; - - /** - * Converts from attribute value to pixel value if applicable. - * Returns converted pixels or original value not converted. - * @param {Number|String} value number to operate on - */ - parseUnit(value: number|string, fontSize?: number): number|string; - - /** - * Function which always returns `false`. - */ - falseFunction(): boolean - - /** - * Returns klass "Class" object of given namespace - * @param {String} type Type of object (eg. 'circle') - * @param {String} namespace Namespace to get klass "Class" object from - */ - getKlass(type: string, namespace: string): any; - - /** - * Returns object of given namespace - * @param {String} namespace Namespace string e.g. 'fabric.Image.filter' or 'fabric' - */ - resolveNamespace(namespace: string): any; - - /** - * Loads image element from given url and passes it to a callback - * @param {String} url URL representing an image - * @param {Function} callback Callback; invoked with loaded image - * @param {Any} [context] Context to invoke callback in - * @param {Object} [crossOrigin] crossOrigin value to set image element to - */ - loadImage(url: string, callback: (image: HTMLImageElement) => {}, context?: any, crossOrigin?: boolean): void; - - /** - * Creates corresponding fabric instances from their object representations - * @param {Array} objects Objects to enliven - * @param {Function} callback Callback to invoke when all objects are created - * @param {String} namespace Namespace to get klass "Class" object from - * @param {Function} reviver Method for further parsing of object elements, called after each fabric object created. - */ - enlivenObjects(objects: any[], callback: Function, namespace: string, reviver?: Function): void; - - /** - * Groups SVG elements (usually those retrieved from SVG document) - * @param {Array} elements SVG elements to group - * @param {Object} [options] Options object - */ - groupSVGElements(elements: any[], options?: any, path?: any): IPathGroup - - /** - * Populates an object with properties of another object - * @param {Object} source Source object - * @param {Object} destination Destination object - * @param {Array} properties Propertie names to include - */ - populateWithProperties(source: any, destination: any, properties: any): void; - - /** - * Draws a dashed line between two points - * - * This method is used to draw dashed line around selection area. - * - * @param {CanvasRenderingContext2D} ctx context - * @param {Number} x start x coordinate - * @param {Number} y start y coordinate - * @param {Number} x2 end x coordinate - * @param {Number} y2 end y coordinate - * @param {Array} da dash array pattern - */ - drawDashedLine(ctx: CanvasRenderingContext2D, x: number, y: number, x2: number, y2: number, da: any[]): void; - - /** - * Creates canvas element and initializes it via excanvas if necessary - * @param {CanvasElement} [canvasEl] optional canvas element to initialize; - * when not given, element is created implicitly - */ - createCanvasElement(canvasEl?: HTMLCanvasElement): HTMLCanvasElement; - - /** - * Creates image element (works on client and node) - */ - createImage(): HTMLImageElement; - - /** - * Creates accessors (getXXX, setXXX) for a "class", based on "stateProperties" array - * @param {Object} klass "Class" to create accessors for - */ - createAccessors(klass: any): any; - - /** - * @param {fabric.Object} receiver Object implementing `clipTo` method - * @param {CanvasRenderingContext2D} ctx Context to clip - */ - clipContext(receiver: IObject, ctx: CanvasRenderingContext2D): void; - - /** - * Multiply matrix A by matrix B to nest transformations - * @param {Array} a First transformMatrix - * @param {Array} b Second transformMatrix - */ - multiplyTransformMatrices(a: any[], b: any[]): any[] - - /** - * Returns string representation of function body - * @param {Function} fn Function to get body of - */ - getFunctionBody(fn: Function): string; - - /** - * Returns true if context has transparent pixel - * at specified location (taking tolerance into account) - * @param {CanvasRenderingContext2D} ctx context - * @param {Number} x x coordinate - * @param {Number} y y coordinate - * @param {Number} tolerance Tolerance - */ - isTransparent(ctx: CanvasRenderingContext2D, x: number, y: number, tolerance: number): boolean; -} - - -interface Util extends IUtilAnimation, IUtilArc, IObservable, IUtilDomEvent, IUtilDomMisc, - IUtilDomRequest, IUtilDomStyle, IUtilClass, IUtilMisc { - ease: IUtilAnimEase; - array: IUtilArray; - object: IUtilObject; - string: IUtilString; -} + interface IBlendFilter extends IBaseFilter { + /** + * Applies filter to canvas element + * @param {Object} canvasEl Canvas element to apply filter to + */ + applyTo(canvasEl: HTMLCanvasElement): void; + } + interface IBrightnessFilter extends IBaseFilter { + /** + * Applies filter to canvas element + * @param {Object} canvasEl Canvas element to apply filter to + */ + applyTo(canvasEl: HTMLCanvasElement): void; + } + interface IConvoluteFilter extends IBaseFilter { + /** + * Applies filter to canvas element + * @param {Object} canvasEl Canvas element to apply filter to + */ + applyTo(canvasEl: HTMLCanvasElement): void; + } + interface IGradientTransparencyFilter { + /** + * Applies filter to canvas element + * @param {Object} canvasEl Canvas element to apply filter to + */ + applyTo(canvasEl: HTMLCanvasElement): void; + } + interface IGrayscaleFilter { + /** + * Applies filter to canvas element + * @param {Object} canvasEl Canvas element to apply filter to + */ + applyTo(canvasEl: HTMLCanvasElement): void; + } + interface IInvertFilter { + /** + * Applies filter to canvas element + * @param {Object} canvasEl Canvas element to apply filter to + */ + applyTo(canvasEl: HTMLCanvasElement): void; + } + interface IMaskFilter { + /** + * Applies filter to canvas element + * @param {Object} canvasEl Canvas element to apply filter to + */ + applyTo(canvasEl: HTMLCanvasElement): void; + } + interface IMultiplyFilter { + /** + * Applies filter to canvas element + * @param {Object} canvasEl Canvas element to apply filter to + */ + applyTo(canvasEl: HTMLCanvasElement): void; + } + interface INoiseFilter { + /** + * Applies filter to canvas element + * @param {Object} canvasEl Canvas element to apply filter to + */ + applyTo(canvasEl: HTMLCanvasElement): void; + } + interface IPixelateFilter { + /** + * Applies filter to canvas element + * @param {Object} canvasEl Canvas element to apply filter to + */ + applyTo(canvasEl: HTMLCanvasElement): void; + } + interface IRemoveWhiteFilter { + /** + * Applies filter to canvas element + * @param {Object} canvasEl Canvas element to apply filter to + */ + applyTo(canvasEl: HTMLCanvasElement): void; + } + interface IResizeFilter { + /** + * Resize type + */ + resizeType: string; + + /** + * Scale factor for resizing, x axis + */ + scaleX: number; + + /** + * Scale factor for resizing, y axis + */ + scaleY: number; + + /** + * LanczosLobes parameter for lanczos filter + */ + lanczosLobes: number; + /** + * Applies filter to canvas element + * @param {Object} canvasEl Canvas element to apply filter to + */ + applyTo(canvasEl: HTMLCanvasElement): void; + } + interface ISepiaFilter { + /** + * Applies filter to canvas element + * @param {Object} canvasEl Canvas element to apply filter to + */ + applyTo(canvasEl: HTMLCanvasElement): void; + } + interface ISepia2Filter { + /** + * Applies filter to canvas element + * @param {Object} canvasEl Canvas element to apply filter to + */ + applyTo(canvasEl: HTMLCanvasElement): void; + } + interface ITintFilter { + /** + * Applies filter to canvas element + * @param {Object} canvasEl Canvas element to apply filter to + */ + applyTo(canvasEl: HTMLCanvasElement): void; + } + + //////////////////////////////////////////////////////////// + // Brushes + //////////////////////////////////////////////////////////// + interface IBaseBrush { + /** + * Color of a brush + */ + color: string; + + /** + * Width of a brush + */ + width: number; + + /** + * Shadow object representing shadow of this shape. + * Backwards incompatibility note: This property replaces "shadowColor" (String), "shadowOffsetX" (Number), + * "shadowOffsetY" (Number) and "shadowBlur" (Number) since v1.2.12 + */ + shadow: IShadow|string; + /** + * Line endings style of a brush (one of "butt", "round", "square") + */ + strokeLineCap: string; + + /** + * Corner style of a brush (one of "bevil", "round", "miter") + */ + strokeLineJoin: string; + + /** + * Stroke Dash Array. + */ + strokeDashArray: any[]; + + /** + * Sets shadow of an object + * @param {Object|String} [options] Options object or string (e.g. "2px 2px 10px rgba(0,0,0,0.2)") + */ + setShadow(options: string|any): IBaseBrush; + + } + interface ICircleBrush extends IBaseBrush { + /** + * Width of a brush + */ + width: number; + /** + * Invoked inside on mouse down and mouse move + * @param {Object} pointer + */ + drawDot(pointer: any): void; + + /** + * @param {Object} pointer + * @return {fabric.Point} Just added pointer point + */ + addPoint(pointer: any): IPoint + } + interface ISprayBrush extends IBaseBrush { + /** + * Width of a brush + */ + width: number; + /** + * Density of a spray (number of dots per chunk) + */ + density: number; + + /** + * Width of spray dots + */ + dotWidth: number; + /** + * Width variance of spray dots + */ + dotWidthVariance: number; + + /** + * Whether opacity of a dot should be random + */ + randomOpacity: boolean; + /** + * Whether overlapping dots (rectangles) should be removed (for performance reasons) + */ + optimizeOverlapping: boolean; + /** + * @param {Object} pointer + */ + addSprayChunk(pointer: any): void + } + interface IPatternBrush extends IPencilBrush { + getPatternSrc(): HTMLCanvasElement; + + getPatternSrcFunction(): string; + + /** + * Creates "pattern" instance property + */ + getPattern(): any; + /** + * Creates path + */ + createPath(pathData: string): IPath; + } + interface IPencilBrush extends IBaseBrush { + /** + * Converts points to SVG path + * @param {Array} points Array of points + * @param {Number} minX + * @param {Number} minY + */ + convertPointsToSVGPath(points: { x: number; y: number }[], minX?: number, minY?: number): string[]; + + /** + * Creates fabric.Path object to add on canvas + * @param {String} pathData Path data + */ + createPath(pathData: string): IPath; + } + var BaseBrush: { + new (): IBaseBrush + }; + var CircleBrush: { + new (canvas: fabric.ICanvas): ICircle + }; + var SprayBrush: { + new (canvas: fabric.ICanvas): ISprayBrush + }; + var PencilBrush: { + new (canvas: fabric.ICanvas): IPencilBrush + }; + var PatternBrush: { + new (canvas: fabric.ICanvas): IPatternBrush + }; + /////////////////////////////////////////////////////////////////////////////// + // Fabric util Interface + ////////////////////////////////////////////////////////////////////////////// + interface IUtilAnimationOptions { + /** + * Starting value + */ + startValue?: number; + /** + * Ending value + */ + endValue?: number; + /** + * Value to modify the property by + */ + byValue: number; + /** + * Duration of change (in ms) + */ + duration?: number; + /** + * Callback; invoked on every value change + */ + onChange?: Function; + /** + * Callback; invoked when value change is completed + */ + onComplete?: Function; + /** + * Easing function + */ + easing?: Function; + } + interface IUtilAnimation { + /** + * Changes value from one to another within certain period of time, invoking callbacks as value is being changed. + * @param {Object} [options] Animation options + */ + animate(options?: IUtilAnimationOptions): void; + /** + * requestAnimationFrame polyfill based on http://paulirish.com/2011/requestanimationframe-for-smart-animating/ + * In order to get a precise start time, `requestAnimFrame` should be called as an entry into the method + * @param {Function} callback Callback to invoke + */ + requestAnimFrame(callback: Function): void; + } + + interface IUtilAnimEase { + easeInBack(): Function; + easeInBounce(): Function; + easeInCirc(): Function; + easeInCubic(): Function; + easeInElastic(): Function; + easeInExpo(): Function; + easeInOutBack(): Function; + easeInOutBounce(): Function; + easeInOutCirc(): Function; + easeInOutCubic(): Function; + easeInOutElastic(): Function; + easeInOutExpo(): Function; + easeInOutQuad(): Function; + easeInOutQuart(): Function; + easeInOutQuint(): Function; + easeInOutSine(): Function; + easeInQuad(): Function; + easeInQuart(): Function; + easeInQuint(): Function; + easeInSine(): Function; + easeOutBack(): Function; + easeOutBounce(): Function; + easeOutCirc(): Function; + easeOutCubic(): Function; + easeOutElastic(): Function; + easeOutExpo(): Function; + easeOutQuad(): Function; + easeOutQuart(): Function; + easeOutQuint(): Function; + easeOutSine(): Function; + } + + interface IUtilArc { + /** + * Draws arc + * @param {CanvasRenderingContext2D} ctx + * @param {Number} fx + * @param {Number} fy + * @param {Array} coords + */ + drawArc(ctx: CanvasRenderingContext2D, fx: number, fy: number, coords: number[]): void; + /** + * Calculate bounding box of a elliptic-arc + * @param {Number} fx start point of arc + * @param {Number} fy + * @param {Number} rx horizontal radius + * @param {Number} ry vertical radius + * @param {Number} rot angle of horizontal axe + * @param {Number} large 1 or 0, whatever the arc is the big or the small on the 2 points + * @param {Number} sweep 1 or 0, 1 clockwise or counterclockwise direction + * @param {Number} tx end point of arc + * @param {Number} ty + */ + getBoundsOfArc(fx: number, fy: number, rx: number, ry: number, rot: number, large: number, sweep: number, tx: number, ty: number): IPoint[]; + /** + * Calculate bounding box of a beziercurve + * @param {Number} x0 starting point + * @param {Number} y0 + * @param {Number} x1 first control point + * @param {Number} y1 + * @param {Number} x2 secondo control point + * @param {Number} y2 + * @param {Number} x3 end of beizer + * @param {Number} y3 + */ + getBoundsOfCurve(x0: number, y0: number, x1: number, y1: number, x2: number, y2: number, x3: number, y3: number): IPoint[]; + + } + + interface IUtilDomEvent { + /** + * Cross-browser wrapper for getting event's coordinates + * @param {Event} event Event object + * @param {HTMLCanvasElement} upperCanvasEl <canvas> element on which object selection is drawn + */ + getPointer(event: Event, upperCanvasEl: HTMLCanvasElement): IPoint; + + /** + * Adds an event listener to an element + * @param {HTMLElement} element + * @param {String} eventName + * @param {Function} handler + */ + addListener(element: HTMLElement, eventName: string, handler: Function): void; + + /** + * Removes an event listener from an element + * @param {HTMLElement} element + * @param {String} eventName + * @param {Function} handler + */ + removeListener(element: HTMLElement, eventName: string, handler: Function): void; + } + + interface IUtilDomMisc { + /** + * Takes id and returns an element with that id (if one exists in a document) + * @param {String|HTMLElement} id + */ + getById(id: string|HTMLElement): HTMLElement; + /** + * Converts an array-like object (e.g. arguments or NodeList) to an array + * @param {Object} arrayLike + */ + toArray(arrayLike: any): any[]; + /** + * Creates specified element with specified attributes + * @memberOf fabric.util + * @param {String} tagName Type of an element to create + * @param {Object} [attributes] Attributes to set on an element + * @return {HTMLElement} Newly created element + */ + makeElement(tagName: string, attributes?: any): HTMLElement; + /** + * Adds class to an element + * @param {HTMLElement} element Element to add class to + * @param {String} className Class to add to an element + */ + addClass(element: HTMLElement, classname: string): void; + /** + * Wraps element with another element + * @param {HTMLElement} element Element to wrap + * @param {HTMLElement|String} wrapper Element to wrap with + * @param {Object} [attributes] Attributes to set on a wrapper + */ + wrapElement(element: HTMLElement, wrapper: HTMLElement|string, attributes?: any): HTMLElement; + /** + * Returns element scroll offsets + * @param {HTMLElement} element Element to operate on + * @param {HTMLElement} upperCanvasEl Upper canvas element + */ + getScrollLeftTop(element: HTMLElement, upperCanvasEl: HTMLElement): { left: number; right: number; }; + /** + * Returns offset for a given element + * @param {HTMLElement} element Element to get offset for + */ + getElementOffset(element: HTMLElement): { left: number; right: number; }; + /** + * Returns style attribute value of a given element + * @param {HTMLElement} element Element to get style attribute for + * @param {String} attr Style attribute to get for element + */ + getElementStyle(elment: HTMLElement, attr: string): string; + /** + * Inserts a script element with a given url into a document; invokes callback, when that script is finished loading + * @memberOf fabric.util + * @param {String} url URL of a script to load + * @param {Function} callback Callback to execute when script is finished loading + */ + getScript(url: string, callback: Function): void; + /** + * Makes element unselectable + * @param {HTMLElement} element Element to make unselectable + */ + makeElementUnselectable(element: HTMLElement): HTMLElement; + /** + * Makes element selectable + * @param {HTMLElement} element Element to make selectable + */ + makeElementSelectable(element: HTMLElement): HTMLElement; + } + + interface IUtilDomRequest { + /** + * Cross-browser abstraction for sending XMLHttpRequest + * @param {String} url URL to send XMLHttpRequest to + * @param {Object} [options] Options object + * @param {String} [options.method="GET"] + * @param {Function} options.onComplete Callback to invoke when request is completed + */ + request(url: string, options?: { method?: string; onComplete: Function }): XMLHttpRequest; + } + + interface IUtilDomStyle { + /** + * Cross-browser wrapper for setting element's style + * @param {HTMLElement} element + * @param {Object} styles + */ + setStyle(element: HTMLElement, styles: any): HTMLElement; + } + + interface IUtilArray { + /** + * Invokes method on all items in a given array + * @param {Array} array Array to iterate over + * @param {String} method Name of a method to invoke + */ + invoke(array: any[], method: string): any[]; + /** + * Finds minimum value in array (not necessarily "first" one) + * @param {Array} array Array to iterate over + * @param {String} byProperty + */ + min(array: any[], byProperty: string): any; + /** + * Finds maximum value in array (not necessarily "first" one) + * @param {Array} array Array to iterate over + * @param {String} byProperty + */ + max(array: any[], byProperty: string): any; + } + + interface IUtilClass { + /** + * Helper for creation of "classes". + * @param {Function} [parent] optional "Class" to inherit from + * @param {Object} [properties] Properties shared by all instances of this class + * (be careful modifying objects defined here as this would affect all instances) + */ + createClass(parent: Function, properties?: any); + /** + * Helper for creation of "classes". + * @param {Object} [properties] Properties shared by all instances of this class + * (be careful modifying objects defined here as this would affect all instances) + */ + createClass(properties?: any); + + } + + interface IUtilObject { + /** + * Copies all enumerable properties of one object to another + * @param {Object} destination Where to copy to + * @param {Object} source Where to copy from + */ + extend(destination: any, source: any): any; + + /** + * Creates an empty object and copies all enumerable properties of another object to it + * @memberOf fabric.util.object + * @param {Object} object Object to clone + * @return {Object} + */ + clone(object: any): any + } + + interface IUtilString { + /** + * Camelizes a string + * @param {String} string String to camelize + */ + camelize(string: string): string; + + /** + * Capitalizes a string + * @param {String} string String to capitalize + * @param {Boolean} [firstLetterOnly] If true only first letter is capitalized + * and other letters stay untouched, if false first letter is capitalized + * and other letters are converted to lowercase. + */ + capitalize(string: string, firstLetterOnly: boolean): string; + + /** + * Escapes XML in a string + * @param {String} string String to escape + */ + escapeXml(string: string): string; + } + + interface IUtilMisc { + /** + * Removes value from an array. + * Presence of value (and its position in an array) is determined via `Array.prototype.indexOf` + * @param {Array} array + * @param {Any} value + */ + removeFromArray(array: any[], value: any): any[]; + + /** + * Returns random number between 2 specified ones. + * @param {Number} min lower limit + * @param {Number} max upper limit + */ + getRandomInt(min: number, max: number): number; + + /** + * Transforms degrees to radians. + * @param {Number} degrees value in degrees + */ + degreesToRadians(degrees: number): number; + + /** + * Transforms radians to degrees. + * @memberOf fabric.util + * @param {Number} radians value in radians + */ + radiansToDegrees(radians: number): number; + + /** + * Rotates `point` around `origin` with `radians` + * @param {fabric.Point} point The point to rotate + * @param {fabric.Point} origin The origin of the rotation + * @param {Number} radians The radians of the angle for the rotation + */ + rotatePoint(point: IPoint, origin: IPoint, radians: number): IPoint; + + /** + * Apply transform t to point p + * @param {fabric.Point} p The point to transform + * @param {Array} t The transform + * @param {Boolean} [ignoreOffset] Indicates that the offset should not be applied + */ + transformPoint(p: IPoint, t: any[], ignoreOffset?: boolean): IPoint; + + /** + * Invert transformation t + * @param {Array} t The transform + */ + invertTransform(t: any[]): any[]; + + /** + * A wrapper around Number#toFixed, which contrary to native method returns number, not string. + * @param {Number|String} number number to operate on + * @param {Number} fractionDigits number of fraction digits to "leave" + */ + toFixed(number: number, fractionDigits: number): number; + + /** + * Converts from attribute value to pixel value if applicable. + * Returns converted pixels or original value not converted. + * @param {Number|String} value number to operate on + */ + parseUnit(value: number|string, fontSize?: number): number|string; + + /** + * Function which always returns `false`. + */ + falseFunction(): boolean; + + /** + * Returns klass "Class" object of given namespace + * @param {String} type Type of object (eg. 'circle') + * @param {String} namespace Namespace to get klass "Class" object from + */ + getKlass(type: string, namespace: string): any; + + /** + * Returns object of given namespace + * @param {String} namespace Namespace string e.g. 'fabric.Image.filter' or 'fabric' + */ + resolveNamespace(namespace: string): any; + + /** + * Loads image element from given url and passes it to a callback + * @param {String} url URL representing an image + * @param {Function} callback Callback; invoked with loaded image + * @param {Any} [context] Context to invoke callback in + * @param {Object} [crossOrigin] crossOrigin value to set image element to + */ + loadImage(url: string, callback: (image: HTMLImageElement) => {}, context?: any, crossOrigin?: boolean): void; + + /** + * Creates corresponding fabric instances from their object representations + * @param {Array} objects Objects to enliven + * @param {Function} callback Callback to invoke when all objects are created + * @param {String} namespace Namespace to get klass "Class" object from + * @param {Function} reviver Method for further parsing of object elements, called after each fabric object created. + */ + enlivenObjects(objects: any[], callback: Function, namespace: string, reviver?: Function): void; + + /** + * Groups SVG elements (usually those retrieved from SVG document) + * @param {Array} elements SVG elements to group + * @param {Object} [options] Options object + */ + groupSVGElements(elements: any[], options?: any, path?: any): IPathGroup; + + /** + * Populates an object with properties of another object + * @param {Object} source Source object + * @param {Object} destination Destination object + * @param {Array} properties Propertie names to include + */ + populateWithProperties(source: any, destination: any, properties: any): void; + + /** + * Draws a dashed line between two points + * This method is used to draw dashed line around selection area. + * @param {CanvasRenderingContext2D} ctx context + * @param {Number} x start x coordinate + * @param {Number} y start y coordinate + * @param {Number} x2 end x coordinate + * @param {Number} y2 end y coordinate + * @param {Array} da dash array pattern + */ + drawDashedLine(ctx: CanvasRenderingContext2D, x: number, y: number, x2: number, y2: number, da: any[]): void; + + /** + * Creates canvas element and initializes it via excanvas if necessary + * @param {CanvasElement} [canvasEl] optional canvas element to initialize; + * when not given, element is created implicitly + */ + createCanvasElement(canvasEl?: HTMLCanvasElement): HTMLCanvasElement; + + /** + * Creates image element (works on client and node) + */ + createImage(): HTMLImageElement; + + /** + * Creates accessors (getXXX, setXXX) for a "class", based on "stateProperties" array + * @param {Object} klass "Class" to create accessors for + */ + createAccessors(klass: any): any; + + /** + * @param {fabric.Object} receiver Object implementing `clipTo` method + * @param {CanvasRenderingContext2D} ctx Context to clip + */ + clipContext(receiver: IObject, ctx: CanvasRenderingContext2D): void; + + /** + * Multiply matrix A by matrix B to nest transformations + * @param {Array} a First transformMatrix + * @param {Array} b Second transformMatrix + */ + multiplyTransformMatrices(a: any[], b: any[]): any[]; + + /** + * Returns string representation of function body + * @param {Function} fn Function to get body of + */ + getFunctionBody(fn: Function): string; + + /** + * Returns true if context has transparent pixel + * at specified location (taking tolerance into account) + * @param {CanvasRenderingContext2D} ctx context + * @param {Number} x x coordinate + * @param {Number} y y coordinate + * @param {Number} tolerance Tolerance + */ + isTransparent(ctx: CanvasRenderingContext2D, x: number, y: number, tolerance: number): boolean; + } + + interface IUtil extends IUtilAnimation, IUtilArc, IObservable, IUtilDomEvent, IUtilDomMisc, + IUtilDomRequest, IUtilDomStyle, IUtilClass, IUtilMisc { + ease: IUtilAnimEase; + array: IUtilArray; + object: IUtilObject; + string: IUtilString; + } } From 333fa1e40280c24ae122bc65f022c39b592048b4 Mon Sep 17 00:00:00 2001 From: phillips1012 Date: Mon, 18 May 2015 20:32:47 -0600 Subject: [PATCH 072/179] add typings for node-irc --- node-irc/node-irc-tests.ts | 52 +++ node-irc/node-irc.d.ts | 877 +++++++++++++++++++++++++++++++++++++ 2 files changed, 929 insertions(+) create mode 100644 node-irc/node-irc-tests.ts create mode 100644 node-irc/node-irc.d.ts diff --git a/node-irc/node-irc-tests.ts b/node-irc/node-irc-tests.ts new file mode 100644 index 000000000..1ea58c2dd --- /dev/null +++ b/node-irc/node-irc-tests.ts @@ -0,0 +1,52 @@ +// https://github.com/martynsmith/node-irc/blob/master/example/bot.js +import irc = require('irc'); + +let bot = new irc.Client('irc.dollyfish.net.nz', 'nodebot', { + debug: true, + channels: ['#blah', '#test'] +}); + +bot.addListener('error', ((message) => { + console.error('ERROR: %s: %s', message.command, message.args.join(' ')); +})); + +bot.addListener('message#blah', ((from, message) => { + console.log('<%s> %s', from, message); +})); + +bot.addListener('message', ((from, to, message) => { + console.log('%s => %s: %s', from, to, message); + + if (to.match(/^[#&]/)) { + // channel message + if (message.match(/hello/i)) { + bot.say(to, 'Hello there ' + from); + } + if (message.match(/dance/)) { + setTimeout(() => { bot.say(to, '\u0001ACTION dances: :D\\-<\u0001'); }, 1000); + setTimeout(() => { bot.say(to, '\u0001ACTION dances: :D|-<\u0001'); }, 2000); + setTimeout(() => { bot.say(to, '\u0001ACTION dances: :D/-<\u0001'); }, 3000); + setTimeout(() => { bot.say(to, '\u0001ACTION dances: :D|-<\u0001'); }, 4000); + } + } + else { + // private message + console.log('private message'); + } +})); + +bot.addListener('pm', ((nick, message) => { + console.log('Got private message from %s: %s', nick, message); +})); + +bot.addListener('join', ((channel, who) => { + console.log('%s has joined %s', who, channel); +})); + +bot.addListener('part', ((channel, who, reason) => { + console.log('%s has left %s: %s', who, channel, reason); +})); + +bot.addListener('kick', ((channel, who, by, reason) => { + console.log('%s was kicked from %s by %s: %s', who, channel, by, reason); +})); diff --git a/node-irc/node-irc.d.ts b/node-irc/node-irc.d.ts new file mode 100644 index 000000000..a5a366643 --- /dev/null +++ b/node-irc/node-irc.d.ts @@ -0,0 +1,877 @@ +// Type definitions for node-irc v0.3.12 +// Project: https://github.com/martynsmith/node-irc +// Definitions by: phillips1012 +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/** This library provides IRC client functionality. */ +declare module 'irc' { + import events = require('events'); + import crypto = require('crypto'); + import net = require('net'); + + /** This library provides IRC client functionality. */ + module NodeIRC { + /** A nick connect to an IRC server. */ + export class Client extends events.EventEmitter { + /** + * Socket to the server. Rarely, if ever needed. Use Client#send + * instead. + */ + public conn: net.Socket + + /** + * Channels joined. Includes channel modes, user list, and topic + * information. Only updated after the server recognizes the join. + */ + public chans: { + [index: string]: { + key: string; + serverName: string; + users: { + [index: string]: string; + }; + mode: string; + created: string; + } + } + + /** Features supported by the server */ + public supported: { + channel: { + idlength: string[]; + length: number; + limit: string[]; + modes: { + [index: string]: string; + } + types: string; + }; + + kicklength: number; + maxlist: number[]; + maxtargets: string[]; + modes: number; + nicklength: number + topiclength: number; + usermodes: string; + } + + /** + * The current nick of the client. Updated if the nick changes + */ + public nick: string; + + /** Channel listing data. */ + public channellist: IChannel[]; + + /** IRC server MOTD */ + public motd: string; + + /** Maximum line length */ + public maxLineLength: number; + + /** Bot options */ + public opt: IClientOpts; + + /** Host mask */ + public hostMask: string; + + /** + * Connect to an IRC server + * @param server - server hostname + * @param nick - nickname + * @param opts + */ + constructor( + server: string, + nick: string, + opts?: IClientOpts + ); + + /** + * Send a raw message to the server; generally speaking, it’s best + * not to use this method unless you know what you’re doing. + * @param command - irc command + * @param args - command arguments (splat) + */ + public send( + command: string, + ...args: string[] + ): void; + + /** + * Join the specified channel + * @param channel - channel to join + * @param callback + */ + public join( + channel: string, + callback?: handlers.IJoinChannel + ): void; + + /** + * Part the specified channel + * @param channel - channel to part + * @param message - optional message to send + * @param callback + */ + public part( + channel: string, + message: string, + callback: handlers.IPartChannel + ): void; + + /** + * Send a message to the specified target + * @param target - nick or channel + * @param message - message to send + */ + public say( + target: string, + message: string + ): void; + + /** + * Send a CTCP message to the specified target + * @param target - nick or channel + * @param type - "privmsg" for PRIVMSG, anything else for NOTICE + * @param text - CTCP message + */ + public ctcp( + target: string, + type: string, + text: string + ): void; + + /** + * Send an action to the specified target + * @param target - target + * @param message - message + */ + public action( + target: string, + message: string + ): void; + + /** + * Send a notice to the specified target. + * @param target - nick or channel + * @param message - message to send + */ + public notice( + target: string, + message: string + ): void; + + /** + * Request a whois for the specified nick + * @param nick - nickname + * @param callback + */ + public whois( + nick: string, + callback: handlers.IWhois + ): void; + + /** + * Request a channel listing from the server. The arguments for this + * are farily server specific, this method passes them as specified. + * + * Responses from the server are available via `channellist_start`, + * `channellist_item`, and `channellist` events. + * + * @param args - arguments + */ + public list( + ...args: string[] + ): void; + + /** + * Connect to the server. Use when `autoConnect` is false. + * @param retryCount - times to retry + * @param callback + */ + public connect( + retryCount?: number, + callback?: handlers.IRaw + ): void; + + /** + * Disconnect from the IRC server + * @param message - message to send + * @param callback + */ + public disconnect( + message: string, + callback: () => void + ): void; + + /** + * Activate flood protection “after the fact”. You can also use + * floodProtection while instantiating the Client to enable flood + * protection, and floodProtectionDelay to set the default message + * interval. + * @param interval - ms to wait between messages + */ + public activateFloodProtection( + interval: number + ): void; + } + + /** Client options object */ + export interface IClientOpts { + /** + * IRC username + * @default 'nodebot' + */ + userName?: string; + + /** + * IRC "real name" + * @default 'nodeJS IRC client' + */ + realName?: string; + + /** + * IRC connection port. See + * https://nodejs.org/api/net.html#net_socket_remoteport + * @default 6667 + */ + port?: number; + + /** + * Local interface to bind to for network connections. See + * https://nodejs.org/api/net.html#net_socket_localaddress + */ + localAddress?: string; + + /** + * Should we output debug messages to STDOUT? + * @default false + */ + debug?: boolean; + + /** + * Should we output IRC errors? + * @default false + */ + showErrors?: boolean; + + /** + * Should we auto-rejoin channels? + * @default false + */ + autoRejoin?: boolean; + + /** + * Should we auto-reconnect to networks? + * @default true + */ + autoConnect?: boolean; + + /** + * Channels to join + * @default [] + */ + channels?: string[]; + + /** + * Should SSL be used? Can either be true or crypto credentials. + * @default false + */ + secure?: boolean | crypto.Credentials; + + /** + * Should we accept self-signed certificates? + * @default false + */ + selfSigned?: boolean; + + + /** + * Should we accept expired certificates? + * @default false + */ + certExpired?: boolean; + + /** + * Should we queue our messages to ensure we don't get kicked? + * @default false + */ + floodProtection?: boolean; + + /** + * Delay between messages when flood protection is active + * @default 1000 + */ + floodProtectionDelay?: number; + + /** + * Should we use SASL authentication? + * @default false + */ + sasl?: boolean; + + /** + * Should we strip mIRC colors from the output messages? + * @default false + */ + stripColors?: boolean; + + /** + * Channel prefix + * @default '&#' + */ + channelPrefixes?: string; + + /** + * Characters to split a message at. + * @default 512 + */ + messageSplit?: number; + + /** + * Encoding to use. See + * https://nodejs.org/api/stream.html#stream_readable_setencoding_encoding + * @default 'utf-8' + */ + encoding?: string; + } + + /** Command types */ + export enum CommandType { + normal, reply, error + } + + /** Parsed IRC message. */ + export interface IMessage { + /** Prefix */ + prefix?: string; + + /** Mapped IRC command */ + command: string; + + /** Raw IRC command */ + rawCommand: string; + + /** Command type */ + commandType: CommandType; + + /** Command arguments */ + args: string[]; + } + + /** Whois data */ + export interface IWhoisData { + /** Nickname */ + nick: string; + + /** Username */ + user: string; + + /** Hostnamej */ + host: string; + + /** Real name" */ + realname: string; + + /** Channels */ + channels: string[]; + + /** Server */ + server: string; + + /** Server description string */ + serverinfo: string; + + /** Is this user an operator? */ + operator: string; + } + + /** A channel returned by a channel listing. */ + export interface IChannel { + /** Channel name */ + name: string; + + /** User count */ + users: string; + + /** Topic string */ + topic: string; + } + + /** + * Handler functions for Client. + */ + module handlers { + /** + * 'registered': Emitted when the server sends the initial 001 line, + * indicating you’ve connected to the server. See the raw event for + * details on the message object. + */ + export interface IRegistered { + /** + * @param message - raw message + */ + (message: IMessage): void; + } + + /** + * 'motd': Emitted when the server sends the message of the day to + * clients. + */ + export interface IMotd { + /** + * @param motd - motd string + */ + (motd: string): void; + } + + /** + * 'names': Emitted when the server sends a list of nicks for a channel + * (which happens immediately after joining and on request. The nicks + * object passed to the callback is keyed by nick names, and has + * values ‘’, ‘+’, or ‘@’ depending on the level of that nick in the + * channel. + */ + export interface INames { + /** + * @param channel - channel name + * @param nicks - nicks list + */ + (channel: string, nicks: string[]): void; + } + + /** + * 'names#*' As per ‘names’ event but only emits for the subscribed + * channel. + */ + export interface INamesChannel { + /** + * @param channel - channel name + * @param nicks - nicks list + */ + (nicks: string[]): void; + } + + /** + * 'topic': Emitted when the server sends the channel topic on joining + * a channel, or when a user changes the topic on a channel. See the + * raw event for details on the message object. + */ + export interface ITopic { + /** + * @param channel - channel name + * @param topic - topic + * @param nick - nick + * @param message - raw message + */ + ( + channel: string, + topic: string, + nick: string, + message: IMessage + ): void; + } + + /** + * 'join': Emitted when a user joins a channel (including when the + * client itself joins a channel). See the raw event for details on the + * message object. + */ + export interface IJoin { + /** + * @param channel - channel name + * @param nick - who joined + * @param message - raw message + */ + (channel: string, nick: string, message: IMessage): void; + } + + /** + * 'join#*': As per ‘join’ event but only emits for the subscribed + * channel. See the raw event for details on the message object. + */ + export interface IJoinChannel { + /** + * @param nick - who joined + * @param message - raw message + */ + (nick: string, message: IMessage): void; + } + + /** + * 'part': Emitted when a user parts a channel (including when the + * client itself parts a channel). See the raw event for details on the + * message object. + */ + export interface IPart { + /** + * @param channel - channel name + * @param nick - who parted + * @param reason - part reason + * @param message - raw message + */ + ( + channel: string, + nick: string, + reason: string, + message: IMessage + ): void + } + + /** + * 'part': As per ‘part’ event but only emits for the subscribed + * channel. See the raw event for details on the message object. + */ + export interface IPartChannel { + /** + * @param nick - who parted + * @param reason - part reason + * @param message - raw message + */ + ( + nick: string, + reason: string, + message: IMessage + ): void + } + + /** + * 'kick': Emitted when a user is kicked from a channel. See the raw + * event for details on the message object. + */ + export interface IKick { + /** + * @param channel - channel name + * @param nick - who was kicked + * @param by - kicker + * @param reason - kick reason + * @param message - raw message + */ + ( + channel: string, + nick: string, + by: string, + reason: string, + message: IMessage + ): void; + } + + /** + * 'kick#*': Emitted when a user is kicked from a channel. See the raw + * event for details on the message object. + */ + export interface IKickChannel { + /** + * @param nick - who was kicked + * @param by - kicker + * @param reason - kick reason + * @param message - raw message + */ + ( + nick: string, + by: string, + reason: string, + message: IMessage + ): void; + } + + /** + * 'message': Emitted when a message is sent. to can be either a nick + * (which is most likely this clients nick and means a private message), + * or a channel (which means a message to that channel). See the raw + * event for details on the message object. + */ + export interface IRecievedMessage { + /** + * @param nick - who sent the message + * @param to - to whom was the message sent + * @param text - message text + * @param message - raw message + */ + ( + nick: string, to: string, text: string, message: IMessage + ): void; + } + + /** + * 'message#': Emitted when a message is sent to any channel (i.e. + * exactly the same as the message event but excluding private + * messages. See the raw event for details on the message object. + */ + export interface IMessageAllChannels { + /** + * @param nick - who sent the message + * @param to - to whom was the message sent + * @param text - message text + * @param message - raw message + */ + ( + nick: string, to: string, text: string, message: IMessage + ): void; + } + + /** + * 'message#*': As per ‘message’ event but only emits for the + * subscribed channel. See the raw event for details on the message + * object. + */ + export interface IMessageChannel { + /** + * @param nick - who sent the message + * @param text - message text + * @param message - raw message + */ + (nick: string, text: string, message: IMessage): void; + } + + /** + * 'selfMessage': Emitted when a message is sent from the client. + * `to` is who the message was sent to. It can be either a nick + * (which most likely means a private message), or a channel (which + * means a message to that channel). + */ + export interface ISelfMessage { + (to: string, text: string): void; + } + + /** + * 'notice': Emitted when a notice is sent. to can be either a nick + * (which is most likely this clients nick and means a private + * message), or a channel (which means a message to that channel). nick + * is either the senders nick or null which means that the notice comes + * from the server. See the raw event for details on the message object. + */ + export interface INotice { + /** + * @param nick - from + * @param to - to + * @param text - text + * @param message - raw message + */ + (nick: string, to: string, text: string, message: IMessage): void; + } + + /** + * 'ping': Emitted when a server PINGs the client. The client will + * automatically send a PONG request just before this is emitted. + */ + export interface IPing { + /** + * @param server - server that adiministered the ping + */ + (server: string): void; + } + + /** + * 'pm': As per ‘message’ event but only emits when the message is + * direct to the client. See the raw event for details on the message + * object. + */ + export interface IPm { + /** + * @param nick - sender + * @param text - message text + * @param message - raw message + */ + (nick: string, text: string, message: IMessage): void; + } + + /** + * 'ctcp': Emitted when a CTCP notice or privmsg was received (type + * is either ‘notice’ or ‘privmsg’). See the raw event for details + * on the message object. + */ + export interface ICtcp { + /** + * @param from - sender + * @param to - recievier + * @param text - ctcp text + * @param type - ctcp type + * @param message - raw message + */ + ( + from: string, + to: string, + text: string, + type: string, + message: IMessage + ): void; + } + + + /** + * 'ctcp-*': Emitted when a specific type of CTCP request was + * recieved. + */ + export interface ICtcpSpecific { + /** + * @param from - sender + * @param to - recievier + * @param message - raw message + */ + ( + from: string, + to: string, + text: string, + message: IMessage + ): void; + + ( + from: string, + to: string, + text: string, + type: string, + message: IMessage + ): void; + } + + /** + * 'nick': Emitted when a user changes nick along with the channels + * the user is in. See the raw event for details on the message + * object. + */ + export interface INick { + /** + * @param oldnick - old nickname + * @param newnick - new nickname + * @param channels - channels the nick changed in + * @param message - raw message + */ + ( + oldnick: string, + newnick: string, + channels: string[], + message: IMessage + ): void; + } + + /** + * 'invite': Emitted when the client receives an /invite. See the + * raw event for details on the message object. + */ + export interface IInvite { + /** + * @param channel - channel user was invited to + * @param from - user who invited + * @param message - raw message + */ + (channel: string, from: string, message: IMessage): void; + } + + /** + * '+mode'/'-mode': Emitted when a mode is added or removed from a user or + * channel. channel is the channel which the mode is being set on/in + * . by is the user setting the mode. mode is the single character + * mode identifier. If the mode is being set on a user, argument is + * the nick of the user. If the mode is being set on a channel, + * argument is the argument to the mode. If a channel mode doesn’t + * have any arguments, argument will be ‘undefined’. See the raw + * event for details on the message object. + */ + export interface IModeChange { + /** + * @param channel - channel + * @param by - nick that changed mode + * @param mode - single character mode identifier + * @param argument - mode argument + * @param message - raw message + */ + ( + channel: string, + by: string, + mode: string, + argument: string, + message: IMessage + ): void; + } + + /** + * 'whois': Emitted whenever the server finishes outputting a WHOIS + * response. + */ + export interface IWhois { + (info: IWhoisData): void; + } + + /** + * 'channellist': Emitted when the server has finished returning a + * channel list. The channel_list array is simply a list of the + * objects that were returned in the intervening channellist_item + * events. + * + * This data is also available via the Client.channellist property + * after this event has fired. + */ + export interface IChannelList { + /** + * @param list - channels + */ + ( + list: IChannel[] + ): void; + } + + /** + * 'raw': Emitted when ever the client receives a “message” from + * the server. A message is a parsed line from the server. + */ + export interface IRaw { + /** + * @param message - raw message + */ + (message: IMessage): void; + } + + /** + * 'error': Emitted when ever the server responds with an error-type message. The message parameter is exactly as in the ‘raw’ event. + */ + export interface IError { + /** + * @param message - raw message + */ + (message: IMessage): void; + } + + /** + * 'action': Emitted whenever a user performs an action + * (e.g. /me waves). + */ + export interface IAction { + /** + * @param from - sender + * @param to - reciever + * @param text - text + * @param message - raw message + */ + ( + from: string, to: string, text: string, message: IMessage + ): void; + } + } + } + + /** Colors */ + module NodeIRC.colors { + /** + * Takes a color by name, text, and optionally what color to return. + * @param color - name of color + * @param text - text to color + * @param reset_color - color to set after text + */ + export function wrap( + color: string, text: string, reset_color?: string + ): string; + + /** + * This contains the set of colors available and a function to wrap + * text in a color. + */ + export const codes: { + [index: string]: string; + }; + } + + export = NodeIRC; +} From 03b65ffa983508e69750d5687d12ecfc82538f65 Mon Sep 17 00:00:00 2001 From: phillips1012 Date: Mon, 18 May 2015 20:45:38 -0600 Subject: [PATCH 073/179] fix es6 usage in node-irc --- node-irc/node-irc-tests.ts | 2 +- node-irc/node-irc.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/node-irc/node-irc-tests.ts b/node-irc/node-irc-tests.ts index 1ea58c2dd..07137b876 100644 --- a/node-irc/node-irc-tests.ts +++ b/node-irc/node-irc-tests.ts @@ -1,7 +1,7 @@ // https://github.com/martynsmith/node-irc/blob/master/example/bot.js import irc = require('irc'); -let bot = new irc.Client('irc.dollyfish.net.nz', 'nodebot', { +var bot = new irc.Client('irc.dollyfish.net.nz', 'nodebot', { debug: true, channels: ['#blah', '#test'] }); diff --git a/node-irc/node-irc.d.ts b/node-irc/node-irc.d.ts index a5a366643..6831ece82 100644 --- a/node-irc/node-irc.d.ts +++ b/node-irc/node-irc.d.ts @@ -868,7 +868,7 @@ declare module 'irc' { * This contains the set of colors available and a function to wrap * text in a color. */ - export const codes: { + export var codes: { [index: string]: string; }; } From e10cc3a2829d0a9a3ada99667f8bb9cb6dfc0af0 Mon Sep 17 00:00:00 2001 From: Legokichi Duckscallion Date: Tue, 19 May 2015 12:33:07 +0900 Subject: [PATCH 074/179] JSZip.compressions.DEFLATE add --- jszip/jszip-tests.ts | 45 +++++++++++++++++++++++++++++++------------- jszip/jszip.d.ts | 22 +++++++++++++++++++--- 2 files changed, 51 insertions(+), 16 deletions(-) diff --git a/jszip/jszip-tests.ts b/jszip/jszip-tests.ts index 97fd10450..514beb501 100644 --- a/jszip/jszip-tests.ts +++ b/jszip/jszip-tests.ts @@ -33,18 +33,18 @@ function testJSZip() { var folder = newJszip.folder("test"); if(folder.file("test.txt").asText() == "test string") { log(SEVERITY.INFO, "all ok"); - } + } else { log(SEVERITY.ERROR, "wrong file"); } var folders = newJszip.folder(new RegExp("^test")); - + if(folders.length == 1) { log(SEVERITY.INFO, "all ok"); if(folders[0].dir == true) { log(SEVERITY.INFO, "all ok"); - } + } else { log(SEVERITY.ERROR, "wrong file"); } @@ -59,14 +59,14 @@ function testJSZip() { log(SEVERITY.INFO, "all ok"); } else { - log(SEVERITY.ERROR, "wrong data in files"); + log(SEVERITY.ERROR, "wrong data in files"); } - } + } else { log(SEVERITY.ERROR, "wrong number of files"); } - var filterFiles = newJszip.filter((relativePath: string, file: JSZipObject) => { + var filterFiles = newJszip.filter((relativePath: string, file: JSZipObject) => { if (file.asText() == "test string") { return true; } @@ -82,7 +82,7 @@ function testJSZip() { newJszip.remove("test/test.txt"); - filterFiles = newJszip.filter((relativePath: string, file: JSZipObject) => { + filterFiles = newJszip.filter((relativePath: string, file: JSZipObject) => { if (file.asText() == "test string") { return true; } @@ -95,24 +95,43 @@ function testJSZip() { else { log(SEVERITY.ERROR, "wrong number of files"); } + + var uncompressedStr = JSZip.compressions.DEFLATE.uncompress( + JSZip.compressions.DEFLATE.compress("\0\1\2\3\4\5\6\7",{level:9})); + var uncompressedArr = JSZip.compressions.DEFLATE.uncompress( + JSZip.compressions.DEFLATE.compress([0,1,2,3,4,5,6,7],{level:9})); + var uncompressedUint8Arr = JSZip.compressions.DEFLATE.uncompress( + JSZip.compressions.DEFLATE.compress(new Uint8Array([0,1,2,3,4,5,6,7]),{level:9})); + + var every_match = [0,1,2,3,4,5,6,7].every(function(val, i){ + return uncompressedStr[i] === val && + uncompressedArr[i] === val && + uncompressedUint8Arr[i] === val; + }); + if(every_match) { + log(SEVERITY.INFO, "compress and uncompress ok."); + }else{ + log(SEVERITY.ERROR, "compress or uncompress failed."); + } + } function log(severity:number, message: any) { var log = ""; switch(severity) { - case 0: + case 0: log += "[DEBUG] "; break; - case 1: + case 1: log += "[INFO] "; break; - case 2: + case 2: log += "[WARN] "; break; - case 3: + case 3: log += "[ERROR] "; break; - case 4: + case 4: log += "[FATAL] "; break; default: @@ -122,4 +141,4 @@ function log(severity:number, message: any) { console.log(log += message); } -testJSZip(); \ No newline at end of file +testJSZip(); diff --git a/jszip/jszip.d.ts b/jszip/jszip.d.ts index df571793b..dfa316625 100644 --- a/jszip/jszip.d.ts +++ b/jszip/jszip.d.ts @@ -32,7 +32,7 @@ interface JSZip { /** * Return an new JSZip instance with the given folder as root - * + * * @param name Name of the folder * @return New JSZip object with the given folder as root or null */ @@ -40,7 +40,7 @@ interface JSZip { /** * Returns new JSZip instances with the matching folders as root - * + * * @param name RegExp to match * @return New array of JSZipFile objects which match the RegExp */ @@ -56,7 +56,7 @@ interface JSZip { /** * Removes the file or folder from the archive - * + * * @param path Relative path of file or folder * @return Returns the JSZip instance */ @@ -140,6 +140,18 @@ interface JSZipSupport { nodebuffer: boolean; } +interface DEFLATE { + /** pako.deflateRaw, level:0-9 */ + compress(input: string, compressionOptions: {level:number}): Uint8Array; + compress(input: number[], compressionOptions: {level:number}): Uint8Array; + compress(input: Uint8Array, compressionOptions: {level:number}): Uint8Array; + + /** pako.inflateRaw */ + uncompress(input: string): Uint8Array; + uncompress(input: number[]): Uint8Array; + uncompress(input: Uint8Array): Uint8Array; +} + declare var JSZip: { /** * Create JSZip instance @@ -169,6 +181,10 @@ declare var JSZip: { prototype: JSZip; support: JSZipSupport; + + compressions: { + DEFLATE: DEFLATE; + } } declare module "jszip" { From fd23f8f26c8cb903ae0230c9c97af9c8a609a515 Mon Sep 17 00:00:00 2001 From: Legokichi Duckscallion Date: Tue, 19 May 2015 12:42:18 +0900 Subject: [PATCH 075/179] force travis --- jszip/jszip.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/jszip/jszip.d.ts b/jszip/jszip.d.ts index dfa316625..651a26da5 100644 --- a/jszip/jszip.d.ts +++ b/jszip/jszip.d.ts @@ -181,7 +181,6 @@ declare var JSZip: { prototype: JSZip; support: JSZipSupport; - compressions: { DEFLATE: DEFLATE; } From e8c7e9b41423d5e19910a503f5a82be9ed9d5d91 Mon Sep 17 00:00:00 2001 From: phillips1012 Date: Mon, 18 May 2015 21:46:56 -0600 Subject: [PATCH 076/179] fix references for node-irc --- node-irc/node-irc-tests.ts | 2 ++ node-irc/node-irc.d.ts | 2 ++ 2 files changed, 4 insertions(+) diff --git a/node-irc/node-irc-tests.ts b/node-irc/node-irc-tests.ts index 07137b876..a4af82d80 100644 --- a/node-irc/node-irc-tests.ts +++ b/node-irc/node-irc-tests.ts @@ -1,4 +1,6 @@ +/// // https://github.com/martynsmith/node-irc/blob/master/example/bot.js + import irc = require('irc'); var bot = new irc.Client('irc.dollyfish.net.nz', 'nodebot', { diff --git a/node-irc/node-irc.d.ts b/node-irc/node-irc.d.ts index 6831ece82..ebb3f7e34 100644 --- a/node-irc/node-irc.d.ts +++ b/node-irc/node-irc.d.ts @@ -3,6 +3,8 @@ // Definitions by: phillips1012 // Definitions: https://github.com/borisyankov/DefinitelyTyped +/// + /** This library provides IRC client functionality. */ declare module 'irc' { import events = require('events'); From 155e657e34d2e7b82533ee50e729af3d56dcecc8 Mon Sep 17 00:00:00 2001 From: phillips1012 Date: Mon, 18 May 2015 21:59:55 -0600 Subject: [PATCH 077/179] fix tests for node-irc --- node-irc/node-irc-tests.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/node-irc/node-irc-tests.ts b/node-irc/node-irc-tests.ts index a4af82d80..62d105acc 100644 --- a/node-irc/node-irc-tests.ts +++ b/node-irc/node-irc-tests.ts @@ -8,15 +8,15 @@ var bot = new irc.Client('irc.dollyfish.net.nz', 'nodebot', { channels: ['#blah', '#test'] }); -bot.addListener('error', ((message) => { +bot.addListener('error', ((message: irc.IMessage) => { console.error('ERROR: %s: %s', message.command, message.args.join(' ')); })); -bot.addListener('message#blah', ((from, message) => { +bot.addListener('message#blah', ((from: string, message: string) => { console.log('<%s> %s', from, message); })); -bot.addListener('message', ((from, to, message) => { +bot.addListener('message', ((from: string, to: string, message: string) => { console.log('%s => %s: %s', from, to, message); if (to.match(/^[#&]/)) { @@ -37,18 +37,18 @@ bot.addListener('message', ((from, to, message) } })); -bot.addListener('pm', ((nick, message) => { +bot.addListener('pm', ((nick: string, message: string) => { console.log('Got private message from %s: %s', nick, message); })); -bot.addListener('join', ((channel, who) => { +bot.addListener('join', ((channel: string, who: string) => { console.log('%s has joined %s', who, channel); })); -bot.addListener('part', ((channel, who, reason) => { +bot.addListener('part', ((channel: string, who: string, reason: string) => { console.log('%s has left %s: %s', who, channel, reason); })); -bot.addListener('kick', ((channel, who, by, reason) => { +bot.addListener('kick', ((channel: string, who: string, by: string, reason: string) => { console.log('%s was kicked from %s by %s: %s', who, channel, by, reason); })); From a38b9565636e8fd7720c02b77e4e617e26760fd0 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 19 May 2015 10:45:42 +0200 Subject: [PATCH 078/179] backgrid.d.ts: added some class and exported the module --- backgrid/backgrid.d.ts | 133 +++++++++++++++++++++++++++-------------- 1 file changed, 87 insertions(+), 46 deletions(-) diff --git a/backgrid/backgrid.d.ts b/backgrid/backgrid.d.ts index fcae05d80..3a75e6142 100644 --- a/backgrid/backgrid.d.ts +++ b/backgrid/backgrid.d.ts @@ -8,12 +8,12 @@ declare module Backgrid { interface GridOptions { - columns: Column[]; - collection: Backbone.Collection; - header: Header; - body: Body; - row: Row; - footer: Footer; + columns: Column[]; + collection: Backbone.Collection; + header: Header; + body: Body; + row: Row; + footer: Footer; } class Header extends Backbone.View { @@ -21,65 +21,106 @@ declare module Backgrid { class Footer extends Backbone.View { } - + class Row extends Backbone.View { } class Command { - cancel(); - moveDown(); - moveLeft(); - moveRight(); - moveUp(); - passThru(); - save(); + moveUp(): boolean; + moveDown(): boolean; + moveLeft(): boolean; + moveRight(): boolean; + save(): boolean; + cancel(): boolean; + passThru(): boolean; + } + + class CellFormatter { + fromRaw(rawData: any, model: Backbone.Model); + toRaw(formattedData: any, model: Backbone.Model); + } + + class NumberFormatter extends CellFormatter {} + + class PercentFormatter extends NumberFormatter {} + + class DateTimeFormatter extends CellFormatter {} + + class StringFormatter extends CellFormatter {} + + class EmailFormatter extends CellFormatter {} + + class SelectFormatter extends CellFormatter {} + + class CellEditor extends Backbone.View{ + initialize(options?: any); + postRender(model: Backbone.Model, column: Backbone.Model); + } + + class InputCellEditor extends CellEditor { + render(); + saveOrCancel(event: any); + } + + class Cell extends Backbone.View{ + tagName: string; + formatter: CellFormatter; + editor: InputCellEditor; + enterEditMode(); + renderError(); + exitEditMode(); + remove(); + } + + class StringCell extends Cell { } interface ColumnAttr { - name: string; - cell: string; - headerCell: string; - label: string; - sortable: boolean; - editable: boolean; - renderable: boolean; - formater: string; + name: string; + cell: string; + headerCell: string; + label: string; + sortable: boolean; + editable: boolean; + renderable: boolean; + formater: string; } class Column extends Backbone.Model { - initialize(options?: any); + initialize(options?: any); } class Body extends Backbone.View { - tagName: string; + tagName: string; - initialize(options?: any); - insertRow(model: Backbone.Model, collection: Backbone.Collection, options: any); - moveToNextCell(model: Backbone.Model, cell: Column, command: Command); - refresh(): Body; - remove(): Body; - removeRow(model: Backbone.Model, collection: Backbone.Collection, options: any); - render(): Body; + initialize(options?: any); + insertRow(model: Backbone.Model, collection: Backbone.Collection, options: any); + moveToNextCell(model: Backbone.Model, cell: Column, command: Command); + refresh(): Body; + remove(): Body; + removeRow(model: Backbone.Model, collection: Backbone.Collection, options: any); + render(): Body; } class Grid extends Backbone.View { - body: Backgrid.Body; - className: string; - footer: any; - header: any; - tagName: string; + body: Backgrid.Body; + className: string; + footer: any; + header: any; + tagName: string; - initialize(options: any); - getSelectedModels(): Backbone.Model[]; - insertColumn(...options: any[]): Grid; - insertRow(model: Backbone.Model, collection: Backbone.Collection, options: any); - remove():Grid; - removeColumn(...options: any[]): Grid; - removeRow(model: Backbone.Model, collection: Backbone.Collection, options: any); - render():Grid; + initialize(options: any); + getSelectedModels(): Backbone.Model[]; + insertColumn(...options: any[]): Grid; + insertRow(model: Backbone.Model, collection: Backbone.Collection, options: any); + remove(): Grid; + removeColumn(...options: any[]): Grid; + removeRow(model: Backbone.Model, collection: Backbone.Collection, options: any); + render(): Grid; } - - } +declare module "backgrid" { + export = Backgrid; +} From 2440153cd3bb1037500597f2a2a5407509cd105f Mon Sep 17 00:00:00 2001 From: Aleksey Blokhin Date: Tue, 19 May 2015 12:06:01 +0300 Subject: [PATCH 079/179] Interface updates. --- angular-translate/angular-translate.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/angular-translate/angular-translate.d.ts b/angular-translate/angular-translate.d.ts index 141804791..87a75439b 100644 --- a/angular-translate/angular-translate.d.ts +++ b/angular-translate/angular-translate.d.ts @@ -28,7 +28,6 @@ declare module angular.translate { interface IPartialLoader { addPart(name : string, priority? : number) : T; - setPart(lang : string, part : string, table : ITranslationTable) : T; deletePart(name : string) : T; isPartAvailable(name : string) : boolean; } @@ -39,6 +38,7 @@ declare module angular.translate { } interface ITranslatePartialLoaderProvider extends angular.IServiceProvider, IPartialLoader { + setPart(lang : string, part : string, table : ITranslationTable) : ITranslatePartialLoaderProvider; } interface ITranslateService { From ca2e9fe96668108e4270640a715ae1de3640b541 Mon Sep 17 00:00:00 2001 From: jdtaylor91 Date: Tue, 19 May 2015 15:06:22 +0100 Subject: [PATCH 080/179] Add missing definitions for youtube.d.ts --- youtube/youtube.d.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/youtube/youtube.d.ts b/youtube/youtube.d.ts index 85f96b22f..d7e52ae17 100644 --- a/youtube/youtube.d.ts +++ b/youtube/youtube.d.ts @@ -38,11 +38,11 @@ declare module YT { iv_load_policy?: number; list?: string; listType?: ListType; - loop?; + loop?: number; modestbranding?: number; - origin?; + origin?: string; playerpiid?: string; - playlist?; + playlist?: string[]; rel?: number; showinfo?: number; start?: number; @@ -84,17 +84,17 @@ declare module YT { // Queueing functions loadVideoById(videoId: string, startSeconds?: number, suggestedQuality?: string): void; - loadVideoById(VideoByIdParams): void; + loadVideoById(VideoByIdParams: Object): void; cueVideoById(videoId: string, startSeconds?: number, suggestedQuality?: string): void; - cueVideoById(VideoByIdParams): void; + cueVideoById(VideoByIdParams: Object): void; loadVideoByUrl(mediaContentUrl: string, startSeconds?: number, suggestedQuality?: string): void; - loadVideoByUrl(VideoByUrlParams): void; + loadVideoByUrl(VideoByUrlParams: Object): void; cueVideoByUrl(mediaContentUrl: string, startSeconds?: number, suggestedQuality?: string): void; - cueVideoByUrl(VideoByUrlParams): void; + cueVideoByUrl(VideoByUrlParams: Object): void; // Properties - size; + size: any; // Playing playVideo(): void; @@ -156,4 +156,4 @@ declare module YT { PAUSED, PLAYING } -} +} \ No newline at end of file From 0669ff6b2354aed3f65b48f96af3e954b4ff4ca5 Mon Sep 17 00:00:00 2001 From: Matt Brooks Date: Tue, 19 May 2015 16:15:14 +0100 Subject: [PATCH 081/179] Renamed succinct type definition and test files Renamed files to match Bower package name: - `jquery.succinct/jquery.succinct-tests.ts` to `succinct/succinct-tests.ts` - `jquery.succinct/jquery.succinct.d.ts` to `succinct/succinct.d.ts` --- succinct/succinct-tests.ts | 31 +++++++++++++++++++++++++++++++ succinct/succinct.d.ts | 18 ++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 succinct/succinct-tests.ts create mode 100644 succinct/succinct.d.ts diff --git a/succinct/succinct-tests.ts b/succinct/succinct-tests.ts new file mode 100644 index 000000000..7b81e5f85 --- /dev/null +++ b/succinct/succinct-tests.ts @@ -0,0 +1,31 @@ +/// + +// Call with no arguments (accepting defaults) +$(".truncate").succinct(); + +// Specify size +$(".truncate").succinct({ + size: 120 +}); + +// Specify ellipsis replacement +$(".truncate").succinct({ + omission: "→" +}); + +// Specify flag to leave trailing special characters +$(".truncate").succinct({ + ignore: false +}); + +// Combine options +$(".truncate").succinct({ + size: 120, + omission: '...', + ignore: false +}); + +// Can chain jQuery methods +$(".truncate") + .succinct() + .removeClass("truncate"); \ No newline at end of file diff --git a/succinct/succinct.d.ts b/succinct/succinct.d.ts new file mode 100644 index 000000000..59a1646e3 --- /dev/null +++ b/succinct/succinct.d.ts @@ -0,0 +1,18 @@ +// Type definitions for jQuery Succinct v1.1.0 +// Project: http://mikeking.io/succinct/ +// Definitions by: Matt Brooks +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module JQuerySuccinct { + interface Options { + size?: number; + omission?: string; + ignore?: boolean; + } +} + +interface JQuery { + succinct(settings?: JQuerySuccinct.Options): JQuery; +} \ No newline at end of file From de56afe5ed5b4b6373e3c3d35f62989aa1e825d5 Mon Sep 17 00:00:00 2001 From: Matt Brooks Date: Tue, 19 May 2015 16:18:21 +0100 Subject: [PATCH 082/179] Removing original files left over from rename --- jquery.succinct/jquery.succinct-tests.ts | 31 ------------------------ jquery.succinct/jquery.succinct.d.ts | 18 -------------- 2 files changed, 49 deletions(-) delete mode 100644 jquery.succinct/jquery.succinct-tests.ts delete mode 100644 jquery.succinct/jquery.succinct.d.ts diff --git a/jquery.succinct/jquery.succinct-tests.ts b/jquery.succinct/jquery.succinct-tests.ts deleted file mode 100644 index 7ca72048e..000000000 --- a/jquery.succinct/jquery.succinct-tests.ts +++ /dev/null @@ -1,31 +0,0 @@ -/// - -// Call with no arguments (accepting defaults) -$(".truncate").succinct(); - -// Specify size -$(".truncate").succinct({ - size: 120 -}); - -// Specify ellipsis replacement -$(".truncate").succinct({ - omission: "→" -}); - -// Specify flag to leave trailing special characters -$(".truncate").succinct({ - ignore: false -}); - -// Combine options -$(".truncate").succinct({ - size: 120, - omission: '...', - ignore: false -}); - -// Can chain jQuery methods -$(".truncate") - .succinct() - .removeClass("truncate"); \ No newline at end of file diff --git a/jquery.succinct/jquery.succinct.d.ts b/jquery.succinct/jquery.succinct.d.ts deleted file mode 100644 index 489ee98d2..000000000 --- a/jquery.succinct/jquery.succinct.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -// Type definitions for jQuery Succinct v1.1.0 -// Project: http://mikeking.io/succinct/ -// Definitions by: Matt Brooks -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -/// - -declare module JQuerySuccinct { - interface Options { - size?: number; - omission?: string; - ignore?: boolean; - } -} - -interface JQuery { - succinct(settings?: JQuerySuccinct.Options): JQuery; -} \ No newline at end of file From 38571cb9dd66f6979bbf02b102bddc8a1dbc7472 Mon Sep 17 00:00:00 2001 From: phillips1012 Date: Tue, 19 May 2015 09:43:30 -0600 Subject: [PATCH 083/179] rename node-irc to irc --- node-irc/node-irc-tests.ts => irc/irc-tests.ts | 2 +- node-irc/node-irc.d.ts => irc/irc.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename node-irc/node-irc-tests.ts => irc/irc-tests.ts (98%) rename node-irc/node-irc.d.ts => irc/irc.d.ts (99%) diff --git a/node-irc/node-irc-tests.ts b/irc/irc-tests.ts similarity index 98% rename from node-irc/node-irc-tests.ts rename to irc/irc-tests.ts index 62d105acc..edda5e14f 100644 --- a/node-irc/node-irc-tests.ts +++ b/irc/irc-tests.ts @@ -1,4 +1,4 @@ -/// +/// // https://github.com/martynsmith/node-irc/blob/master/example/bot.js import irc = require('irc'); diff --git a/node-irc/node-irc.d.ts b/irc/irc.d.ts similarity index 99% rename from node-irc/node-irc.d.ts rename to irc/irc.d.ts index ebb3f7e34..11f14ab6f 100644 --- a/node-irc/node-irc.d.ts +++ b/irc/irc.d.ts @@ -1,4 +1,4 @@ -// Type definitions for node-irc v0.3.12 +// Type definitions for irc v0.3.12 // Project: https://github.com/martynsmith/node-irc // Definitions by: phillips1012 // Definitions: https://github.com/borisyankov/DefinitelyTyped From 2dc99a01410103c3e935d6946c195ed1d31edc4e Mon Sep 17 00:00:00 2001 From: Jordi Aranda Date: Tue, 19 May 2015 18:31:48 +0200 Subject: [PATCH 084/179] Callback type definition fix in xhr methods --- d3/d3.d.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/d3/d3.d.ts b/d3/d3.d.ts index 0bf3d599d..fd81d7e9a 100644 --- a/d3/d3.d.ts +++ b/d3/d3.d.ts @@ -304,7 +304,7 @@ declare module D3 { * @param url Url to request * @param callback Function to invoke when resource is loaded or the request fails */ - (url: string, callback?: (xhr: XMLHttpRequest) => void ): Xhr; + (url: string, callback?: (error: any, xhr: XMLHttpRequest) => void ): Xhr; /** * Creates an asynchronous request for specified url * @@ -312,7 +312,7 @@ declare module D3 { * @param mime MIME type to request * @param callback Function to invoke when resource is loaded or the request fails */ - (url: string, mime: string, callback?: (xhr: XMLHttpRequest) => void ): Xhr; + (url: string, mime: string, callback?: (error: any, xhr: XMLHttpRequest) => void ): Xhr; }; /** * Request a text file @@ -324,7 +324,7 @@ declare module D3 { * @param url Url to request * @param callback Function to invoke when resource is loaded or the request fails */ - (url: string, callback?: (response: string) => void ): Xhr; + (url: string, callback?: (error: any, responseText: string) => void ): Xhr; /** * Request a text file * @@ -332,7 +332,7 @@ declare module D3 { * @param mime MIME type to request * @param callback Function to invoke when resource is loaded or the request fails */ - (url: string, mime: string, callback?: (response: string) => void ): Xhr; + (url: string, mime: string, callback?: (error: any, responseText: string) => void ): Xhr; }; /** * Request a JSON blob @@ -351,7 +351,7 @@ declare module D3 { * @param url Url to request * @param callback Function to invoke when resource is loaded or the request fails */ - (url: string, callback?: (response: Document) => void ): Xhr; + (url: string, callback?: (error: any, response: Document) => void ): Xhr; /** * Request an HTML document fragment. * @@ -359,7 +359,7 @@ declare module D3 { * @param mime MIME type to request * @param callback Function to invoke when resource is loaded or the request fails */ - (url: string, mime: string, callback?: (response: Document) => void ): Xhr; + (url: string, mime: string, callback?: (error: any, response: Document) => void ): Xhr; }; /** * Request an XML document fragment. @@ -367,7 +367,7 @@ declare module D3 { * @param url Url to request * @param callback Function to invoke when resource is loaded or the request fails */ - html: (url: string, callback?: (response: DocumentFragment) => void ) => Xhr; + html: (url: string, callback?: (error: any, response: DocumentFragment) => void ) => Xhr; /** * Request a comma-separated values (CSV) file. */ @@ -654,7 +654,7 @@ declare module D3 { * * @param callback Function to invoke on completion of request */ - get(callback?: (xhr: XMLHttpRequest) => void ): Xhr; + get(callback?: (error: any, xhr: XMLHttpRequest) => void ): Xhr; /** * Issue the request using the POST method */ From c514d8784a943e7f9cc470999fabd7689e8695fa Mon Sep 17 00:00:00 2001 From: Jordi Aranda Date: Tue, 19 May 2015 18:57:52 +0200 Subject: [PATCH 085/179] Fixes in callback type definition in xhr methods --- d3/d3.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/d3/d3.d.ts b/d3/d3.d.ts index fd81d7e9a..ae0c8911a 100644 --- a/d3/d3.d.ts +++ b/d3/d3.d.ts @@ -664,14 +664,14 @@ declare module D3 { * * @param callback Function to invoke on completion of request */ - (callback?: (xhr: XMLHttpRequest) => void ): Xhr; + (callback?: (error: any, xhr: XMLHttpRequest) => void ): Xhr; /** * Issue the request using the POST method * * @param data Data to post back in the request * @param callback Function to invoke on completion of request */ - (data: any, callback?: (xhr: XMLHttpRequest) => void ): Xhr; + (data: any, callback?: (error: any, xhr: XMLHttpRequest) => void ): Xhr; }; /** * Issues this request using the specified method @@ -683,7 +683,7 @@ declare module D3 { * @param method Method to use to make the request * @param callback Function to invoke on completion of request */ - (method: string, callback?: (xhr: XMLHttpRequest) => void ): Xhr; + (method: string, callback?: (eror: any, xhr: XMLHttpRequest) => void ): Xhr; /** * Issues this request using the specified method * @@ -691,7 +691,7 @@ declare module D3 { * @param data Data to post back in the request * @param callback Function to invoke on completion of request */ - (method: string, data: any, callback?: (xhr: XMLHttpRequest) => void ): Xhr; + (method: string, data: any, callback?: (error: any, xhr: XMLHttpRequest) => void ): Xhr; }; /** * Aborts this request, if it is currently in-flight From 3efc88b49af47c3632f953a5b2763da364b35332 Mon Sep 17 00:00:00 2001 From: Nick Lee Date: Tue, 19 May 2015 15:14:55 -0400 Subject: [PATCH 086/179] Added uri validator to Joi --- joi/joi.d.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/joi/joi.d.ts b/joi/joi.d.ts index 951fc4045..5e4bfc37b 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; } @@ -252,6 +257,11 @@ 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 to be a valid uri with the passed scheme. + */ + uri(options?: { scheme?: string }): StringSchema; } export interface ArraySchema extends AnySchema { @@ -461,8 +471,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 56532a6b84a85f0bede3f0d5582d838cad6ff563 Mon Sep 17 00:00:00 2001 From: Josh Heyse Date: Tue, 19 May 2015 16:51:02 -0500 Subject: [PATCH 087/179] Added WebSocket router declerations --- websocket/websocket-tests.ts | 44 ++++++++++++++- websocket/websocket.d.ts | 102 +++++++++++++++++++++++++++++++---- 2 files changed, 136 insertions(+), 10 deletions(-) diff --git a/websocket/websocket-tests.ts b/websocket/websocket-tests.ts index 7de0fa5b0..c30ddd3e9 100644 --- a/websocket/websocket-tests.ts +++ b/websocket/websocket-tests.ts @@ -45,6 +45,48 @@ import http = require('http'); console.log(Date.now() + ' Peer ' + connection.remoteAddress + ' disconnected.'); }); }); + + var wsRouter = new websocket.router({ + server: wsServer + }); + + wsRouter.mount('*', (request) => { + if(!originIsAllowed(request.origin)) { + request.reject(); + console.log((new Date()) + ' Connection from origin ' + request.origin + ' rejected.'); + return; + } + + var connection = request.accept('echo-protocol', request.origin); + console.log((new Date()) + ' Connection accepted.'); + connection.on('message', (message: websocket.IMessage) => { + if (message.type === 'utf8') { + console.log('Received Message: ' + message.utf8Data); + connection.sendUTF(message.utf8Data); + } + else if (message.type === 'binary') { + console.log('Received Binary Message of ' + message.binaryData.length + ' bytes'); + connection.sendBytes(message.binaryData); + } + }); + + connection.on('close', (code: number) => { + console.log(Date.now() + ' Peer ' + connection.remoteAddress + ' disconnected.'); + }); + }); + + wsRouter.mount('*', 'protocol', (request) => { + }); + + wsRouter.mount(/^route\/[a-zA-Z]+$/, (request) => { + + }); + + wsRouter.unmount('*'); + wsRouter.unmount('*', 'protocol'); + + wsRouter.unmount(/^route\/[a-zA-Z]+$/); + wsRouter.unmount(/^route\/[a-zA-Z]+$/, 'protocol'); } { @@ -78,7 +120,7 @@ import http = require('http'); setTimeout(sendNumber, 1000); } } - + sendNumber(); }); diff --git a/websocket/websocket.d.ts b/websocket/websocket.d.ts index d984e1bea..d17542e82 100644 --- a/websocket/websocket.d.ts +++ b/websocket/websocket.d.ts @@ -106,7 +106,7 @@ declare module "websocket" { /** * If this is true, websocket connections will be accepted regardless of the path - * and protocol specified by the client. The protocol accepted will be the first + * and protocol specified by the client. The protocol accepted will be the first * that was requested by the client. * @default false */ @@ -118,7 +118,7 @@ declare module "websocket" { * together before going onto the wire. This however comes at the cost of latency. * @default true */ - disableNagleAlgorithm?: boolean; + disableNagleAlgorithm?: boolean; } export class server extends events.EventEmitter { @@ -188,7 +188,7 @@ declare module "websocket" { key: string; /** Parsed resource, including the query string parameters */ resourceURL: url.Url; - + /** * Client's IP. If an `X-Forwarded-For` header is present, the value will be taken * from that header to facilitate WebSocket servers that live behind a reverse-proxy @@ -226,7 +226,7 @@ declare module "websocket" { * After inspecting the `request` properties, call this function on the * request object to accept the connection. If you don't have a particular subprotocol * you wish to speak, you may pass `null` for the `acceptedProtocol` parameter. - * + * * @param [acceptedProtocol] case-insensitive value that was requested by the client */ accept(acceptedProtocol?: string, allowedOrigin?: string, cookies?: ICookie[]): connection; @@ -321,7 +321,7 @@ declare module "websocket" { */ closeReasonCode: number; - /** + /** * The subprotocol that was chosen to be spoken on this connection. This field * will have been converted to lower case. */ @@ -451,13 +451,13 @@ declare module "websocket" { * a Protocol Error on the receiving peer. */ rsv1: boolean; - + /** * Represents the RSV1 field in the framing. Setting this to true will result in * a Protocol Error on the receiving peer. */ rsv2: boolean; - + /** * Represents the RSV1 field in the framing. Setting this to true will result in * a Protocol Error on the receiving peer. @@ -473,7 +473,7 @@ declare module "websocket" { /** * Identifies which kind of frame this is. - * + * * Hex - Dec - Description * 0x00 - 0 - Continuation * 0x01 - 1 - Text Frame @@ -548,7 +548,7 @@ declare module "websocket" { /** * Establish a connection. The remote server will select the best subprotocol that * it supports and send that back when establishing the connection. - * + * * @param [origin] can be used in user-agent scenarios to identify the page containing * any scripting content that caused the connection to be requested. * @param requestUrl should be a standard websocket url @@ -567,6 +567,90 @@ declare module "websocket" { addListener(event: 'connectFailed', cb: (err: Error) => void): client; } + class routerRequest extends events.EventEmitter { + + /** A reference to the original Node HTTP request object */ + httpRequest: http.ClientRequest; + /** A string containing the path that was requested by the client */ + resource: string; + /** Parsed resource, including the query string parameters */ + resourceURL: url.Url; + + /** + * Client's IP. If an `X-Forwarded-For` header is present, the value will be taken + * from that header to facilitate WebSocket servers that live behind a reverse-proxy + */ + remoteAddress: string; + + /** + * If the client is a web browser, origin will be a string containing the URL + * of the page containing the script that opened the connection. + * If the client is not a web browser, origin may be `null` or "*". + */ + origin: string; + + /** The version of the WebSocket protocol requested by the client */ + webSocketVersion: number; + /** An array containing a list of extensions requested by the client */ + requestedExtensions: any[]; + + cookies: ICookie[]; + + constructor(webSocketRequest: request, resolvedProtocol: string); + + /** + * After inspecting the `request` properties, call this function on the + * request object to accept the connection. If you don't have a particular subprotocol + * you wish to speak, you may pass `null` for the `acceptedProtocol` parameter. + * + * @param [acceptedProtocol] case-insensitive value that was requested by the client + */ + accept(acceptedProtocol?: string, allowedOrigin?: string, cookies?: ICookie[]): connection; + + /** + * Reject connection. + * You may optionally pass in an HTTP Status code (such as 404) and a textual + * description that will be sent to the client in the form of an + * `X-WebSocket-Reject-Reason` header. + */ + reject(httpStatus?: number, reason?: string): void; + + // Events + on(event: string, listener: () => void): request; + on(event: 'requestAccepted', cb: (connection: connection) => void): request; + on(event: 'requestRejected', cb: () => void): request; + addListener(event: string, listener: () => void): request; + addListener(event: 'requestAccepted', cb: (connection: connection) => void): request; + addListener(event: 'requestRejected', cb: () => void): request; + } + + interface IRouterConfig { + /* + * The WebSocketServer instance to attach to. + */ + server: server + } + + class router extends events.EventEmitter { + + constructor(config?: IRouterConfig); + + /** Attach to WebSocket server */ + attachServer(server: server): void; + + /** Detach from WebSocket server */ + detachServer(): void; + + mount(path: string, cb: (request: routerRequest) => void): void; + mount(path: string, protocol: string, cb: (request: routerRequest) => void): void; + mount(path: RegExp, cb: (request: routerRequest) => void): void; + mount(path: RegExp, protocol: string, cb: (request: routerRequest) => void): void; + + unmount(path: string, protocol?: string): void; + unmount(path: RegExp, protocol?: string): void; + + } + export var version: string; export var constants: { DEBUG: boolean; From 962cf3f96bf7aa45cf34c5575fb0a70d98a8aa80 Mon Sep 17 00:00:00 2001 From: hansrwindhoff Date: Tue, 19 May 2015 16:29:28 -0600 Subject: [PATCH 088/179] adding defs for https://github.com/gkz/type-check --- type-check/type-check-tests.ts | 95 ++++++++++++++++++++++++++++++++++ type-check/type-check.d.ts | 33 ++++++++++++ 2 files changed, 128 insertions(+) create mode 100644 type-check/type-check-tests.ts create mode 100644 type-check/type-check.d.ts diff --git a/type-check/type-check-tests.ts b/type-check/type-check-tests.ts new file mode 100644 index 000000000..d0c40ba8b --- /dev/null +++ b/type-check/type-check-tests.ts @@ -0,0 +1,95 @@ +// run this in node +/// +import tchecker = require("type-check"); + +var typeCheck = (i1:string|string[],i2:any,i3?: TypeCheck.Options ) => { + console.log(tchecker.typeCheck(i1,i2,i3)); + } ; +var parseType = (i1:string) => { + var res = tchecker.parseType(i1); + console.log(res); + return res; + } ; +var parsedTypeCheck= (i1:any,i2:any) => { + var res =tchecker.parsedTypeCheck(i1,i2); + console.log(res); + return res; + } ; +var TCVersion= () => { console.log(tchecker.VERSION); } ; + + + +console.log("===>testing typeCheck function"); +typeCheck('Number', 1); // true +typeCheck('Number', 2); // true +typeCheck('Number', 'str'); // false +typeCheck('Error', new Error); // true +typeCheck('Undefined', undefined); // true + +console.log("===>testing typeCheck function on Date"); +typeCheck('Date', new Date()); // true +typeCheck('Date', new Date("invalid")); // false + +// Comment +typeCheck('count::Number', 1); // true + +// One type OR another type: +typeCheck('Number | String', 2); // true +typeCheck('Number | String', 'str'); // true + +// Wildcard, matches all types: +typeCheck('*', 2) // true + +// Array, all elements of a single type: +typeCheck('[Number]', [1, 2, 3]); // true +typeCheck('[Number]', [1, 'str', 3]); // false + +// Tuples, or fixed length arrays with elements of different types: +typeCheck('(String, Number)', ['str', 2]); // true +typeCheck('(String, Number)', ['str']); // false +typeCheck('(String, Number)', ['str', 2, 5]); // false + +// Object properties: +typeCheck('{x: Number, y: Boolean}', {x: 2, y: false}); // true +typeCheck('{x: Number, y: Boolean}', {x: 2}); // false +typeCheck('{x: Number, y: Maybe Boolean}', {x: 2}); // true +typeCheck('{x: Number, y: Boolean}', {x: 2, y: false, z: 3}); // false +typeCheck('{x: Number, y: Boolean, ...}', {x: 2, y: false, z: 3}); // true + +// A particular type AND object properties: +typeCheck('RegExp{source: String, ...}', /re/i); // true +typeCheck('RegExp{source: String, ...}', {source: 're'}); // false + + + +console.log("===>testing custom types"); +// Custom types: +var opt = {customTypes: + {Even: { typeOf: 'Number', + validate: function(x:number) { console.log("=>testing even"); return x % 2 === 0; } +}}}; +typeCheck('Even', 2, opt); // true + + +opt = {customTypes: +{Odd : { typeOf: 'Number', + validate: function(x:number) { console.log("=>testing odd");return x % 2 !== 0; } +}}}; +typeCheck('Odd', 3, opt); // true + + +console.log("===>testing nested types"); +// Nested: +var type = '{a: (String, [Number], {y: Array, ...}), b: Error{message: String, ...}}' +typeCheck(type, {a: ['hi', [1, 2, 3], {y: [1, 'ms']}], b: new Error('oh no')}); // true + + + + + +console.log("===>testing parseType function"); +// parseType(type); +var parsedType = parseType( 'Number'); // object +console.log("===>testing parsedTypeCheck function"); +// parsedTypeCheck(parsedType, input, options); +parsedTypeCheck(parsedType, 2); // true diff --git a/type-check/type-check.d.ts b/type-check/type-check.d.ts new file mode 100644 index 000000000..12b7de594 --- /dev/null +++ b/type-check/type-check.d.ts @@ -0,0 +1,33 @@ +// Type definitions for type-check v0.3.1 +// Project: https://github.com/gkz/type-check +// Definitions by: Hans Windhoff +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +declare module TypeCheck { + + export interface CustomType { + [typeName: string]: { + typeOf: string; + validate: (x: any)=> any; + } + } + + export interface Options { + customTypes: CustomType; + } + + export interface TC{ + VERSION: string; + typeCheck: (typeDescription: string , inst: any, options?: Options) => boolean; + parseType: (typeDescription: string) => Object; + parsedTypeCheck: (parsedType: any, obj: any) => boolean; + + } +} + +declare var typecheck: TypeCheck.TC; + +declare module "type-check" { + export=typecheck; +} From 05b8636b50e52f265bd49f42a411f9f92edd799e Mon Sep 17 00:00:00 2001 From: hansrwindhoff Date: Tue, 19 May 2015 16:40:08 -0600 Subject: [PATCH 089/179] adapt test --- type-check/type-check-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/type-check/type-check-tests.ts b/type-check/type-check-tests.ts index d0c40ba8b..b1d629309 100644 --- a/type-check/type-check-tests.ts +++ b/type-check/type-check-tests.ts @@ -2,7 +2,7 @@ /// import tchecker = require("type-check"); -var typeCheck = (i1:string|string[],i2:any,i3?: TypeCheck.Options ) => { +var typeCheck = (i1:string,i2:any,i3?: TypeCheck.Options ) => { console.log(tchecker.typeCheck(i1,i2,i3)); } ; var parseType = (i1:string) => { From c1dcab7dc47e2abbe5bdf560f8129f4fa44d5ae9 Mon Sep 17 00:00:00 2001 From: Phips Peter Date: Tue, 19 May 2015 16:34:16 -0700 Subject: [PATCH 090/179] Updating browser-sync to 2.6.0 This primarily adds watch options --- browser-sync/browser-sync-tests.ts | 10 ++ browser-sync/browser-sync.d.ts | 187 ++++++++++++++++------------- 2 files changed, 112 insertions(+), 85 deletions(-) diff --git a/browser-sync/browser-sync-tests.ts b/browser-sync/browser-sync-tests.ts index 2f5459c2f..0af5dfc00 100644 --- a/browser-sync/browser-sync-tests.ts +++ b/browser-sync/browser-sync-tests.ts @@ -70,3 +70,13 @@ evt.on("init", function () { }); browserSync(config); + +var bs = browserSync.create(); + +bs.init({ + server: "./app" +}); + +bs.reload(); + + diff --git a/browser-sync/browser-sync.d.ts b/browser-sync/browser-sync.d.ts index 4b0cd72c0..db9f3ad3b 100644 --- a/browser-sync/browser-sync.d.ts +++ b/browser-sync/browser-sync.d.ts @@ -3,96 +3,113 @@ // Definitions by: Asana // Definitions: https://github.com/borisyankov/DefinitelyTyped +/// /// declare module "browser-sync" { + import chokidar = require("chokidar"); + import fs = require("fs"); import http = require("http"); - - function BrowserSync(config?: BrowserSync.Options, callback?: (err: Error, bs: Object) => any): void; - - module BrowserSync { - export function reload(): void; - export function reload(file: string): void; - export function reload(files: string[]): void; - export function reload(options: {stream: boolean}): NodeJS.ReadWriteStream; - export function notify(message: string, timeout?: number): void; - - export function exit(): void; - - export var active: boolean; - - export var emitter: NodeJS.EventEmitter; - - interface Options { - files?: string | string[]; - watchOptions?: GazeOptions; - server?: ServerOptions; - proxy?: string | boolean; - port?: number; - https?: boolean; - ghostMode?: GhostOptions | boolean; - logLevel?: string; - logPrefix?: string; - logConnections?: boolean; - logFileChanges?: boolean; - logSnippet?: boolean; - snippetOptions?: SnippetOptions; - tunnel?: string | boolean; - online?: boolean; - open?: string | boolean; - browser?: string | string[]; - xip?: boolean; - notify?: boolean; - scrollProportionally?: boolean; - scrollThrottle?: number; - reloadDelay?: number; - injectChanges?: boolean; - startPath?: string; - minify?: boolean; - host?: string; - codeSync?: boolean; - timestamps?: boolean; - scriptPath?: (path: string) => string; - socket?: SocketOptions; - } - - interface GazeOptions { - interval?: number; - debounceDelay?: number; - mode?: string; - cwd?: string; - } - - interface ServerOptions { - baseDir?: string | string[]; - directory?: boolean; - index?: string; - routes?: {[path: string]: string}; - middleware?: MiddlewareHandler[]; - } - - interface MiddlewareHandler { - (req: http.ServerRequest, res: http.ServerResponse, next: Function): any; - } - - interface GhostOptions { - clicks?: boolean; - scroll?: boolean; - forms?: boolean; - } - - interface SnippetOptions { - ignorePaths?: string; - rule?: {match?: RegExp; fn?: (snippet: string, match: string) => any}; - } - - interface SocketOptions { - path?: string; - clientPath?: string; - namespace?: string; - } + interface Options { + files?: string | string[]; + watchOptions?: GazeOptions; + server?: ServerOptions; + proxy?: string | boolean; + port?: number; + https?: boolean; + ghostMode?: GhostOptions | boolean; + logLevel?: string; + logPrefix?: string; + logConnections?: boolean; + logFileChanges?: boolean; + logSnippet?: boolean; + snippetOptions?: SnippetOptions; + rewriteRules?: boolean | RewriteRules[]; + tunnel?: string | boolean; + online?: boolean; + open?: string | boolean; + browser?: string | string[]; + xip?: boolean; + notify?: boolean; + scrollProportionally?: boolean; + scrollThrottle?: number; + reloadDelay?: number; + reloadDebounce?: number; + plugins?: any[]; + injectChanges?: boolean; + startPath?: string; + minify?: boolean; + host?: string; + codeSync?: boolean; + timestamps?: boolean; + scriptPath?: (path: string) => string; + socket?: SocketOptions; } - export = BrowserSync; + interface GazeOptions { + interval?: number; + debounceDelay?: number; + mode?: string; + cwd?: string; + } + + interface ServerOptions { + baseDir?: string | string[]; + directory?: boolean; + index?: string; + routes?: {[path: string]: string}; + middleware?: MiddlewareHandler[]; + } + + interface MiddlewareHandler { + (req: http.ServerRequest, res: http.ServerResponse, next: Function): any; + } + + interface GhostOptions { + clicks?: boolean; + scroll?: boolean; + forms?: boolean; + } + + interface SnippetOptions { + ignorePaths?: string; + rule?: {match?: RegExp; fn?: (snippet: string, match: string) => any}; + } + + interface SocketOptions { + path?: string; + clientPath?: string; + namespace?: string; + } + + interface RewriteRules { + match: RegExp; + fn: (match: string) => string; + } + + interface BrowserSync { + init(config?: Options, callback?: (err: Error, bs: Object) => any): void; + reload(): void; + reload(file: string): void; + reload(files: string[]): void; + reload(options: {stream: boolean}): NodeJS.ReadWriteStream; + notify(message: string, timeout?: number): void; + exit(): void; + watch(patterns: string, opts?: chokidar.WatchOptions, fn?: (event: string, file: fs.Stats) => any): NodeJS.EventEmitter; + pause(): void; + resume(): void; + emitter: NodeJS.EventEmitter; + active: boolean; + paused: boolean; + } + + interface Exports extends BrowserSync { + create(): BrowserSync; + (config?: Options, callback?: (err: Error, bs: Object) => any): void; + } + + var browserSync: Exports; + + export = browserSync; } From a358c640e7f7110d950f84c419190ee7a11fe5df Mon Sep 17 00:00:00 2001 From: Andy Brown Date: Wed, 20 May 2015 01:21:44 +0100 Subject: [PATCH 091/179] #4372 - add `should` support for fluent & `should` extras --- chai-subset/chai-subset.d.ts | 6 +- chai/chai-tests.ts | 346 +++++++++++++++++++++++++++++++++++ chai/chai.d.ts | 27 ++- 3 files changed, 373 insertions(+), 6 deletions(-) diff --git a/chai-subset/chai-subset.d.ts b/chai-subset/chai-subset.d.ts index 44bbef9cc..b9605241b 100644 --- a/chai-subset/chai-subset.d.ts +++ b/chai-subset/chai-subset.d.ts @@ -1,6 +1,6 @@ // Type definitions for chai-subset 1.0.0 // Project: https://github.com/e-conomic/chai-subset -// Definitions by: Sam Noedel +// Definitions by: Sam Noedel , Andrew Brown // Definitions: https://github.com/borisyankov/DefinitelyTyped /// @@ -11,10 +11,6 @@ declare module Chai { } } -interface Object { - should: Chai.Assertion; -} - declare module "chai-subset" { function chaiSubset(chai: any, utils: any): void; export = chaiSubset; diff --git a/chai/chai-tests.ts b/chai/chai-tests.ts index c3f6fe06a..fdd23da16 100644 --- a/chai/chai-tests.ts +++ b/chai/chai-tests.ts @@ -5,290 +5,416 @@ import chai = require('chai'); var expect = chai.expect; var assert = chai.assert; +var should = chai.should(); declare var err: Function; function chaiVersion() { expect(chai).to.have.property('version'); + (<{}>chai).should.have.property('version'); } function assertion() { expect('test').to.be.a('string'); + 'test'.should.be.a('string'); expect('foo').to.equal('foo'); + 'foo'.should.equal('foo'); + should.equal('foo', 'foo'); +} + +function fail() { + err(() => { + should.fail('foo', 'bar'); + }, 'expected fail to throw an AssertionError'); + err(() => { + should.fail('foo', 'bar', 'should fail'); + }, 'expected fail to throw an AssertionError'); + err(() => { + should.fail('foo', 'bar', 'should fail', 'equal'); + }, 'expected fail to throw an AssertionError'); } // ReSharper disable once InconsistentNaming function _true() { expect(true).to.be.true; + true.should.be.true; expect(false).to.not.be.true; + false.should.not.be.true; expect(1).to.not.be.true; + (1).should.not.be.true; err(() => { expect('test').to.be.true; + 'test'.should.be.true; }, 'expected \'test\' to be true'); } function ok() { expect(true).to.be.ok; + true.should.be.ok; expect(false).to.not.be.ok; + false.should.not.be.ok; expect(1).to.be.ok; + (1).should.be.ok; expect(0).to.not.be.ok; + (0).should.not.be.ok; err(() => { expect('').to.be.ok; + ''.should.be.ok; }, 'expected \'\' to be truthy'); err(() => { expect('test').to.not.be.ok; + 'test'.should.not.be.ok; }, 'expected \'test\' to be falsy'); } function _false() { expect(false).to.be.false; + false.should.be.false; expect(true).to.not.be.false; + true.should.not.be.false; expect(0).to.not.be.false; + (0).should.not.be.false; err(() => { expect('').to.be.false; + ''.should.be.false; }, 'expected \'\' to be false'); } function _null() { expect(null).to.be.null; + should.equal(null, null); expect(false).to.not.be.null; + false.should.not.be.null; err(() => { expect('').to.be.null; + ''.should.be.null; }, 'expected \'\' to be null'); } function _undefined() { expect(undefined).to.be.undefined; + should.equal(undefined, undefined); expect(null).to.not.be.undefined; + should.not.equal(null, undefined); err(() => { expect('').to.be.undefined; + ''.should.be.undefined; }, 'expected \'\' to be undefined'); } function exist() { var foo = 'bar'; expect(foo).to.exist; + should.exist(foo); expect(void(0)).to.not.exist; + should.not.exist(void (0)); } function arguments() { var args = arguments; expect(args).to.be.arguments; + args.should.be.arguments; expect([]).to.not.be.arguments; + [].should.not.be.arguments; expect(args).to.be.an('arguments').and.be.arguments; + args.should.be.an('arguments').and.be.arguments; expect([]).to.be.an('array').and.not.be.Arguments; + [].should.be.an('array').and.not.be.Arguments; } function equal() { expect(undefined).to.equal(void(0)); + should.equal(undefined, void(0)); } function _typeof() { expect('test').to.be.a('string'); + 'test'.should.be.a('string'); err(() => { expect('test').to.not.be.a('string'); + 'test'.should.not.be.a('string'); }, 'expected \'test\' not to be a string'); expect(arguments).to.be.an('arguments'); + arguments.should.be.an('arguments'); expect(5).to.be.a('number'); + (5).should.be.a('number'); + expect(new Number(1)).to.be.a('number'); + (new Number(1)).should.be.a('number'); expect(Number(1)).to.be.a('number'); + Number(1).should.be.a('number'); expect(true).to.be.a('boolean'); + true.should.be.a('boolean'); expect(new Array()).to.be.a('array'); + (new Array()).should.be.a('array'); expect(new Object()).to.be.a('object'); + (new Object()).should.be.a('object'); expect({}).to.be.a('object'); + ({}).should.be.a('object'); expect([]).to.be.a('array'); + [].should.be.a('array'); expect(() => { }).to.be.a('function'); + (() => { }).should.be.a('function'); expect(null).to.be.a('null'); + // N.B. previous line has no should equivalent err(() => { expect(5).to.not.be.a('number', 'blah'); + (5).should.not.be.a('number', 'blah'); }, 'blah: expected 5 not to be a number'); } class Foo { } function _instanceof() { expect(new Foo()).to.be.an.instanceof(Foo); + (new Foo()).should.be.an.instanceof(Foo); err(() => { expect(3).to.an.instanceof(Foo, 'blah'); + (3).should.an.instanceof(Foo, 'blah'); }, 'blah: expected 3 to be an instance of Foo'); } function within() { expect(5).to.be.within(5, 10); + (5).should.be.within(5, 10); expect(5).to.be.within(3, 6); + (5).should.be.within(3, 6); expect(5).to.be.within(3, 5); + (5).should.be.within(3, 5); expect(5).to.not.be.within(1, 3); + (5).should.not.be.within(1, 3); expect('foo').to.have.length.within(2, 4); + 'foo'.should.have.length.within(2, 4); expect([1, 2, 3]).to.have.length.within(2, 4); + [1, 2, 3].should.have.length.within(2, 4); err(() => { expect(5).to.not.be.within(4, 6, 'blah'); + (5).should.not.be.within(4, 6, 'blah'); }, 'blah: expected 5 to not be within 4..6', 'blah'); err(() => { expect(10).to.be.within(50, 100, 'blah'); + (10).should.be.within(50, 100, 'blah'); }, 'blah: expected 10 to be within 50..100'); err(() => { expect('foo').to.have.length.within(5, 7, 'blah'); + 'foo'.should.have.length.within(5, 7, 'blah'); }, 'blah: expected \'foo\' to have a length within 5..7'); err(() => { expect([1, 2, 3]).to.have.length.within(5, 7, 'blah'); + [1, 2, 3].should.have.length.within(5, 7, 'blah'); }, 'blah: expected [ 1, 2, 3 ] to have a length within 5..7'); } function above() { expect(5).to.be.above(2); + (5).should.be.above(2); expect(5).to.be.greaterThan(2); + (5).should.be.greaterThan(2); expect(5).to.not.be.above(5); + (5).should.not.be.above(5); expect(5).to.not.be.above(6); + (5).should.not.be.above(6); expect('foo').to.have.length.above(2); + 'foo'.should.have.length.above(2); expect([1, 2, 3]).to.have.length.above(2); + [1, 2, 3].should.have.length.above(2); err(() => { expect(5).to.be.above(6, 'blah'); + (5).should.be.above(6, 'blah'); }, 'blah: expected 5 to be above 6', 'blah'); err(() => { expect(10).to.not.be.above(6, 'blah'); + (10).should.not.be.above(6, 'blah'); }, 'blah: expected 10 to be at most 6'); err(() => { expect('foo').to.have.length.above(4, 'blah'); + 'foo'.should.have.length.above(4, 'blah'); }, 'blah: expected \'foo\' to have a length above 4 but got 3'); err(() => { expect([1, 2, 3]).to.have.length.above(4, 'blah'); + [1, 2, 3].should.have.length.above(4, 'blah'); }, 'blah: expected [ 1, 2, 3 ] to have a length above 4 but got 3'); } function least() { expect(5).to.be.at.least(2); + (5).should.be.at.least(2); expect(5).to.be.at.least(5); + (5).should.be.at.least(5); expect(5).to.not.be.at.least(6); + (5).should.not.be.at.least(6); expect('foo').to.have.length.of.at.least(2); + 'foo'.should.have.length.of.at.least(2); expect([1, 2, 3]).to.have.length.of.at.least(2); + [1, 2, 3].should.have.length.of.at.least(2); err(() => { expect(5).to.be.at.least(6, 'blah'); + (5).should.be.at.least(6, 'blah'); }, 'blah: expected 5 to be at least 6', 'blah'); err(() => { expect(10).to.not.be.at.least(6, 'blah'); + (10).should.not.be.at.least(6, 'blah'); }, 'blah: expected 10 to be below 6'); err(() => { expect('foo').to.have.length.of.at.least(4, 'blah'); + 'foo'.should.have.length.of.at.least(4, 'blah'); }, 'blah: expected \'foo\' to have a length at least 4 but got 3'); err(() => { expect([1, 2, 3]).to.have.length.of.at.least(4, 'blah'); + [1, 2, 3].should.have.length.of.at.least(4, 'blah'); }, 'blah: expected [ 1, 2, 3 ] to have a length at least 4 but got 3'); err(() => { expect([1, 2, 3, 4]).to.not.have.length.of.at.least(4, 'blah'); + [1, 2, 3, 4].should.not.have.length.of.at.least(4, 'blah'); }, 'blah: expected [ 1, 2, 3, 4 ] to have a length below 4'); } function below() { expect(2).to.be.below(5); + (2).should.be.below(5); expect(2).to.be.lessThan(5); + (2).should.be.lessThan(5); expect(2).to.not.be.below(2); + (2).should.not.be.below(2); expect(2).to.not.be.below(1); + (2).should.not.be.below(1); expect('foo').to.have.length.below(4); + 'foo'.should.have.length.below(4); expect([1, 2, 3]).to.have.length.below(4); + [1, 2, 3].should.have.length.below(4); err(() => { expect(6).to.be.below(5, 'blah'); + (6).should.be.below(5, 'blah'); }, 'blah: expected 6 to be below 5'); err(() => { expect(6).to.not.be.below(10, 'blah'); + (6).should.not.be.below(10, 'blah'); }, 'blah: expected 6 to be at least 10'); err(() => { expect('foo').to.have.length.below(2, 'blah'); + 'foo'.should.have.length.below(2, 'blah'); }, 'blah: expected \'foo\' to have a length below 2 but got 3'); err(() => { expect([1, 2, 3]).to.have.length.below(2, 'blah'); + [1, 2, 3].should.have.length.below(2, 'blah'); }, 'blah: expected [ 1, 2, 3 ] to have a length below 2 but got 3'); } function most() { expect(2).to.be.at.most(5); + (2).should.be.at.most(5); expect(2).to.be.at.most(2); + (2).should.be.at.most(2); expect(2).to.not.be.at.most(1); + (2).should.not.be.at.most(1); expect(2).to.not.be.at.most(1); + (2).should.not.be.at.most(1); expect('foo').to.have.length.of.at.most(4); + 'foo'.should.have.length.of.at.most(4); expect([1, 2, 3]).to.have.length.of.at.most(4); + [1, 2, 3].should.have.length.of.at.most(4); err(() => { expect(6).to.be.at.most(5, 'blah'); + (6).should.be.at.most(5, 'blah'); }, 'blah: expected 6 to be at most 5'); err(() => { expect(6).to.not.be.at.most(10, 'blah'); + (6).should.not.be.at.most(10, 'blah'); }, 'blah: expected 6 to be above 10'); err(() => { expect('foo').to.have.length.of.at.most(2, 'blah'); + 'foo'.should.have.length.of.at.most(2, 'blah'); }, 'blah: expected \'foo\' to have a length at most 2 but got 3'); err(() => { expect([1, 2, 3]).to.have.length.of.at.most(2, 'blah'); + [1, 2, 3].should.have.length.of.at.most(2, 'blah'); }, 'blah: expected [ 1, 2, 3 ] to have a length at most 2 but got 3'); err(() => { expect([1, 2]).to.not.have.length.of.at.most(2, 'blah'); + [1, 2].should.not.have.length.of.at.most(2, 'blah'); }, 'blah: expected [ 1, 2 ] to have a length above 2'); } function match() { expect('foobar').to.match(/^foo/); + 'foobar'.should.match(/^foo/); expect('foobar').to.not.match(/^bar/); + 'foobar'.should.not.match(/^bar/); err(() => { expect('foobar').to.match(/^bar/i, 'blah'); + 'foobar'.should.match(/^bar/i, 'blah'); }, 'blah: expected \'foobar\' to match /^bar/i'); err(() => { expect('foobar').to.not.match(/^foo/i, 'blah'); + 'foobar'.should.not.match(/^foo/i, 'blah'); }, 'blah: expected \'foobar\' not to match /^foo/i'); } function length2() { expect('test').to.have.length(4); + 'test'.should.have.length(4); expect('test').to.not.have.length(3); + 'test'.should.not.have.length(3); expect([1, 2, 3]).to.have.length(3); + [1, 2, 3].should.have.length(3); err(() => { expect(4).to.have.length(3, 'blah'); + (4).should.have.length(3, 'blah'); }, 'blah: expected 4 to have a property \'length\''); err(() => { expect('asd').to.not.have.length(3, 'blah'); + 'asd'.should.not.have.length(3, 'blah'); }, 'blah: expected \'asd\' to not have a length of 3'); } function eql() { expect('test').to.eql('test'); + 'test'.should.eql('test'); expect({ foo: 'bar' }).to.eql({ foo: 'bar' }); + ({ foo: 'bar' }).should.eql({ foo: 'bar' }); expect(1).to.eql(1); + (1).should.eql(1); expect('4').to.not.eql(4); + '4'.should.not.eql(4); err(() => { expect(4).to.eql(3, 'blah'); + (4).should.eql(3, 'blah'); }, 'blah: expected 4 to deeply equal 3'); } @@ -298,39 +424,54 @@ class Buffer { } function buffer() { expect(new Buffer([1])).to.eql(new Buffer([1])); + (new Buffer([1])).should.eql(new Buffer([1])); err(() => { expect(new Buffer([0])).to.eql(new Buffer([1])); + (new Buffer([0])).should.eql(new Buffer([1])); }, 'expected to deeply equal '); } function equal2() { expect('test').to.equal('test'); + 'test'.should.equal('test'); + should.equal('test', 'test'); expect(1).to.equal(1); + (1).should.equal(1); + should.equal(1, 1); err(() => { expect(4).to.equal(3, 'blah'); + (4).should.equal(3, 'blah'); + should.equal(4, 3, 'blah'); }, 'blah: expected 4 to equal 3'); err(() => { expect('4').to.equal(4, 'blah'); + '4'.should.equal(4, 'blah'); + should.equal(4, 4, 'blah'); }, 'blah: expected \'4\' to equal 4'); } function deepEqual() { expect({ foo: 'bar' }).to.deep.equal({ foo: 'bar' }); + ({ foo: 'bar' }).should.deep.equal({ foo: 'bar' }); expect({ foo: 'bar' }).not.to.deep.equal({ foo: 'baz' }); } function deepEqual2() { expect(/a/).to.deep.equal(/a/); + /a/.should.deep.equal(/a/); expect(/a/).not.to.deep.equal(/b/); expect(/a/).not.to.deep.equal({}); expect(/a/g).to.deep.equal(/a/g); + /a/g.should.deep.equal(/a/g); expect(/a/g).not.to.deep.equal(/b/g); expect(/a/i).to.deep.equal(/a/i); + /a/i.should.deep.equal(/a/i); expect(/a/i).not.to.deep.equal(/b/i); expect(/a/m).to.deep.equal(/a/m); + /a/m.should.deep.equal(/a/m); expect(/a/m).not.to.deep.equal(/b/m); } @@ -339,13 +480,18 @@ function deepEqual3() { var a = new Date(1, 2, 3); var b = new Date(4, 5, 6); expect(a).to.deep.equal(a); + a.should.deep.equal(a); expect(a).not.to.deep.equal(b); + a.should.not.deep.equal(b); expect(a).not.to.deep.equal({}); + a.should.not.deep.equal({}); } function deepInclude() { expect(['foo', 'bar']).to.deep.include(['bar', 'foo']); + ['foo', 'bar'].should.deep.include(['bar', 'foo']); expect(['foo', 'bar']).not.to.deep.equal(['foo', 'baz' ]); + ['foo', 'bar'].should.not.deep.equal(['foo', 'baz' ]); } class FakeArgs { @@ -356,239 +502,332 @@ function empty() { FakeArgs.prototype.length = 0; expect('').to.be.empty; + + ''.should.be.empty; expect('foo').not.to.be.empty; + 'foo'.should.not.be.empty; expect([]).to.be.empty; + [].should.be.empty; expect(['foo']).not.to.be.empty; + ['foo'].should.not.be.empty; expect(new FakeArgs).to.be.empty; + (new FakeArgs).should.be.empty; expect({ arguments: 0 }).not.to.be.empty; + ({ arguments: 0 }).should.not.be.empty; expect({}).to.be.empty; + ({}).should.be.empty; expect({ foo: 'bar' }).not.to.be.empty; + ({ foo: 'bar' }).should.not.be.empty; err(() => { expect('').not.to.be.empty; + ''.should.not.be.empty; }, 'expected \'\' not to be empty'); err(() => { expect('foo').to.be.empty; + 'foo'.should.be.empty; + 'foo'.should.be.empty; }, 'expected \'foo\' to be empty'); err(() => { expect([]).not.to.be.empty; + [].should.not.be.empty; }, 'expected [] not to be empty'); err(() => { expect(['foo']).to.be.empty; + ['foo'].should.be.empty; }, 'expected [ \'foo\' ] to be empty'); err(() => { expect(new FakeArgs).not.to.be.empty; + (new FakeArgs).should.not.be.empty; }, 'expected { length: 0 } not to be empty'); err(() => { expect({ arguments: 0 }).to.be.empty; + ({ arguments: 0 }).should.be.empty; }, 'expected { arguments: 0 } to be empty'); err(() => { expect({}).not.to.be.empty; + ({}).should.not.be.empty; }, 'expected {} not to be empty'); err(() => { expect({ foo: 'bar' }).to.be.empty; + ({ foo: 'bar' }).should.be.empty; }, 'expected { foo: \'bar\' } to be empty'); } function property() { expect('test').to.have.property('length'); + 'test'.should.have.property('length'); expect(4).to.not.have.property('length'); + (4).should.not.have.property('length'); expect({ 'foo.bar': 'baz' }) .to.have.property('foo.bar'); + ({ 'foo.bar': 'baz' }).should.have.property('foo.bar'); expect({ foo: { bar: 'baz' } }) .to.not.have.property('foo.bar'); + ({ foo: { bar: 'baz' } }).should.not.have.property('foo.bar'); err(() => { expect('asd').to.have.property('foo'); + 'asd'.should.have.property('foo'); }, 'expected \'asd\' to have a property \'foo\''); err(() => { expect({ foo: { bar: 'baz' } }) .to.have.property('foo.bar'); + ({ foo: { bar: 'baz' } }).should.have.property('foo.bar'); }, 'expected { foo: { bar: \'baz\' } } to have a property \'foo.bar\''); } function deepProperty() { expect({ 'foo.bar': 'baz' }) .to.not.have.deep.property('foo.bar'); + ({ 'foo.bar': 'baz' }).should + .not.have.deep.property('foo.bar'); expect({ foo: { bar: 'baz' } }) .to.have.deep.property('foo.bar'); + ({ foo: { bar: 'baz' } }).should + .have.deep.property('foo.bar'); err(() => { expect({ 'foo.bar': 'baz' }) .to.have.deep.property('foo.bar'); + ({ 'foo.bar': 'baz' }).should + .have.deep.property('foo.bar'); }, 'expected { \'foo.bar\': \'baz\' } to have a deep property \'foo.bar\''); } function property2() { expect('test').to.have.property('length', 4); + 'test'.should.have.property('length', 4); expect('asd').to.have.property('constructor', String); + 'asd'.should.have.property('constructor', String); err(() => { expect('asd').to.have.property('length', 4, 'blah'); + 'asd'.should.have.property('length', 4, 'blah'); }, 'blah: expected \'asd\' to have a property \'length\' of 4, but got 3'); err(() => { expect('asd').to.not.have.property('length', 3, 'blah'); + 'asd'.should.not.have.property('length', 3, 'blah'); }, 'blah: expected \'asd\' to not have a property \'length\' of 3'); err(() => { expect('asd').to.not.have.property('foo', 3, 'blah'); + 'asd'.should.not.have.property('foo', 3, 'blah'); }, 'blah: \'asd\' has no property \'foo\''); err(() => { expect('asd').to.have.property('constructor', Number, 'blah'); + 'asd'.should.have.property('constructor', Number, 'blah'); }, 'blah: expected \'asd\' to have a property \'constructor\' of [Function: Number], but got [Function: String]'); } function deepProperty2() { expect({ foo: { bar: 'baz' } }) .to.have.deep.property('foo.bar', 'baz'); + ({ foo: { bar: 'baz' } }).should + .have.deep.property('foo.bar', 'baz'); err(() => { expect({ foo: { bar: 'baz' } }) .to.have.deep.property('foo.bar', 'quux', 'blah'); + ({ foo: { bar: 'baz' } }).should + .have.deep.property('foo.bar', 'quux', 'blah'); }, 'blah: expected { foo: { bar: \'baz\' } } to have a deep property \'foo.bar\' of \'quux\', but got \'baz\''); err(() => { expect({ foo: { bar: 'baz' } }) .to.not.have.deep.property('foo.bar', 'baz', 'blah'); + ({ foo: { bar: 'baz' } }).should + .not.have.deep.property('foo.bar', 'baz', 'blah'); }, 'blah: expected { foo: { bar: \'baz\' } } to not have a deep property \'foo.bar\' of \'baz\''); err(() => { expect({ foo: 5 }) .to.not.have.deep.property('foo.bar', 'baz', 'blah'); + ({ foo: 5 }).should + .not.have.deep.property('foo.bar', 'baz', 'blah'); }, 'blah: { foo: 5 } has no deep property \'foo.bar\''); } function ownProperty() { expect('test').to.have.ownProperty('length'); + 'test'.should.have.ownProperty('length'); expect('test').to.haveOwnProperty('length'); + 'test'.should.haveOwnProperty('length'); expect({ length: 12 }).to.have.ownProperty('length'); + ({ length: 12 }).should.have.ownProperty('length'); err(() => { expect({ length: 12 }).to.not.have.ownProperty('length', 'blah'); + ({ length: 12 }).should.not.have.ownProperty('length', 'blah'); }, 'blah: expected { length: 12 } to not have own property \'length\''); } function string() { expect('foobar').to.have.string('bar'); + 'foobar'.should.have.string('bar'); expect('foobar').to.have.string('foo'); + 'foobar'.should.have.string('foo'); expect('foobar').to.not.have.string('baz'); + 'foobar'.should.not.have.string('baz'); err(() => { expect(3).to.have.string('baz'); + (3).should.have.string('baz'); }, 'expected 3 to be a string'); err(() => { expect('foobar').to.have.string('baz', 'blah'); + 'foobar'.should.have.string('baz', 'blah'); }, 'blah: expected \'foobar\' to contain \'baz\''); err(() => { expect('foobar').to.not.have.string('bar', 'blah'); + 'foobar'.should.not.have.string('bar', 'blah'); }, 'blah: expected \'foobar\' to not contain \'bar\''); } function include() { expect(['foo', 'bar']).to.include('foo'); + ['foo', 'bar'].should.include('foo'); expect(['foo', 'bar']).to.include('foo'); + ['foo', 'bar'].should.include('foo'); expect(['foo', 'bar']).to.include('bar'); + ['foo', 'bar'].should.include('bar'); expect([1, 2]).to.include(1); + [1, 2].should.include(1); expect(['foo', 'bar']).to.not.include('baz'); + ['foo', 'bar'].should.not.include('baz'); expect(['foo', 'bar']).to.not.include(1); + ['foo', 'bar'].should.not.include(1); err(() => { expect(['foo']).to.include('bar', 'blah'); + ['foo'].should.include('bar', 'blah'); }, 'blah: expected [ \'foo\' ] to include \'bar\''); err(() => { expect(['bar', 'foo']).to.not.include('foo', 'blah'); + ['bar', 'foo'].should.not.include('foo', 'blah'); }, 'blah: expected [ \'bar\', \'foo\' ] to not include \'foo\''); } function keys() { expect({ foo: 1 }).to.have.keys(['foo']); + ({ foo: 1 }).should.have.keys(['foo']); expect({ foo: 1, bar: 2 }).to.have.keys(['foo', 'bar']); + ({ foo: 1, bar: 2 }).should.have.keys(['foo', 'bar']); expect({ foo: 1, bar: 2 }).to.have.keys('foo', 'bar'); + ({ foo: 1, bar: 2 }).should.have.keys('foo', 'bar'); expect({ foo: 1, bar: 2, baz: 3 }).to.contain.keys('foo', 'bar'); + ({ foo: 1, bar: 2, baz: 3 }).should.contain.keys('foo', 'bar'); expect({ foo: 1, bar: 2, baz: 3 }).to.contain.keys('bar', 'foo'); + ({ foo: 1, bar: 2, baz: 3 }).should.contain.keys('bar', 'foo'); expect({ foo: 1, bar: 2, baz: 3 }).to.contain.keys('baz'); + ({ foo: 1, bar: 2, baz: 3 }).should.contain.keys('baz'); expect({ foo: 1, bar: 2 }).to.contain.keys('foo'); + ({ foo: 1, bar: 2 }).should.contain.keys('foo'); expect({ foo: 1, bar: 2 }).to.contain.keys('bar', 'foo'); + ({ foo: 1, bar: 2 }).should.contain.keys('bar', 'foo'); expect({ foo: 1, bar: 2 }).to.contain.keys(['foo']); + ({ foo: 1, bar: 2 }).should.contain.keys(['foo']); expect({ foo: 1, bar: 2 }).to.contain.keys(['bar']); + ({ foo: 1, bar: 2 }).should.contain.keys(['bar']); expect({ foo: 1, bar: 2 }).to.contain.keys(['bar', 'foo']); + ({ foo: 1, bar: 2 }).should.contain.keys(['bar', 'foo']); expect({ foo: 1, bar: 2 }).to.not.have.keys('baz'); + ({ foo: 1, bar: 2 }).should.not.have.keys('baz'); expect({ foo: 1, bar: 2 }).to.not.have.keys('foo', 'baz'); + ({ foo: 1, bar: 2 }).should.not.have.keys('foo', 'baz'); expect({ foo: 1, bar: 2 }).to.not.contain.keys('baz'); + ({ foo: 1, bar: 2 }).should.not.contain.keys('baz'); expect({ foo: 1, bar: 2 }).to.not.contain.keys('foo', 'baz'); + ({ foo: 1, bar: 2 }).should.not.contain.keys('foo', 'baz'); expect({ foo: 1, bar: 2 }).to.not.contain.keys('baz', 'foo'); + ({ foo: 1, bar: 2 }).should.not.contain.keys('baz', 'foo'); err(() => { expect({ foo: 1 }).to.have.keys(); + ({ foo: 1 }).should.have.keys(); }, 'keys required'); err(() => { expect({ foo: 1 }).to.have.keys([]); + ({ foo: 1 }).should.have.keys([]); }, 'keys required'); err(() => { expect({ foo: 1 }).to.not.have.keys([]); + ({ foo: 1 }).should.not.have.keys([]); }, 'keys required'); err(() => { expect({ foo: 1 }).to.contain.keys([]); + ({ foo: 1 }).should.contain.keys([]); }, 'keys required'); err(() => { expect({ foo: 1 }).to.have.keys(['bar']); + ({ foo: 1 }).should.have.keys(['bar']); }, 'expected { foo: 1 } to have key \'bar\''); err(() => { expect({ foo: 1 }).to.have.keys(['bar', 'baz']); + ({ foo: 1 }).should.have.keys(['bar', 'baz']); }, 'expected { foo: 1 } to have keys \'bar\', and \'baz\''); err(() => { expect({ foo: 1 }).to.have.keys(['foo', 'bar', 'baz']); + ({ foo: 1 }).should.have.keys(['foo', 'bar', 'baz']); }, 'expected { foo: 1 } to have keys \'foo\', \'bar\', and \'baz\''); err(() => { expect({ foo: 1 }).to.not.have.keys(['foo']); + ({ foo: 1 }).should.not.have.keys(['foo']); }, 'expected { foo: 1 } to not have key \'foo\''); err(() => { expect({ foo: 1 }).to.not.have.keys(['foo']); + ({ foo: 1 }).should.not.have.keys(['foo']); }, 'expected { foo: 1 } to not have key \'foo\''); err(() => { expect({ foo: 1, bar: 2 }).to.not.have.keys(['foo', 'bar']); + ({ foo: 1, bar: 2 }).should.not.have.keys(['foo', 'bar']); }, 'expected { foo: 1, bar: 2 } to not have keys \'foo\', and \'bar\''); err(() => { expect({ foo: 1 }).to.not.contain.keys(['foo']); + ({ foo: 1 }).should.not.contain.keys(['foo']); }, 'expected { foo: 1 } to not contain key \'foo\''); err(() => { expect({ foo: 1 }).to.contain.keys('foo', 'bar'); + ({ foo: 1 }).should.contain.keys('foo', 'bar'); }, 'expected { foo: 1 } to contain keys \'foo\', and \'bar\''); } function chaining() { var tea = { name: 'chai', extras: ['milk', 'sugar', 'smile'] }; expect(tea).to.have.property('extras').with.lengthOf(3); + tea.should.have.property('extras').with.lengthOf(3); err(() => { expect(tea).to.have.property('extras').with.lengthOf(4); + tea.should.have.property('extras').with.lengthOf(4); }, 'expected [ \'milk\', \'sugar\', \'smile\' ] to have a length of 4 but got 3'); expect(tea).to.be.a('object').and.have.property('name', 'chai'); + tea.should.be.a('object').and.have.property('name', 'chai'); } class PoorlyConstructedError {} @@ -607,97 +846,180 @@ function _throw() { , specificErrFn = () => { throw specificError; }; expect(goodFn).to.not.throw(); + goodFn.should.not.throw(); + should.not.throw(goodFn); expect(goodFn).to.not.throw(Error); + goodFn.should.not.throw(Error); + should.not.throw(goodFn, Error); expect(goodFn).to.not.throw(specificError); + goodFn.should.not.throw(specificError); + should.not.throw(goodFn, specificError); + expect(badFn).to.throw(); + badFn.should.throw(); + should.throw(badFn); expect(badFn).to.throw(Error); + badFn.should.throw(Error); + should.throw(badFn, Error); expect(badFn).to.not.throw(ReferenceError); + badFn.should.not.throw(ReferenceError); + should.not.throw(badFn, ReferenceError); expect(badFn).to.not.throw(specificError); + badFn.should.not.throw(specificError); + should.not.throw(badFn, specificError); + expect(refErrFn).to.throw(); + refErrFn.should.throw(); + should.throw(refErrFn); expect(refErrFn).to.throw(ReferenceError); + refErrFn.should.throw(ReferenceError); + should.throw(refErrFn, ReferenceError); expect(refErrFn).to.throw(Error); + refErrFn.should.throw(Error); + should.throw(refErrFn, Error); expect(refErrFn).to.not.throw(TypeError); + refErrFn.should.not.throw(TypeError); + should.not.throw(refErrFn, TypeError); expect(refErrFn).to.not.throw(specificError); + refErrFn.should.not.throw(specificError); + should.not.throw(refErrFn, specificError); + expect(ickyErrFn).to.throw(); + ickyErrFn.should.throw(); + should.throw(ickyErrFn); expect(ickyErrFn).to.throw(PoorlyConstructedError); + ickyErrFn.should.throw(PoorlyConstructedError); + should.throw(ickyErrFn, PoorlyConstructedError); expect(ickyErrFn).to.throw(Error); + ickyErrFn.should.throw(Error); + should.throw(ickyErrFn, Error); expect(ickyErrFn).to.not.throw(specificError); + ickyErrFn.should.not.throw(specificError); + should.not.throw(ickyErrFn, specificError); expect(specificErrFn).to.throw(specificError); + specificErrFn.should.throw(specificError); + should.throw(ickyErrFn, specificError); expect(badFn).to.throw(/testing/); + badFn.should.throw(/testing/); + should.throw(badFn, /testing/); expect(badFn).to.not.throw(/hello/); + badFn.should.not.throw(/hello/); + should.not.throw(badFn, /hello/); expect(badFn).to.throw('testing'); + badFn.should.throw('testing'); + should.throw(badFn, 'testing'); expect(badFn).to.not.throw('hello'); + badFn.should.not.throw('hello'); + should.not.throw(badFn, 'hello'); expect(badFn).to.throw(Error, /testing/); + badFn.should.throw(Error, /testing/); + should.throw(badFn, Error, /testing/); expect(badFn).to.throw(Error, 'testing'); + badFn.should.throw(Error, 'testing'); + should.throw(badFn, Error, 'testing'); err(() => { expect(goodFn).to.throw(); + goodFn.should.throw(); + should.throw(goodFn); }, 'expected [Function] to throw an error'); err(() => { expect(goodFn).to.throw(ReferenceError); + goodFn.should.throw(ReferenceError); + should.throw(goodFn, ReferenceError); }, 'expected [Function] to throw ReferenceError'); err(() => { expect(goodFn).to.throw(specificError); + goodFn.should.throw(specificError); + should.throw(goodFn, specificError); }, 'expected [Function] to throw [RangeError: boo]'); err(() => { expect(badFn).to.not.throw(); + badFn.should.not.throw(); + should.not.throw(badFn); }, 'expected [Function] to not throw an error but [Error: testing] was thrown'); err(() => { expect(badFn).to.throw(ReferenceError); + badFn.should.throw(ReferenceError); + should.throw(badFn, ReferenceError); }, 'expected [Function] to throw \'ReferenceError\' but [Error: testing] was thrown'); err(() => { expect(badFn).to.throw(specificError); + badFn.should.throw(specificError); + should.throw(badFn, specificError); }, 'expected [Function] to throw [RangeError: boo] but [Error: testing] was thrown'); err(() => { expect(badFn).to.not.throw(Error); + badFn.should.not.throw(Error); + should.not.throw(badFn, Error); }, 'expected [Function] to not throw \'Error\' but [Error: testing] was thrown'); err(() => { expect(refErrFn).to.not.throw(ReferenceError); + refErrFn.should.not.throw(ReferenceError); + should.not.throw(refErrFn, ReferenceError); }, 'expected [Function] to not throw \'ReferenceError\' but [ReferenceError: hello] was thrown'); err(() => { expect(badFn).to.throw(PoorlyConstructedError); + badFn.should.throw(PoorlyConstructedError); + should.throw(badFn, PoorlyConstructedError); }, 'expected [Function] to throw \'PoorlyConstructedError\' but [Error: testing] was thrown'); err(() => { expect(ickyErrFn).to.not.throw(PoorlyConstructedError); + ickyErrFn.should.not.throw(PoorlyConstructedError); + should.not.throw(ickyErrFn, PoorlyConstructedError); }, /^(expected \[Function\] to not throw 'PoorlyConstructedError' but)(.*)(PoorlyConstructedError|\{ Object \()(.*)(was thrown)$/); err(() => { expect(ickyErrFn).to.throw(ReferenceError); + ickyErrFn.should.throw(ReferenceError); + should.throw(ickyErrFn, ReferenceError); }, /^(expected \[Function\] to throw 'ReferenceError' but)(.*)(PoorlyConstructedError|\{ Object \()(.*)(was thrown)$/); err(() => { expect(specificErrFn).to.throw(new ReferenceError('eek')); + specificErrFn.should.throw(new ReferenceError('eek')); + should.throw(specificErrFn, new ReferenceError('eek')); }, 'expected [Function] to throw [ReferenceError: eek] but [RangeError: boo] was thrown'); err(() => { expect(specificErrFn).to.not.throw(specificError); + specificErrFn.should.not.throw(specificError); + should.not.throw(specificErrFn, specificError); }, 'expected [Function] to not throw [RangeError: boo]'); err(() => { expect(badFn).to.not.throw(/testing/); + badFn.should.not.throw(/testing/); + should.not.throw(badFn, /testing/); }, 'expected [Function] to throw error not matching /testing/'); err(() => { expect(badFn).to.throw(/hello/); + badFn.should.throw(/hello/); + should.throw(badFn, /hello/); }, 'expected [Function] to throw error matching /hello/ but got \'testing\''); err(() => { expect(badFn).to.throw(Error, /hello/, 'blah'); + badFn.should.throw(Error, /hello/, 'blah'); + should.throw(badFn, Error, /hello/, 'blah'); }, 'blah: expected [Function] to throw error matching /hello/ but got \'testing\''); err(() => { expect(badFn).to.throw(Error, 'hello', 'blah'); + badFn.should.throw(Error, 'hello', 'blah'); + should.throw(badFn, Error, 'hello', 'blah'); }, 'blah: expected [Function] to throw error including \'hello\' but got \'testing\''); } @@ -712,18 +1034,23 @@ function respondTo() { var bar = {}; expect(Foo).to.respondTo('bar'); + Foo.should.respondTo('bar'); expect(Foo).to.not.respondTo('foo'); + Foo.should.not.respondTo('foo'); expect(Foo).itself.to.respondTo('func'); expect(Foo).itself.not.to.respondTo('bar'); expect(bar).to.respondTo('foo'); + bar.should.respondTo('foo'); err(() => { expect(Foo).to.respondTo('baz', 'constructor'); + Foo.should.respondTo('baz', 'constructor'); }, /^(constructor: expected)(.*)(\[Function: Foo\])(.*)(to respond to \'baz\')$/); err(() => { expect(bar).to.respondTo('baz', 'object'); + bar.should.respondTo('baz', 'object'); }, /^(object: expected)(.*)(\{ foo: \[Function\] \}|\{ Object \()(.*)(to respond to \'baz\')$/); } @@ -733,43 +1060,62 @@ function satisfy() { } expect(1).to.satisfy(matcher); + (1).should.satisfy(matcher); err(() => { expect(2).to.satisfy(matcher, 'blah'); + (2).should.satisfy(matcher, 'blah'); }, 'blah: expected 2 to satisfy [Function: matcher]'); } function closeTo() { expect(1.5).to.be.closeTo(1.0, 0.5); + (1.5).should.be.closeTo(1.0, 0.5); expect(10).to.be.closeTo(20, 20); + (10).should.be.closeTo(20, 20); expect(-10).to.be.closeTo(20, 30); + (-10).should.be.closeTo(20, 30); err(() => { expect(2).to.be.closeTo(1.0, 0.5, 'blah'); + (2).should.be.closeTo(1.0, 0.5, 'blah'); }, 'blah: expected 2 to be close to 1 +/- 0.5'); err(() => { expect(-10).to.be.closeTo(20, 29, 'blah'); + (-10).should.be.closeTo(20, 29, 'blah'); }, 'blah: expected -10 to be close to 20 +/- 29'); } function includeMembers() { expect([1, 2, 3]).to.include.members([]); + [1, 2, 3].should.include.members([]); expect([1, 2, 3]).to.include.members([3, 2]); + [1, 2, 3].should.include.members([3, 2]); + expect([1, 2, 3]).to.not.include.members([8, 4]); + [1, 2, 3].should.not.include.members([8, 4]); + expect([1, 2, 3]).to.not.include.members([1, 2, 3, 4]); + + [1, 2, 3].should.not.include.members([1, 2, 3, 4]); } function sameMembers() { expect([5, 4]).to.have.same.members([4, 5]); + [5, 4].should.have.same.members([4, 5]); expect([5, 4]).to.have.same.members([5, 4]); + [5, 4].should.have.same.members([5, 4]); expect([5, 4]).to.not.have.same.members([]); + [5, 4].should.not.have.same.members([]); expect([5, 4]).to.not.have.same.members([6, 3]); + [5, 4].should.not.have.same.members([6, 3]); expect([5, 4]).to.not.have.same.members([5, 4, 2]); + [5, 4].should.not.have.same.members([5, 4, 2]); } function members() { diff --git a/chai/chai.d.ts b/chai/chai.d.ts index 1134b137d..f693582c5 100644 --- a/chai/chai.d.ts +++ b/chai/chai.d.ts @@ -1,12 +1,15 @@ // Type definitions for chai 2.0.0 // Project: http://chaijs.com/ -// Definitions by: Jed Mao , Bart van der Schoor +// Definitions by: Jed Mao , +// Bart van der Schoor , +// Andrew Brown // Definitions: https://github.com/borisyankov/DefinitelyTyped declare module Chai { interface ChaiStatic { expect: ExpectStatic; + should(): Should; /** * Provides a way to extend the internals of Chai */ @@ -25,6 +28,24 @@ declare module Chai { (target: any, message?: string): Assertion; } + interface ShouldAssertion { + equal(value1: any, value2: any, message?: string): void; + Throw: ShouldThrow; + throw: ShouldThrow; + exist(value: any, message?: string): void; + } + + interface Should extends ShouldAssertion { + not: ShouldAssertion; + fail(actual: any, expected: any, message?: string, operator?: string): void; + } + + interface ShouldThrow { + (actual: Function): void; + (actual: Function, expected: string|RegExp, message?: string): void; + (actual: Function, constructor: Error|Function, expected?: string|RegExp, message?: string): void; + } + interface Assertion extends LanguageChains, NumericComparison, TypeComparison { not: Assertion; deep: Deep; @@ -281,3 +302,7 @@ declare var chai: Chai.ChaiStatic; declare module "chai" { export = chai; } + +interface Object { + should: Chai.Assertion; +} From 908713394efc3c1e8e7ae131c7f7e4d6410551fb Mon Sep 17 00:00:00 2001 From: Sammy Chu Date: Wed, 20 May 2015 13:16:08 +0800 Subject: [PATCH 092/179] update moment-timezone constructor definition, to align the constructor definition of moment --- moment-timezone/moment-timezone-tests.ts | 32 ++++++++++++++++++++++-- moment-timezone/moment-timezone.d.ts | 18 +++++++++++-- 2 files changed, 46 insertions(+), 4 deletions(-) diff --git a/moment-timezone/moment-timezone-tests.ts b/moment-timezone/moment-timezone-tests.ts index 6e818c742..7173b0257 100644 --- a/moment-timezone/moment-timezone-tests.ts +++ b/moment-timezone/moment-timezone-tests.ts @@ -12,14 +12,42 @@ var d = moment.tz("May 12th 2014 8PM", "MMM Do YYYY hA", true, "America/Toronto" a.tz(); -var arr = [2013, 5, 1], +var num = 1367337600000, + arr = [2013, 5, 1], str = "2013-12-01", - obj = { year : 2013, month : 5, day : 1 }; + date = new Date(2013, 4, 1), + mo = moment([2013, 4, 1]), + obj = { year : 2013, month : 5, day : 1 }, + format = "YYYY-MM-DD", + formats = ["YYYY-MM-DD", "YYYY/MM/DD"], + formatsIncludingSpecial: ["YYYY-MM-DD", moment.ISO_8601], + language = "en"; +moment.tz(); moment.tz("America/Los_Angeles"); +moment.tz(num, "America/Los_Angeles"); moment.tz(arr, "America/Los_Angeles"); moment.tz(str, "America/Los_Angeles"); +moment.tz(str, format, "America/Los_Angeles"); +moment.tz(str, format, true, "America/Los_Angeles"); +moment.tz(str, format, language, "America/Los_Angeles"); +moment.tz(str, format, language, true, "America/Los_Angeles"); +moment.tz(str, formats, "America/Los_Angeles"); +moment.tz(str, formats, true, "America/Los_Angeles"); +moment.tz(str, formats, language, "America/Los_Angeles"); +moment.tz(str, formats, language, true, "America/Los_Angeles"); +moment.tz(str, moment.ISO_8601, "America/Los_Angeles"); +moment.tz(str, moment.ISO_8601, true, "America/Los_Angeles"); +moment.tz(str, moment.ISO_8601, language, "America/Los_Angeles"); +moment.tz(str, moment.ISO_8601, language, true, "America/Los_Angeles"); +moment.tz(str, formatsIncludingSpecial, "America/Los_Angeles"); +moment.tz(str, formatsIncludingSpecial, true, "America/Los_Angeles"); +moment.tz(str, formatsIncludingSpecial, language, "America/Los_Angeles"); +moment.tz(str, formatsIncludingSpecial, language, true, "America/Los_Angeles"); + +moment.tz(date, "America/Los_Angeles"); +moment.tz(mo, "America/Los_Angeles"); moment.tz(obj, "America/Los_Angeles"); moment.tz.zone('America/Los_Angeles').abbr(1403465838805); diff --git a/moment-timezone/moment-timezone.d.ts b/moment-timezone/moment-timezone.d.ts index 02d72ac2e..ef9a41142 100644 --- a/moment-timezone/moment-timezone.d.ts +++ b/moment-timezone/moment-timezone.d.ts @@ -28,11 +28,25 @@ interface MomentZone { } interface MomentTimezone { - (timezone: string): moment.Moment; (date: number, timezone: string): moment.Moment; (date: number[], timezone: string): moment.Moment; + (date: string, timezone: string): moment.Moment; (date: string, format: string, timezone: string): moment.Moment; - (date: string, format: string, useStrict: boolean, timezone: string): moment.Moment; + (date: string, format: string, strict: boolean, timezone: string): moment.Moment; + (date: string, format: string, language: string, timezone: string): moment.Moment; + (date: string, format: string, language: string, strict: boolean, timezone: string): moment.Moment; + (date: string, formats: string[], timezone: string): moment.Moment; + (date: string, formats: string[], strict: boolean, timezone: string): moment.Moment; + (date: string, formats: string[], language: string, timezone: string): moment.Moment; + (date: string, formats: string[], language: string, strict: boolean, timezone: string): moment.Moment; + (date: string, specialFormat: () => void, timezone: string): moment.Moment; + (date: string, specialFormat: () => void, strict: boolean, timezone: string): moment.Moment; + (date: string, specialFormat: () => void, language: string, timezone: string): moment.Moment; + (date: string, specialFormat: () => void, language: string, strict: boolean, timezone: string): moment.Moment; + (date: string, formatsIncludingSpecial: any[], timezone: string): moment.Moment; + (date: string, formatsIncludingSpecial: any[], strict: boolean, timezone: string): moment.Moment; + (date: string, formatsIncludingSpecial: any[], language: string, timezone: string): moment.Moment; + (date: string, formatsIncludingSpecial: any[], language: string, strict: boolean, timezone: string): moment.Moment; (date: Date, timezone: string): moment.Moment; (date: moment.Moment, timezone: string): moment.Moment; (date: Object, timezone: string): moment.Moment; From 379e9c0805bca2d0361dc6e9b5206801471fd709 Mon Sep 17 00:00:00 2001 From: Sammy Chu Date: Wed, 20 May 2015 13:16:08 +0800 Subject: [PATCH 093/179] update moment-timezone constructor definition, to align the constructor definition of moment --- moment-timezone/moment-timezone-tests.ts | 32 ++++++++++++++++++++++-- moment-timezone/moment-timezone.d.ts | 18 +++++++++++-- 2 files changed, 46 insertions(+), 4 deletions(-) diff --git a/moment-timezone/moment-timezone-tests.ts b/moment-timezone/moment-timezone-tests.ts index 6e818c742..b7624b63a 100644 --- a/moment-timezone/moment-timezone-tests.ts +++ b/moment-timezone/moment-timezone-tests.ts @@ -12,14 +12,42 @@ var d = moment.tz("May 12th 2014 8PM", "MMM Do YYYY hA", true, "America/Toronto" a.tz(); -var arr = [2013, 5, 1], +var num = 1367337600000, + arr = [2013, 5, 1], str = "2013-12-01", - obj = { year : 2013, month : 5, day : 1 }; + date = new Date(2013, 4, 1), + mo = moment([2013, 4, 1]), + obj = { year : 2013, month : 5, day : 1 }, + format = "YYYY-MM-DD", + formats = ["YYYY-MM-DD", "YYYY/MM/DD"], + formatsIncludingSpecial = ["YYYY-MM-DD", moment.ISO_8601], + language = "en"; +moment.tz(); moment.tz("America/Los_Angeles"); +moment.tz(num, "America/Los_Angeles"); moment.tz(arr, "America/Los_Angeles"); moment.tz(str, "America/Los_Angeles"); +moment.tz(str, format, "America/Los_Angeles"); +moment.tz(str, format, true, "America/Los_Angeles"); +moment.tz(str, format, language, "America/Los_Angeles"); +moment.tz(str, format, language, true, "America/Los_Angeles"); +moment.tz(str, formats, "America/Los_Angeles"); +moment.tz(str, formats, true, "America/Los_Angeles"); +moment.tz(str, formats, language, "America/Los_Angeles"); +moment.tz(str, formats, language, true, "America/Los_Angeles"); +moment.tz(str, moment.ISO_8601, "America/Los_Angeles"); +moment.tz(str, moment.ISO_8601, true, "America/Los_Angeles"); +moment.tz(str, moment.ISO_8601, language, "America/Los_Angeles"); +moment.tz(str, moment.ISO_8601, language, true, "America/Los_Angeles"); +moment.tz(str, formatsIncludingSpecial, "America/Los_Angeles"); +moment.tz(str, formatsIncludingSpecial, true, "America/Los_Angeles"); +moment.tz(str, formatsIncludingSpecial, language, "America/Los_Angeles"); +moment.tz(str, formatsIncludingSpecial, language, true, "America/Los_Angeles"); + +moment.tz(date, "America/Los_Angeles"); +moment.tz(mo, "America/Los_Angeles"); moment.tz(obj, "America/Los_Angeles"); moment.tz.zone('America/Los_Angeles').abbr(1403465838805); diff --git a/moment-timezone/moment-timezone.d.ts b/moment-timezone/moment-timezone.d.ts index 02d72ac2e..ef9a41142 100644 --- a/moment-timezone/moment-timezone.d.ts +++ b/moment-timezone/moment-timezone.d.ts @@ -28,11 +28,25 @@ interface MomentZone { } interface MomentTimezone { - (timezone: string): moment.Moment; (date: number, timezone: string): moment.Moment; (date: number[], timezone: string): moment.Moment; + (date: string, timezone: string): moment.Moment; (date: string, format: string, timezone: string): moment.Moment; - (date: string, format: string, useStrict: boolean, timezone: string): moment.Moment; + (date: string, format: string, strict: boolean, timezone: string): moment.Moment; + (date: string, format: string, language: string, timezone: string): moment.Moment; + (date: string, format: string, language: string, strict: boolean, timezone: string): moment.Moment; + (date: string, formats: string[], timezone: string): moment.Moment; + (date: string, formats: string[], strict: boolean, timezone: string): moment.Moment; + (date: string, formats: string[], language: string, timezone: string): moment.Moment; + (date: string, formats: string[], language: string, strict: boolean, timezone: string): moment.Moment; + (date: string, specialFormat: () => void, timezone: string): moment.Moment; + (date: string, specialFormat: () => void, strict: boolean, timezone: string): moment.Moment; + (date: string, specialFormat: () => void, language: string, timezone: string): moment.Moment; + (date: string, specialFormat: () => void, language: string, strict: boolean, timezone: string): moment.Moment; + (date: string, formatsIncludingSpecial: any[], timezone: string): moment.Moment; + (date: string, formatsIncludingSpecial: any[], strict: boolean, timezone: string): moment.Moment; + (date: string, formatsIncludingSpecial: any[], language: string, timezone: string): moment.Moment; + (date: string, formatsIncludingSpecial: any[], language: string, strict: boolean, timezone: string): moment.Moment; (date: Date, timezone: string): moment.Moment; (date: moment.Moment, timezone: string): moment.Moment; (date: Object, timezone: string): moment.Moment; From f8a90040348e83926f44e690b209769c4f88b961 Mon Sep 17 00:00:00 2001 From: Sammy Chu Date: Wed, 20 May 2015 13:28:42 +0800 Subject: [PATCH 094/179] update moment-timezone constructor definition, to align the constructor definition of moment --- moment-timezone/moment-timezone.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/moment-timezone/moment-timezone.d.ts b/moment-timezone/moment-timezone.d.ts index ef9a41142..2ac473057 100644 --- a/moment-timezone/moment-timezone.d.ts +++ b/moment-timezone/moment-timezone.d.ts @@ -28,6 +28,8 @@ interface MomentZone { } interface MomentTimezone { + (): moment.Moment; + (timezone: string): moment.Moment; (date: number, timezone: string): moment.Moment; (date: number[], timezone: string): moment.Moment; (date: string, timezone: string): moment.Moment; From 5e2826c8a55004946b0b00fd8823063912b8128f Mon Sep 17 00:00:00 2001 From: John Reilly Date: Wed, 20 May 2015 10:39:52 +0100 Subject: [PATCH 095/179] Update angular.d.ts - JSDoc-ed the $cacheFactory --- angularjs/angular.d.ts | 87 +++++++++++++++++++++++++++++++++++------- 1 file changed, 74 insertions(+), 13 deletions(-) diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index 7d1f3140b..92784af38 100755 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -1032,37 +1032,98 @@ declare module angular { disableAutoScrolling(): void; } - /////////////////////////////////////////////////////////////////////////// - // CacheFactoryService - // see http://docs.angularjs.org/api/ng.$cacheFactory - /////////////////////////////////////////////////////////////////////////// + /** + * $cacheFactory - service in module ng + * + * Factory that constructs Cache objects and gives access to them. + * + * see https://docs.angularjs.org/api/ng/service/$cacheFactory + */ interface ICacheFactoryService { - // Lets not foce the optionsMap to have the capacity member. Even though - // it's the ONLY option considered by the implementation today, a consumer - // might find it useful to associate some other options to the cache object. - //(cacheId: string, optionsMap?: { capacity: number; }): CacheObject; - (cacheId: string, optionsMap?: { capacity: number; }): ICacheObject; + /** + * Factory that constructs Cache objects and gives access to them. + * + * @param cacheId Name or id of the newly created cache. + * @param optionsMap Options object that specifies the cache behavior. Properties: + * + * capacity — turns the cache into LRU cache. + */ + (cacheId: string, optionsMap?: { capacity?: number; }): ICacheObject; - // Methods bellow are not documented + /** + * Get information about all the caches that have been created. + * @returns key-value map of cacheId to the result of calling cache#info + */ info(): any; + + /** + * Get access to a cache object by the cacheId used when it was created. + * + * @param cacheId Name or id of a cache to access. + */ get(cacheId: string): ICacheObject; } + /** + * $cacheFactory.Cache - type in module ng + * + * A cache object used to store and retrieve data, primarily used by $http and the script directive to cache templates and other data. + * + * see https://docs.angularjs.org/api/ng/type/$cacheFactory.Cache + */ interface ICacheObject { + /** + * Retrieve information regarding a particular Cache. + */ info(): { + /** + * the id of the cache instance + */ id: string; + + /** + * the number of entries kept in the cache instance + */ size: number; - // Not garanteed to have, since it's a non-mandatory option - //capacity: number; + //...: any additional properties from the options object when creating the cache. }; + + /** + * Inserts a named entry into the Cache object to be retrieved later, and incrementing the size of the cache if the key was not already present in the cache. If behaving like an LRU cache, it will also remove stale entries from the set. + * + * It will not insert undefined values into the cache. + * + * @param key the key under which the cached data is stored. + * @param value the value to store alongside the key. If it is undefined, the key will not be stored. + */ put(key: string, value?: T): T; + + /** + * Retrieves named data stored in the Cache object. + * + * @param key the key of the data to be retrieved + */ get(key: string): any; + + /** + * Removes an entry from the Cache object. + * + * @param key the key of the entry to be removed + */ remove(key: string): void; + + /** + * Clears the cache object of any entries. + */ removeAll(): void; + + /** + * Destroys the Cache object entirely, removing it from the $cacheFactory set. + */ destroy(): void; } - + /////////////////////////////////////////////////////////////////////////// // CompileService // see http://docs.angularjs.org/api/ng.$compile From f275bd2ed5814e1c881b47f8211852c56db9d826 Mon Sep 17 00:00:00 2001 From: Chris Barr Date: Wed, 20 May 2015 08:37:26 -0400 Subject: [PATCH 096/179] (angular-file-upload) Adding missing a typedef for progress event --- angular-file-upload/angular-file-upload.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/angular-file-upload/angular-file-upload.d.ts b/angular-file-upload/angular-file-upload.d.ts index bd76a6e7e..635180a54 100644 --- a/angular-file-upload/angular-file-upload.d.ts +++ b/angular-file-upload/angular-file-upload.d.ts @@ -23,4 +23,9 @@ declare module angular.angularFileUpload { file: File; fileName?: string; } + + interface IFileProgressEvent extends ProgressEvent { + + config: IFileUploadConfig; + } } From 0daffc5de026726e3248ac99165da6c3c1719d2d Mon Sep 17 00:00:00 2001 From: Chris Barr Date: Wed, 20 May 2015 09:01:09 -0400 Subject: [PATCH 097/179] Updating tests to match new defs & updating links in the defs --- .../angular-file-upload-tests.ts | 48 ++++++++++--------- angular-file-upload/angular-file-upload.d.ts | 10 ++-- 2 files changed, 30 insertions(+), 28 deletions(-) diff --git a/angular-file-upload/angular-file-upload-tests.ts b/angular-file-upload/angular-file-upload-tests.ts index d59e65b4e..8b8fe7490 100644 --- a/angular-file-upload/angular-file-upload-tests.ts +++ b/angular-file-upload/angular-file-upload-tests.ts @@ -10,35 +10,37 @@ module controllers { static $inject = ["$upload"]; constructor( - private $upload: ng.angularFileUpload.IUploadService + private $upload: angular.angularFileUpload.IUploadService ) { } onFileSelect($files: File[]) { - //$files: an array of files selected, each file has name, size, and type. - var uploads: ng.IPromise[] = []; + // $files: an array of files selected, each file has name, size, and type. for (var i = 0; i < $files.length; i++) { var file = $files[i]; - uploads.push(this.$upload.upload({ - url: "/api/upload", - method: "POST", - data: { - extraData: { - fileName: file.name, test: "anything" - } - }, - file: file - }) - .progress((evt: any) => { - console.log('progress'); - }) - .then(success => { - // file is uploaded successfully - console.log(success.data); - }) - .catch(err => { - console.error(err); - })); + this.$upload.upload({ + url: "/api/upload", + method: "POST", + data: { + extraData: { + fileName: file.name, + test: "anything" + } + }, + file: file + }) + .progress((evt: angular.angularFileUpload.IFileProgressEvent) => { + var percent = parseInt((100.0 * evt.loaded / evt.total).toString(), 10); + console.log("upload progress: " + percent + "% for " + evt.config.file.name); + }) + .error((data: any, status: number, response: any, headers: any) => { + console.error(data, status, response, headers); + }) + .success((data: any, status: number, headers: any, config: angular.angularFileUpload.IFileUploadConfig) => { + // file is uploaded successfully + console.log("Success!", data, status, headers, config); + }); + } } } diff --git a/angular-file-upload/angular-file-upload.d.ts b/angular-file-upload/angular-file-upload.d.ts index 635180a54..499fdf185 100644 --- a/angular-file-upload/angular-file-upload.d.ts +++ b/angular-file-upload/angular-file-upload.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Angular File Upload 1.6.7 -// Project: https://github.com/danialfarid/angular-file-upload -// Definitions by: John Reilly +// Type definitions for Angular File Upload 4.2.1 +// Project: https://github.com/danialfarid/ng-file-upload +// Definitions by: John Reilly & Chris Barr // Definitions: https://github.com/borisyankov/DefinitelyTyped /// @@ -23,9 +23,9 @@ declare module angular.angularFileUpload { file: File; fileName?: string; } - + interface IFileProgressEvent extends ProgressEvent { config: IFileUploadConfig; } -} +} \ No newline at end of file From 0c58c5a9ebf79e0585b3fb0aec7dc109889d154a Mon Sep 17 00:00:00 2001 From: Pedro Date: Wed, 20 May 2015 20:35:41 +0200 Subject: [PATCH 098/179] added type definition file for PapaParse --- papaparse/papaparse-tests.ts | 55 +++++++++++++ papaparse/papaparse.d.ts | 144 +++++++++++++++++++++++++++++++++++ 2 files changed, 199 insertions(+) create mode 100644 papaparse/papaparse-tests.ts create mode 100644 papaparse/papaparse.d.ts diff --git a/papaparse/papaparse-tests.ts b/papaparse/papaparse-tests.ts new file mode 100644 index 000000000..14cc40bb3 --- /dev/null +++ b/papaparse/papaparse-tests.ts @@ -0,0 +1,55 @@ +/// + +import Papa = require("papaparse"); + +/** + * Parsing + */ +var res = Papa.parse("3,3,3"); + +res.errors[0].code; + +Papa.parse("3,3,3", { + delimiter: ';', + comments: false, + + step: function(results, p) { + p.abort(); + results.data.length; + } +}); + +var file = new File(); + +Papa.parse(file, { + complete: function(a, b) { + a.meta.fields; + b.name; + } +}); + +/** + * Unparsing + */ +Papa.unparse([{a: 1, b: 1, c: 1}]); +Papa.unparse([[1, 2, 3], [4, 5, 6]]); +Papa.unparse({ + fields: ["3"], + data: [] +}); + + + +/** + * Properties + */ +Papa.SCRIPT_PATH; +Papa.LocalChunkSize; + +/** + * Parser + */ +var parser = new Papa.Parser({}) +parser.getCharIndex(); +parser.abort(); +parser.parse("", 0, false); \ No newline at end of file diff --git a/papaparse/papaparse.d.ts b/papaparse/papaparse.d.ts new file mode 100644 index 000000000..028dd2aab --- /dev/null +++ b/papaparse/papaparse.d.ts @@ -0,0 +1,144 @@ +// Type definitions for PapaParse v4.1 +// Project: https://github.com/mholt/PapaParse +// Definitions by: Pedro Flemming +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module PapaParse { + interface Static { + /** + * Parse a csv string or a csv file + */ + parse(csvString: string, config?: ParseConfig): ParseResult; + + parse(file: File, config?: ParseConfig): ParseResult; + + /** + * Unparses javascript data objects and returns a csv string + */ + unparse(data: Array, config?: UnparseConfig): string; + + unparse(data: Array>, config?: UnparseConfig): string; + + unparse(data: UnparseObject, config?: UnparseConfig): string; + + /** + * Read-Only Properties + */ + // An array of characters that are not allowed as delimiters. + BAD_DELIMETERS: Array; + + // The true delimiter. Invisible. ASCII code 30. Should be doing the job we strangely rely upon commas and tabs for. + RECORD_SEP: string; + + // Also sometimes used as a delimiting character. ASCII code 31. + UNIT_SEP: string; + + // Whether or not the browser supports HTML5 Web Workers. If false, worker: true will have no effect. + WORKERS_SUPPORTED: boolean; + + // The relative path to Papa Parse. This is automatically detected when Papa Parse is loaded synchronously. + SCRIPT_PATH: string; + + /** + * Configurable Properties + */ + // The size in bytes of each file chunk. Used when streaming files obtained from the DOM that exist on the local computer. Default 10 MB. + LocalChunkSize: string; + + // Same as LocalChunkSize, but for downloading files from remote locations. Default 5 MB. + RemoteChunkSize: string; + + // The delimiter used when it is left unspecified and cannot be detected automatically. Default is comma. + DefaultDelimiter: string; + + /** + * On Papa there are actually more classes exposed + * but none of them are officially documented + * Since we can interact with the Parser from one of the callbacks + * I have included the API for this class. + */ + Parser: ParserConstructor; + } + + interface ParseConfig { + delimiter?: string; // default: "" + newline?: string; // default: "" + header?: boolean; // default: false + dynamicTyping?: boolean; // default: false + preview?: number; // default: 0 + encoding?: string; // default: "" + worker?: boolean; // default: false + comments?: boolean; // default: false + download?: boolean; // default: false + skipEmptyLines?: boolean; // default: false + fastMode?: boolean; // default: undefined + + // Callbacks + step?(results: ParseResult, parser: Parser): void; // default: undefined + complete?(results: ParseResult, file?: File): void; // default: undefined + error?(error: ParseError, file?: File): void; // default: undefined + chunk?(results: ParseResult, parser: Parser): void; // default: undefined + beforeFirstChunk?(chunk: string): string|void; // default: undefined + } + + interface UnparseConfig { + quotes: boolean; // default: false + delimiter: string; // default: "," + newline: string; // default: "\r\n" + } + + interface UnparseObject { + fields: Array; + data: string | Array; + } + + interface ParseError { + type: string; // A generalization of the error + code: string; // Standardized error code + message: string; // Human-readable details + row: number; // Row index of parsed data where error is + } + + interface ParseMeta { + delimiter: string; // Delimiter used + linebreak: string; // Line break sequence used + aborted: boolean; // Whether process was aborted + fields: Array; // Array of field names + truncated: boolean; // Whether preview consumed all input + } + + /** + * @interface ParseResult + * + * data: is an array of rows. If header is false, rows are arrays; otherwise they are objects of data keyed by the field name. + * errors: is an array of errors + * meta: contains extra information about the parse, such as delimiter used, the newline sequence, whether the process was aborted, etc. Properties in this object are not guaranteed to exist in all situations + */ + interface ParseResult { + data: Array; + errors: Array; + meta: ParseMeta; + } + + /** + * Parser + */ + interface ParserConstructor { new(config: ParseConfig): Parser; } + interface Parser { + // Parses the input + parse(input: string, baseIndex: number, ignoreLastRow: boolean): any; + + // Sets the abort flag + abort(): void; + + // Gets the cursor position + getCharIndex(): number; + } +} + +declare var Papa: PapaParse.Static; + +declare module "papaparse" { + var Papa: PapaParse.Static; + export = Papa; +} From 8bc91d57f68517ccea6c50b30f4a3e8ffe2bd97b Mon Sep 17 00:00:00 2001 From: Phips Peter Date: Wed, 20 May 2015 17:00:13 -0700 Subject: [PATCH 099/179] Adding autoprefixer-core This is actually more useful than autoprefixer since this is the programmatic interface --- autoprefixer-core/autoprefixer-core-tests.ts | 9 ++++ autoprefixer-core/autoprefixer-core.d.ts | 44 ++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 autoprefixer-core/autoprefixer-core-tests.ts create mode 100644 autoprefixer-core/autoprefixer-core.d.ts diff --git a/autoprefixer-core/autoprefixer-core-tests.ts b/autoprefixer-core/autoprefixer-core-tests.ts new file mode 100644 index 000000000..9ff4e7695 --- /dev/null +++ b/autoprefixer-core/autoprefixer-core-tests.ts @@ -0,0 +1,9 @@ +/// +import autoprefixer = require("autoprefixer-core"); + +var css: string; + +var prefixed = autoprefixer.process(css).css; + +var processor = autoprefixer({ browsers: ['> 1%', 'IE 7'], cascade: false }); +console.log(processor.info()); diff --git a/autoprefixer-core/autoprefixer-core.d.ts b/autoprefixer-core/autoprefixer-core.d.ts new file mode 100644 index 000000000..905447acf --- /dev/null +++ b/autoprefixer-core/autoprefixer-core.d.ts @@ -0,0 +1,44 @@ +// Type definitions for Autoprefixer Core 5.1.11 +// Project: https://github.com/postcss/autoprefixer-core +// Definitions by: Asana +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "autoprefixer-core" { + interface Config { + browsers?: string[]; + cascade?: boolean; + remove?: boolean; + } + + interface Options { + from?: string; + to?: string; + safe?: boolean; + map?: { + inline?: boolean; + prev?: string | Object; + } + } + + interface Result { + css: string; + map: string; + opts: Options; + } + + interface Processor { + postcss: any; + info(): string; + process(css: string, opts?: Options): Result; + } + + interface Exports { + (config: Config): Processor; + postcss: any; + info(): string; + process(css: string, opts?: Options): Result; + } + + var exports: Exports; + export = exports; +} From cfc0247741abbad9d12472cac7ec4a6e97f1f474 Mon Sep 17 00:00:00 2001 From: Phips Peter Date: Wed, 20 May 2015 17:12:21 -0700 Subject: [PATCH 100/179] Adding type definitions for node-sass --- node-sass/node-sass-tests.ts | 71 ++++++++++++++++++++++++++++++++++++ node-sass/node-sass.d.ts | 56 ++++++++++++++++++++++++++++ 2 files changed, 127 insertions(+) create mode 100644 node-sass/node-sass-tests.ts create mode 100644 node-sass/node-sass.d.ts diff --git a/node-sass/node-sass-tests.ts b/node-sass/node-sass-tests.ts new file mode 100644 index 000000000..a7c1477cb --- /dev/null +++ b/node-sass/node-sass-tests.ts @@ -0,0 +1,71 @@ +/// +import sass = require('node-sass'); +sass.render({ + file: '/path/to/myFile.scss', + data: 'body{background:blue; a{color:black;}}', + importer: function(url, prev, done) { + // url is the path in import as is, which libsass encountered. + // prev is the previously resolved path. + // done is an optional callback, either consume it or return value synchronously. + // this.options contains this options hash, this.callback contains the node-style callback + someAsyncFunction(url, prev, function(result) { + done({ + file: result.path, // only one of them is required, see section Sepcial Behaviours. + contents: result.data + }); + }); + // OR + var result = someSyncFunction(url, prev); + return { file: result.path, contents: result.data }; + }, + includePaths: ['lib/', 'mod/'], + outputStyle: 'compressed' +}, function(error, result) { // node-style callback from v3.0.0 onwards + if (error) { + console.log(error.status); // used to be "code" in v2x and below + console.log(error.column); + console.log(error.message); + console.log(error.line); + } + else { + console.log(result.css.toString()); + + console.log(result.stats); + + console.log(result.map.toString()); + // or better + console.log(JSON.stringify(result.map)); // note, JSON.stringify accepts Buffer too + } +}); +// OR +var result = sass.renderSync({ + file: '/path/to/file.scss', + data: 'body{background:blue; a{color:black;}}', + outputStyle: 'compressed', + outFile: '/to/my/output.css', + sourceMap: true, // or an absolute or relative (to outFile) path + importer: function(url, prev, done) { + // url is the path in import as is, which libsass encountered. + // prev is the previously resolved path. + // done is an optional callback, either consume it or return value synchronously. + // this.options contains this options hash + someAsyncFunction(url, prev, function(result) { + done({ + file: result.path, // only one of them is required, see section Sepcial Behaviours. + contents: result.data + }); + }); + // OR + var result = someSyncFunction(url, prev); + return { file: result.path, contents: result.data }; + }, +}); + +console.log(result.css); +console.log(result.map); +console.log(result.stats); + +function someAsyncFunction(url: string, prev: string, callback: (result: { path: string; data: string }) => void): void {} +function someSyncFunction(url: string, prev: string): { path: string; data: string} { + return null; +} diff --git a/node-sass/node-sass.d.ts b/node-sass/node-sass.d.ts new file mode 100644 index 000000000..09ea71d4e --- /dev/null +++ b/node-sass/node-sass.d.ts @@ -0,0 +1,56 @@ +// Type definitions for Node Sass +// Project: https://github.com/sass/node-sass +// Definitions by: Asana +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "node-sass" { + interface Importer { + (url: string, prev: string, done: (data: { file: string; contents: string; }) => void): void; + } + + interface Options { + file?: string; + data?: string; + importer?: Importer | Importer[]; + functions?: { [key: string]: Function }; + includePaths?: string[]; + indentedSyntax?: boolean; + indentType?: string; + indentWidth?: number; + linefeed?: string; + omitSourceMapUrl?: boolean; + outFile?: string; + outputStyle?: string; + precision?: number; + sourceComments?: boolean; + sourceMap?: boolean | string; + sourceMapContents?: boolean; + sourceMapEmbed?: boolean; + sourceMapRoot?: boolean; + } + + interface SassError extends Error { + message: string; + line: number; + column: number; + status: number; + file: string; + } + + interface Result { + css: Buffer; + map: Buffer; + stats: { + entry: string; + start: number; + end: number; + duration: number; + includedFiles: string[]; + } + } + + export function render(options: Options, callback: (err: SassError, result: Result) => any): void; + export function renderSync(options: Options): Result; +} From 720878aee7051a9bed9c6e63eb1e41e77c37cf57 Mon Sep 17 00:00:00 2001 From: Inez Korczynski Date: Wed, 20 May 2015 17:31:28 -0700 Subject: [PATCH 101/179] Transition.then - it's optional, really is, to pass "onRejected" callback --- ember/ember.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ember/ember.d.ts b/ember/ember.d.ts index a35d51eb9..48aa81aa2 100644 --- a/ember/ember.d.ts +++ b/ember/ember.d.ts @@ -58,7 +58,7 @@ declare module EmberStates { @arg {String} label optional string for labeling the promise. Useful for tooling. @return {Promise} */ - then(onFulfilled: Function, onRejected: Function, label?: string): Ember.RSVP.Promise; + then(onFulfilled: Function, onRejected?: Function, label?: string): Ember.RSVP.Promise; /** Forwards to the internal `promise` property which you can From b003ec5aef9063d5a99c834612d213f109b1b56a Mon Sep 17 00:00:00 2001 From: Stefan Profanter Date: Tue, 19 May 2015 15:16:33 +0200 Subject: [PATCH 102/179] Vortex Web Client definitions --- vortex-web-client/vortex-web-client-tests.ts | 23 + vortex-web-client/vortex-web-client.d.ts | 488 +++++++++++++++++++ 2 files changed, 511 insertions(+) create mode 100644 vortex-web-client/vortex-web-client-tests.ts create mode 100644 vortex-web-client/vortex-web-client.d.ts diff --git a/vortex-web-client/vortex-web-client-tests.ts b/vortex-web-client/vortex-web-client-tests.ts new file mode 100644 index 000000000..216e268c5 --- /dev/null +++ b/vortex-web-client/vortex-web-client-tests.ts @@ -0,0 +1,23 @@ +/// + +var runtime = new dds.runtime.Runtime(); +runtime.connect("ws://localhost:9000", "user:pass"); + +var tqos = new dds.TopicQos(); +var chatTopic = new dds.Topic(0, 'ChatMessage', tqos); +runtime.registerTopic(chatTopic); + +var writerQos = new dds.DataWriterQos(); +var writer = new dds.DataWriter(runtime, chatTopic, writerQos); + +writer.write({ + user: "John Smith", + msg : "Hello World!" +}); + +var readerQos = new dds.DataReaderQos(); +var reader = new dds.DataReader(runtime, chatTopic, readerQos); + +reader.addListener(function(msg) { + console.log(JSON.stringify(msg)); +}); diff --git a/vortex-web-client/vortex-web-client.d.ts b/vortex-web-client/vortex-web-client.d.ts new file mode 100644 index 000000000..de665c780 --- /dev/null +++ b/vortex-web-client/vortex-web-client.d.ts @@ -0,0 +1,488 @@ +// Type definitions for Vortex Web 1.2.0p1 +// Project: http://www.prismtech.com/vortex/vortex-web +// Definitions by: Stefan Profanter +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/* + Vortex Web + + This software and documentation are Copyright 2010 to 2015 PrismTech + Limited and its licensees. All rights reserved. See file: + + docs/LICENSE.html + + for full copyright notice and license terms. + */ + +declare module DDS { + + + /** + * Base class for all policies + */ + interface Policy { + + } + + /** + * History policy + */ + export enum HistoryKind { + KeepAll = 0, + KeepLast = 1 + } + + /** + * History policy + */ + export class History implements Policy { + /** + * KeepAll - KEEP_ALL qos policy + */ + KeepAll:any; + /** + * KeepLast - KEEP_LAST qos policy + */ + KeepLast:any; + } + + /** + * Reliability Policy + * @example var qos = Reliability.Reliable + */ + export enum ReliabilityKind { + Reliable = 0, + BestEffort = 1 + } + + /** + * History policy + */ + export class Reliability implements Policy { + /** + * Reliable - 'Reliable' reliability policy + */ + Reliable:any; + /** + * BestEffort - 'BestEffort' reliability policy + */ + BestEffort:any; + } + + /** + * Partition policy + */ + export class Partition implements Policy { + /** + * Create new partition policy + * + * @param policies - partition names + * @example var qos = Partition('p1', 'p2') + */ + constructor(...policies:string[]); + } + + /** + * Content Filter policy + */ + export class ContentFilter implements Policy { + /** + * Create new content filter policy + * + * @param expr - filter expression + * @example var filter = ContentFilter("x>10 AND y<50") + */ + constructor(expr:string); + } + + /** + * Time Filter policy + */ + export class TimeFilter implements Policy { + /** + * Create new content filter policy + * + * @param period - time duration (unit ?) + * @example var filter = TimeFilter(100) + */ + constructor(period:number); + } + + /** + * Durability Policy + */ + export enum DurabilityKind { + Volatile = 0, + TransientLocal = 1, + Transient = 2, + Persistent = 3 + } + + /** + * Durability Qos Policy + */ + export class Durability implements Policy { + /** + * Volatile - Volatile durability policy + */ + Volatile:any; + /** + * TransientLocal - TransientLocal durability policy + */ + TransientLocal:any; + /** + * Transient - Transient durability policy + */ + Transient:any; + /** + * Persistent - Persistent durability policy + */ + Persistent:any; + } + + + interface EntityQos { + /** + * Creates any of the DDS entities quality of service, including DataReaderQos and DataWriterQos. + * + * @param policies - list of policies for the Qos entity + */ + new (...policies:Policy[]): EntityQos; + + /** + * Adds the given policy to this instance. + * @param policy - the policy to add + * @return A new copy of this instance with the combined policies + */ + add (policy:Policy): EntityQos; + } + + + /** + * Topic quality of service object + */ + export var TopicQos:EntityQos; + /** + * DataReader quality of service object + */ + export var DataReaderQos:EntityQos; + + /** + * DataWriter quality of service object + */ + export var DataWriterQos:EntityQos; + + export class Topic { + /** + * Creates a `Topic` in the domain `did`, named `tname`, having `qos` Qos, + * for the type `ttype` whose registered name is `tregtype` + * @param {number} did - DDS domain ID + * @param {string} tname - topic name + * @param {TopicQos} qos - topic Qos + * @param {string} ttype - topic type. If not specified, a generic type is used. + * @param {string} tregtype - topic registered type name. If not specified, 'ttype' is used. + */ + constructor(did:number, tname:string, qos:EntityQos, ttype?:string, tregtype?:string); + + /** + * Called when topic gets registered in the runtime + */ + onregistered():void; + + /** + * Called when topic gets unregistered in the runtime + */ + onunregistered():void; + } + + export class DataReader { + /** + * Creates a `DataReader` for a given topic and a specific in a specific DDS runtime. + * + * A `DataReader` allows to read data for a given topic with a specific QoS. A `DataReader` + * * goes through different states, it is intially disconnected and changes to the connected state + * when the underlying transport connection is successfully established with the server. At this point + * a `DataReader` can be explicitely closed or disconnected. A disconnection can happen as the result + * of a network failure or server failure. Disconnection and reconnections are managed by the runtime. + * + * @param runtime - DDS Runtime + * @param topic - DDS Topic + * @param qos - DataReader quality of service + */ + constructor(runtime:Runtime, topic:Topic, qos:EntityQos); + + resetStats():void; + + /** + * Attaches the listener `l` to this data reader and returns + * the id associated to the listener. + * @param l - listener code + * @returns listener handle + */ + addListener(l:(msg:any) => void):number; + + /** + * removes a listener from this data reader. + * @param idx - listener id + */ + removeListener(idx:number):void; + + /** + * closes the DataReader + */ + close():void; + } + + export class DataWriter { + /** + * Creates a `DataWriter` for a given topic and a specific in a specific DDS runtime + * + * defines a DDS data writer. This type + * is used to write data for a specific topic with a given QoS. + * A `DataWriter` goes through different states, it is intially disconnected and changes to the connected + * state when the underlying transport connection is successfully established with the server. + * At this point a `DataWriter` can be explicitely closed or disconnected. A disconnection can happen + * as the result of a network failure or server failure. Disconnection and reconnections are managed by the + * runtime. + * + * @param runtime - DDS Runtime + * @param topic - DDS Topic + * @param qos - DataWriter quality of service + */ + constructor(runtime:Runtime, topic:Topic, qos:EntityQos); + + /** + * Writes one or more samples. + * @param ds - data sample + */ + write(...ds:any[]):void; + + /** + * Closes the DataWriter + */ + close():void; + } + + + export class DataCache { + /** + * Constructs a `DataCache` with a given `depth`. If the `cache` parameter + * is present, then the current cache is initialized with this parameter. + * + * Provides a way of storing and flexibly accessing the + * data received through a `DataReader`. A `DataCache` is organized as + * a map of queues. The depth of the queues is specified at construction + * time. + * + * @param depth - cache size + * @param cache - cache data structure + */ + constructor(depth:number, cache:any); + + /** + * Register a listener to be notified whenever data which matches a predicate is written into the cache. + * If no predicate is provided then the listeners is always notified upon data inserion. + * + * @param l - listener function + * @param p - predicate + */ + addListener(l:(data:any) => void, p?:(data:any) => boolean):void; + + /** + * Write the element `data` with key `k` into the cache. + * + * @param k - data key + * @param data - data value + * @returns the written data value + */ + write(k:any, data:any):any; + + /** + * Same as forEach but applied, for each key, only to the first `n` samples of the cache + * + * @param f - the function to be applied + * @param n - samples set size + */ + forEachN(f:(data:any) => any, n:number):any[]; + + /** + * Execute the function `f` for each element of the cache. + * + * @memberof! dds.DataCache# + * @param f - the function to be applied + * @returns results of the function execution + */ + forEach(f:(data:any) => any):any[]; + + /** + * Returns a cache that is the result of applying `f` to each element of the cache. + * + * @param f - the function to be applied + * @returns A cache holding the results of the function execution + */ + map(f:(data:any) => any):DataCache; + + /** + * Returns the list of elements in the cache that satisfy the predicate `f`. + * + * @param f - the predicate to be applied to filter the cache values + * @returns An array holding the filtered values + */ + filter(f:(data:any) => boolean):any[]; + + /** + * Returns the list of elements in the cache that doesn't satisfy the predicate `f`. + * + * @returns An array holding the filtered values + * @see DataCache#filter + */ + filterNot(f:(data:any) => boolean):any[]; + + /** + * Returns the values included in the cache as an array. + * + * @return All the cache values + */ + read():any[]; + + /** + * Returns the last value of the cache in an array. + * + * @return the last value of the cache + */ + readLast():any; + + /** + * Returns all the values included in the cache as an array and empties the cache. + * + * @return All the cache values + */ + takeAll():any[]; + + /** + * Returns the `K`ith value of the cache as Monad, ie: `coffez.Some` if it exists, `coffez.None` if not. + * + * @return the 'k'th value + */ + take():any; + + /** + * Takes elements from the cache up to when the predicate `f` is satisfied + * + * @param f - the predicate + * @return taken cache values + */ + takeWithFilter(f:(data:any) => boolean):any[]; + + /** + * Return `coffez.Some(v)` if there is an element in the cache corresponding to the + * key `k` otherwise it returns `coffez.None`. + * + * @param k - key + */ + get(k:any):any; + + /** + * Return `coffez.Some(v)` if there is an element in the cache corresponding to the + * key `k` otherwise executes `f` and returns its result. + * + * @param k - key + * @param f - the function to apply + */ + getOrElse(k:any, f:(data:any)=> any):any; + + /** + * folds the element of the cache using `z` as the `zero` element and + * `f` as the binary operator. + * + * @param z - initial value + * @param {function} f - reduce function + */ + fold(z:any, f:(data:any) => any):void; + + /** + * clears the data cache + */ + clear():void; + + } + + interface Runtime { + /** + * Constructs a DDS Runtime object + * + * maintains the connection with the server, re-establish the connection + * if dropped and mediates the `DataReader` and `DataWriter` communication. + */ + new (): Runtime; + + /** + * Connect the runtime to the server. If the runtime is already connected an exception is thrown + * + * @param srv - Vortex Web server WebSocket URL + * @param authToken - Authorization token + */ + connect(server:string, authToken?:string): void; + + /** + * Disconnects, withouth closing, a `Runtime`. Notice that upon re-connection all existing + * subscriptions and publications will be re-restablished. + */ + disconnect(): void; + + /** + * Registers the provided Topic. + * + * @param t - Topic to be registered + */ + registerTopic(t:Topic): void; + + /** + * Function called when runtime is connected. + * + * @param e + */ + onconnect(e:any): void; + + + /** + * Function called when runtime is disconnected. + * + * @param e + */ + ondisconnect(e:any): void; + + /** + * Closes the DDS runtime and as a consequence all the `DataReaders` and `DataWriters` that belong to this runtime. + * + */ + close(): void; + + /** + * Checks whether the Runtime is connected. + * @return `true` if connected, `false` if not + */ + isConnected() : boolean; + + /** + * Checks whether the Runtime is closed. + * @return `true` if connected, `false` if not + */ + isClosed() : boolean; + } + + export var runtime:{ + Runtime : Runtime; + } + + export var VERSION:string; +} + +/** + * Defines the core Vortex-Web-Client javascript library. It includes the JavaScript API for DDS. This API allows + * web applications to share data among them as well as with native DDS applications. + */ +declare +var dds:typeof DDS; + + From 2c3f84a797387fb4b275b027d946694c4326ec11 Mon Sep 17 00:00:00 2001 From: Basarat Ali Syed Date: Thu, 21 May 2015 19:14:33 +1000 Subject: [PATCH 103/179] getTabSize returns number --- ace/ace.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ace/ace.d.ts b/ace/ace.d.ts index 29fadf3bc..9866e1e28 100644 --- a/ace/ace.d.ts +++ b/ace/ace.d.ts @@ -576,7 +576,7 @@ declare module AceAjax { /** * Returns the current tab size. **/ - getTabSize(): string; + getTabSize(): number; /** * Returns `true` if the character at the position is a soft tab. From bfbc30d83298099af8743b114d1a9065220a1fdd Mon Sep 17 00:00:00 2001 From: Basarat Ali Syed Date: Thu, 21 May 2015 19:31:40 +1000 Subject: [PATCH 104/179] Editor is an event emitter --- ace/ace.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ace/ace.d.ts b/ace/ace.d.ts index 9866e1e28..410df1039 100644 --- a/ace/ace.d.ts +++ b/ace/ace.d.ts @@ -1035,6 +1035,8 @@ declare module AceAjax { **/ export interface Editor { + addEventListener(ev: string, callback: Function); + inMultiSelectMode: boolean; selectMoreLines(n: number); From ecc3f26f9cdaaa9db07504495ac05ccb0afb0ace Mon Sep 17 00:00:00 2001 From: Danyil Bohdan Date: Thu, 21 May 2015 12:58:12 +0300 Subject: [PATCH 105/179] Add missing typing for utcOffset for Moment --- moment/moment-external-tests.ts | 1 + moment/moment-tests.ts | 1 + moment/moment.d.ts | 7 +++++-- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/moment/moment-external-tests.ts b/moment/moment-external-tests.ts index 1b1d083ba..c5855c12c 100644 --- a/moment/moment-external-tests.ts +++ b/moment/moment-external-tests.ts @@ -188,6 +188,7 @@ moment(1318874398806).valueOf(); moment(1318874398806).unix(); moment([2000]).isLeapYear(); moment().zone(); +moment().utcOffset(); moment("2012-2", "YYYY-MM").daysInMonth(); moment([2011, 2, 12]).isDST(); diff --git a/moment/moment-tests.ts b/moment/moment-tests.ts index dc11eeac8..16490d2e1 100644 --- a/moment/moment-tests.ts +++ b/moment/moment-tests.ts @@ -188,6 +188,7 @@ moment(1318874398806).valueOf(); moment(1318874398806).unix(); moment([2000]).isLeapYear(); moment().zone(); +moment().utcOffset(); moment("2012-2", "YYYY-MM").daysInMonth(); moment([2011, 2, 12]).isDST(); diff --git a/moment/moment.d.ts b/moment/moment.d.ts index d26834a03..e09aab1d5 100644 --- a/moment/moment.d.ts +++ b/moment/moment.d.ts @@ -224,7 +224,7 @@ declare module moment { diff(b: Moment): number; diff(b: Moment, unitOfTime: string): number; diff(b: Moment, unitOfTime: string, round: boolean): number; - + toArray(): number[]; toDate(): Date; toISOString(): string; @@ -235,6 +235,9 @@ declare module moment { zone(): number; zone(b: number): Moment; zone(b: string): Moment; + utcOffset(): number; + utcOffset(b: number): Moment; + utcOffset(b: string): Moment; daysInMonth(): number; isDST(): boolean; @@ -318,7 +321,7 @@ declare module moment { } - interface BaseMomentLanguage { + interface BaseMomentLanguage { months ?: any; monthsShort ?: any; weekdays ?: any; From 2aac6c6f5072c58ed6055c71f15705ed8bbcb90d Mon Sep 17 00:00:00 2001 From: Emiliano Marino Date: Thu, 21 May 2015 10:47:22 -0300 Subject: [PATCH 106/179] added $setDirty method to INgModelController (added in v1.3.15+) For Angular version 1.3.15+ INgModelController brings $setDirty method. --- angularjs/angular.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index 92784af38..719e84139 100755 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -474,6 +474,7 @@ declare module angular { // types do work and it's common to use them. $setViewValue(value: any, trigger?: string): void; $setPristine(): void; + $setDirty(): void; $validate(): void; $setTouched(): void; $setUntouched(): void; From c5a17104d40e0c0f6cc26fe02172ba6dcff0bae0 Mon Sep 17 00:00:00 2001 From: SaschaNaz Date: Fri, 22 May 2015 00:50:44 +0900 Subject: [PATCH 107/179] readBytes fix --- winrt/winrt.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/winrt/winrt.d.ts b/winrt/winrt.d.ts index 883860b00..1247d0940 100644 --- a/winrt/winrt.d.ts +++ b/winrt/winrt.d.ts @@ -9268,7 +9268,7 @@ declare module Windows { unconsumedBufferLength: number; unicodeEncoding: Windows.Storage.Streams.UnicodeEncoding; readByte(): number; - readBytes(): Uint8Array; + readBytes(value: Uint8Array): void; readBuffer(length: number): Windows.Storage.Streams.IBuffer; readBoolean(): boolean; readGuid(): string; @@ -9297,7 +9297,7 @@ declare module Windows { unconsumedBufferLength: number; unicodeEncoding: Windows.Storage.Streams.UnicodeEncoding; readByte(): number; - readBytes(): Uint8Array; + readBytes(value: Uint8Array): void; readBuffer(length: number): Windows.Storage.Streams.IBuffer; readBoolean(): boolean; readGuid(): string; From 92e29d7ca898ab585f8dd2304dc78aa001e421e6 Mon Sep 17 00:00:00 2001 From: SaschaNaz Date: Fri, 22 May 2015 01:12:41 +0900 Subject: [PATCH 108/179] readBytes/writeBytes receives array of number --- winrt/winrt.d.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/winrt/winrt.d.ts b/winrt/winrt.d.ts index 1247d0940..ed4f33e77 100644 --- a/winrt/winrt.d.ts +++ b/winrt/winrt.d.ts @@ -9268,6 +9268,7 @@ declare module Windows { unconsumedBufferLength: number; unicodeEncoding: Windows.Storage.Streams.UnicodeEncoding; readByte(): number; + readBytes(value: number[]): void; readBytes(value: Uint8Array): void; readBuffer(length: number): Windows.Storage.Streams.IBuffer; readBoolean(): boolean; @@ -9297,6 +9298,7 @@ declare module Windows { unconsumedBufferLength: number; unicodeEncoding: Windows.Storage.Streams.UnicodeEncoding; readByte(): number; + readBytes(value: number[]): void; readBytes(value: Uint8Array): void; readBuffer(length: number): Windows.Storage.Streams.IBuffer; readBoolean(): boolean; @@ -9345,6 +9347,7 @@ declare module Windows { unicodeEncoding: Windows.Storage.Streams.UnicodeEncoding; unstoredBufferLength: number; writeByte(value: number): void; + writeBytes(value: number[]): void; writeBytes(value: Uint8Array): void; writeBuffer(buffer: Windows.Storage.Streams.IBuffer): void; writeBuffer(buffer: Windows.Storage.Streams.IBuffer, start: number, count: number): void; @@ -9377,6 +9380,7 @@ declare module Windows { unicodeEncoding: Windows.Storage.Streams.UnicodeEncoding; unstoredBufferLength: number; writeByte(value: number): void; + writeBytes(value: number[]): void; writeBytes(value: Uint8Array): void; writeBuffer(buffer: Windows.Storage.Streams.IBuffer): void; writeBuffer(buffer: Windows.Storage.Streams.IBuffer, start: number, count: number): void; From 9a8c0ea74e849c796d4a01e42b42dc5d2761b41c Mon Sep 17 00:00:00 2001 From: Basarat Ali Syed Date: Fri, 22 May 2015 18:00:08 +1000 Subject: [PATCH 109/179] feat(ace) specialize 'change' --- ace/ace.d.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/ace/ace.d.ts b/ace/ace.d.ts index 410df1039..72fefbc6e 100644 --- a/ace/ace.d.ts +++ b/ace/ace.d.ts @@ -1034,9 +1034,10 @@ declare module AceAjax { * Event sessions dealing with the mouse and keyboard are bubbled up from `Document` to the `Editor`, which decides what to do with them. **/ export interface Editor { - - addEventListener(ev: string, callback: Function); + addEventListener(ev: 'change', callback: (ev: EditorChangeEvent) => any); + addEventListener(ev: string, callback: Function); + inMultiSelectMode: boolean; selectMoreLines(n: number); @@ -1712,6 +1713,13 @@ declare module AceAjax { **/ new(renderer: VirtualRenderer, session?: IEditSession): Editor; } + + interface EditorChangeEvent { + start: Position; + end: Position; + action: string; // insert, remove + lines: any[]; + } //////////////////////////////// /// PlaceHolder From c3125d7aebd46b9bd024287b12eaf3438cc500c1 Mon Sep 17 00:00:00 2001 From: Chris Barr Date: Fri, 22 May 2015 07:50:50 -0400 Subject: [PATCH 110/179] Fixing header format --- angular-file-upload/angular-file-upload.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/angular-file-upload/angular-file-upload.d.ts b/angular-file-upload/angular-file-upload.d.ts index 499fdf185..fa7aaa54e 100644 --- a/angular-file-upload/angular-file-upload.d.ts +++ b/angular-file-upload/angular-file-upload.d.ts @@ -1,6 +1,6 @@ // Type definitions for Angular File Upload 4.2.1 // Project: https://github.com/danialfarid/ng-file-upload -// Definitions by: John Reilly & Chris Barr +// Definitions by: John Reilly // Definitions: https://github.com/borisyankov/DefinitelyTyped /// From f42164e284d20bfebdea9a6283dc387359f1a46a Mon Sep 17 00:00:00 2001 From: Sascha Thiel Date: Fri, 22 May 2015 14:19:45 +0200 Subject: [PATCH 111/179] fixed the collection TModel workaround. --- backbone/backbone.d.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/backbone/backbone.d.ts b/backbone/backbone.d.ts index 7de8eb807..9d54361d5 100644 --- a/backbone/backbone.d.ts +++ b/backbone/backbone.d.ts @@ -169,9 +169,7 @@ declare module Backbone { **/ private static extend(properties: any, classProperties?: any): any; - // TODO: this really has to be typeof TModel - //model: typeof TModel; - model: { new(): TModel; }; // workaround + model: new (...args:any[]) => TModel; models: TModel[]; length: number; From 0deb573197c1be1859e9433012b4df6f78fa9795 Mon Sep 17 00:00:00 2001 From: Sascha Thiel Date: Fri, 22 May 2015 15:00:44 +0200 Subject: [PATCH 112/179] added the missing ui property --- marionette/marionette.d.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/marionette/marionette.d.ts b/marionette/marionette.d.ts index 2b9b25635..4a2bfac10 100644 --- a/marionette/marionette.d.ts +++ b/marionette/marionette.d.ts @@ -1291,6 +1291,15 @@ declare module Marionette { options: any; + /** + * Behaviors can have their own ui hash, which will be mixed into the ui + * hash of its associated View instance. ui elements defined on either the + * Behavior or the View will be made available within events and triggers. + * They also are attached directly to the Behavior and can be accessed within + * Behavior methods as this.ui. + */ + ui: any; + /** * Any triggers you define on the Behavior will be triggered in response to the appropriate event on the view. */ From 043288c68ebef1b3c4c11cb1b96a04f8129405ae Mon Sep 17 00:00:00 2001 From: Slavo Vojacek Date: Fri, 22 May 2015 17:23:41 +0100 Subject: [PATCH 113/179] Update gapi.d.ts I am using Google+ Sign-In on one of my applications and I needed to add a couple of definitions into this file. The update is based on https://developers.google.com/+/web/signin/reference#javascript_api. --- gapi/gapi.d.ts | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/gapi/gapi.d.ts b/gapi/gapi.d.ts index d9d6fb90b..8c50826d4 100644 --- a/gapi/gapi.d.ts +++ b/gapi/gapi.d.ts @@ -65,6 +65,45 @@ declare module gapi.auth { * @param token The token to set. */ export function setToken(token: GoogleApiOAuth2TokenObject): void; + /** + * Initiates the client-side Google+ Sign-In OAuth 2.0 flow. + * When the method is called, the OAuth 2.0 authorization dialog is displayed to the user and when they accept, the callback function is called. + * @param params + */ + export function signIn(params: { + /** + * Your OAuth 2.0 client ID that you obtained from the Google Developers Console. + */ + clientid?: string; + /** + * Directs the sign-in button to store user and session information in a session cookie and HTML5 session storage on the user's client for the purpose of minimizing HTTP traffic and distinguishing between multiple Google accounts a user might be signed into. + */ + cookiepolicy?: string; + /** + * A function in the global namespace, which is called when the sign-in button is rendered and also called after a sign-in flow completes. + */ + callback?: Function; + /** + * If true, all previously granted scopes remain granted in each incremental request, for incremental authorization. The default value true is correct for most use cases; use false only if employing delegated auth, where you pass the bearer token to a less-trusted component with lower programmatic authority. + */ + includegrantedscopes?: boolean; + /** + * If your app will write moments, list the full URI of the types of moments that you intend to write. + */ + requestvisibleactions?: any; + /** + * The OAuth 2.0 scopes for the APIs that you would like to use as a space-delimited list. + */ + scope?: any; + /** + * If you have an Android app, you can drive automatic Android downloads from your web sign-in flow. + */ + apppackagename?: string; + }): void; + /** + * Signs a user out of your app without logging the user out of Google. This method will only work when the user is signed in with Google+ Sign-In. + */ + export function signOut(): void; } declare module gapi.client { From dd10c1a6f9b2e243b34544334f160af03ab80459 Mon Sep 17 00:00:00 2001 From: Tom Hasner Date: Fri, 22 May 2015 15:47:41 -0400 Subject: [PATCH 114/179] scoping exported interfaces with an `Interact` module --- interactjs/interact.d.ts | 468 +++++++++++++++++++-------------------- 1 file changed, 234 insertions(+), 234 deletions(-) diff --git a/interactjs/interact.d.ts b/interactjs/interact.d.ts index 1ad864607..495e5e1a3 100644 --- a/interactjs/interact.d.ts +++ b/interactjs/interact.d.ts @@ -1,245 +1,245 @@ // Type definitions for Interacting for interact.js v1.0.25 // Project: https://github.com/taye/interact.js -// Definitions by: Douglas Eichelberger , Adi Dahiya +// Definitions by: Douglas Eichelberger , Adi Dahiya , Tom Hasner // Definitions: https://github.com/borisyankov/DefinitelyTyped // API documentation: http://interactjs.io/docs -interface Interactable { - // returns Element or string - accept(): any; - accept(newValue: Element): Interactable; - accept(newValue: string): Interactable; - actionChecker(): Function; - actionChecker(checker: Function): Interactable; - // returns boolean or {[key: string]: any} - autoScroll(): any; - autoScroll(options: boolean): Interactable; - autoScroll(options: {[key: string]: any}): Interactable; - context(): Node; - defaultActionChecker(event: any): string; - deltaSource(): string; - // returns Interactable if newValue is "page" or "client", otherwise returns string - deltaSource(newValue: String): Interactable; - draggable(): boolean; - draggable(options: boolean): Interactable; - draggable(options: {[key: string]: any}): Interactable; - dropCheck(event: MouseEvent): boolean; - dropCheck(event: TouchEvent): boolean; - dropChecker(): Function; - dropChecker(checker: Function): Interactable; - // returns boolean or {[key: string]: any} - dropzone(): any; - dropzone(options: boolean): Interactable; - dropzone(options: {[key: string]: any}): Interactable; - // return HTMLElement or SVGElement - element(): Element; - fire(iEvent: InteractEvent): Interactable; - // returns boolean or {[key: string]: any} - gesturable(): any; - gesturable(options: boolean): Interactable; - gesturable(options: {[key: string]: any}): Interactable; - getRect(): ClientRect; - // returns Element or string - ignoreFrom(): any; - ignoreFrom(newValue: string): Interactable; - ignoreFrom(newValue: Element): Interactable; - // returns boolean or {[key: string]: any} - inertia(): any; - inertia(options: boolean): Interactable; - inertia(options: {[key: string]: any}): Interactable; - off(eventType: string, listener: Function, useCapture?: boolean): Interactable; - on(eventType: string, listener: Function, useCapture?: boolean): Interactable; - origin(): Point; - origin(newValue: HTMLElement): Interactable; - origin(newValue: SVGElement): Interactable; - origin(newValue: Point): Interactable; - rectChecker(): Function; - rectChecker(newValue: Function): Interactable; - resizable(): Interactable; - resizable(options: boolean): Interactable; - resizable(options: {[key: string]: any}): Interactable; - restrict(): Restrict; - restrict(newValue: Restrict): Interactable; - set(options: {[key: string]: any}): Interactable; - // returns boolean or {[key: string]: any} - snap(): any; - snap(options: boolean): Interactable; - snap(options: {[key: string]: any}): Interactable; - squareResize(): boolean; - squareResize(newValue: boolean): Interactable; - styleCursor(): boolean; - styleCursor(newValue: boolean): Interactable; - unset(): InteractStatic; - validateSetting(context: string, option: string, value: any): any; +declare module Interact { + interface Interactable { + // returns Element or string + accept(): any; + accept(newValue: Element): Interactable; + accept(newValue: string): Interactable; + actionChecker(): Function; + actionChecker(checker: Function): Interactable; + // returns boolean or {[key: string]: any} + autoScroll(): any; + autoScroll(options: boolean): Interactable; + autoScroll(options: {[key: string]: any}): Interactable; + context(): Node; + defaultActionChecker(event: any): string; + deltaSource(): string; + // returns Interactable if newValue is "page" or "client", otherwise returns string + deltaSource(newValue: String): Interactable; + draggable(): boolean; + draggable(options: boolean): Interactable; + draggable(options: {[key: string]: any}): Interactable; + dropCheck(event: MouseEvent): boolean; + dropCheck(event: TouchEvent): boolean; + dropChecker(): Function; + dropChecker(checker: Function): Interactable; + // returns boolean or {[key: string]: any} + dropzone(): any; + dropzone(options: boolean): Interactable; + dropzone(options: {[key: string]: any}): Interactable; + // return HTMLElement or SVGElement + element(): Element; + fire(iEvent: InteractEvent): Interactable; + // returns boolean or {[key: string]: any} + gesturable(): any; + gesturable(options: boolean): Interactable; + gesturable(options: {[key: string]: any}): Interactable; + getRect(): ClientRect; + // returns Element or string + ignoreFrom(): any; + ignoreFrom(newValue: string): Interactable; + ignoreFrom(newValue: Element): Interactable; + // returns boolean or {[key: string]: any} + inertia(): any; + inertia(options: boolean): Interactable; + inertia(options: {[key: string]: any}): Interactable; + off(eventType: string, listener: Function, useCapture?: boolean): Interactable; + on(eventType: string, listener: Function, useCapture?: boolean): Interactable; + origin(): Point; + origin(newValue: HTMLElement): Interactable; + origin(newValue: SVGElement): Interactable; + origin(newValue: Point): Interactable; + rectChecker(): Function; + rectChecker(newValue: Function): Interactable; + resizable(): Interactable; + resizable(options: boolean): Interactable; + resizable(options: {[key: string]: any}): Interactable; + restrict(): Restrict; + restrict(newValue: Restrict): Interactable; + set(options: {[key: string]: any}): Interactable; + // returns boolean or {[key: string]: any} + snap(): any; + snap(options: boolean): Interactable; + snap(options: {[key: string]: any}): Interactable; + squareResize(): boolean; + squareResize(newValue: boolean): Interactable; + styleCursor(): boolean; + styleCursor(newValue: boolean): Interactable; + unset(): InteractStatic; + validateSetting(context: string, option: string, value: any): any; + } + + interface Coordinates { + clientX: number; + clientY: number; + pageX: number; + pageY: number; + timeStamp: number; + } + + interface Debug { + target: any; + dragging: any; + resizing: any; + gesturing: any; + prepared: any; + + prevCoords: Coordinates; + downCoords: Coordinates; + + pointerIds: any[]; + pointerMoves: any[]; + addPointer: any; + removePointer: any; + recordPointers: any; + + inertia: InertiaStatus; + + downTime: any; + downEvent: any; + prevEvent: any; + + Interactable: any; + IOptions: any; + interactables: any; + dropzones: any; + pointerIsDown: any; + defaultOptions: any; + defaultActionChecker: any; + + actions: any; + dragMove: any; + resizeMove: any; + gestureMove: any; + pointerUp: any; + pointerDown: any; + pointerMove: any; + pointerHover: any; + + events: any; + globalEvents: any; + delegatedEvents: any; + } + + interface InertiaStatus { + active: boolean; + target: any; + targetElement: any; + + startEvent: any; + pointerUp: any + + xe: number; + ye: number; + duration: number; + + t0: number; + vx0: number; + vys: number; + + lambda_v0: number; + one_ve_v0: number; + i: any; + } + + interface Point { + x: number; + y: number; + } + + // value types are either ClientRect or Element + interface Restrict { + drag?: any; + gesture?: any; + resize?: any; + elementRect?: {[direction: string]: number}; + } + + interface InteractEvent { + altKey: boolean; + axes: string; + button: number + clientX0: number; + clientX: number + clientY0: number; + clientY: number + ctrlKey: boolean + dt: number; + duration: number; + dx: number; + dy: number; + metaKey: boolean; + pageX: number; + pageY: number; + shiftKey: boolean; + speed: number; + t0: number; + target: any; + timeStamp: number; + type: string; + velocityX: number; + velocityY: number; + x0: number; + y0: number; + } + + interface TouchEvent { + pageX: number; + pageY: number; + type: string; + } + + interface InteractStatic { + (element: HTMLElement): Interactable; + (element: SVGElement): Interactable; + (element: string): Interactable; + // returns boolean or {[key: string]: any} + autoScroll(): any; + autoScroll(options: boolean): InteractStatic; + autoScroll(options: {[key: string]: any}): InteractStatic; + currentAction(): string + debug(): Debug; + deltaSource(): string; + // "page" and "client" are the valid parameters + deltaSource(newValue: string): InteractStatic; + dynamicDrop(): boolean; + dynamicDrop(newValue: boolean): InteractStatic; + enableDragging(): boolean; + enableDragging(newValue: boolean): InteractStatic; + enableGesturing(): boolean; + enableGesturing(newValue: boolean): InteractStatic; + enableResizing(): boolean; + enableResizing(newValue: boolean): InteractStatic; + // returns boolean or {[key: string]: any} + inertia(): any; + inertia(options: boolean): InteractStatic; + inertia(options: {[key: string]: any}): InteractStatic; + isSet(element: Element): boolean; + margin(): number; + margin(newvalue: number): InteractStatic; + off(type: string, listener: Function, useCapture?: boolean): InteractStatic; + on(type: string, listener: Function, useCapture?: boolean): InteractStatic; + restrict(): Restrict; + restrict(newValue: Restrict): InteractStatic; + simulate(action: string, element: Element, pointerEvent?: any): InteractStatic; + // returns boolean or {[key: string]: any} + snap(): any; + snap(options: boolean): InteractStatic; + snap(options: {[key: string]: any}): InteractStatic; + stop(event: Event): InteractStatic; + styleCursor(): boolean; + styleCursor(newValue: boolean): InteractStatic; + supportsTouch(): boolean + } } -interface Coordinates { - clientX: number; - clientY: number; - pageX: number; - pageY: number; - timeStamp: number; -} - -interface Debug { - target: any; - dragging: any; - resizing: any; - gesturing: any; - prepared: any; - - prevCoords: Coordinates; - downCoords: Coordinates; - - pointerIds: any[]; - pointerMoves: any[]; - addPointer: any; - removePointer: any; - recordPointers: any; - - inertia: InertiaStatus; - - downTime: any; - downEvent: any; - prevEvent: any; - - Interactable: any; - IOptions: any; - interactables: any; - dropzones: any; - pointerIsDown: any; - defaultOptions: any; - defaultActionChecker: any; - - actions: any; - dragMove: any; - resizeMove: any; - gestureMove: any; - pointerUp: any; - pointerDown: any; - pointerMove: any; - pointerHover: any; - - events: any; - globalEvents: any; - delegatedEvents: any; -} - -interface InertiaStatus { - active: boolean; - target: any; - targetElement: any; - - startEvent: any; - pointerUp: any - - xe: number; - ye: number; - duration: number; - - t0: number; - vx0: number; - vys: number; - - lambda_v0: number; - one_ve_v0: number; - i: any; -} - -interface Point { - x: number; - y: number; -} - -// value types are either ClientRect or Element -interface Restrict { - drag?: any; - gesture?: any; - resize?: any; - elementRect?: {[direction: string]: number}; -} - -interface InteractEvent { - altKey: boolean; - axes: string; - button: number - clientX0: number; - clientX: number - clientY0: number; - clientY: number - ctrlKey: boolean - dt: number; - duration: number; - dx: number; - dy: number; - metaKey: boolean; - pageX: number; - pageY: number; - shiftKey: boolean; - speed: number; - t0: number; - target: any; - timeStamp: number; - type: string; - velocityX: number; - velocityY: number; - x0: number; - y0: number; -} - -interface TouchEvent { - changedTouches: any[]; - pageX: number; - pageY: number; - touches: any[]; - type: string; -} - -interface InteractStatic { - (element: HTMLElement): Interactable; - (element: SVGElement): Interactable; - (element: string): Interactable; - // returns boolean or {[key: string]: any} - autoScroll(): any; - autoScroll(options: boolean): InteractStatic; - autoScroll(options: {[key: string]: any}): InteractStatic; - currentAction(): string - debug(): Debug; - deltaSource(): string; - // "page" and "client" are the valid parameters - deltaSource(newValue: string): InteractStatic; - dynamicDrop(): boolean; - dynamicDrop(newValue: boolean): InteractStatic; - enableDragging(): boolean; - enableDragging(newValue: boolean): InteractStatic; - enableGesturing(): boolean; - enableGesturing(newValue: boolean): InteractStatic; - enableResizing(): boolean; - enableResizing(newValue: boolean): InteractStatic; - // returns boolean or {[key: string]: any} - inertia(): any; - inertia(options: boolean): InteractStatic; - inertia(options: {[key: string]: any}): InteractStatic; - isSet(element: Element): boolean; - margin(): number; - margin(newvalue: number): InteractStatic; - off(type: string, listener: Function, useCapture?: boolean): InteractStatic; - on(type: string, listener: Function, useCapture?: boolean): InteractStatic; - restrict(): Restrict; - restrict(newValue: Restrict): InteractStatic; - simulate(action: string, element: Element, pointerEvent?: any): InteractStatic; - // returns boolean or {[key: string]: any} - snap(): any; - snap(options: boolean): InteractStatic; - snap(options: {[key: string]: any}): InteractStatic; - stop(event: Event): InteractStatic; - styleCursor(): boolean; - styleCursor(newValue: boolean): InteractStatic; - supportsTouch(): boolean -} - -declare var interact: InteractStatic; +declare var interact: Interact.InteractStatic; declare module "interact" { export = interact; From 92c408d7d8f7bf7d91f6e494a589362cc3a2316c Mon Sep 17 00:00:00 2001 From: Daniel Beckwith Date: Fri, 22 May 2015 16:55:48 -0400 Subject: [PATCH 115/179] Added bootstrap-slider --- bootstrap-slider/bootstrap-slider-tests.ts | 120 +++++++++++++ bootstrap-slider/bootstrap-slider.d.ts | 200 +++++++++++++++++++++ 2 files changed, 320 insertions(+) create mode 100644 bootstrap-slider/bootstrap-slider-tests.ts create mode 100644 bootstrap-slider/bootstrap-slider.d.ts diff --git a/bootstrap-slider/bootstrap-slider-tests.ts b/bootstrap-slider/bootstrap-slider-tests.ts new file mode 100644 index 000000000..0524323e0 --- /dev/null +++ b/bootstrap-slider/bootstrap-slider-tests.ts @@ -0,0 +1,120 @@ +/// +/// + +$(function() { + // examples from http://seiyria.github.io/bootstrap-slider/ + + $('#ex1').slider({ + formatter: function(value) { + return 'Current value: ' + value; + } + }); + + + + $("#ex2").slider({}); + + var RGBChange = function() { + $('#RGB').css('background', 'rgb('+r.getValue()+','+g.getValue()+','+b.getValue()+')') + }; + + var r = $('#R').slider() + .on('slide', RGBChange) + .data('slider'); + var g = $('#G').slider() + .on('slide', RGBChange) + .data('slider'); + var b = $('#B').slider() + .on('slide', RGBChange) + .data('slider'); + + + + $("#ex4").slider({ + reversed : true + }); + + + + $("#ex5").slider(); + + $("#destroyEx5Slider").click(function() { + $("#ex5").slider('destroy'); + }); + + + + $("#ex6").slider(); + $("#ex6").on("slide", function(slideEvt) { + $("#ex6SliderVal").text(slideEvt.value); + }); + + + + $("#ex7").slider(); + + $("#ex7-enabled").click(function() { + if(this.checked) { + // With JQuery + $("#ex7").slider("enable"); + } + else { + // With JQuery + $("#ex7").slider("disable"); + } + }); + + + + $("#ex8").slider({ + tooltip: 'always' + }); + + + + $("#ex9").slider({ + precision: 2, + value: 8.115 // Slider will instantiate showing 8.12 due to specified precision + }); + + + + $("#ex11").slider({step: 20000, min: 0, max: 200000}); + + + + $("#ex12a").slider({ id: "slider12a", min: 0, max: 10, value: 5 }); + $("#ex12b").slider({ id: "slider12b", min: 0, max: 10, range: true, value: [3, 7] }); + $("#ex12c").slider({ id: "slider12c", min: 0, max: 10, range: true, value: [3, 7] }); + + + + $("#ex13").slider({ + ticks: [0, 100, 200, 300, 400], + ticks_labels: ['$0', '$100', '$200', '$300', '$400'], + ticks_snap_bounds: 30 + }); + + + + $("#ex14").slider({ + ticks: [0, 100, 200, 300, 400], + ticks_positions: [0, 30, 60, 70, 90, 100], + ticks_labels: ['$0', '$100', '$200', '$300', '$400'], + ticks_snap_bounds: 30 + }); + + + + $("#ex15").slider({ + min: 1000, + max: 10000000, + scale: 'logarithmic', + step: 10 + }); + + + + $("#ex16a").slider({ min: 0, max: 10, value: 0, focus: true }); + $("#ex16b").slider({ min: 0, max: 10, value: [0, 10], focus: true }); +}); diff --git a/bootstrap-slider/bootstrap-slider.d.ts b/bootstrap-slider/bootstrap-slider.d.ts new file mode 100644 index 000000000..e92e2fae2 --- /dev/null +++ b/bootstrap-slider/bootstrap-slider.d.ts @@ -0,0 +1,200 @@ +// Type definitions for bootstrap-slider.js 4.8.3 +// Project: https://github.com/seiyria/bootstrap-slider +// Definitions by: Daniel Beckwith +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +interface SliderOptions { + /** + * Default: '' + * set the id of the slider element when it's created + */ + id?: string; + /** + * Default: 0 + * minimum possible value + */ + min?: number; + /** + * Default: 10 + * maximum possible value + */ + max?: number; + /** + * Default: 1 + * increment step + */ + step?: number; + /** + * Default: number of digits after the decimal of step value + * The number of digits shown after the decimal. Defaults to the number of digits after the decimal of step value. + */ + precision?: number; + /** + * Default: 'horizontal' + * set the orientation. Accepts 'vertical' or 'horizontal' + */ + orientation?: number; + /** + * Default: 5 + * initial value. Use array to have a range slider. + */ + value?: number|number[]; + /** + * Default: false + * make range slider. Optional if initial value is an array. If initial value is scalar, max will be used for second value. + */ + range?: boolean; + /** + * Default: 'before' + * selection placement. Accepts: 'before', 'after' or 'none'. In case of a range slider, the selection will be placed between the handles + */ + selection?: string; + /** + * Default: 'show' + * whether to show the tooltip on drag, hide the tooltip, or always show the tooltip. Accepts: 'show', 'hide', or 'always' + */ + tooltip?: string; + /** + * Default: false + * if false show one tootip if true show two tooltips one for each handler + */ + tooltip_split?: boolean; + /** + * Default: 'round' + * handle shape. Accepts: 'round', 'square', 'triangle' or 'custom' + */ + handle?: string; + /** + * Default: false + * whether or not the slider should be reversed + */ + reversed?: boolean; + /** + * Default: true + * whether or not the slider is initially enabled + */ + enabled?: boolean; + /** + * Default: returns the plain value + * formatter callback. Return the value wanted to be displayed in the tooltip + * @param number the current value to display + */ + formatter?(number): string; + /** + * Default: false + * The natural order is used for the arrow keys. Arrow up select the upper slider value for vertical sliders, arrow right the righter slider value for a horizontal slider - no matter if the slider was reversed or not. By default the arrow keys are oriented by arrow up/right to the higher slider value, arrow down/left to the lower slider value. + */ + natural_arrow_keys?: boolean; + /** + * Default: [ ] + * Used to define the values of ticks. Tick marks are indicators to denote special values in the range. This option overwrites min and max options. + */ + ticks?: number[]; + /** + * Default: [ ] + * Defines the positions of the tick values in percentages. The first value should alwasy be 0, the last value should always be 100 percent. + */ + ticks_positions?: number[]; + /** + * Default: [ ] + * Defines the labels below the tick marks. Accepts HTML input. + */ + ticks_labels?: number[]; + /** + * Default: 0 + * Used to define the snap bounds of a tick. Snaps to the tick if value is within these bounds. + */ + ticks_snap_bounds?: number; + /** + * Default: 'linear' + * Set to 'logarithmic' to use a logarithmic scale. + */ + scale?: string; + /** + * Default: false + * Focus the appropriate slider handle after a value change. + */ + focus?: boolean; +} + +interface JQuery { + /** + * Creates a slider from the current element. + * @param options + */ + slider(options?:SliderOptions): JQuery; + slider(methodName:string, ...args:any[]): JQuery; +} + +interface ChangeValue { + oldValue: number; + newValue: number; +} + +interface JQueryEventObject { + value: number|ChangeValue; +} + +/** + * This class is actually not used when using the jQuery version of bootstrap-slider + * The method documentation is still here thouh. + * When using jQuery, slider methods like setValue(3, true) have to be called like $slider.slider('setValue', 3, true) + */ +interface Slider extends JQuery { + /** + * Get the current value from the slider + */ + getValue(): number; + /** + * Set a new value for the slider. If optional triggerSlideEvent parameter is true, 'slide' events will be triggered. If optional triggerChangeEvent parameter is true, 'change' events will be triggered. + * @param newValue + * @param triggerSlideEvent + * @param triggerChangeEvent + */ + setValue(newValue:number, triggerSlideEvent?:boolean, triggerChangeEvent?:boolean): void; + /** + * Properly clean up and remove the slider instance + */ + destroy(): void; + /** + * Disables the slider and prevents the user from changing the value + */ + disable(): void; + /** + * Enables the slider + */ + enable(): void; + /** + * Returns true if enabled, false if disabled + */ + isEnabled(): boolean; + /** + * Updates the slider's attributes + * @param attribute + * @param value + */ + setAttribute(attribute:string, value:any): void; + /** + * Get the slider's attributes + * @param attribute + */ + getAttribute(attribute:string): any; + /** + * Refreshes the current slider + */ + refresh(): void; + /** + * Renders the tooltip again, after initialization. Useful in situations when the slider and tooltip are initially hidden. + */ + relayout(): void; + on: { + (eventType:string, callback:(eventObject:JQueryEventObject, ...args:any[]) => any): Slider; + (eventType:string, data:any, callback:(eventObject:JQueryEventObject, ...args:any[]) => any): Slider; + (eventType:string, selector:string, callback:(eventObject:JQueryEventObject, ...eventData:any[]) => any): Slider; + (eventType:string, selector:string, data:any, callback:(eventObject:JQueryEventObject, ...eventData:any[]) => any): Slider; + (eventType:{ [key: string]: any; }, selector?:string, data?:any): Slider; + (eventType:{ [key: string]: any; }, data?:any): Slider; + } +} From 7e901c0f96d50cc6ae1de5391f60cad03385565c Mon Sep 17 00:00:00 2001 From: Daniel Beckwith Date: Fri, 22 May 2015 17:05:12 -0400 Subject: [PATCH 116/179] Fixed build errors. --- bootstrap-slider/bootstrap-slider-tests.ts | 2 +- bootstrap-slider/bootstrap-slider.d.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bootstrap-slider/bootstrap-slider-tests.ts b/bootstrap-slider/bootstrap-slider-tests.ts index 0524323e0..548d909a6 100644 --- a/bootstrap-slider/bootstrap-slider-tests.ts +++ b/bootstrap-slider/bootstrap-slider-tests.ts @@ -46,7 +46,7 @@ $(function() { $("#ex6").slider(); $("#ex6").on("slide", function(slideEvt) { - $("#ex6SliderVal").text(slideEvt.value); + $("#ex6SliderVal").text(slideEvt.value); }); diff --git a/bootstrap-slider/bootstrap-slider.d.ts b/bootstrap-slider/bootstrap-slider.d.ts index e92e2fae2..78aeb645c 100644 --- a/bootstrap-slider/bootstrap-slider.d.ts +++ b/bootstrap-slider/bootstrap-slider.d.ts @@ -79,9 +79,9 @@ interface SliderOptions { /** * Default: returns the plain value * formatter callback. Return the value wanted to be displayed in the tooltip - * @param number the current value to display + * @param val the current value to display */ - formatter?(number): string; + formatter?(val:number): string; /** * Default: false * The natural order is used for the arrow keys. Arrow up select the upper slider value for vertical sliders, arrow right the righter slider value for a horizontal slider - no matter if the slider was reversed or not. By default the arrow keys are oriented by arrow up/right to the higher slider value, arrow down/left to the lower slider value. @@ -101,7 +101,7 @@ interface SliderOptions { * Default: [ ] * Defines the labels below the tick marks. Accepts HTML input. */ - ticks_labels?: number[]; + ticks_labels?: string[]; /** * Default: 0 * Used to define the snap bounds of a tick. Snaps to the tick if value is within these bounds. From d930a8fc40d653b1c48a89538f45d9c645d87f28 Mon Sep 17 00:00:00 2001 From: cherrydev Date: Fri, 22 May 2015 17:26:33 -0700 Subject: [PATCH 117/179] Add strictDi() to angular.mocks.inject --- angularjs/angular-mocks.d.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/angularjs/angular-mocks.d.ts b/angularjs/angular-mocks.d.ts index db551ee3d..1e412cb8c 100644 --- a/angularjs/angular-mocks.d.ts +++ b/angularjs/angular-mocks.d.ts @@ -39,8 +39,11 @@ declare module angular { dump(obj: any): string; // see http://docs.angularjs.org/api/angular.mock.inject - inject(...fns: Function[]): any; - inject(...inlineAnnotatedConstructor: any[]): any; // this overload is undocumented, but works + inject: { + (...fns: Function[]): any; + (...inlineAnnotatedConstructor: any[]): any; // this overload is undocumented, but works + strictDi(val: boolean): void; + } // see http://docs.angularjs.org/api/angular.mock.module module(...modules: any[]): any; From e3e6c4d8fee264dbdfb6d28a75dc2a1b1083fad7 Mon Sep 17 00:00:00 2001 From: Haskell Camargo Date: Sat, 23 May 2015 00:57:06 -0300 Subject: [PATCH 118/179] Added Zynga Scroller library --- zynga-scroller/zynga-scroller-tests.ts | 36 +++++++++++++++++++ zynga-scroller/zynga-scroller.ts | 49 ++++++++++++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 zynga-scroller/zynga-scroller-tests.ts create mode 100644 zynga-scroller/zynga-scroller.ts diff --git a/zynga-scroller/zynga-scroller-tests.ts b/zynga-scroller/zynga-scroller-tests.ts new file mode 100644 index 000000000..575c8f3fc --- /dev/null +++ b/zynga-scroller/zynga-scroller-tests.ts @@ -0,0 +1,36 @@ +/// + +var scroller: Scroller = new Scroller((left, top, zoom) => { }); +scroller = new Scroller((left, top, zoom) => { }, { + scrollingX: true, + scrollingY: true, + animating: true, + animationDuration: 400, + bouncing: false, + locking: false, + paging: false, + snapping: true, + zooming: 10, + minZoom: 1, + maxZoom: 2, +}); + +scroller.setDimensions(10, 10, 10, 10); +scroller.setPosition(200, 300); +scroller.setSnapSize(300, 300); +scroller.activatePullToRefresh(200, () => { }, () => { }, () => { }); +scroller.finishPullToRefresh(); +var data: { + left: number, + top: number, + zoom: number +} = scroller.getValues(); +scroller.zoomTo(10); +scroller.zoomBy(10); +scroller.doMouseZoom(10, 10, 10, 10); +scroller.doTouchStart({ + pageX: 10, + pageY: 20 +}, 200); +scroller.doTouchMove([10], 200); +scroller.doTouchEnd(300); \ No newline at end of file diff --git a/zynga-scroller/zynga-scroller.ts b/zynga-scroller/zynga-scroller.ts new file mode 100644 index 000000000..9e1e4bb92 --- /dev/null +++ b/zynga-scroller/zynga-scroller.ts @@ -0,0 +1,49 @@ +// Type definitions for Zynga Scroller +// Definitions by: Marcelo Haskell Camargo +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare class Scroller { + constructor(a: (left: number, top: number, zoom: number) => void, b?: { + scrollingX?: boolean, + scrollingY?: boolean, + animating?: boolean, + animationDuration?: number, + bouncing?: boolean, + locking?: boolean, + paging?: boolean, + snapping?: boolean, + zooming?: number, + minZoom?: number, + maxZoom?: number + }); + setDimensions(clientWidth: number, clientHeight: number, contentWidth: number, + contentHeight: number): void; + setPosition(clientLeft: number, clientTop: number): void; + setSnapSize(width: number, height: number); + activatePullToRefresh(height: number, activate: () => void, + deactivate: () => void, start: () => void); + finishPullToRefresh(): void; + getValues(): { + left: number, + top: number, + zoom: number + }; + zoomTo(level: number, animate?: boolean, originLeft?: number, + originTop?: number): void; + zoomBy(factor: number, animate?: boolean, originLeft?:number, + originTop?: number): void; + scrollTo(left: number, top: number, animate?: boolean): void; + scrollBy(leftOffset: number, topOffset: number, animate?: boolean): void; + doMouseZoom(wheelData: number, timeStamp: number, pageX: number, + pageY: number): void; + doTouchStart(touches: { + pageX: number, + pageY: number, + }, timeStamp: number): void; + doTouchMove(touches: { + pageX: number, + pageY: number, + }, timeStamp: number, scale?: number): void; + doTouchMove(touches: [any], timeStamp: number); + doTouchEnd(timeStamp: number): void; +} \ No newline at end of file From 4e88cdc797a21e9fb260a949a779e78e773306c3 Mon Sep 17 00:00:00 2001 From: Haskell Camargo Date: Sat, 23 May 2015 01:10:36 -0300 Subject: [PATCH 119/179] Fixed issue in filename to pass on Travis --- zynga-scroller/zynga-scroller.d.ts | 49 ++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 zynga-scroller/zynga-scroller.d.ts diff --git a/zynga-scroller/zynga-scroller.d.ts b/zynga-scroller/zynga-scroller.d.ts new file mode 100644 index 000000000..9e1e4bb92 --- /dev/null +++ b/zynga-scroller/zynga-scroller.d.ts @@ -0,0 +1,49 @@ +// Type definitions for Zynga Scroller +// Definitions by: Marcelo Haskell Camargo +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare class Scroller { + constructor(a: (left: number, top: number, zoom: number) => void, b?: { + scrollingX?: boolean, + scrollingY?: boolean, + animating?: boolean, + animationDuration?: number, + bouncing?: boolean, + locking?: boolean, + paging?: boolean, + snapping?: boolean, + zooming?: number, + minZoom?: number, + maxZoom?: number + }); + setDimensions(clientWidth: number, clientHeight: number, contentWidth: number, + contentHeight: number): void; + setPosition(clientLeft: number, clientTop: number): void; + setSnapSize(width: number, height: number); + activatePullToRefresh(height: number, activate: () => void, + deactivate: () => void, start: () => void); + finishPullToRefresh(): void; + getValues(): { + left: number, + top: number, + zoom: number + }; + zoomTo(level: number, animate?: boolean, originLeft?: number, + originTop?: number): void; + zoomBy(factor: number, animate?: boolean, originLeft?:number, + originTop?: number): void; + scrollTo(left: number, top: number, animate?: boolean): void; + scrollBy(leftOffset: number, topOffset: number, animate?: boolean): void; + doMouseZoom(wheelData: number, timeStamp: number, pageX: number, + pageY: number): void; + doTouchStart(touches: { + pageX: number, + pageY: number, + }, timeStamp: number): void; + doTouchMove(touches: { + pageX: number, + pageY: number, + }, timeStamp: number, scale?: number): void; + doTouchMove(touches: [any], timeStamp: number); + doTouchEnd(timeStamp: number): void; +} \ No newline at end of file From 6f02b8773fc194bcfdc0b583b76330e0f566cb10 Mon Sep 17 00:00:00 2001 From: Haskell Camargo Date: Sat, 23 May 2015 01:16:51 -0300 Subject: [PATCH 120/179] Fixed issue with semicolons --- zynga-scroller/zynga-scroller.ts | 49 -------------------------------- 1 file changed, 49 deletions(-) delete mode 100644 zynga-scroller/zynga-scroller.ts diff --git a/zynga-scroller/zynga-scroller.ts b/zynga-scroller/zynga-scroller.ts deleted file mode 100644 index 9e1e4bb92..000000000 --- a/zynga-scroller/zynga-scroller.ts +++ /dev/null @@ -1,49 +0,0 @@ -// Type definitions for Zynga Scroller -// Definitions by: Marcelo Haskell Camargo -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -declare class Scroller { - constructor(a: (left: number, top: number, zoom: number) => void, b?: { - scrollingX?: boolean, - scrollingY?: boolean, - animating?: boolean, - animationDuration?: number, - bouncing?: boolean, - locking?: boolean, - paging?: boolean, - snapping?: boolean, - zooming?: number, - minZoom?: number, - maxZoom?: number - }); - setDimensions(clientWidth: number, clientHeight: number, contentWidth: number, - contentHeight: number): void; - setPosition(clientLeft: number, clientTop: number): void; - setSnapSize(width: number, height: number); - activatePullToRefresh(height: number, activate: () => void, - deactivate: () => void, start: () => void); - finishPullToRefresh(): void; - getValues(): { - left: number, - top: number, - zoom: number - }; - zoomTo(level: number, animate?: boolean, originLeft?: number, - originTop?: number): void; - zoomBy(factor: number, animate?: boolean, originLeft?:number, - originTop?: number): void; - scrollTo(left: number, top: number, animate?: boolean): void; - scrollBy(leftOffset: number, topOffset: number, animate?: boolean): void; - doMouseZoom(wheelData: number, timeStamp: number, pageX: number, - pageY: number): void; - doTouchStart(touches: { - pageX: number, - pageY: number, - }, timeStamp: number): void; - doTouchMove(touches: { - pageX: number, - pageY: number, - }, timeStamp: number, scale?: number): void; - doTouchMove(touches: [any], timeStamp: number); - doTouchEnd(timeStamp: number): void; -} \ No newline at end of file From d83732dc9e6e3ea81b68f019e3621e761f4a6019 Mon Sep 17 00:00:00 2001 From: Haskell Camargo Date: Sat, 23 May 2015 01:17:23 -0300 Subject: [PATCH 121/179] Fixed issue with semicolons --- zynga-scroller/zynga-scroller.d.ts | 38 +++++++++++++++--------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/zynga-scroller/zynga-scroller.d.ts b/zynga-scroller/zynga-scroller.d.ts index 9e1e4bb92..7d1f6dfa1 100644 --- a/zynga-scroller/zynga-scroller.d.ts +++ b/zynga-scroller/zynga-scroller.d.ts @@ -4,45 +4,45 @@ declare class Scroller { constructor(a: (left: number, top: number, zoom: number) => void, b?: { - scrollingX?: boolean, - scrollingY?: boolean, - animating?: boolean, - animationDuration?: number, - bouncing?: boolean, - locking?: boolean, - paging?: boolean, - snapping?: boolean, - zooming?: number, - minZoom?: number, + scrollingX?: boolean; + scrollingY?: boolean; + animating?: boolean; + animationDuration?: number; + bouncing?: boolean; + locking?: boolean; + paging?: boolean; + snapping?: boolean; + zooming?: number; + minZoom?: number; maxZoom?: number }); setDimensions(clientWidth: number, clientHeight: number, contentWidth: number, - contentHeight: number): void; + contentHeight: number): void; setPosition(clientLeft: number, clientTop: number): void; setSnapSize(width: number, height: number); activatePullToRefresh(height: number, activate: () => void, - deactivate: () => void, start: () => void); + deactivate: () => void, start: () => void); finishPullToRefresh(): void; getValues(): { - left: number, - top: number, + left: number; + top: number; zoom: number }; zoomTo(level: number, animate?: boolean, originLeft?: number, originTop?: number): void; - zoomBy(factor: number, animate?: boolean, originLeft?:number, + zoomBy(factor: number, animate?: boolean, originLeft?: number, originTop?: number): void; scrollTo(left: number, top: number, animate?: boolean): void; scrollBy(leftOffset: number, topOffset: number, animate?: boolean): void; doMouseZoom(wheelData: number, timeStamp: number, pageX: number, pageY: number): void; doTouchStart(touches: { - pageX: number, - pageY: number, + pageX: number; + pageY: number }, timeStamp: number): void; doTouchMove(touches: { - pageX: number, - pageY: number, + pageX: number; + pageY: number }, timeStamp: number, scale?: number): void; doTouchMove(touches: [any], timeStamp: number); doTouchEnd(timeStamp: number): void; From 0983e639167136453c52d573117290946d090886 Mon Sep 17 00:00:00 2001 From: Haskell Camargo Date: Sat, 23 May 2015 01:18:17 -0300 Subject: [PATCH 122/179] Fixed issue with semicolons in tests --- zynga-scroller/zynga-scroller-tests.ts | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/zynga-scroller/zynga-scroller-tests.ts b/zynga-scroller/zynga-scroller-tests.ts index 575c8f3fc..f888bf64c 100644 --- a/zynga-scroller/zynga-scroller-tests.ts +++ b/zynga-scroller/zynga-scroller-tests.ts @@ -2,17 +2,17 @@ var scroller: Scroller = new Scroller((left, top, zoom) => { }); scroller = new Scroller((left, top, zoom) => { }, { - scrollingX: true, - scrollingY: true, - animating: true, - animationDuration: 400, - bouncing: false, - locking: false, - paging: false, - snapping: true, - zooming: 10, - minZoom: 1, - maxZoom: 2, + scrollingX: true; + scrollingY: true; + animating: true; + animationDuration: 400; + bouncing: false; + locking: false; + paging: false; + snapping: true; + zooming: 10; + minZoom: 1; + maxZoom: 2 }); scroller.setDimensions(10, 10, 10, 10); @@ -21,8 +21,8 @@ scroller.setSnapSize(300, 300); scroller.activatePullToRefresh(200, () => { }, () => { }, () => { }); scroller.finishPullToRefresh(); var data: { - left: number, - top: number, + left: number; + top: number; zoom: number } = scroller.getValues(); scroller.zoomTo(10); From cf984a7d53f1618be1439599d6e7e6ddd1003a06 Mon Sep 17 00:00:00 2001 From: Haskell Camargo Date: Sat, 23 May 2015 01:22:22 -0300 Subject: [PATCH 123/179] Added project annotation and explicit return --- zynga-scroller/zynga-scroller-tests.ts | 20 ++++++++++---------- zynga-scroller/zynga-scroller.d.ts | 7 ++++--- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/zynga-scroller/zynga-scroller-tests.ts b/zynga-scroller/zynga-scroller-tests.ts index f888bf64c..412765671 100644 --- a/zynga-scroller/zynga-scroller-tests.ts +++ b/zynga-scroller/zynga-scroller-tests.ts @@ -2,16 +2,16 @@ var scroller: Scroller = new Scroller((left, top, zoom) => { }); scroller = new Scroller((left, top, zoom) => { }, { - scrollingX: true; - scrollingY: true; - animating: true; - animationDuration: 400; - bouncing: false; - locking: false; - paging: false; - snapping: true; - zooming: 10; - minZoom: 1; + scrollingX: true, + scrollingY: true, + animating: true, + animationDuration: 400, + bouncing: false, + locking: false, + paging: false, + snapping: true, + zooming: 10, + minZoom: 1, maxZoom: 2 }); diff --git a/zynga-scroller/zynga-scroller.d.ts b/zynga-scroller/zynga-scroller.d.ts index 7d1f6dfa1..f4b9501ed 100644 --- a/zynga-scroller/zynga-scroller.d.ts +++ b/zynga-scroller/zynga-scroller.d.ts @@ -1,4 +1,5 @@ // Type definitions for Zynga Scroller +// Project: Zynga Scroller // Definitions by: Marcelo Haskell Camargo // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -19,9 +20,9 @@ declare class Scroller { setDimensions(clientWidth: number, clientHeight: number, contentWidth: number, contentHeight: number): void; setPosition(clientLeft: number, clientTop: number): void; - setSnapSize(width: number, height: number); + setSnapSize(width: number, height: number): void; activatePullToRefresh(height: number, activate: () => void, - deactivate: () => void, start: () => void); + deactivate: () => void, start: () => void): void; finishPullToRefresh(): void; getValues(): { left: number; @@ -44,6 +45,6 @@ declare class Scroller { pageX: number; pageY: number }, timeStamp: number, scale?: number): void; - doTouchMove(touches: [any], timeStamp: number); + doTouchMove(touches: [any], timeStamp: number): void; doTouchEnd(timeStamp: number): void; } \ No newline at end of file From 9796c3973d9fbbd214142ec3da32f952ab9dfd74 Mon Sep 17 00:00:00 2001 From: Haskell Camargo Date: Sat, 23 May 2015 01:24:25 -0300 Subject: [PATCH 124/179] Added URL to project label --- zynga-scroller/zynga-scroller.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zynga-scroller/zynga-scroller.d.ts b/zynga-scroller/zynga-scroller.d.ts index f4b9501ed..04b82b577 100644 --- a/zynga-scroller/zynga-scroller.d.ts +++ b/zynga-scroller/zynga-scroller.d.ts @@ -1,5 +1,5 @@ // Type definitions for Zynga Scroller -// Project: Zynga Scroller +// Project: http://zynga.github.com/scroller/ // Definitions by: Marcelo Haskell Camargo // Definitions: https://github.com/borisyankov/DefinitelyTyped From 978b3e6c748257e4d25c7fa8b9aab2531eb3852f Mon Sep 17 00:00:00 2001 From: Markus Peloso Date: Sat, 23 May 2015 11:41:46 +0200 Subject: [PATCH 125/179] Update type definitons to SweetAlert 1.0.1 --- sweetalert/sweetalert-tests.ts | 8 ++++++-- sweetalert/sweetalert.d.ts | 10 ++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/sweetalert/sweetalert-tests.ts b/sweetalert/sweetalert-tests.ts index 9523bc010..ca0faacbf 100644 --- a/sweetalert/sweetalert-tests.ts +++ b/sweetalert/sweetalert-tests.ts @@ -63,7 +63,10 @@ swal({ text: "I will close in 2 seconds.", timer: 2000, showConfirmButton: false -}); +}, + function () { + swal("Time Out!", "The time is out of joint.", "success"); + }); // A replacement for the "prompt" function swal({ @@ -73,7 +76,8 @@ swal({ showCancelButton: true, closeOnConfirm: false, animation: "slide-from-top", - inputPlaceholder: "Write something" + inputPlaceholder: "Write something plx", + inputValue: "Write something" }, function (inputValue) { if (inputValue === false) return false; diff --git a/sweetalert/sweetalert.d.ts b/sweetalert/sweetalert.d.ts index 108e2b906..61b643c32 100644 --- a/sweetalert/sweetalert.d.ts +++ b/sweetalert/sweetalert.d.ts @@ -1,4 +1,4 @@ -// Type definitions for SweetAlert 1.0.0-beta +// Type definitions for SweetAlert 1.0.1 // Project: https://github.com/t4t5/sweetalert/ // Definitions by: Markus Peloso // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -97,7 +97,7 @@ declare module SweetAlert { imageSize?: string; /** - * Auto close timer of the modal.Set in ms (milliseconds). + * Auto close timer of the modal. Set in ms (milliseconds). * Default: null */ timer?: number; @@ -125,6 +125,12 @@ declare module SweetAlert { * Default: null */ inputPlaceholder?: string; + + /** + * Specify a default text value that you want your input to show when using type: "input" + * Default: null + */ + inputValue?: string; } interface Settings extends SettingsBase { From 8caaea8d482f2da0834fd5d249fddcd728c9ce63 Mon Sep 17 00:00:00 2001 From: Michael Zabka Date: Sat, 23 May 2015 14:12:24 +0200 Subject: [PATCH 126/179] Fix numeric properties of node-each object --- each/each-tests.ts | 6 +++--- each/each.d.ts | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/each/each-tests.ts b/each/each-tests.ts index 370e6ac39..4b07c694d 100644 --- a/each/each-tests.ts +++ b/each/each-tests.ts @@ -6,9 +6,9 @@ function testEach() { return { paused: true, readable: false, - started: true, - done: true, - total: true, + started: 11, + done: 12, + total: 22, on: function (eventName: string, cb: (a: any, b?: () => void) => void) { return EachStaticClass([]); }, diff --git a/each/each.d.ts b/each/each.d.ts index 65d0a3f9d..0e9b900dc 100644 --- a/each/each.d.ts +++ b/each/each.d.ts @@ -6,9 +6,9 @@ interface Each { paused: boolean; readable: boolean; - started: boolean; - done: boolean; - total: boolean; + started: number; + done: number; + total: number; on(eventName: string, onCallback: Function): Each; on(eventName: "item", onItem: (item: any, next: (error?: Error) => void) => void): Each; on(eventName: "error", onError: (error: Error[]) => void): Each; @@ -36,4 +36,4 @@ declare var each: EachStatic; declare module "each" { export = each; -} \ No newline at end of file +} From 7d5e63e281dfdf0405bacd8efcdc251feae8baca Mon Sep 17 00:00:00 2001 From: Brian Surowiec Date: Fri, 22 May 2015 03:54:12 -0400 Subject: [PATCH 127/179] Add typings for raygun4js --- raygun4js/raygun4js-tests.ts | 48 ++++++++++++++++++ raygun4js/raygun4js.d.ts | 97 ++++++++++++++++++++++++++++++++++++ 2 files changed, 145 insertions(+) create mode 100644 raygun4js/raygun4js-tests.ts create mode 100644 raygun4js/raygun4js.d.ts diff --git a/raygun4js/raygun4js-tests.ts b/raygun4js/raygun4js-tests.ts new file mode 100644 index 000000000..56577765c --- /dev/null +++ b/raygun4js/raygun4js-tests.ts @@ -0,0 +1,48 @@ +/// + +var client: raygun.RaygunStatic = Raygun.noConflict(); + +var newClient: raygun.RaygunStatic = client.constructNewRaygun(); + +client.init('api-key'); +client.init('api-key', { allowInsecureSubmissions: true }); +client.init('api-key', { allowInsecureSubmissions: true }, { some: 'data' }); + +client.withCustomData({ some: 'data' }); + +client.withTags(['tag1', 'tag2']); + +client.attach().detach(); + +client.send(new Error('a error')); +client.send(new Error('a error'), ['tag1', 'tag2']); + +try { + throw new Error('oops'); +} +catch (e) { + client.send(e); +} + +client.setUser('username'); +client.setUser('username', true); +client.setUser('username', false, 'user@email.com', 'Robbie Robot'); +client.setUser('username', false, 'user@email.com', 'Robbie Robot', 'Robbie'); +client.setUser('username', false, 'user@email.com', 'Robbie Robot', 'Robbie', '8ae89fc9-1144-42d6-9629-bf085dab18d2'); + +client.resetAnonymousUser(); + +client.setVersion('1.2.3.4'); + +client.saveIfOffline(true); + +client.filterSensitiveData(['field1', 'field2']); + +client.setFilterScope('all'); + +client.whitelistCrossOriginDomains(['domain1', 'domain2']); + +client.onBeforeSend(payload=> { + payload.OccurredOn = new Date(); + return payload; +}); \ No newline at end of file diff --git a/raygun4js/raygun4js.d.ts b/raygun4js/raygun4js.d.ts new file mode 100644 index 000000000..a3c2feeb4 --- /dev/null +++ b/raygun4js/raygun4js.d.ts @@ -0,0 +1,97 @@ +// Type definitions for raygun4js 1.18.3 +// Project: https://github.com/MindscapeHQ/raygun4js +// Definitions by: Brian Surowiec +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module raygun { + + // https://github.com/MindscapeHQ/raygun4js/blob/c7d8880045214ab6d403d5cc613c207f696a3cdd/src/raygun.js#L533-539 + interface IStackTrace { + LineNumber: number; + ColumnNumber: number; + ClassName: string; + FileName: string; + MethodName: string; + } + + // https://github.com/MindscapeHQ/raygun4js/blob/c7d8880045214ab6d403d5cc613c207f696a3cdd/src/raygun.js#L598-637 + interface IPayload { + OccurredOn: Date; + Details: { + Error: { + ClassName: string; + Message: string; + StackTrace: IStackTrace[]; + }; + Environment: { + UtcOffset: number; + 'User-Language': string; + 'Document-Mode': number; + 'Browser-Width': number; + 'Browser-Height': number; + 'Screen-Width': number; + 'Screen-Height': number; + 'Color-Depth': number; + Browser: string; + 'Browser-Name': string; + 'Browser-Version': string; + Platform: string; + }; + Client: { + Name: string; + Version: string; + }; + UserCustomData: any; + Tags: string[]; + Request: { + Url: string; + QueryString: string; + Headers: { + 'User-Agent': string; + Referer: string; + Host: string; + }; + }; + Version: string; + }; + } + + // https://github.com/MindscapeHQ/raygun4js/blob/c7d8880045214ab6d403d5cc613c207f696a3cdd/src/raygun.js#L61-82 + interface IRaygunOptions { + allowInsecureSubmissions?: boolean; + ignoreAjaxAbort?: boolean; + ignoreAjaxError?: boolean; + disableAnonymousUserTracking?: boolean; + excludedHostnames?: boolean; + excludedUserAgents?: boolean; + wrapAsynchronousCallbacks?: boolean; + debugMode?: boolean; + ignore3rdPartyErrors?: boolean; + } + + interface RaygunStatic { + noConflict(): RaygunStatic; + constructNewRaygun(): RaygunStatic; + init(apiKey: string, options?: IRaygunOptions, customdata?: any): RaygunStatic; + withCustomData(customdata: any): RaygunStatic; + withTags(tags: string[]): RaygunStatic; + attach(): RaygunStatic; + detach(): RaygunStatic; + send(e: Error, customData?: any, tags?: string[]): RaygunStatic; + setUser(user: string, isAnonymous?: boolean, email?: string, fullName?: string, firstName?: string, uuid?: string): RaygunStatic; + resetAnonymousUser(): void; + setVersion(version: string): RaygunStatic; + saveIfOffline(enableOffline: boolean): RaygunStatic; + filterSensitiveData(filteredKeys: string[]): RaygunStatic; + setFilterScope(scope: string): RaygunStatic; + whitelistCrossOriginDomains(whitelist: string[]): RaygunStatic; + onBeforeSend(callback: (payload: IPayload) => IPayload): RaygunStatic; + } + +} + +declare var Raygun: raygun.RaygunStatic; + +declare module 'Raygun' { + export = Raygun; +} \ No newline at end of file From e4ff3c73efd626d2b8887c195451ab61d2d5907f Mon Sep 17 00:00:00 2001 From: Tom Hasner Date: Sun, 24 May 2015 13:18:15 -0400 Subject: [PATCH 128/179] fixing interact tests --- interactjs/interact-tests.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/interactjs/interact-tests.ts b/interactjs/interact-tests.ts index b57a02c97..90f43a966 100644 --- a/interactjs/interact-tests.ts +++ b/interactjs/interact-tests.ts @@ -16,9 +16,9 @@ var interactable = interact(button); interactable.draggable(); interactable.draggable(true); interactable.draggable({ - onstart: (event: InteractEvent) => {}, - onmove : (event: InteractEvent) => {}, - onend : (event: InteractEvent) => {} + onstart: (event: Interact.InteractEvent) => {}, + onmove : (event: Interact.InteractEvent) => {}, + onend : (event: Interact.InteractEvent) => {} }); interactable.dropzone(); interactable.dropzone(true); @@ -45,7 +45,7 @@ interactable.inertia({ }); interactable.inertia(true); interactable.actionChecker(); -interactable.actionChecker((event: MouseEvent, defaultAction: string, interactable2: Interactable) => defaultAction); +interactable.actionChecker((event: MouseEvent, defaultAction: string, interactable2: Interact.Interactable) => defaultAction); var rect: ClientRect = interactable.getRect(); interactable.rectChecker(); interactable.styleCursor(); From da4009486dc74e251946c524d86d87b84c767076 Mon Sep 17 00:00:00 2001 From: cherrydev Date: Sun, 24 May 2015 10:21:22 -0700 Subject: [PATCH 129/179] Update angular-mocks.d.ts --- angularjs/angular-mocks.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/angularjs/angular-mocks.d.ts b/angularjs/angular-mocks.d.ts index 1e412cb8c..1c1966c1b 100644 --- a/angularjs/angular-mocks.d.ts +++ b/angularjs/angular-mocks.d.ts @@ -42,7 +42,7 @@ declare module angular { inject: { (...fns: Function[]): any; (...inlineAnnotatedConstructor: any[]): any; // this overload is undocumented, but works - strictDi(val: boolean): void; + strictDi(val?: boolean): void; } // see http://docs.angularjs.org/api/angular.mock.module From cb587e2dff0c587cc8c72f9358b30a876cf59f62 Mon Sep 17 00:00:00 2001 From: Mathias Rodriguez Date: Fri, 22 May 2015 01:34:39 -0300 Subject: [PATCH 130/179] Add definitions for markerclustererplus. --- .../markerclustererplus-tests.ts | 2217 +++++++++++++++++ markerclustererplus/markerclustererplus.d.ts | 834 +++++++ 2 files changed, 3051 insertions(+) create mode 100644 markerclustererplus/markerclustererplus-tests.ts create mode 100644 markerclustererplus/markerclustererplus.d.ts diff --git a/markerclustererplus/markerclustererplus-tests.ts b/markerclustererplus/markerclustererplus-tests.ts new file mode 100644 index 000000000..c710727aa --- /dev/null +++ b/markerclustererplus/markerclustererplus-tests.ts @@ -0,0 +1,2217 @@ +/// +/// + +module MarkerClusterApp { + export function simple_test() { + var center = new google.maps.LatLng(37.4419, -122.1419); + var map = new google.maps.Map(document.getElementById('map'), { + zoom: 3, + center: center, + mapTypeId: google.maps.MapTypeId.ROADMAP + }); + + var markers: google.maps.Marker[] = []; + for (var i = 0; i < 100; i++) { + var dataPhoto = data.photos[i]; + var latLng = new google.maps.LatLng(dataPhoto.latitude, dataPhoto.longitude); + var marker = new google.maps.Marker({ position: latLng }); + markers.push(marker); + } + var markerCluster = new MarkerClusterer(map, markers); + } + + export function init() { + google.maps.event.addDomListener(window, 'load', simple_test); + } + + // Dummy data from http://cdn.rawgit.com/mahnunchik/markerclustererplus/master/src/data.json + var data = { + "count": 10785236, + "photos": [{"photo_id": 27932, "photo_title": "Atardecer en Embalse", "photo_url": "http://www.panoramio.com/photo/27932", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/27932.jpg", "longitude": -64.404945, "latitude": -32.202924, "width": 500, "height": 375, "upload_date": "25 June 2006", "owner_id": 4483, "owner_name": "Miguel Coranti", "owner_url": "http://www.panoramio.com/user/4483"} + , + {"photo_id": 522084, "photo_title": "In Memoriam Antoine de Saint Exupéry", "photo_url": "http://www.panoramio.com/photo/522084", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/522084.jpg", "longitude": 17.470493, "latitude": 47.867077, "width": 500, "height": 350, "upload_date": "21 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 1578881, "photo_title": "Rosina Lamberti,Sunset,Templestowe , Victoria, Australia", "photo_url": "http://www.panoramio.com/photo/1578881", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1578881.jpg", "longitude": 145.141754, "latitude": -37.766372, "width": 500, "height": 474, "upload_date": "01 April 2007", "owner_id": 140796, "owner_name": "rosina lamberti", "owner_url": "http://www.panoramio.com/user/140796"} + , + {"photo_id": 97671, "photo_title": "kin-dza-dza", "photo_url": "http://www.panoramio.com/photo/97671", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/97671.jpg", "longitude": 30.785408, "latitude": 46.639301, "width": 500, "height": 375, "upload_date": "09 December 2006", "owner_id": 13058, "owner_name": "Kyryl", "owner_url": "http://www.panoramio.com/user/13058"} + , + {"photo_id": 25514, "photo_title": "Arenal", "photo_url": "http://www.panoramio.com/photo/25514", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/25514.jpg", "longitude": -84.693432, "latitude": 10.479372, "width": 500, "height": 375, "upload_date": "17 June 2006", "owner_id": 4112, "owner_name": "Roberto Garcia", "owner_url": "http://www.panoramio.com/user/4112"} + , + {"photo_id": 57823, "photo_title": "Maria Alm", "photo_url": "http://www.panoramio.com/photo/57823", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/57823.jpg", "longitude": 12.900009, "latitude": 47.409968, "width": 500, "height": 333, "upload_date": "05 October 2006", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 532693, "photo_title": "Wheatfield in afternoon light", "photo_url": "http://www.panoramio.com/photo/532693", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/532693.jpg", "longitude": 11.272659, "latitude": 59.637472, "width": 500, "height": 333, "upload_date": "22 January 2007", "owner_id": 39160, "owner_name": "Snemann", "owner_url": "http://www.panoramio.com/user/39160"} + , + {"photo_id": 57819, "photo_title": "Burg Hohenwerfen", "photo_url": "http://www.panoramio.com/photo/57819", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/57819.jpg", "longitude": 13.189259, "latitude": 47.483221, "width": 500, "height": 333, "upload_date": "05 October 2006", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 1282387, "photo_title": "Thunderstorm in Martinique", "photo_url": "http://www.panoramio.com/photo/1282387", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1282387.jpg", "longitude": -61.013432, "latitude": 14.493688, "width": 500, "height": 400, "upload_date": "12 March 2007", "owner_id": 49870, "owner_name": "Jean-Michel Raggioli", "owner_url": "http://www.panoramio.com/user/49870"} + , + {"photo_id": 945976, "photo_title": "Al tard", "photo_url": "http://www.panoramio.com/photo/945976", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/945976.jpg", "longitude": 0.490866, "latitude": 40.903783, "width": 335, "height": 500, "upload_date": "21 February 2007", "owner_id": 3022, "owner_name": "Arcadi", "owner_url": "http://www.panoramio.com/user/3022"} + , + {"photo_id": 73514, "photo_title": "Hintersee bei Ramsau", "photo_url": "http://www.panoramio.com/photo/73514", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/73514.jpg", "longitude": 12.852459, "latitude": 47.609519, "width": 500, "height": 333, "upload_date": "30 October 2006", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 298967, "photo_title": "Antelope Canyon, Ray of Light", "photo_url": "http://www.panoramio.com/photo/298967", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/298967.jpg", "longitude": -111.407890, "latitude": 36.894037, "width": 500, "height": 375, "upload_date": "04 January 2007", "owner_id": 64388, "owner_name": "Artusi", "owner_url": "http://www.panoramio.com/user/64388"} + , + {"photo_id": 88151, "photo_title": "Val Verzasca - Switzerland", "photo_url": "http://www.panoramio.com/photo/88151", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/88151.jpg", "longitude": 8.838158, "latitude": 46.257746, "width": 500, "height": 375, "upload_date": "28 November 2006", "owner_id": 11098, "owner_name": "Michele Masnata", "owner_url": "http://www.panoramio.com/user/11098"} + , + {"photo_id": 6463, "photo_title": "Guggenheim and spider", "photo_url": "http://www.panoramio.com/photo/6463", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6463.jpg", "longitude": -2.933736, "latitude": 43.269159, "width": 500, "height": 375, "upload_date": "09 January 2006", "owner_id": 414, "owner_name": "Sonia Villegas", "owner_url": "http://www.panoramio.com/user/414"} + , + {"photo_id": 107980, "photo_title": "Mostar", "photo_url": "http://www.panoramio.com/photo/107980", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/107980.jpg", "longitude": 17.815200, "latitude": 43.337255, "width": 369, "height": 500, "upload_date": "10 December 2006", "owner_id": 12954, "owner_name": "Ziębol", "owner_url": "http://www.panoramio.com/user/12954"} + , + {"photo_id": 9439, "photo_title": "Bora Bora", "photo_url": "http://www.panoramio.com/photo/9439", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9439.jpg", "longitude": -151.750000, "latitude": -16.500000, "width": 500, "height": 375, "upload_date": "02 February 2006", "owner_id": 1600, "owner_name": "heavenearth", "owner_url": "http://www.panoramio.com/user/1600"} + , + {"photo_id": 673131, "photo_title": "Nivane in Ørsta", "photo_url": "http://www.panoramio.com/photo/673131", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/673131.jpg", "longitude": 6.108742, "latitude": 62.226676, "width": 500, "height": 334, "upload_date": "03 February 2007", "owner_id": 56091, "owner_name": "Kjetil Vaage Øie", "owner_url": "http://www.panoramio.com/user/56091"} + , + {"photo_id": 346269, "photo_title": "italy-toscany", "photo_url": "http://www.panoramio.com/photo/346269", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/346269.jpg", "longitude": 11.616282, "latitude": 43.064389, "width": 500, "height": 334, "upload_date": "08 January 2007", "owner_id": 69671, "owner_name": "illusandpics.com", "owner_url": "http://www.panoramio.com/user/69671"} + , + {"photo_id": 290039, "photo_title": "Gentoo Penguins at Sunrise", "photo_url": "http://www.panoramio.com/photo/290039", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/290039.jpg", "longitude": -59.070311, "latitude": -52.430295, "width": 500, "height": 284, "upload_date": "03 January 2007", "owner_id": 61890, "owner_name": "enriquevidalphoto.com", "owner_url": "http://www.panoramio.com/user/61890"} + , + {"photo_id": 1870141, "photo_title": "Les Mines", "photo_url": "http://www.panoramio.com/photo/1870141", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1870141.jpg", "longitude": 1.314712, "latitude": 45.922199, "width": 500, "height": 379, "upload_date": "21 April 2007", "owner_id": 372189, "owner_name": "Phil©", "owner_url": "http://www.panoramio.com/user/372189"} + , + {"photo_id": 516809, "photo_title": "Az őrszem", "photo_url": "http://www.panoramio.com/photo/516809", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/516809.jpg", "longitude": 18.239279, "latitude": 47.535341, "width": 500, "height": 286, "upload_date": "21 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 67347, "photo_title": "Amanecer en el Salar de Uyuni", "photo_url": "http://www.panoramio.com/photo/67347", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/67347.jpg", "longitude": -67.549438, "latitude": -20.552438, "width": 500, "height": 375, "upload_date": "20 October 2006", "owner_id": 9080, "owner_name": "Marco Teodonio", "owner_url": "http://www.panoramio.com/user/9080"} + , + {"photo_id": 405822, "photo_title": "tulip", "photo_url": "http://www.panoramio.com/photo/405822", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/405822.jpg", "longitude": 139.011619, "latitude": 37.871500, "width": 500, "height": 386, "upload_date": "13 January 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 233619, "photo_title": "Warsaw Bridge 01 [www.wierzchon.com]", "photo_url": "http://www.panoramio.com/photo/233619", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/233619.jpg", "longitude": 21.035728, "latitude": 52.242353, "width": 500, "height": 500, "upload_date": "25 December 2006", "owner_id": 47836, "owner_name": "Andrzej Wierzchon", "owner_url": "http://www.panoramio.com/user/47836"} + , + {"photo_id": 1516726, "photo_title": "Облако над вулканом Камень. www.photo-sturm.ru", "photo_url": "http://www.panoramio.com/photo/1516726", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1516726.jpg", "longitude": 160.587502, "latitude": 56.081999, "width": 414, "height": 500, "upload_date": "27 March 2007", "owner_id": 268724, "owner_name": "Korotnev AV", "owner_url": "http://www.panoramio.com/user/268724"} + , + {"photo_id": 70975, "photo_title": "Hospiz", "photo_url": "http://www.panoramio.com/photo/70975", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/70975.jpg", "longitude": 8.024461, "latitude": 46.245801, "width": 500, "height": 500, "upload_date": "26 October 2006", "owner_id": 9379, "owner_name": "Davide Bernacchi", "owner_url": "http://www.panoramio.com/user/9379"} + , + {"photo_id": 882660, "photo_title": "icy_chains_1_hdr_web", "photo_url": "http://www.panoramio.com/photo/882660", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/882660.jpg", "longitude": -79.798197, "latitude": 43.321353, "width": 500, "height": 333, "upload_date": "18 February 2007", "owner_id": 17488, "owner_name": "John Gillett", "owner_url": "http://www.panoramio.com/user/17488"} + , + {"photo_id": 9363990, "photo_title": "Marble Cave", "photo_url": "http://www.panoramio.com/photo/9363990", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9363990.jpg", "longitude": -72.607527, "latitude": -46.647138, "width": 500, "height": 375, "upload_date": "14 April 2008", "owner_id": 947917, "owner_name": "Dejah", "owner_url": "http://www.panoramio.com/user/947917"} + , + {"photo_id": 1884507, "photo_title": "fukushimagata", "photo_url": "http://www.panoramio.com/photo/1884507", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1884507.jpg", "longitude": 139.243813, "latitude": 37.909669, "width": 500, "height": 384, "upload_date": "22 April 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 1343502, "photo_title": "вулкан Карымский", "photo_url": "http://www.panoramio.com/photo/1343502", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1343502.jpg", "longitude": 159.480114, "latitude": 54.025419, "width": 500, "height": 334, "upload_date": "16 March 2007", "owner_id": 268724, "owner_name": "Korotnev AV", "owner_url": "http://www.panoramio.com/user/268724"} + , + {"photo_id": 97723, "photo_title": "Torrent de pareis", "photo_url": "http://www.panoramio.com/photo/97723", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/97723.jpg", "longitude": 2.805762, "latitude": 39.852352, "width": 401, "height": 500, "upload_date": "09 December 2006", "owner_id": 13121, "owner_name": "Andreas G.M.", "owner_url": "http://www.panoramio.com/user/13121"} + , + {"photo_id": 537672, "photo_title": "Sr. da Pedra", "photo_url": "http://www.panoramio.com/photo/537672", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/537672.jpg", "longitude": -8.659008, "latitude": 41.068821, "width": 500, "height": 366, "upload_date": "23 January 2007", "owner_id": 115618, "owner_name": "Paulo J Moreira", "owner_url": "http://www.panoramio.com/user/115618"} + , + {"photo_id": 204924, "photo_title": "zaldiak", "photo_url": "http://www.panoramio.com/photo/204924", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/204924.jpg", "longitude": -1.806951, "latitude": 43.245140, "width": 500, "height": 346, "upload_date": "21 December 2006", "owner_id": 2575, "owner_name": "mikel ortega", "owner_url": "http://www.panoramio.com/user/2575"} + , + {"photo_id": 114795, "photo_title": "TIBAUM-BIZZAR", "photo_url": "http://www.panoramio.com/photo/114795", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/114795.jpg", "longitude": 7.706180, "latitude": 51.665741, "width": 334, "height": 500, "upload_date": "11 December 2006", "owner_id": 13121, "owner_name": "Andreas G.M.", "owner_url": "http://www.panoramio.com/user/13121"} + , + {"photo_id": 1287881, "photo_title": "Aurora borealis", "photo_url": "http://www.panoramio.com/photo/1287881", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1287881.jpg", "longitude": 44.215508, "latitude": 65.829148, "width": 500, "height": 205, "upload_date": "12 March 2007", "owner_id": 75359, "owner_name": "Andrey Larin", "owner_url": "http://www.panoramio.com/user/75359"} + , + {"photo_id": 1781717, "photo_title": "Water Cuts Rock", "photo_url": "http://www.panoramio.com/photo/1781717", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1781717.jpg", "longitude": -113.047771, "latitude": 37.312154, "width": 333, "height": 500, "upload_date": "15 April 2007", "owner_id": 376395, "owner_name": "JeffSullivan (www.MyPhotoGuides.com)", "owner_url": "http://www.panoramio.com/user/376395"} + , + {"photo_id": 196103, "photo_title": "albufera", "photo_url": "http://www.panoramio.com/photo/196103", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/196103.jpg", "longitude": -0.323882, "latitude": 39.349166, "width": 332, "height": 500, "upload_date": "20 December 2006", "owner_id": 38804, "owner_name": "www.oscarsanchez.net", "owner_url": "http://www.panoramio.com/user/38804"} + , + {"photo_id": 266224, "photo_title": "Boulzojavri", "photo_url": "http://www.panoramio.com/photo/266224", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/266224.jpg", "longitude": 24.373169, "latitude": 68.908534, "width": 500, "height": 334, "upload_date": "30 December 2006", "owner_id": 56091, "owner_name": "Kjetil Vaage Øie", "owner_url": "http://www.panoramio.com/user/56091"} + , + {"photo_id": 6126294, "photo_title": "Richmond Deer", "photo_url": "http://www.panoramio.com/photo/6126294", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6126294.jpg", "longitude": -0.275195, "latitude": 51.445890, "width": 489, "height": 500, "upload_date": "25 November 2007", "owner_id": 1130880, "owner_name": "marksimms", "owner_url": "http://www.panoramio.com/user/1130880"} + , + {"photo_id": 168032, "photo_title": "Buci Seine - Looking Up", "photo_url": "http://www.panoramio.com/photo/168032", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/168032.jpg", "longitude": 2.336990, "latitude": 48.853891, "width": 500, "height": 357, "upload_date": "16 December 2006", "owner_id": 5684, "owner_name": "Brent Townshend", "owner_url": "http://www.panoramio.com/user/5684"} + , + {"photo_id": 1370932, "photo_title": "Mercury Bay Sunrise", "photo_url": "http://www.panoramio.com/photo/1370932", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1370932.jpg", "longitude": 175.699196, "latitude": -36.817685, "width": 500, "height": 470, "upload_date": "17 March 2007", "owner_id": 286729, "owner_name": "jimwitkowski", "owner_url": "http://www.panoramio.com/user/286729"} + , + {"photo_id": 120844, "photo_title": "Adelie-Prat- Kratzmaier", "photo_url": "http://www.panoramio.com/photo/120844", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/120844.jpg", "longitude": -59.683228, "latitude": -62.485684, "width": 500, "height": 351, "upload_date": "12 December 2006", "owner_id": 19856, "owner_name": "Juan Kratzmaier", "owner_url": "http://www.panoramio.com/user/19856"} + , + {"photo_id": 940294, "photo_title": "Infrared Mediterranean Heat", "photo_url": "http://www.panoramio.com/photo/940294", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/940294.jpg", "longitude": 25.376015, "latitude": 36.461537, "width": 500, "height": 332, "upload_date": "21 February 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 4446084, "photo_title": "Vizivarázs", "photo_url": "http://www.panoramio.com/photo/4446084", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4446084.jpg", "longitude": 17.504482, "latitude": 47.842773, "width": 367, "height": 500, "upload_date": "06 September 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 498352, "photo_title": "Wave", "photo_url": "http://www.panoramio.com/photo/498352", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/498352.jpg", "longitude": -112.005315, "latitude": 36.995972, "width": 500, "height": 333, "upload_date": "20 January 2007", "owner_id": 40260, "owner_name": "Don Albonico", "owner_url": "http://www.panoramio.com/user/40260"} + , + {"photo_id": 775893, "photo_title": "Leoparden", "photo_url": "http://www.panoramio.com/photo/775893", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/775893.jpg", "longitude": 36.046829, "latitude": -3.818353, "width": 500, "height": 336, "upload_date": "11 February 2007", "owner_id": 164434, "owner_name": "Achim Mittler", "owner_url": "http://www.panoramio.com/user/164434"} + , + {"photo_id": 665502, "photo_title": "Sunset Beach Walker", "photo_url": "http://www.panoramio.com/photo/665502", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/665502.jpg", "longitude": -124.077530, "latitude": 44.519888, "width": 500, "height": 340, "upload_date": "03 February 2007", "owner_id": 107359, "owner_name": "Ron Cooper", "owner_url": "http://www.panoramio.com/user/107359"} + , + {"photo_id": 9021415, "photo_title": "Wat Suwan Kuha or Wat Tham, Phang Nga, Winner Unusual Location April 2008", "photo_url": "http://www.panoramio.com/photo/9021415", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9021415.jpg", "longitude": 98.471628, "latitude": 8.428840, "width": 500, "height": 334, "upload_date": "31 March 2008", "owner_id": 1077251, "owner_name": "picsonthemove", "owner_url": "http://www.panoramio.com/user/1077251"} + , + {"photo_id": 287244, "photo_title": "Landwasser-Viadukt - This is an unofficial photo point. Just follow the footpath up from the official one, until the clearing.", "photo_url": "http://www.panoramio.com/photo/287244", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/287244.jpg", "longitude": 9.675007, "latitude": 46.681229, "width": 337, "height": 500, "upload_date": "03 January 2007", "owner_id": 57869, "owner_name": "NAGY Albert", "owner_url": "http://www.panoramio.com/user/57869"} + , + {"photo_id": 677366, "photo_title": "Oak tree in winter", "photo_url": "http://www.panoramio.com/photo/677366", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/677366.jpg", "longitude": 10.771065, "latitude": 59.663926, "width": 358, "height": 500, "upload_date": "03 February 2007", "owner_id": 39160, "owner_name": "Snemann", "owner_url": "http://www.panoramio.com/user/39160"} + , + {"photo_id": 196086, "photo_title": "albufera", "photo_url": "http://www.panoramio.com/photo/196086", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/196086.jpg", "longitude": -0.323882, "latitude": 39.349166, "width": 500, "height": 332, "upload_date": "20 December 2006", "owner_id": 38804, "owner_name": "www.oscarsanchez.net", "owner_url": "http://www.panoramio.com/user/38804"} + , + {"photo_id": 4340931, "photo_title": "Cold morning", "photo_url": "http://www.panoramio.com/photo/4340931", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4340931.jpg", "longitude": 12.113349, "latitude": 49.342559, "width": 500, "height": 333, "upload_date": "31 August 2007", "owner_id": 696605, "owner_name": "© alfredschaffer", "owner_url": "http://www.panoramio.com/user/696605"} + , + {"photo_id": 488, "photo_title": "Lagos de Montebello, México", "photo_url": "http://www.panoramio.com/photo/488", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/488.jpg", "longitude": -91.677904, "latitude": 16.111297, "width": 500, "height": 345, "upload_date": "31 August 2005", "owner_id": 7, "owner_name": "Eduardo Manchón", "owner_url": "http://www.panoramio.com/user/7"} + , + {"photo_id": 723666, "photo_title": "Majestically Still", "photo_url": "http://www.panoramio.com/photo/723666", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/723666.jpg", "longitude": -116.175613, "latitude": 51.327608, "width": 500, "height": 332, "upload_date": "07 February 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 1081710, "photo_title": "Gjevilvatnet lake in Oppdal", "photo_url": "http://www.panoramio.com/photo/1081710", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1081710.jpg", "longitude": 9.412537, "latitude": 62.686749, "width": 500, "height": 333, "upload_date": "28 February 2007", "owner_id": 223406, "owner_name": "Sigmund Rise", "owner_url": "http://www.panoramio.com/user/223406"} + , + {"photo_id": 22575, "photo_title": "Lijiang River, near Yangshuo, China", "photo_url": "http://www.panoramio.com/photo/22575", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/22575.jpg", "longitude": 110.454826, "latitude": 24.962716, "width": 500, "height": 333, "upload_date": "05 June 2006", "owner_id": 3557, "owner_name": "Placebo", "owner_url": "http://www.panoramio.com/user/3557"} + , + {"photo_id": 2735754, "photo_title": "Después de la lluvia", "photo_url": "http://www.panoramio.com/photo/2735754", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2735754.jpg", "longitude": -73.241998, "latitude": -39.809583, "width": 360, "height": 500, "upload_date": "13 June 2007", "owner_id": 327310, "owner_name": "Erwin Woenckhaus", "owner_url": "http://www.panoramio.com/user/327310"} + , + {"photo_id": 73515, "photo_title": "Kloster Höglwörth", "photo_url": "http://www.panoramio.com/photo/73515", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/73515.jpg", "longitude": 12.850227, "latitude": 47.815575, "width": 500, "height": 333, "upload_date": "30 October 2006", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 723015, "photo_title": "Cape Flattery (infrared)", "photo_url": "http://www.panoramio.com/photo/723015", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/723015.jpg", "longitude": -124.726700, "latitude": 48.385898, "width": 500, "height": 332, "upload_date": "07 February 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 1288595, "photo_title": "O'Keeffe ?", "photo_url": "http://www.panoramio.com/photo/1288595", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1288595.jpg", "longitude": 72.920637, "latitude": 4.038162, "width": 332, "height": 500, "upload_date": "12 March 2007", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 1008304, "photo_title": "nyhavn", "photo_url": "http://www.panoramio.com/photo/1008304", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1008304.jpg", "longitude": 12.591190, "latitude": 55.679762, "width": 500, "height": 333, "upload_date": "24 February 2007", "owner_id": 2659, "owner_name": "ozalph", "owner_url": "http://www.panoramio.com/user/2659"} + , + {"photo_id": 19547, "photo_title": "Embarcador 1", "photo_url": "http://www.panoramio.com/photo/19547", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/19547.jpg", "longitude": 0.493140, "latitude": 40.904172, "width": 500, "height": 335, "upload_date": "07 May 2006", "owner_id": 3022, "owner_name": "Arcadi", "owner_url": "http://www.panoramio.com/user/3022"} + , + {"photo_id": 98115, "photo_title": "FREE-SPIRIT", "photo_url": "http://www.panoramio.com/photo/98115", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/98115.jpg", "longitude": 9.908917, "latitude": 50.487112, "width": 500, "height": 304, "upload_date": "10 December 2006", "owner_id": 13121, "owner_name": "Andreas G.M.", "owner_url": "http://www.panoramio.com/user/13121"} + , + {"photo_id": 9822056, "photo_title": "Reflection under the Bridge", "photo_url": "http://www.panoramio.com/photo/9822056", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9822056.jpg", "longitude": 103.853851, "latitude": 1.286973, "width": 333, "height": 500, "upload_date": "01 May 2008", "owner_id": 1465912, "owner_name": "funtor", "owner_url": "http://www.panoramio.com/user/1465912"} + , + {"photo_id": 9117094, "photo_title": "Baron's Haugh, Scotland", "photo_url": "http://www.panoramio.com/photo/9117094", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9117094.jpg", "longitude": -3.986835, "latitude": 55.773532, "width": 500, "height": 337, "upload_date": "05 April 2008", "owner_id": 165346, "owner_name": "Alan Knox", "owner_url": "http://www.panoramio.com/user/165346"} + , + {"photo_id": 5342534, "photo_title": "Őszi pompa", "photo_url": "http://www.panoramio.com/photo/5342534", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5342534.jpg", "longitude": 15.964594, "latitude": 47.875426, "width": 500, "height": 334, "upload_date": "16 October 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 2346129, "photo_title": "Pipacsálom", "photo_url": "http://www.panoramio.com/photo/2346129", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2346129.jpg", "longitude": 17.521820, "latitude": 47.748558, "width": 500, "height": 378, "upload_date": "22 May 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 3749005, "photo_title": "Once in a Blue Moon....", "photo_url": "http://www.panoramio.com/photo/3749005", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3749005.jpg", "longitude": -105.654080, "latitude": 40.294560, "width": 374, "height": 500, "upload_date": "05 August 2007", "owner_id": 87752, "owner_name": "Richard Ryer", "owner_url": "http://www.panoramio.com/user/87752"} + , + {"photo_id": 1360629, "photo_title": "Frente a la Cascada de Gujuli -103 m.-", "photo_url": "http://www.panoramio.com/photo/1360629", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1360629.jpg", "longitude": -2.909800, "latitude": 42.976199, "width": 333, "height": 500, "upload_date": "17 March 2007", "owner_id": 129297, "owner_name": "Enrique Ortiz de Zárate", "owner_url": "http://www.panoramio.com/user/129297"} + , + {"photo_id": 6129915, "photo_title": "A vadon szava", "photo_url": "http://www.panoramio.com/photo/6129915", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6129915.jpg", "longitude": 17.521133, "latitude": 47.854408, "width": 500, "height": 325, "upload_date": "25 November 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 67183, "photo_title": "Laguna verde e Vulcano Licancabur", "photo_url": "http://www.panoramio.com/photo/67183", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/67183.jpg", "longitude": -67.819161, "latitude": -22.787696, "width": 500, "height": 370, "upload_date": "20 October 2006", "owner_id": 9080, "owner_name": "Marco Teodonio", "owner_url": "http://www.panoramio.com/user/9080"} + , + {"photo_id": 507571, "photo_title": "Mikor a harangszó is szebben hallik", "photo_url": "http://www.panoramio.com/photo/507571", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/507571.jpg", "longitude": 17.684383, "latitude": 47.587873, "width": 396, "height": 500, "upload_date": "20 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 6685422, "photo_title": "Dawn at Bagan, Myanmar (Burma)", "photo_url": "http://www.panoramio.com/photo/6685422", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6685422.jpg", "longitude": 94.860935, "latitude": 21.169045, "width": 500, "height": 333, "upload_date": "25 December 2007", "owner_id": 1221287, "owner_name": "TS Jeung", "owner_url": "http://www.panoramio.com/user/1221287"} + , + {"photo_id": 3513121, "photo_title": "Báláim", "photo_url": "http://www.panoramio.com/photo/3513121", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3513121.jpg", "longitude": 17.481651, "latitude": 47.457576, "width": 419, "height": 500, "upload_date": "24 July 2007", "owner_id": 689769, "owner_name": "Ponty István", "owner_url": "http://www.panoramio.com/user/689769"} + , + {"photo_id": 10574161, "photo_title": "Silhouette", "photo_url": "http://www.panoramio.com/photo/10574161", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10574161.jpg", "longitude": 148.662905, "latitude": -35.304724, "width": 500, "height": 346, "upload_date": "25 May 2008", "owner_id": 766550, "owner_name": "VFedele", "owner_url": "http://www.panoramio.com/user/766550"} + , + {"photo_id": 89190, "photo_title": "Mount Ararat, Yerevan, Armenia", "photo_url": "http://www.panoramio.com/photo/89190", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/89190.jpg", "longitude": 44.483900, "latitude": 40.195299, "width": 500, "height": 375, "upload_date": "30 November 2006", "owner_id": 11226, "owner_name": "Ardani", "owner_url": "http://www.panoramio.com/user/11226"} + , + {"photo_id": 1182305, "photo_title": "Dobel, Albrecht-Hütte", "photo_url": "http://www.panoramio.com/photo/1182305", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1182305.jpg", "longitude": 8.500500, "latitude": 48.793465, "width": 500, "height": 375, "upload_date": "05 March 2007", "owner_id": 66229, "owner_name": "Mast", "owner_url": "http://www.panoramio.com/user/66229"} + , + {"photo_id": 4258015, "photo_title": "Fényözön", "photo_url": "http://www.panoramio.com/photo/4258015", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4258015.jpg", "longitude": 16.391602, "latitude": 46.851269, "width": 333, "height": 500, "upload_date": "28 August 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 1413, "photo_title": "Champlain Lookout", "photo_url": "http://www.panoramio.com/photo/1413", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1413.jpg", "longitude": -75.912872, "latitude": 45.507640, "width": 500, "height": 375, "upload_date": "06 October 2005", "owner_id": 273, "owner_name": "JC", "owner_url": "http://www.panoramio.com/user/273"} + , + {"photo_id": 1526763, "photo_title": "Gizeh Pyramids, Cairo", "photo_url": "http://www.panoramio.com/photo/1526763", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1526763.jpg", "longitude": 31.133537, "latitude": 29.966721, "width": 500, "height": 333, "upload_date": "27 March 2007", "owner_id": 59919, "owner_name": "xflo:w (http://www.xflo.net)", "owner_url": "http://www.panoramio.com/user/59919"} + , + {"photo_id": 8802900, "photo_title": "Martigues, miroir aux oiseaux", "photo_url": "http://www.panoramio.com/photo/8802900", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8802900.jpg", "longitude": 5.054559, "latitude": 43.405079, "width": 387, "height": 500, "upload_date": "24 March 2008", "owner_id": 629243, "owner_name": "Olivier Faugeras", "owner_url": "http://www.panoramio.com/user/629243"} + , + {"photo_id": 459515, "photo_title": "fire works", "photo_url": "http://www.panoramio.com/photo/459515", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/459515.jpg", "longitude": 138.423271, "latitude": 38.069312, "width": 500, "height": 385, "upload_date": "16 January 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 749464, "photo_title": "Gondola", "photo_url": "http://www.panoramio.com/photo/749464", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/749464.jpg", "longitude": 12.336917, "latitude": 45.434053, "width": 500, "height": 332, "upload_date": "09 February 2007", "owner_id": 159455, "owner_name": "©Franco Truscello", "owner_url": "http://www.panoramio.com/user/159455"} + , + {"photo_id": 422608, "photo_title": "tanada", "photo_url": "http://www.panoramio.com/photo/422608", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/422608.jpg", "longitude": 139.047089, "latitude": 37.449787, "width": 383, "height": 500, "upload_date": "14 January 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 85617, "photo_title": "Parque Natural de Calblanque", "photo_url": "http://www.panoramio.com/photo/85617", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/85617.jpg", "longitude": -0.739861, "latitude": 37.594104, "width": 332, "height": 500, "upload_date": "24 November 2006", "owner_id": 10969, "owner_name": "Juanra", "owner_url": "http://www.panoramio.com/user/10969"} + , + {"photo_id": 1089235, "photo_title": "Nyáridéző", "photo_url": "http://www.panoramio.com/photo/1089235", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1089235.jpg", "longitude": 18.207092, "latitude": 47.318578, "width": 500, "height": 282, "upload_date": "28 February 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 505229, "photo_title": "Etangs près de Dijon", "photo_url": "http://www.panoramio.com/photo/505229", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/505229.jpg", "longitude": 5.168552, "latitude": 47.312642, "width": 350, "height": 500, "upload_date": "20 January 2007", "owner_id": 78506, "owner_name": "Philippe Stoop", "owner_url": "http://www.panoramio.com/user/78506"} + , + {"photo_id": 679343, "photo_title": "melbourne sunset over the yarra river", "photo_url": "http://www.panoramio.com/photo/679343", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/679343.jpg", "longitude": 144.968119, "latitude": -37.819616, "width": 500, "height": 500, "upload_date": "04 February 2007", "owner_id": 146092, "owner_name": "sid1662", "owner_url": "http://www.panoramio.com/user/146092"} + , + {"photo_id": 436336, "photo_title": "myoujyousan", "photo_url": "http://www.panoramio.com/photo/436336", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/436336.jpg", "longitude": 137.831554, "latitude": 36.911608, "width": 500, "height": 362, "upload_date": "15 January 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 9733680, "photo_title": "Sydney", "photo_url": "http://www.panoramio.com/photo/9733680", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9733680.jpg", "longitude": 151.209834, "latitude": -33.848588, "width": 333, "height": 500, "upload_date": "28 April 2008", "owner_id": 1465912, "owner_name": "funtor", "owner_url": "http://www.panoramio.com/user/1465912"} + , + {"photo_id": 7415625, "photo_title": "Në fushë të Pallaticesë", "photo_url": "http://www.panoramio.com/photo/7415625", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7415625.jpg", "longitude": 21.077271, "latitude": 42.011550, "width": 437, "height": 500, "upload_date": "28 January 2008", "owner_id": 695042, "owner_name": "Neim Sejfuli ♦", "owner_url": "http://www.panoramio.com/user/695042"} + , + {"photo_id": 5358174, "photo_title": "Morning Glory", "photo_url": "http://www.panoramio.com/photo/5358174", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5358174.jpg", "longitude": -110.843537, "latitude": 44.475020, "width": 500, "height": 348, "upload_date": "16 October 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 316199, "photo_title": "A lake on Gasherbrum glacier", "photo_url": "http://www.panoramio.com/photo/316199", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/316199.jpg", "longitude": 76.732550, "latitude": 35.877298, "width": 500, "height": 375, "upload_date": "06 January 2007", "owner_id": 65672, "owner_name": "www.turclubmai.ru", "owner_url": "http://www.panoramio.com/user/65672"} + , + {"photo_id": 400536, "photo_title": "Half Dome Mtn, Yosemite Nat Park, CA", "photo_url": "http://www.panoramio.com/photo/400536", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/400536.jpg", "longitude": -119.495888, "latitude": 37.811411, "width": 500, "height": 333, "upload_date": "12 January 2007", "owner_id": 85489, "owner_name": "Bruce MacIver", "owner_url": "http://www.panoramio.com/user/85489"} + , + {"photo_id": 2942693, "photo_title": "Tulips and Windmills", "photo_url": "http://www.panoramio.com/photo/2942693", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2942693.jpg", "longitude": 4.864798, "latitude": 52.594393, "width": 500, "height": 500, "upload_date": "25 June 2007", "owner_id": 588149, "owner_name": "Adam Salwanowicz", "owner_url": "http://www.panoramio.com/user/588149"} + , + {"photo_id": 9733633, "photo_title": "Oper-Sydney", "photo_url": "http://www.panoramio.com/photo/9733633", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9733633.jpg", "longitude": 151.216968, "latitude": -33.851702, "width": 500, "height": 333, "upload_date": "28 April 2008", "owner_id": 1465912, "owner_name": "funtor", "owner_url": "http://www.panoramio.com/user/1465912"} + , + {"photo_id": 1800454, "photo_title": "Bombay Beach, Salton Sea, CA", "photo_url": "http://www.panoramio.com/photo/1800454", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1800454.jpg", "longitude": -115.729235, "latitude": 33.347316, "width": 500, "height": 407, "upload_date": "16 April 2007", "owner_id": 107613, "owner_name": "Tom Grubbe", "owner_url": "http://www.panoramio.com/user/107613"} + , + {"photo_id": 2558057, "photo_title": "Kin-dza-dza 2", "photo_url": "http://www.panoramio.com/photo/2558057", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2558057.jpg", "longitude": 30.785751, "latitude": 46.639301, "width": 500, "height": 375, "upload_date": "03 June 2007", "owner_id": 13058, "owner_name": "Kyryl", "owner_url": "http://www.panoramio.com/user/13058"} + , + {"photo_id": 7768089, "photo_title": "Isteni színjáték", "photo_url": "http://www.panoramio.com/photo/7768089", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7768089.jpg", "longitude": 17.507057, "latitude": 47.776425, "width": 500, "height": 334, "upload_date": "12 February 2008", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 1213006, "photo_title": "Twilight Drive", "photo_url": "http://www.panoramio.com/photo/1213006", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1213006.jpg", "longitude": -114.481916, "latitude": 51.095841, "width": 500, "height": 335, "upload_date": "07 March 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 395800, "photo_title": "Pic de Bure depuis le Pic de Gleize", "photo_url": "http://www.panoramio.com/photo/395800", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/395800.jpg", "longitude": 6.055870, "latitude": 44.610146, "width": 500, "height": 350, "upload_date": "12 January 2007", "owner_id": 78506, "owner_name": "Philippe Stoop", "owner_url": "http://www.panoramio.com/user/78506"} + , + {"photo_id": 11073609, "photo_title": "Sunrise in Koroni, by Kostas Andreopoulos", "photo_url": "http://www.panoramio.com/photo/11073609", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/11073609.jpg", "longitude": 21.952747, "latitude": 36.797775, "width": 500, "height": 375, "upload_date": "09 June 2008", "owner_id": 1690483, "owner_name": "k.andre", "owner_url": "http://www.panoramio.com/user/1690483"} + , + {"photo_id": 6564418, "photo_title": "Baron's Haugh, Scotland", "photo_url": "http://www.panoramio.com/photo/6564418", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6564418.jpg", "longitude": -3.989239, "latitude": 55.772808, "width": 500, "height": 337, "upload_date": "19 December 2007", "owner_id": 165346, "owner_name": "Alan Knox", "owner_url": "http://www.panoramio.com/user/165346"} + , + {"photo_id": 10158925, "photo_title": "Lluvia púrpura ( Purple rain )", "photo_url": "http://www.panoramio.com/photo/10158925", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10158925.jpg", "longitude": -0.476360, "latitude": 39.612565, "width": 500, "height": 333, "upload_date": "12 May 2008", "owner_id": 787217, "owner_name": "♣ Víctor S de Lara ♣", "owner_url": "http://www.panoramio.com/user/787217"} + , + {"photo_id": 121574, "photo_title": "Moscú/Moscow - Catedral de San Basilio", "photo_url": "http://www.panoramio.com/photo/121574", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/121574.jpg", "longitude": 37.621951, "latitude": 55.753033, "width": 500, "height": 375, "upload_date": "12 December 2006", "owner_id": 17212, "owner_name": "javier herranz", "owner_url": "http://www.panoramio.com/user/17212"} + , + {"photo_id": 6012915, "photo_title": "Erleuchtung in Venedig", "photo_url": "http://www.panoramio.com/photo/6012915", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6012915.jpg", "longitude": 12.340747, "latitude": 45.433364, "width": 500, "height": 333, "upload_date": "19 November 2007", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 346687, "photo_title": "namibia desert", "photo_url": "http://www.panoramio.com/photo/346687", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/346687.jpg", "longitude": 15.408325, "latitude": -24.729370, "width": 500, "height": 334, "upload_date": "08 January 2007", "owner_id": 69671, "owner_name": "illusandpics.com", "owner_url": "http://www.panoramio.com/user/69671"} + , + {"photo_id": 1913758, "photo_title": "Cortona - Via Gino Severini", "photo_url": "http://www.panoramio.com/photo/1913758", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1913758.jpg", "longitude": 11.988916, "latitude": 43.273659, "width": 500, "height": 498, "upload_date": "24 April 2007", "owner_id": 193913, "owner_name": "Klesitz Piroska", "owner_url": "http://www.panoramio.com/user/193913"} + , + {"photo_id": 405843, "photo_title": "siroiwa", "photo_url": "http://www.panoramio.com/photo/405843", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/405843.jpg", "longitude": 138.789682, "latitude": 37.726398, "width": 500, "height": 338, "upload_date": "13 January 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 91375, "photo_title": "Burj Al Arab At Night", "photo_url": "http://www.panoramio.com/photo/91375", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/91375.jpg", "longitude": 55.187416, "latitude": 25.140312, "width": 255, "height": 500, "upload_date": "03 December 2006", "owner_id": 1295, "owner_name": "Matthew Walters", "owner_url": "http://www.panoramio.com/user/1295"} + , + {"photo_id": 940792, "photo_title": "Moraine Branch", "photo_url": "http://www.panoramio.com/photo/940792", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/940792.jpg", "longitude": -116.177502, "latitude": 51.325946, "width": 500, "height": 332, "upload_date": "21 February 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 58287, "photo_title": "Schloß Anif", "photo_url": "http://www.panoramio.com/photo/58287", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/58287.jpg", "longitude": 13.068817, "latitude": 47.744540, "width": 500, "height": 333, "upload_date": "07 October 2006", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 194118, "photo_title": "Mount Fuji: Fuji-San", "photo_url": "http://www.panoramio.com/photo/194118", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/194118.jpg", "longitude": 138.727455, "latitude": 35.377294, "width": 500, "height": 332, "upload_date": "20 December 2006", "owner_id": 27882, "owner_name": "taoy", "owner_url": "http://www.panoramio.com/user/27882"} + , + {"photo_id": 5158892, "photo_title": "prati di Tires Alto Adige Südtirol south tyrol", "photo_url": "http://www.panoramio.com/photo/5158892", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5158892.jpg", "longitude": 11.557188, "latitude": 46.471044, "width": 500, "height": 429, "upload_date": "08 October 2007", "owner_id": 578163, "owner_name": "Margherita-Italy", "owner_url": "http://www.panoramio.com/user/578163"} + , + {"photo_id": 280123, "photo_title": "kaouki05", "photo_url": "http://www.panoramio.com/photo/280123", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/280123.jpg", "longitude": -9.799418, "latitude": 31.355662, "width": 328, "height": 500, "upload_date": "01 January 2007", "owner_id": 58867, "owner_name": "Lachaud Franck", "owner_url": "http://www.panoramio.com/user/58867"} + , + {"photo_id": 6789223, "photo_title": "Exploding sky", "photo_url": "http://www.panoramio.com/photo/6789223", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6789223.jpg", "longitude": -69.930505, "latitude": 12.522579, "width": 500, "height": 333, "upload_date": "30 December 2007", "owner_id": 89499, "owner_name": "Michael Braxenthaler", "owner_url": "http://www.panoramio.com/user/89499"} + , + {"photo_id": 3722547, "photo_title": "Morning fog in the Alps", "photo_url": "http://www.panoramio.com/photo/3722547", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3722547.jpg", "longitude": 10.591164, "latitude": 47.521142, "width": 500, "height": 333, "upload_date": "04 August 2007", "owner_id": 89499, "owner_name": "Michael Braxenthaler", "owner_url": "http://www.panoramio.com/user/89499"} + , + {"photo_id": 9530458, "photo_title": "Castillian cereal fields from Atienza walls", "photo_url": "http://www.panoramio.com/photo/9530458", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9530458.jpg", "longitude": -2.874470, "latitude": 41.198451, "width": 500, "height": 470, "upload_date": "20 April 2008", "owner_id": 134279, "owner_name": "4ullas", "owner_url": "http://www.panoramio.com/user/134279"} + , + {"photo_id": 2935974, "photo_title": "Atardecer tras el Anboto desde el Aitzgorri", "photo_url": "http://www.panoramio.com/photo/2935974", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2935974.jpg", "longitude": -2.324982, "latitude": 42.951240, "width": 500, "height": 331, "upload_date": "25 June 2007", "owner_id": 129297, "owner_name": "Enrique Ortiz de Zárate", "owner_url": "http://www.panoramio.com/user/129297"} + , + {"photo_id": 38587, "photo_title": "Blitz", "photo_url": "http://www.panoramio.com/photo/38587", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/38587.jpg", "longitude": 7.949853, "latitude": 48.489947, "width": 500, "height": 375, "upload_date": "13 August 2006", "owner_id": 6002, "owner_name": "Paul Feiler", "owner_url": "http://www.panoramio.com/user/6002"} + , + {"photo_id": 9312247, "photo_title": "Idrija - High water after rain", "photo_url": "http://www.panoramio.com/photo/9312247", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9312247.jpg", "longitude": 13.965683, "latitude": 45.955625, "width": 500, "height": 375, "upload_date": "12 April 2008", "owner_id": 763995, "owner_name": "Samo T.", "owner_url": "http://www.panoramio.com/user/763995"} + , + {"photo_id": 110409, "photo_title": "Laguna de Yanganuco", "photo_url": "http://www.panoramio.com/photo/110409", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/110409.jpg", "longitude": -77.640553, "latitude": -9.071585, "width": 330, "height": 500, "upload_date": "11 December 2006", "owner_id": 16323, "owner_name": "Luis Torres", "owner_url": "http://www.panoramio.com/user/16323"} + , + {"photo_id": 7609439, "photo_title": "Fényfürdő", "photo_url": "http://www.panoramio.com/photo/7609439", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7609439.jpg", "longitude": 15.965366, "latitude": 47.877556, "width": 500, "height": 312, "upload_date": "05 February 2008", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 8599453, "photo_title": "Realidad comprimida", "photo_url": "http://www.panoramio.com/photo/8599453", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8599453.jpg", "longitude": -2.780957, "latitude": 43.033953, "width": 500, "height": 387, "upload_date": "17 March 2008", "owner_id": 129297, "owner_name": "Enrique Ortiz de Zárate", "owner_url": "http://www.panoramio.com/user/129297"} + , + {"photo_id": 233921, "photo_title": "Mount Titlis, Engelberg, Switzerland www.titlis.ch / www.engelberg.ch/ www.berghuette.ch /www.brunnihuette.ch", "photo_url": "http://www.panoramio.com/photo/233921", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/233921.jpg", "longitude": 8.410742, "latitude": 46.841583, "width": 500, "height": 375, "upload_date": "25 December 2006", "owner_id": 47930, "owner_name": "werni", "owner_url": "http://www.panoramio.com/user/47930"} + , + {"photo_id": 561386, "photo_title": "the country", "photo_url": "http://www.panoramio.com/photo/561386", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/561386.jpg", "longitude": 138.871393, "latitude": 37.602196, "width": 500, "height": 383, "upload_date": "24 January 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 1195112, "photo_title": "Tolar Grande", "photo_url": "http://www.panoramio.com/photo/1195112", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1195112.jpg", "longitude": -67.361984, "latitude": -24.545249, "width": 500, "height": 342, "upload_date": "06 March 2007", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 5466129, "photo_title": "\"Lasciate ogne speranza, voi ch’intrate\". (\"Abandon all hope, ye who enter here\" ; \"Toi qui entre ici, abandonne toute espérance\".) Dante e il primo girone dell'Inferno (o Virgilio nella selva oscura, accanto all'ingresso dell'Inferno) (ou encore, plus prosaïquement, pêche dans le Jaunay en Vendée, le 21 octobre 2007 à l'aube d'un très froid matin d'automne). #129", "photo_url": "http://www.panoramio.com/photo/5466129", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5466129.jpg", "longitude": -1.901300, "latitude": 46.663398, "width": 500, "height": 281, "upload_date": "22 October 2007", "owner_id": 666755, "owner_name": "Armagnac", "owner_url": "http://www.panoramio.com/user/666755"} + , + {"photo_id": 57820, "photo_title": "Hallstatt 2", "photo_url": "http://www.panoramio.com/photo/57820", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/57820.jpg", "longitude": 13.649054, "latitude": 47.555040, "width": 500, "height": 333, "upload_date": "05 October 2006", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 798312, "photo_title": "Riflettendo...", "photo_url": "http://www.panoramio.com/photo/798312", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/798312.jpg", "longitude": 7.677534, "latitude": 45.069925, "width": 500, "height": 332, "upload_date": "12 February 2007", "owner_id": 159455, "owner_name": "©Franco Truscello", "owner_url": "http://www.panoramio.com/user/159455"} + , + {"photo_id": 7401432, "photo_title": "07-12-18_\"Arterias del Bosque\" PIXELECTA", "photo_url": "http://www.panoramio.com/photo/7401432", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7401432.jpg", "longitude": -2.775679, "latitude": 43.005338, "width": 500, "height": 333, "upload_date": "27 January 2008", "owner_id": 163655, "owner_name": "[[[ PIXELECTA ]]]", "owner_url": "http://www.panoramio.com/user/163655"} + , + {"photo_id": 2584132, "photo_title": "Farm Tomita", "photo_url": "http://www.panoramio.com/photo/2584132", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2584132.jpg", "longitude": 142.426586, "latitude": 43.418889, "width": 500, "height": 375, "upload_date": "05 June 2007", "owner_id": 532882, "owner_name": "wisdomcomplex", "owner_url": "http://www.panoramio.com/user/532882"} + , + {"photo_id": 4670499, "photo_title": "El despertar de la naturaleza", "photo_url": "http://www.panoramio.com/photo/4670499", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4670499.jpg", "longitude": -73.227739, "latitude": -39.821285, "width": 500, "height": 371, "upload_date": "15 September 2007", "owner_id": 327310, "owner_name": "Erwin Woenckhaus", "owner_url": "http://www.panoramio.com/user/327310"} + , + {"photo_id": 5133875, "photo_title": "Lumi Vardar", "photo_url": "http://www.panoramio.com/photo/5133875", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5133875.jpg", "longitude": 21.075597, "latitude": 42.006671, "width": 500, "height": 375, "upload_date": "06 October 2007", "owner_id": 695042, "owner_name": "Neim Sejfuli ♦", "owner_url": "http://www.panoramio.com/user/695042"} + , + {"photo_id": 8309167, "photo_title": "Cueva de los Verdes", "photo_url": "http://www.panoramio.com/photo/8309167", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8309167.jpg", "longitude": -13.439734, "latitude": 29.161137, "width": 333, "height": 500, "upload_date": "05 March 2008", "owner_id": 1465912, "owner_name": "funtor", "owner_url": "http://www.panoramio.com/user/1465912"} + , + {"photo_id": 1756166, "photo_title": "The Pantheon, Rome, Italy", "photo_url": "http://www.panoramio.com/photo/1756166", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1756166.jpg", "longitude": 12.476842, "latitude": 41.898540, "width": 376, "height": 500, "upload_date": "13 April 2007", "owner_id": 140796, "owner_name": "rosina lamberti", "owner_url": "http://www.panoramio.com/user/140796"} + , + {"photo_id": 1831309, "photo_title": "Oak in blue - last one", "photo_url": "http://www.panoramio.com/photo/1831309", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1831309.jpg", "longitude": 10.771322, "latitude": 59.664143, "width": 326, "height": 500, "upload_date": "18 April 2007", "owner_id": 39160, "owner_name": "Snemann", "owner_url": "http://www.panoramio.com/user/39160"} + , + {"photo_id": 626487, "photo_title": "A harag napja", "photo_url": "http://www.panoramio.com/photo/626487", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/626487.jpg", "longitude": 15.919275, "latitude": 43.589468, "width": 500, "height": 333, "upload_date": "30 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 202162, "photo_title": "Monument Valley", "photo_url": "http://www.panoramio.com/photo/202162", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/202162.jpg", "longitude": -110.094552, "latitude": 36.976810, "width": 500, "height": 333, "upload_date": "21 December 2006", "owner_id": 40260, "owner_name": "Don Albonico", "owner_url": "http://www.panoramio.com/user/40260"} + , + {"photo_id": 791016, "photo_title": "Sossusvlei", "photo_url": "http://www.panoramio.com/photo/791016", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/791016.jpg", "longitude": 15.289364, "latitude": -24.730656, "width": 500, "height": 333, "upload_date": "12 February 2007", "owner_id": 12736, "owner_name": "www.sliwi.de", "owner_url": "http://www.panoramio.com/user/12736"} + , + {"photo_id": 9760518, "photo_title": "Eglise Notre-Dame de la Couture", "photo_url": "http://www.panoramio.com/photo/9760518", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9760518.jpg", "longitude": 0.596437, "latitude": 49.082510, "width": 375, "height": 500, "upload_date": "29 April 2008", "owner_id": 1275480, "owner_name": "Nicolas Aubé", "owner_url": "http://www.panoramio.com/user/1275480"} + , + {"photo_id": 2097684, "photo_title": "", "photo_url": "http://www.panoramio.com/photo/2097684", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2097684.jpg", "longitude": -79.793916, "latitude": 43.299447, "width": 500, "height": 333, "upload_date": "06 May 2007", "owner_id": 17488, "owner_name": "John Gillett", "owner_url": "http://www.panoramio.com/user/17488"} + , + {"photo_id": 6851021, "photo_title": "Lumi Vardar-Sunset", "photo_url": "http://www.panoramio.com/photo/6851021", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6851021.jpg", "longitude": 21.077871, "latitude": 42.007532, "width": 458, "height": 500, "upload_date": "02 January 2008", "owner_id": 695042, "owner_name": "Neim Sejfuli ♦", "owner_url": "http://www.panoramio.com/user/695042"} + , + {"photo_id": 8137868, "photo_title": "Sunset Trace at Kotchi, Korea", "photo_url": "http://www.panoramio.com/photo/8137868", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8137868.jpg", "longitude": 126.333847, "latitude": 36.498597, "width": 500, "height": 500, "upload_date": "27 February 2008", "owner_id": 1221287, "owner_name": "TS Jeung", "owner_url": "http://www.panoramio.com/user/1221287"} + , + {"photo_id": 382104, "photo_title": "Meteora", "photo_url": "http://www.panoramio.com/photo/382104", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/382104.jpg", "longitude": 21.616974, "latitude": 39.743626, "width": 500, "height": 500, "upload_date": "11 January 2007", "owner_id": 16880, "owner_name": "evgenidinev.com", "owner_url": "http://www.panoramio.com/user/16880"} + , + {"photo_id": 3399014, "photo_title": "Vue du Schneibstein vers l'Est", "photo_url": "http://www.panoramio.com/photo/3399014", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3399014.jpg", "longitude": 13.055191, "latitude": 47.562396, "width": 500, "height": 328, "upload_date": "19 July 2007", "owner_id": 78506, "owner_name": "Philippe Stoop", "owner_url": "http://www.panoramio.com/user/78506"} + , + {"photo_id": 29596, "photo_title": "Ciudad de Los Cielos", "photo_url": "http://www.panoramio.com/photo/29596", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/29596.jpg", "longitude": -72.545900, "latitude": -13.165304, "width": 500, "height": 375, "upload_date": "01 July 2006", "owner_id": 4483, "owner_name": "Miguel Coranti", "owner_url": "http://www.panoramio.com/user/4483"} + , + {"photo_id": 1269713, "photo_title": "Rainbow over Olskårdvatnet near Kiberg, Finnmark, Norway", "photo_url": "http://www.panoramio.com/photo/1269713", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1269713.jpg", "longitude": 30.906601, "latitude": 70.295137, "width": 361, "height": 500, "upload_date": "11 March 2007", "owner_id": 66734, "owner_name": "Svein Solhaug", "owner_url": "http://www.panoramio.com/user/66734"} + , + {"photo_id": 507631, "photo_title": "Egy ábrándos reggelen", "photo_url": "http://www.panoramio.com/photo/507631", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/507631.jpg", "longitude": 17.466667, "latitude": 47.866667, "width": 500, "height": 334, "upload_date": "20 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 722974, "photo_title": "Airdrie Vortex", "photo_url": "http://www.panoramio.com/photo/722974", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/722974.jpg", "longitude": -114.087481, "latitude": 51.048544, "width": 500, "height": 323, "upload_date": "07 February 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 1118007, "photo_title": "Moraine Lake, Banff NP (Canada)", "photo_url": "http://www.panoramio.com/photo/1118007", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1118007.jpg", "longitude": -116.177673, "latitude": 51.328091, "width": 500, "height": 326, "upload_date": "02 March 2007", "owner_id": 229005, "owner_name": "mypictures4u.com", "owner_url": "http://www.panoramio.com/user/229005"} + , + {"photo_id": 1343943, "photo_title": "Andes Mountains.Patagonia.Argentina", "photo_url": "http://www.panoramio.com/photo/1343943", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1343943.jpg", "longitude": -72.422905, "latitude": -49.381814, "width": 500, "height": 375, "upload_date": "16 March 2007", "owner_id": 281428, "owner_name": "avni_", "owner_url": "http://www.panoramio.com/user/281428"} + , + {"photo_id": 5637365, "photo_title": "Northen lights", "photo_url": "http://www.panoramio.com/photo/5637365", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5637365.jpg", "longitude": 28.599129, "latitude": 66.247365, "width": 500, "height": 333, "upload_date": "30 October 2007", "owner_id": 897591, "owner_name": "markku pirttimaa www.karhukuusamo.com", "owner_url": "http://www.panoramio.com/user/897591"} + , + {"photo_id": 241562, "photo_title": "Süd-Ostisland", "photo_url": "http://www.panoramio.com/photo/241562", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/241562.jpg", "longitude": -17.512207, "latitude": 63.954261, "width": 500, "height": 326, "upload_date": "26 December 2006", "owner_id": 14774, "owner_name": "Frank Block", "owner_url": "http://www.panoramio.com/user/14774"} + , + {"photo_id": 48899, "photo_title": "Bellagio Fountain", "photo_url": "http://www.panoramio.com/photo/48899", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/48899.jpg", "longitude": -115.174227, "latitude": 36.112778, "width": 500, "height": 375, "upload_date": "16 September 2006", "owner_id": 7190, "owner_name": "Perry Tang", "owner_url": "http://www.panoramio.com/user/7190"} + , + {"photo_id": 49822, "photo_title": "Baños termales en Alhama de Granada", "photo_url": "http://www.panoramio.com/photo/49822", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/49822.jpg", "longitude": -3.983274, "latitude": 37.018248, "width": 374, "height": 500, "upload_date": "19 September 2006", "owner_id": 5477, "owner_name": "errece", "owner_url": "http://www.panoramio.com/user/5477"} + , + {"photo_id": 8248490, "photo_title": "Emmerald river", "photo_url": "http://www.panoramio.com/photo/8248490", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8248490.jpg", "longitude": 13.650362, "latitude": 46.340336, "width": 375, "height": 500, "upload_date": "02 March 2008", "owner_id": 763995, "owner_name": "Samo T.", "owner_url": "http://www.panoramio.com/user/763995"} + , + {"photo_id": 459528, "photo_title": "gassan", "photo_url": "http://www.panoramio.com/photo/459528", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/459528.jpg", "longitude": 139.895782, "latitude": 38.282391, "width": 500, "height": 379, "upload_date": "16 January 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 50203, "photo_title": "Die Hütte in Nyidalur an einem Septembermorgen ....", "photo_url": "http://www.panoramio.com/photo/50203", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/50203.jpg", "longitude": -18.132935, "latitude": 64.762124, "width": 500, "height": 299, "upload_date": "20 September 2006", "owner_id": 7434, "owner_name": "baldinger reisen ag, waedenswil/switzerland", "owner_url": "http://www.panoramio.com/user/7434"} + , + {"photo_id": 51502, "photo_title": "eclipse", "photo_url": "http://www.panoramio.com/photo/51502", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/51502.jpg", "longitude": -0.121665, "latitude": 51.500969, "width": 500, "height": 375, "upload_date": "24 September 2006", "owner_id": 6645, "owner_name": "JesusVillalba", "owner_url": "http://www.panoramio.com/user/6645"} + , + {"photo_id": 3671663, "photo_title": "Urbia traspuesta de sol, desde Aizkorri", "photo_url": "http://www.panoramio.com/photo/3671663", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3671663.jpg", "longitude": -2.324831, "latitude": 42.951271, "width": 500, "height": 298, "upload_date": "02 August 2007", "owner_id": 129297, "owner_name": "Enrique Ortiz de Zárate", "owner_url": "http://www.panoramio.com/user/129297"} + , + {"photo_id": 1928780, "photo_title": "God is looking", "photo_url": "http://www.panoramio.com/photo/1928780", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1928780.jpg", "longitude": 19.952137, "latitude": 50.106075, "width": 500, "height": 379, "upload_date": "25 April 2007", "owner_id": 12954, "owner_name": "Ziębol", "owner_url": "http://www.panoramio.com/user/12954"} + , + {"photo_id": 10068109, "photo_title": "#2 Steinerne Brücke über Lendkanal, Stone Bridge over Lendkanal, Klagenfurt, Austria", "photo_url": "http://www.panoramio.com/photo/10068109", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10068109.jpg", "longitude": 14.284313, "latitude": 46.620436, "width": 376, "height": 500, "upload_date": "09 May 2008", "owner_id": 1077251, "owner_name": "picsonthemove", "owner_url": "http://www.panoramio.com/user/1077251"} + , + {"photo_id": 8730264, "photo_title": "Large wave hits the North Pier, Tynemouth - Easter 2008", "photo_url": "http://www.panoramio.com/photo/8730264", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8730264.jpg", "longitude": -1.420702, "latitude": 55.020727, "width": 434, "height": 500, "upload_date": "22 March 2008", "owner_id": 1107262, "owner_name": "bobpercy", "owner_url": "http://www.panoramio.com/user/1107262"} + , + {"photo_id": 330436, "photo_title": "bolivia salar-de-uyuni", "photo_url": "http://www.panoramio.com/photo/330436", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/330436.jpg", "longitude": -67.876625, "latitude": -20.180046, "width": 500, "height": 334, "upload_date": "07 January 2007", "owner_id": 69671, "owner_name": "illusandpics.com", "owner_url": "http://www.panoramio.com/user/69671"} + , + {"photo_id": 10287647, "photo_title": "A moment of silence * Honorable mention may contest*", "photo_url": "http://www.panoramio.com/photo/10287647", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10287647.jpg", "longitude": 6.177192, "latitude": 52.218099, "width": 500, "height": 413, "upload_date": "16 May 2008", "owner_id": 523564, "owner_name": "Luud Riphagen", "owner_url": "http://www.panoramio.com/user/523564"} + , + {"photo_id": 436323, "photo_title": "zeikan", "photo_url": "http://www.panoramio.com/photo/436323", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/436323.jpg", "longitude": 139.057925, "latitude": 37.930016, "width": 500, "height": 381, "upload_date": "15 January 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 298350, "photo_title": "What are you looking at ?", "photo_url": "http://www.panoramio.com/photo/298350", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/298350.jpg", "longitude": -109.276510, "latitude": -27.125567, "width": 500, "height": 332, "upload_date": "04 January 2007", "owner_id": 57893, "owner_name": "ThoiryK", "owner_url": "http://www.panoramio.com/user/57893"} + , + {"photo_id": 85618, "photo_title": "Minas de Mazarrón", "photo_url": "http://www.panoramio.com/photo/85618", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/85618.jpg", "longitude": -1.331406, "latitude": 37.599544, "width": 500, "height": 334, "upload_date": "24 November 2006", "owner_id": 10969, "owner_name": "Juanra", "owner_url": "http://www.panoramio.com/user/10969"} + , + {"photo_id": 3804107, "photo_title": "_Feloeka on the Nile_ (Aswan - Egypt)", "photo_url": "http://www.panoramio.com/photo/3804107", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3804107.jpg", "longitude": 32.887723, "latitude": 24.095443, "width": 500, "height": 350, "upload_date": "08 August 2007", "owner_id": 366746, "owner_name": "T NL", "owner_url": "http://www.panoramio.com/user/366746"} + , + {"photo_id": 369885, "photo_title": "Monarque on the beach", "photo_url": "http://www.panoramio.com/photo/369885", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/369885.jpg", "longitude": -70.563126, "latitude": 43.308816, "width": 500, "height": 371, "upload_date": "10 January 2007", "owner_id": 78738, "owner_name": "Nicola Vachon", "owner_url": "http://www.panoramio.com/user/78738"} + , + {"photo_id": 4819425, "photo_title": "Zeeland Magic, 1", "photo_url": "http://www.panoramio.com/photo/4819425", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4819425.jpg", "longitude": 3.479254, "latitude": 51.501169, "width": 492, "height": 500, "upload_date": "22 September 2007", "owner_id": 213866, "owner_name": "Nicolas Mertens", "owner_url": "http://www.panoramio.com/user/213866"} + , + {"photo_id": 88122, "photo_title": "Arpy Lake - Aosta Valley - Italy", "photo_url": "http://www.panoramio.com/photo/88122", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/88122.jpg", "longitude": 6.999636, "latitude": 45.723008, "width": 375, "height": 500, "upload_date": "28 November 2006", "owner_id": 11098, "owner_name": "Michele Masnata", "owner_url": "http://www.panoramio.com/user/11098"} + , + {"photo_id": 10219582, "photo_title": "MITTENS ALONG THE ROAD", "photo_url": "http://www.panoramio.com/photo/10219582", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10219582.jpg", "longitude": -110.091248, "latitude": 36.970810, "width": 500, "height": 462, "upload_date": "14 May 2008", "owner_id": 864987, "owner_name": "antorenz", "owner_url": "http://www.panoramio.com/user/864987"} + , + {"photo_id": 558167, "photo_title": "Táltostánc", "photo_url": "http://www.panoramio.com/photo/558167", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/558167.jpg", "longitude": 18.001614, "latitude": 47.409038, "width": 417, "height": 500, "upload_date": "24 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 7113068, "photo_title": "Bálavár", "photo_url": "http://www.panoramio.com/photo/7113068", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7113068.jpg", "longitude": 17.522507, "latitude": 47.775560, "width": 500, "height": 336, "upload_date": "14 January 2008", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 2920885, "photo_title": "Rainbow", "photo_url": "http://www.panoramio.com/photo/2920885", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2920885.jpg", "longitude": 10.620818, "latitude": 47.770960, "width": 375, "height": 500, "upload_date": "24 June 2007", "owner_id": 123698, "owner_name": "© Kojak", "owner_url": "http://www.panoramio.com/user/123698"} + , + {"photo_id": 2499825, "photo_title": "Rosina lamberti,sunset, templestowe", "photo_url": "http://www.panoramio.com/photo/2499825", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2499825.jpg", "longitude": 145.143299, "latitude": -37.770104, "width": 500, "height": 359, "upload_date": "01 June 2007", "owner_id": 140796, "owner_name": "rosina lamberti", "owner_url": "http://www.panoramio.com/user/140796"} + , + {"photo_id": 4536639, "photo_title": "Lago di Carezza", "photo_url": "http://www.panoramio.com/photo/4536639", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4536639.jpg", "longitude": 11.575298, "latitude": 46.410227, "width": 500, "height": 393, "upload_date": "09 September 2007", "owner_id": 578163, "owner_name": "Margherita-Italy", "owner_url": "http://www.panoramio.com/user/578163"} + , + {"photo_id": 314957, "photo_title": "\"He it is, who coming after me...\" - St. John Baptist on the Charles Bridge ", "photo_url": "http://www.panoramio.com/photo/314957", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/314957.jpg", "longitude": 14.410307, "latitude": 50.086597, "width": 335, "height": 500, "upload_date": "06 January 2007", "owner_id": 57869, "owner_name": "NAGY Albert", "owner_url": "http://www.panoramio.com/user/57869"} + , + {"photo_id": 507214, "photo_title": "A változás ideje", "photo_url": "http://www.panoramio.com/photo/507214", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/507214.jpg", "longitude": 17.980499, "latitude": 47.390912, "width": 500, "height": 335, "upload_date": "20 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 5551561, "photo_title": "New light old trees26-10-2007", "photo_url": "http://www.panoramio.com/photo/5551561", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5551561.jpg", "longitude": -5.663366, "latitude": 55.390130, "width": 338, "height": 500, "upload_date": "26 October 2007", "owner_id": 599676, "owner_name": "mossip", "owner_url": "http://www.panoramio.com/user/599676"} + , + {"photo_id": 67338, "photo_title": "Salar de Uyuni", "photo_url": "http://www.panoramio.com/photo/67338", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/67338.jpg", "longitude": -67.539825, "latitude": -20.439882, "width": 375, "height": 500, "upload_date": "20 October 2006", "owner_id": 9080, "owner_name": "Marco Teodonio", "owner_url": "http://www.panoramio.com/user/9080"} + , + {"photo_id": 436354, "photo_title": "oonogame", "photo_url": "http://www.panoramio.com/photo/436354", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/436354.jpg", "longitude": 138.461380, "latitude": 38.311760, "width": 387, "height": 500, "upload_date": "15 January 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 10068358, "photo_title": "#08 Reflections in Lendkanal, Klagenfurt, Scenery June 2008", "photo_url": "http://www.panoramio.com/photo/10068358", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10068358.jpg", "longitude": 14.294415, "latitude": 46.622326, "width": 375, "height": 500, "upload_date": "09 May 2008", "owner_id": 1077251, "owner_name": "picsonthemove", "owner_url": "http://www.panoramio.com/user/1077251"} + , + {"photo_id": 1440137, "photo_title": "Horseshoe Bend", "photo_url": "http://www.panoramio.com/photo/1440137", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1440137.jpg", "longitude": -111.510887, "latitude": 36.882641, "width": 500, "height": 391, "upload_date": "22 March 2007", "owner_id": 286729, "owner_name": "jimwitkowski", "owner_url": "http://www.panoramio.com/user/286729"} + , + {"photo_id": 4809439, "photo_title": "Going Nowhere Fast", "photo_url": "http://www.panoramio.com/photo/4809439", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4809439.jpg", "longitude": -119.013970, "latitude": 38.211420, "width": 375, "height": 500, "upload_date": "21 September 2007", "owner_id": 376395, "owner_name": "JeffSullivan (www.MyPhotoGuides.com)", "owner_url": "http://www.panoramio.com/user/376395"} + , + {"photo_id": 7806281, "photo_title": "Moon&Mosque", "photo_url": "http://www.panoramio.com/photo/7806281", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7806281.jpg", "longitude": 21.138296, "latitude": 41.960958, "width": 500, "height": 344, "upload_date": "13 February 2008", "owner_id": 695042, "owner_name": "Neim Sejfuli ♦", "owner_url": "http://www.panoramio.com/user/695042"} + , + {"photo_id": 821388, "photo_title": "Aurora Borealis with frosty fog from the sea in front", "photo_url": "http://www.panoramio.com/photo/821388", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/821388.jpg", "longitude": 23.229733, "latitude": 69.962616, "width": 500, "height": 256, "upload_date": "14 February 2007", "owner_id": 56091, "owner_name": "Kjetil Vaage Øie", "owner_url": "http://www.panoramio.com/user/56091"} + , + {"photo_id": 946841, "photo_title": "Maroon Bells", "photo_url": "http://www.panoramio.com/photo/946841", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/946841.jpg", "longitude": -106.948385, "latitude": 39.095030, "width": 500, "height": 375, "upload_date": "21 February 2007", "owner_id": 163881, "owner_name": "faisasy", "owner_url": "http://www.panoramio.com/user/163881"} + , + {"photo_id": 3719882, "photo_title": "Puesta de Sol(Oest.Portugal)", "photo_url": "http://www.panoramio.com/photo/3719882", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3719882.jpg", "longitude": -9.286709, "latitude": 39.392428, "width": 375, "height": 500, "upload_date": "04 August 2007", "owner_id": 83865, "owner_name": "Epi F.Villanueva", "owner_url": "http://www.panoramio.com/user/83865"} + , + {"photo_id": 3418114, "photo_title": "Fény-Kép", "photo_url": "http://www.panoramio.com/photo/3418114", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3418114.jpg", "longitude": 17.511692, "latitude": 47.837127, "width": 500, "height": 333, "upload_date": "20 July 2007", "owner_id": 689769, "owner_name": "Ponty István", "owner_url": "http://www.panoramio.com/user/689769"} + , + {"photo_id": 255257, "photo_title": "Croatia, Brela - Sunset on the Beach - near \"Kamen Brela\" rock, symbol of this adriatic town", "photo_url": "http://www.panoramio.com/photo/255257", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/255257.jpg", "longitude": 16.922604, "latitude": 43.372309, "width": 500, "height": 332, "upload_date": "28 December 2006", "owner_id": 52119, "owner_name": "RomanV", "owner_url": "http://www.panoramio.com/user/52119"} + , + {"photo_id": 2346040, "photo_title": "Huncut fények", "photo_url": "http://www.panoramio.com/photo/2346040", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2346040.jpg", "longitude": 15.539217, "latitude": 47.670589, "width": 500, "height": 334, "upload_date": "22 May 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 1235900, "photo_title": "Fog, Hemlocks and Cedars ", "photo_url": "http://www.panoramio.com/photo/1235900", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1235900.jpg", "longitude": -131.682816, "latitude": 52.885706, "width": 500, "height": 352, "upload_date": "09 March 2007", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 111554, "photo_title": "Lahna", "photo_url": "http://www.panoramio.com/photo/111554", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/111554.jpg", "longitude": 27.557831, "latitude": 42.550551, "width": 500, "height": 357, "upload_date": "11 December 2006", "owner_id": 16880, "owner_name": "evgenidinev.com", "owner_url": "http://www.panoramio.com/user/16880"} + , + {"photo_id": 280112, "photo_title": "dune02", "photo_url": "http://www.panoramio.com/photo/280112", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/280112.jpg", "longitude": -3.985291, "latitude": 31.156408, "width": 500, "height": 338, "upload_date": "01 January 2007", "owner_id": 58867, "owner_name": "Lachaud Franck", "owner_url": "http://www.panoramio.com/user/58867"} + , + {"photo_id": 5984, "photo_title": "Chott El Jerid", "photo_url": "http://www.panoramio.com/photo/5984", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5984.jpg", "longitude": 8.358536, "latitude": 33.715202, "width": 347, "height": 500, "upload_date": "17 December 2005", "owner_id": 989, "owner_name": "Mrgud", "owner_url": "http://www.panoramio.com/user/989"} + , + {"photo_id": 25513, "photo_title": "Catarata Rio Celeste", "photo_url": "http://www.panoramio.com/photo/25513", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/25513.jpg", "longitude": -85.046539, "latitude": 10.643400, "width": 375, "height": 500, "upload_date": "17 June 2006", "owner_id": 4112, "owner_name": "Roberto Garcia", "owner_url": "http://www.panoramio.com/user/4112"} + , + {"photo_id": 35502, "photo_title": "roques", "photo_url": "http://www.panoramio.com/photo/35502", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/35502.jpg", "longitude": -66.774902, "latitude": 11.802834, "width": 500, "height": 375, "upload_date": "29 July 2006", "owner_id": 3360, "owner_name": "ozzy", "owner_url": "http://www.panoramio.com/user/3360"} + , + {"photo_id": 1656020, "photo_title": "Palmeras", "photo_url": "http://www.panoramio.com/photo/1656020", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1656020.jpg", "longitude": -1.211929, "latitude": 37.935804, "width": 500, "height": 333, "upload_date": "06 April 2007", "owner_id": 10969, "owner_name": "Juanra", "owner_url": "http://www.panoramio.com/user/10969"} + , + {"photo_id": 58341, "photo_title": "Lio Piccolo - Palazzetto Boldú", "photo_url": "http://www.panoramio.com/photo/58341", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/58341.jpg", "longitude": 12.489095, "latitude": 45.490615, "width": 500, "height": 333, "upload_date": "07 October 2006", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 416310, "photo_title": "Lake of Glass Falls", "photo_url": "http://www.panoramio.com/photo/416310", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/416310.jpg", "longitude": -105.664272, "latitude": 40.283192, "width": 500, "height": 374, "upload_date": "13 January 2007", "owner_id": 87752, "owner_name": "Richard Ryer", "owner_url": "http://www.panoramio.com/user/87752"} + , + {"photo_id": 8148031, "photo_title": "Der Morgen in der Camargue .....", "photo_url": "http://www.panoramio.com/photo/8148031", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8148031.jpg", "longitude": 4.451180, "latitude": 43.507102, "width": 500, "height": 351, "upload_date": "27 February 2008", "owner_id": 7434, "owner_name": "baldinger reisen ag, waedenswil/switzerland", "owner_url": "http://www.panoramio.com/user/7434"} + , + {"photo_id": 1088575, "photo_title": "Lampion", "photo_url": "http://www.panoramio.com/photo/1088575", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1088575.jpg", "longitude": 17.698631, "latitude": 47.521374, "width": 500, "height": 397, "upload_date": "28 February 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 771169, "photo_title": "Bloodred evening sky, near Zutphen", "photo_url": "http://www.panoramio.com/photo/771169", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/771169.jpg", "longitude": 6.110770, "latitude": 52.113681, "width": 500, "height": 500, "upload_date": "11 February 2007", "owner_id": 161254, "owner_name": "fotoartistry", "owner_url": "http://www.panoramio.com/user/161254"} + , + {"photo_id": 2334149, "photo_title": "", "photo_url": "http://www.panoramio.com/photo/2334149", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2334149.jpg", "longitude": 0.493269, "latitude": 40.904204, "width": 500, "height": 304, "upload_date": "21 May 2007", "owner_id": 3022, "owner_name": "Arcadi", "owner_url": "http://www.panoramio.com/user/3022"} + , + {"photo_id": 41688, "photo_title": "Unbelieveable sunrise colors at Lofoten", "photo_url": "http://www.panoramio.com/photo/41688", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/41688.jpg", "longitude": 14.256134, "latitude": 68.239368, "width": 500, "height": 375, "upload_date": "26 August 2006", "owner_id": 3404, "owner_name": "Csongor Böröczky", "owner_url": "http://www.panoramio.com/user/3404"} + , + {"photo_id": 6953, "photo_title": "Last moment of the day", "photo_url": "http://www.panoramio.com/photo/6953", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6953.jpg", "longitude": 2.191944, "latitude": 41.578599, "width": 500, "height": 320, "upload_date": "16 January 2006", "owner_id": 414, "owner_name": "Sonia Villegas", "owner_url": "http://www.panoramio.com/user/414"} + , + {"photo_id": 10895432, "photo_title": "Карагайская сосна", "photo_url": "http://www.panoramio.com/photo/10895432", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10895432.jpg", "longitude": 57.886791, "latitude": 51.644708, "width": 333, "height": 500, "upload_date": "04 June 2008", "owner_id": 904057, "owner_name": "Б.Ярцев", "owner_url": "http://www.panoramio.com/user/904057"} + , + {"photo_id": 1446812, "photo_title": "Elfland", "photo_url": "http://www.panoramio.com/photo/1446812", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1446812.jpg", "longitude": 17.808323, "latitude": 47.349408, "width": 345, "height": 500, "upload_date": "22 March 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 4898495, "photo_title": "Elfendel", "photo_url": "http://www.panoramio.com/photo/4898495", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4898495.jpg", "longitude": 17.724380, "latitude": 47.261058, "width": 500, "height": 325, "upload_date": "25 September 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 911298, "photo_title": "View from Nordenskiöldtoppen, Svalbard", "photo_url": "http://www.panoramio.com/photo/911298", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/911298.jpg", "longitude": 15.314941, "latitude": 78.179588, "width": 500, "height": 287, "upload_date": "20 February 2007", "owner_id": 66734, "owner_name": "Svein Solhaug", "owner_url": "http://www.panoramio.com/user/66734"} + , + {"photo_id": 2169236, "photo_title": "sunset", "photo_url": "http://www.panoramio.com/photo/2169236", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2169236.jpg", "longitude": 145.128708, "latitude": -37.759859, "width": 333, "height": 500, "upload_date": "11 May 2007", "owner_id": 140796, "owner_name": "rosina lamberti", "owner_url": "http://www.panoramio.com/user/140796"} + , + {"photo_id": 237466, "photo_title": "wierzchon.com warsaw podzamcze", "photo_url": "http://www.panoramio.com/photo/237466", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/237466.jpg", "longitude": 21.011347, "latitude": 52.253852, "width": 335, "height": 500, "upload_date": "26 December 2006", "owner_id": 47836, "owner_name": "Andrzej Wierzchon", "owner_url": "http://www.panoramio.com/user/47836"} + , + {"photo_id": 355519, "photo_title": "chile laguna miscanti", "photo_url": "http://www.panoramio.com/photo/355519", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/355519.jpg", "longitude": -67.798347, "latitude": -23.758010, "width": 500, "height": 334, "upload_date": "09 January 2007", "owner_id": 69671, "owner_name": "illusandpics.com", "owner_url": "http://www.panoramio.com/user/69671"} + , + {"photo_id": 58360, "photo_title": "Castello di Toblino", "photo_url": "http://www.panoramio.com/photo/58360", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/58360.jpg", "longitude": 10.966415, "latitude": 46.054173, "width": 500, "height": 333, "upload_date": "07 October 2006", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 10511168, "photo_title": "Në Fush të Pallaticës", "photo_url": "http://www.panoramio.com/photo/10511168", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10511168.jpg", "longitude": 21.075296, "latitude": 42.007692, "width": 500, "height": 413, "upload_date": "23 May 2008", "owner_id": 695042, "owner_name": "Neim Sejfuli ♦", "owner_url": "http://www.panoramio.com/user/695042"} + , + {"photo_id": 572526, "photo_title": "Farm by Osafjorden in the first sun of the day", "photo_url": "http://www.panoramio.com/photo/572526", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/572526.jpg", "longitude": 6.998119, "latitude": 60.563101, "width": 500, "height": 353, "upload_date": "25 January 2007", "owner_id": 39160, "owner_name": "Snemann", "owner_url": "http://www.panoramio.com/user/39160"} + , + {"photo_id": 5303687, "photo_title": "Fátyoltánc", "photo_url": "http://www.panoramio.com/photo/5303687", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5303687.jpg", "longitude": 15.934725, "latitude": 47.915997, "width": 500, "height": 334, "upload_date": "14 October 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 370324, "photo_title": "Rainbow_by_bkm", "photo_url": "http://www.panoramio.com/photo/370324", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/370324.jpg", "longitude": 6.453094, "latitude": 62.636926, "width": 500, "height": 344, "upload_date": "10 January 2007", "owner_id": 78923, "owner_name": "bj00rn", "owner_url": "http://www.panoramio.com/user/78923"} + , + {"photo_id": 7996369, "photo_title": "Bled - Church on the island", "photo_url": "http://www.panoramio.com/photo/7996369", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7996369.jpg", "longitude": 14.084473, "latitude": 46.360671, "width": 375, "height": 500, "upload_date": "21 February 2008", "owner_id": 763995, "owner_name": "Samo T.", "owner_url": "http://www.panoramio.com/user/763995"} + , + {"photo_id": 498385, "photo_title": "Rainbow Falls in Sun", "photo_url": "http://www.panoramio.com/photo/498385", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/498385.jpg", "longitude": -119.084823, "latitude": 37.601771, "width": 407, "height": 500, "upload_date": "20 January 2007", "owner_id": 107613, "owner_name": "Tom Grubbe", "owner_url": "http://www.panoramio.com/user/107613"} + , + {"photo_id": 571110, "photo_title": "Nordlys - Aurora Borealis - over Vadsø", "photo_url": "http://www.panoramio.com/photo/571110", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/571110.jpg", "longitude": 29.815350, "latitude": 70.075649, "width": 500, "height": 332, "upload_date": "25 January 2007", "owner_id": 121482, "owner_name": "Jens Gressmyr", "owner_url": "http://www.panoramio.com/user/121482"} + , + {"photo_id": 3904502, "photo_title": "Una notte di fuoco - a night of fire ", "photo_url": "http://www.panoramio.com/photo/3904502", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3904502.jpg", "longitude": 11.337290, "latitude": 46.461257, "width": 500, "height": 360, "upload_date": "13 August 2007", "owner_id": 578163, "owner_name": "Margherita-Italy", "owner_url": "http://www.panoramio.com/user/578163"} + , + {"photo_id": 1835001, "photo_title": "Вулкан Жупановский. Рассвет", "photo_url": "http://www.panoramio.com/photo/1835001", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1835001.jpg", "longitude": 158.595543, "latitude": 53.496828, "width": 500, "height": 341, "upload_date": "19 April 2007", "owner_id": 268724, "owner_name": "Korotnev AV", "owner_url": "http://www.panoramio.com/user/268724"} + , + {"photo_id": 91931, "photo_title": "Plitvice (Croacia)", "photo_url": "http://www.panoramio.com/photo/91931", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/91931.jpg", "longitude": 15.599556, "latitude": 44.851975, "width": 500, "height": 375, "upload_date": "04 December 2006", "owner_id": 11403, "owner_name": "Arnáiz", "owner_url": "http://www.panoramio.com/user/11403"} + , + {"photo_id": 515905, "photo_title": "A figyelő", "photo_url": "http://www.panoramio.com/photo/515905", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/515905.jpg", "longitude": 17.625675, "latitude": 47.565060, "width": 500, "height": 345, "upload_date": "21 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 7444056, "photo_title": "Ragyogás II.", "photo_url": "http://www.panoramio.com/photo/7444056", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7444056.jpg", "longitude": 16.385422, "latitude": 46.850095, "width": 333, "height": 500, "upload_date": "29 January 2008", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 1674082, "photo_title": "STATUA LIBERTA'", "photo_url": "http://www.panoramio.com/photo/1674082", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1674082.jpg", "longitude": -74.042444, "latitude": 40.689229, "width": 500, "height": 375, "upload_date": "07 April 2007", "owner_id": 135078, "owner_name": "Fabio Belli FABIOSO", "owner_url": "http://www.panoramio.com/user/135078"} + , + {"photo_id": 798846, "photo_title": "Panther Rock, Antelope Canyon, AZ", "photo_url": "http://www.panoramio.com/photo/798846", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/798846.jpg", "longitude": -111.391668, "latitude": 36.878728, "width": 376, "height": 500, "upload_date": "12 February 2007", "owner_id": 52440, "owner_name": "Hank Waxman", "owner_url": "http://www.panoramio.com/user/52440"} + , + {"photo_id": 21458, "photo_title": "The way of dreams (Aletschgletsher)", "photo_url": "http://www.panoramio.com/photo/21458", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/21458.jpg", "longitude": 7.976074, "latitude": 46.544694, "width": 500, "height": 375, "upload_date": "29 May 2006", "owner_id": 3404, "owner_name": "Csongor Böröczky", "owner_url": "http://www.panoramio.com/user/3404"} + , + {"photo_id": 691681, "photo_title": "PANORAMIO - Ilha das Cabras - by Wolfgang Wodeck", "photo_url": "http://www.panoramio.com/photo/691681", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/691681.jpg", "longitude": -48.628750, "latitude": -26.989624, "width": 500, "height": 333, "upload_date": "04 February 2007", "owner_id": 103166, "owner_name": "Wolfgang Wodeck", "owner_url": "http://www.panoramio.com/user/103166"} + , + {"photo_id": 564451, "photo_title": "Gewitter über Schutterwald", "photo_url": "http://www.panoramio.com/photo/564451", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/564451.jpg", "longitude": 7.887470, "latitude": 48.453409, "width": 500, "height": 333, "upload_date": "25 January 2007", "owner_id": 121083, "owner_name": "Alexandra Buss", "owner_url": "http://www.panoramio.com/user/121083"} + , + {"photo_id": 1430151, "photo_title": "Burano", "photo_url": "http://www.panoramio.com/photo/1430151", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1430151.jpg", "longitude": 12.416686, "latitude": 45.485966, "width": 500, "height": 365, "upload_date": "21 March 2007", "owner_id": 193913, "owner_name": "Klesitz Piroska", "owner_url": "http://www.panoramio.com/user/193913"} + , + {"photo_id": 3156915, "photo_title": "Brussels - Grand Place", "photo_url": "http://www.panoramio.com/photo/3156915", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3156915.jpg", "longitude": 4.352152, "latitude": 50.846658, "width": 500, "height": 375, "upload_date": "07 July 2007", "owner_id": 138691, "owner_name": "Josep Maria Alegre", "owner_url": "http://www.panoramio.com/user/138691"} + , + {"photo_id": 6126516, "photo_title": "Richmond Deer", "photo_url": "http://www.panoramio.com/photo/6126516", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6126516.jpg", "longitude": -0.279776, "latitude": 51.448565, "width": 500, "height": 294, "upload_date": "25 November 2007", "owner_id": 1130880, "owner_name": "marksimms", "owner_url": "http://www.panoramio.com/user/1130880"} + , + {"photo_id": 679356, "photo_title": "sulphur crested cockatoos", "photo_url": "http://www.panoramio.com/photo/679356", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/679356.jpg", "longitude": 150.363181, "latitude": -33.718234, "width": 500, "height": 500, "upload_date": "04 February 2007", "owner_id": 146092, "owner_name": "sid1662", "owner_url": "http://www.panoramio.com/user/146092"} + , + {"photo_id": 462324, "photo_title": "Yucca", "photo_url": "http://www.panoramio.com/photo/462324", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/462324.jpg", "longitude": -106.259680, "latitude": 32.797448, "width": 500, "height": 500, "upload_date": "17 January 2007", "owner_id": 93560, "owner_name": "Alex Petrov", "owner_url": "http://www.panoramio.com/user/93560"} + , + {"photo_id": 9528831, "photo_title": "maldives", "photo_url": "http://www.panoramio.com/photo/9528831", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9528831.jpg", "longitude": 73.454686, "latitude": 3.845837, "width": 500, "height": 335, "upload_date": "20 April 2008", "owner_id": 647076, "owner_name": "garethohara", "owner_url": "http://www.panoramio.com/user/647076"} + , + {"photo_id": 11825351, "photo_title": " ARC Buque Escuela Gloria. ARC School Ship Gloria. by (((Jose Daniel))) ", "photo_url": "http://www.panoramio.com/photo/11825351", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/11825351.jpg", "longitude": -75.539761, "latitude": 10.410917, "width": 500, "height": 392, "upload_date": "05 July 2008", "owner_id": 1611883, "owner_name": "(((Jose Daniel)))", "owner_url": "http://www.panoramio.com/user/1611883"} + , + {"photo_id": 459614, "photo_title": "seaside line", "photo_url": "http://www.panoramio.com/photo/459614", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/459614.jpg", "longitude": 138.801785, "latitude": 37.756669, "width": 500, "height": 383, "upload_date": "16 January 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 771974, "photo_title": "Retired Boat", "photo_url": "http://www.panoramio.com/photo/771974", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/771974.jpg", "longitude": 25.427610, "latitude": 36.427576, "width": 500, "height": 332, "upload_date": "11 February 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 1781649, "photo_title": "Fall in Yosemite Valley", "photo_url": "http://www.panoramio.com/photo/1781649", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1781649.jpg", "longitude": -119.609270, "latitude": 37.735290, "width": 500, "height": 400, "upload_date": "15 April 2007", "owner_id": 376395, "owner_name": "JeffSullivan (www.MyPhotoGuides.com)", "owner_url": "http://www.panoramio.com/user/376395"} + , + {"photo_id": 8491500, "photo_title": "Horsetail Falls at Sunset", "photo_url": "http://www.panoramio.com/photo/8491500", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8491500.jpg", "longitude": -119.623947, "latitude": 37.723512, "width": 333, "height": 500, "upload_date": "12 March 2008", "owner_id": 376395, "owner_name": "JeffSullivan (www.MyPhotoGuides.com)", "owner_url": "http://www.panoramio.com/user/376395"} + , + {"photo_id": 9505599, "photo_title": "#9 Penguins at Boulders Beach, Simon’s Town, Scenery May08", "photo_url": "http://www.panoramio.com/photo/9505599", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9505599.jpg", "longitude": 18.450642, "latitude": -34.196443, "width": 500, "height": 489, "upload_date": "19 April 2008", "owner_id": 1077251, "owner_name": "picsonthemove", "owner_url": "http://www.panoramio.com/user/1077251"} + , + {"photo_id": 1320563, "photo_title": "Pirates on anchor", "photo_url": "http://www.panoramio.com/photo/1320563", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1320563.jpg", "longitude": 39.311485, "latitude": -5.724799, "width": 316, "height": 500, "upload_date": "14 March 2007", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 2381962, "photo_title": "Uluru,Northern Territory,Australia-Rosina lamberti", "photo_url": "http://www.panoramio.com/photo/2381962", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2381962.jpg", "longitude": 131.054878, "latitude": -25.326959, "width": 500, "height": 274, "upload_date": "25 May 2007", "owner_id": 140796, "owner_name": "rosina lamberti", "owner_url": "http://www.panoramio.com/user/140796"} + , + {"photo_id": 92102, "photo_title": "Briksdalsbreen (Norway)", "photo_url": "http://www.panoramio.com/photo/92102", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/92102.jpg", "longitude": 6.887054, "latitude": 61.664788, "width": 500, "height": 375, "upload_date": "05 December 2006", "owner_id": 11403, "owner_name": "Arnáiz", "owner_url": "http://www.panoramio.com/user/11403"} + , + {"photo_id": 7012377, "photo_title": "Kanyarfények", "photo_url": "http://www.panoramio.com/photo/7012377", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7012377.jpg", "longitude": 17.517700, "latitude": 47.760445, "width": 500, "height": 334, "upload_date": "09 January 2008", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 422769, "photo_title": "hazaki2", "photo_url": "http://www.panoramio.com/photo/422769", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/422769.jpg", "longitude": 138.862553, "latitude": 37.711410, "width": 500, "height": 333, "upload_date": "14 January 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 4558763, "photo_title": "Corsica - West Coast", "photo_url": "http://www.panoramio.com/photo/4558763", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4558763.jpg", "longitude": 8.640404, "latitude": 42.255205, "width": 500, "height": 342, "upload_date": "10 September 2007", "owner_id": 49870, "owner_name": "Jean-Michel Raggioli", "owner_url": "http://www.panoramio.com/user/49870"} + , + {"photo_id": 374479, "photo_title": "Corinthos", "photo_url": "http://www.panoramio.com/photo/374479", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/374479.jpg", "longitude": 22.997131, "latitude": 37.925514, "width": 375, "height": 500, "upload_date": "10 January 2007", "owner_id": 74407, "owner_name": "Yeoman", "owner_url": "http://www.panoramio.com/user/74407"} + , + {"photo_id": 2421991, "photo_title": "\"Different\" Arch", "photo_url": "http://www.panoramio.com/photo/2421991", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2421991.jpg", "longitude": -109.499032, "latitude": 38.744118, "width": 500, "height": 333, "upload_date": "27 May 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 945978, "photo_title": "L'Ebre", "photo_url": "http://www.panoramio.com/photo/945978", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/945978.jpg", "longitude": 0.495501, "latitude": 40.905015, "width": 500, "height": 377, "upload_date": "21 February 2007", "owner_id": 3022, "owner_name": "Arcadi", "owner_url": "http://www.panoramio.com/user/3022"} + , + {"photo_id": 48449, "photo_title": "Montserrat", "photo_url": "http://www.panoramio.com/photo/48449", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/48449.jpg", "longitude": 1.840060, "latitude": 41.593702, "width": 500, "height": 337, "upload_date": "15 September 2006", "owner_id": 5477, "owner_name": "errece", "owner_url": "http://www.panoramio.com/user/5477"} + , + {"photo_id": 572483, "photo_title": "wheatfield in autumn", "photo_url": "http://www.panoramio.com/photo/572483", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/572483.jpg", "longitude": 11.278152, "latitude": 59.644760, "width": 500, "height": 351, "upload_date": "25 January 2007", "owner_id": 39160, "owner_name": "Snemann", "owner_url": "http://www.panoramio.com/user/39160"} + , + {"photo_id": 2060897, "photo_title": "Mid Coolum", "photo_url": "http://www.panoramio.com/photo/2060897", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2060897.jpg", "longitude": 153.097685, "latitude": -26.540052, "width": 500, "height": 336, "upload_date": "04 May 2007", "owner_id": 411736, "owner_name": "Nixpix", "owner_url": "http://www.panoramio.com/user/411736"} + , + {"photo_id": 6327146, "photo_title": "Winterwald beim \"Widi\" - a thin sheet of ice (messi 06)", "photo_url": "http://www.panoramio.com/photo/6327146", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6327146.jpg", "longitude": 7.381070, "latitude": 47.015670, "width": 500, "height": 363, "upload_date": "06 December 2007", "owner_id": 162722, "owner_name": "©polytropos", "owner_url": "http://www.panoramio.com/user/162722"} + , + {"photo_id": 36476, "photo_title": "Bergbach", "photo_url": "http://www.panoramio.com/photo/36476", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/36476.jpg", "longitude": 13.911953, "latitude": 47.634164, "width": 375, "height": 500, "upload_date": "02 August 2006", "owner_id": 5703, "owner_name": "dancer", "owner_url": "http://www.panoramio.com/user/5703"} + , + {"photo_id": 436366, "photo_title": "sunset", "photo_url": "http://www.panoramio.com/photo/436366", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/436366.jpg", "longitude": 138.857231, "latitude": 37.828497, "width": 500, "height": 351, "upload_date": "15 January 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 701842, "photo_title": "Singapore Skyline @ Night", "photo_url": "http://www.panoramio.com/photo/701842", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/701842.jpg", "longitude": 103.855486, "latitude": 1.288897, "width": 500, "height": 324, "upload_date": "05 February 2007", "owner_id": 20398, "owner_name": "boerx", "owner_url": "http://www.panoramio.com/user/20398"} + , + {"photo_id": 6086623, "photo_title": "Lángoló repce", "photo_url": "http://www.panoramio.com/photo/6086623", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6086623.jpg", "longitude": 17.784977, "latitude": 47.660994, "width": 500, "height": 334, "upload_date": "23 November 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 1595617, "photo_title": "Rosina lamberti,Templestowe,Victoria,Australia", "photo_url": "http://www.panoramio.com/photo/1595617", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1595617.jpg", "longitude": 145.137978, "latitude": -37.774785, "width": 500, "height": 354, "upload_date": "02 April 2007", "owner_id": 140796, "owner_name": "rosina lamberti", "owner_url": "http://www.panoramio.com/user/140796"} + , + {"photo_id": 74727, "photo_title": "ama dablam in background", "photo_url": "http://www.panoramio.com/photo/74727", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/74727.jpg", "longitude": 86.826496, "latitude": 27.904631, "width": 500, "height": 334, "upload_date": "02 November 2006", "owner_id": 9812, "owner_name": "wsm earp", "owner_url": "http://www.panoramio.com/user/9812"} + , + {"photo_id": 36086, "photo_title": "Рим. двор Ватикана", "photo_url": "http://www.panoramio.com/photo/36086", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/36086.jpg", "longitude": 12.454505, "latitude": 41.905695, "width": 500, "height": 444, "upload_date": "31 July 2006", "owner_id": 5641, "owner_name": "sergey duhanin", "owner_url": "http://www.panoramio.com/user/5641"} + , + {"photo_id": 2066940, "photo_title": "Unbelievable ice sculptures", "photo_url": "http://www.panoramio.com/photo/2066940", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2066940.jpg", "longitude": -73.264389, "latitude": -50.009063, "width": 500, "height": 333, "upload_date": "04 May 2007", "owner_id": 3316, "owner_name": "kristine hannon (www.traveltheglobe.be)", "owner_url": "http://www.panoramio.com/user/3316"} + , + {"photo_id": 1759754, "photo_title": "On the way for the heat wave", "photo_url": "http://www.panoramio.com/photo/1759754", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1759754.jpg", "longitude": -12.734528, "latitude": 20.208079, "width": 500, "height": 331, "upload_date": "13 April 2007", "owner_id": 121377, "owner_name": "Philippe Buffard", "owner_url": "http://www.panoramio.com/user/121377"} + , + {"photo_id": 5717808, "photo_title": "Moonlight @ Eglisau", "photo_url": "http://www.panoramio.com/photo/5717808", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5717808.jpg", "longitude": 8.521459, "latitude": 47.575035, "width": 500, "height": 331, "upload_date": "05 November 2007", "owner_id": 436351, "owner_name": "Sunpixx", "owner_url": "http://www.panoramio.com/user/436351"} + , + {"photo_id": 44853, "photo_title": "Airfocus20050501DSC_3416l", "photo_url": "http://www.panoramio.com/photo/44853", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/44853.jpg", "longitude": 7.663361, "latitude": 50.287009, "width": 500, "height": 332, "upload_date": "02 September 2006", "owner_id": 6703, "owner_name": "Peter Jansen", "owner_url": "http://www.panoramio.com/user/6703"} + , + {"photo_id": 57403, "photo_title": "Burano 2", "photo_url": "http://www.panoramio.com/photo/57403", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/57403.jpg", "longitude": 12.420173, "latitude": 45.485365, "width": 500, "height": 331, "upload_date": "04 October 2006", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 13130, "photo_title": "Agde - Painted wall", "photo_url": "http://www.panoramio.com/photo/13130", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/13130.jpg", "longitude": 3.471251, "latitude": 43.312314, "width": 500, "height": 375, "upload_date": "25 February 2006", "owner_id": 1981, "owner_name": "Eric Medvet", "owner_url": "http://www.panoramio.com/user/1981"} + , + {"photo_id": 7375236, "photo_title": "le Loir en crue à Briollay, janvier 2008. #276", "photo_url": "http://www.panoramio.com/photo/7375236", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7375236.jpg", "longitude": -0.500618, "latitude": 47.557827, "width": 500, "height": 338, "upload_date": "26 January 2008", "owner_id": 666755, "owner_name": "Armagnac", "owner_url": "http://www.panoramio.com/user/666755"} + , + {"photo_id": 3851701, "photo_title": "Mailbox", "photo_url": "http://www.panoramio.com/photo/3851701", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3851701.jpg", "longitude": -73.475790, "latitude": 44.528271, "width": 500, "height": 333, "upload_date": "10 August 2007", "owner_id": 17488, "owner_name": "John Gillett", "owner_url": "http://www.panoramio.com/user/17488"} + , + {"photo_id": 1235904, "photo_title": "Ripples", "photo_url": "http://www.panoramio.com/photo/1235904", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1235904.jpg", "longitude": -131.616211, "latitude": 52.834299, "width": 330, "height": 500, "upload_date": "09 March 2007", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 50646, "photo_title": "Ice Cave", "photo_url": "http://www.panoramio.com/photo/50646", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/50646.jpg", "longitude": -118.052559, "latitude": 52.678620, "width": 500, "height": 375, "upload_date": "21 September 2006", "owner_id": 7190, "owner_name": "Perry Tang", "owner_url": "http://www.panoramio.com/user/7190"} + , + {"photo_id": 617458, "photo_title": "Pescador", "photo_url": "http://www.panoramio.com/photo/617458", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/617458.jpg", "longitude": 0.492368, "latitude": 40.904091, "width": 500, "height": 334, "upload_date": "29 January 2007", "owner_id": 3022, "owner_name": "Arcadi", "owner_url": "http://www.panoramio.com/user/3022"} + , + {"photo_id": 52724, "photo_title": "Sunrise Gythio", "photo_url": "http://www.panoramio.com/photo/52724", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/52724.jpg", "longitude": 22.574501, "latitude": 36.755665, "width": 500, "height": 333, "upload_date": "26 September 2006", "owner_id": 7464, "owner_name": "Pieter", "owner_url": "http://www.panoramio.com/user/7464"} + , + {"photo_id": 289855, "photo_title": "Coronation Island Colours", "photo_url": "http://www.panoramio.com/photo/289855", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/289855.jpg", "longitude": -45.703125, "latitude": -60.705448, "width": 500, "height": 335, "upload_date": "03 January 2007", "owner_id": 61890, "owner_name": "enriquevidalphoto.com", "owner_url": "http://www.panoramio.com/user/61890"} + , + {"photo_id": 5649263, "photo_title": "Naab im Herbst", "photo_url": "http://www.panoramio.com/photo/5649263", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5649263.jpg", "longitude": 12.070885, "latitude": 49.298711, "width": 500, "height": 329, "upload_date": "31 October 2007", "owner_id": 696605, "owner_name": "© alfredschaffer", "owner_url": "http://www.panoramio.com/user/696605"} + , + {"photo_id": 110750, "photo_title": "The Peter and Paul Fortress. Panoramic view (180°) from The Palace Quay. — Большая (180°) панорама Петропавловской крепости с Дворцовой набережной.", "photo_url": "http://www.panoramio.com/photo/110750", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/110750.jpg", "longitude": 30.317802, "latitude": 59.946930, "width": 500, "height": 31, "upload_date": "11 December 2006", "owner_id": 12103, "owner_name": "Roman Sobolenko", "owner_url": "http://www.panoramio.com/user/12103"} + , + {"photo_id": 1870028, "photo_title": "Tour Moretti", "photo_url": "http://www.panoramio.com/photo/1870028", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1870028.jpg", "longitude": 2.247775, "latitude": 48.889175, "width": 500, "height": 395, "upload_date": "21 April 2007", "owner_id": 372189, "owner_name": "Phil©", "owner_url": "http://www.panoramio.com/user/372189"} + , + {"photo_id": 52752, "photo_title": "Sun and Clouds in Naphlion", "photo_url": "http://www.panoramio.com/photo/52752", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/52752.jpg", "longitude": 22.792425, "latitude": 37.562405, "width": 333, "height": 500, "upload_date": "26 September 2006", "owner_id": 7464, "owner_name": "Pieter", "owner_url": "http://www.panoramio.com/user/7464"} + , + {"photo_id": 2256672, "photo_title": "En algún punto", "photo_url": "http://www.panoramio.com/photo/2256672", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2256672.jpg", "longitude": -2.579153, "latitude": 42.493436, "width": 500, "height": 331, "upload_date": "17 May 2007", "owner_id": 129297, "owner_name": "Enrique Ortiz de Zárate", "owner_url": "http://www.panoramio.com/user/129297"} + , + {"photo_id": 519209, "photo_title": "Armageddon", "photo_url": "http://www.panoramio.com/photo/519209", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/519209.jpg", "longitude": 17.627563, "latitude": 47.664809, "width": 500, "height": 334, "upload_date": "21 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 10175554, "photo_title": "Vessel to eternity", "photo_url": "http://www.panoramio.com/photo/10175554", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10175554.jpg", "longitude": 119.670467, "latitude": 11.089976, "width": 500, "height": 363, "upload_date": "13 May 2008", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 11138384, "photo_title": "Lac des Joncs, reflets", "photo_url": "http://www.panoramio.com/photo/11138384", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/11138384.jpg", "longitude": 6.946986, "latitude": 46.513176, "width": 500, "height": 375, "upload_date": "12 June 2008", "owner_id": 1430484, "owner_name": "tiopepe8", "owner_url": "http://www.panoramio.com/user/1430484"} + , + {"photo_id": 204255, "photo_title": "Old farm by Osafjorden", "photo_url": "http://www.panoramio.com/photo/204255", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/204255.jpg", "longitude": 6.998978, "latitude": 60.564197, "width": 500, "height": 368, "upload_date": "21 December 2006", "owner_id": 39160, "owner_name": "Snemann", "owner_url": "http://www.panoramio.com/user/39160"} + , + {"photo_id": 3871571, "photo_title": "St. Bartholomä am Königssee", "photo_url": "http://www.panoramio.com/photo/3871571", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3871571.jpg", "longitude": 12.973351, "latitude": 47.545220, "width": 500, "height": 375, "upload_date": "11 August 2007", "owner_id": 424589, "owner_name": "PeSchn", "owner_url": "http://www.panoramio.com/user/424589"} + , + {"photo_id": 5358166, "photo_title": "Mooney Falls", "photo_url": "http://www.panoramio.com/photo/5358166", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5358166.jpg", "longitude": -112.709148, "latitude": 36.262849, "width": 500, "height": 335, "upload_date": "16 October 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 600797, "photo_title": "Living (?) in Hong Kong", "photo_url": "http://www.panoramio.com/photo/600797", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/600797.jpg", "longitude": 113.935831, "latitude": 22.279794, "width": 500, "height": 334, "upload_date": "28 January 2007", "owner_id": 20398, "owner_name": "boerx", "owner_url": "http://www.panoramio.com/user/20398"} + , + {"photo_id": 6459385, "photo_title": "Alternativ Future", "photo_url": "http://www.panoramio.com/photo/6459385", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6459385.jpg", "longitude": 17.598467, "latitude": 47.645846, "width": 500, "height": 325, "upload_date": "13 December 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 522010, "photo_title": "Hyperion", "photo_url": "http://www.panoramio.com/photo/522010", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/522010.jpg", "longitude": 17.562933, "latitude": 47.632545, "width": 500, "height": 353, "upload_date": "21 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 4942642, "photo_title": "Förgeteg elött", "photo_url": "http://www.panoramio.com/photo/4942642", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4942642.jpg", "longitude": 17.807121, "latitude": 47.646887, "width": 500, "height": 334, "upload_date": "27 September 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 223798, "photo_title": "Kachemak Bay Moonrise", "photo_url": "http://www.panoramio.com/photo/223798", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/223798.jpg", "longitude": -151.426835, "latitude": 59.680146, "width": 500, "height": 333, "upload_date": "24 December 2006", "owner_id": 45308, "owner_name": "Mike Cavaroc", "owner_url": "http://www.panoramio.com/user/45308"} + , + {"photo_id": 1946961, "photo_title": "Három \"Grácia\"", "photo_url": "http://www.panoramio.com/photo/1946961", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1946961.jpg", "longitude": 18.273354, "latitude": 47.577684, "width": 500, "height": 290, "upload_date": "27 April 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 821342, "photo_title": "Northern Lights seen from Alta", "photo_url": "http://www.panoramio.com/photo/821342", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/821342.jpg", "longitude": 23.234882, "latitude": 69.962969, "width": 500, "height": 346, "upload_date": "14 February 2007", "owner_id": 56091, "owner_name": "Kjetil Vaage Øie", "owner_url": "http://www.panoramio.com/user/56091"} + , + {"photo_id": 9831100, "photo_title": "Repcepásztor", "photo_url": "http://www.panoramio.com/photo/9831100", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9831100.jpg", "longitude": 18.213100, "latitude": 47.567956, "width": 500, "height": 334, "upload_date": "01 May 2008", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 8294907, "photo_title": "Winds of Change", "photo_url": "http://www.panoramio.com/photo/8294907", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8294907.jpg", "longitude": -112.007847, "latitude": 36.993299, "width": 333, "height": 500, "upload_date": "04 March 2008", "owner_id": 107292, "owner_name": "Kevin Mikkelsen", "owner_url": "http://www.panoramio.com/user/107292"} + , + {"photo_id": 7388668, "photo_title": "jak dobrze wstać ...", "photo_url": "http://www.panoramio.com/photo/7388668", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7388668.jpg", "longitude": 15.746498, "latitude": 51.848929, "width": 500, "height": 353, "upload_date": "27 January 2008", "owner_id": 889535, "owner_name": "yossarian01", "owner_url": "http://www.panoramio.com/user/889535"} + , + {"photo_id": 617471, "photo_title": "Rio", "photo_url": "http://www.panoramio.com/photo/617471", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/617471.jpg", "longitude": 0.493505, "latitude": 40.904318, "width": 500, "height": 335, "upload_date": "29 January 2007", "owner_id": 3022, "owner_name": "Arcadi", "owner_url": "http://www.panoramio.com/user/3022"} + , + {"photo_id": 259612, "photo_title": "Miss Liberty, NY/NJ Harbor", "photo_url": "http://www.panoramio.com/photo/259612", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/259612.jpg", "longitude": -74.039698, "latitude": 40.687472, "width": 357, "height": 500, "upload_date": "29 December 2006", "owner_id": 52440, "owner_name": "Hank Waxman", "owner_url": "http://www.panoramio.com/user/52440"} + , + {"photo_id": 2282545, "photo_title": "San Remo Scorcio di San Siro", "photo_url": "http://www.panoramio.com/photo/2282545", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2282545.jpg", "longitude": 7.773911, "latitude": 43.818234, "width": 500, "height": 459, "upload_date": "18 May 2007", "owner_id": 60898, "owner_name": "esseil", "owner_url": "http://www.panoramio.com/user/60898"} + , + {"photo_id": 84795, "photo_title": "0032", "photo_url": "http://www.panoramio.com/photo/84795", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/84795.jpg", "longitude": 25.830574, "latitude": -20.889688, "width": 500, "height": 334, "upload_date": "22 November 2006", "owner_id": 10637, "owner_name": "Carles Campsolinas Dresaire", "owner_url": "http://www.panoramio.com/user/10637"} + , + {"photo_id": 6205, "photo_title": "Valencia III", "photo_url": "http://www.panoramio.com/photo/6205", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6205.jpg", "longitude": -0.352764, "latitude": 39.456143, "width": 500, "height": 375, "upload_date": "28 December 2005", "owner_id": 414, "owner_name": "Sonia Villegas", "owner_url": "http://www.panoramio.com/user/414"} + , + {"photo_id": 5255997, "photo_title": "Az alkonyvigyázó", "photo_url": "http://www.panoramio.com/photo/5255997", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5255997.jpg", "longitude": 17.417107, "latitude": 46.942762, "width": 500, "height": 334, "upload_date": "12 October 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 4214336, "photo_title": "船家 ship On Li river", "photo_url": "http://www.panoramio.com/photo/4214336", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4214336.jpg", "longitude": 110.342388, "latitude": 25.215347, "width": 500, "height": 313, "upload_date": "26 August 2007", "owner_id": 161470, "owner_name": "John Su", "owner_url": "http://www.panoramio.com/user/161470"} + , + {"photo_id": 611660, "photo_title": "Tikehau Ile aux oiseaux JC", "photo_url": "http://www.panoramio.com/photo/611660", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/611660.jpg", "longitude": -148.098224, "latitude": -14.974528, "width": 375, "height": 500, "upload_date": "29 January 2007", "owner_id": 131113, "owner_name": "Lair Jean Claude", "owner_url": "http://www.panoramio.com/user/131113"} + , + {"photo_id": 9822041, "photo_title": "Singapore", "photo_url": "http://www.panoramio.com/photo/9822041", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9822041.jpg", "longitude": 103.855219, "latitude": 1.288907, "width": 500, "height": 333, "upload_date": "01 May 2008", "owner_id": 1465912, "owner_name": "funtor", "owner_url": "http://www.panoramio.com/user/1465912"} + , + {"photo_id": 126820, "photo_title": "Taj Mahal - colores", "photo_url": "http://www.panoramio.com/photo/126820", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/126820.jpg", "longitude": 78.042165, "latitude": 27.172871, "width": 500, "height": 385, "upload_date": "12 December 2006", "owner_id": 10456, "owner_name": "eulogio", "owner_url": "http://www.panoramio.com/user/10456"} + , + {"photo_id": 112504, "photo_title": "V-01009", "photo_url": "http://www.panoramio.com/photo/112504", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/112504.jpg", "longitude": 12.335946, "latitude": 45.438213, "width": 500, "height": 500, "upload_date": "11 December 2006", "owner_id": 17599, "owner_name": "Dmitry Andreev", "owner_url": "http://www.panoramio.com/user/17599"} + , + {"photo_id": 1898139, "photo_title": "Ein sehr menschenähnlicher Baum (http://www.redbubble.com/products/configure/1935618)", "photo_url": "http://www.panoramio.com/photo/1898139", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1898139.jpg", "longitude": 13.158177, "latitude": 52.456836, "width": 375, "height": 500, "upload_date": "23 April 2007", "owner_id": 311327, "owner_name": "www.einkauf.tk", "owner_url": "http://www.panoramio.com/user/311327"} + , + {"photo_id": 57813, "photo_title": "Hallstatt 1", "photo_url": "http://www.panoramio.com/photo/57813", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/57813.jpg", "longitude": 13.652229, "latitude": 47.551274, "width": 500, "height": 333, "upload_date": "05 October 2006", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 533476, "photo_title": "Comet McNaught 220107 02", "photo_url": "http://www.panoramio.com/photo/533476", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/533476.jpg", "longitude": 18.371286, "latitude": -33.964363, "width": 328, "height": 500, "upload_date": "22 January 2007", "owner_id": 2748, "owner_name": "WirelessMonkey", "owner_url": "http://www.panoramio.com/user/2748"} + , + {"photo_id": 507370, "photo_title": "The Silence", "photo_url": "http://www.panoramio.com/photo/507370", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/507370.jpg", "longitude": 17.497959, "latitude": 47.781328, "width": 465, "height": 500, "upload_date": "20 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 2422269, "photo_title": "Grand Trees", "photo_url": "http://www.panoramio.com/photo/2422269", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2422269.jpg", "longitude": -112.124019, "latitude": 36.062942, "width": 500, "height": 333, "upload_date": "27 May 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 2808348, "photo_title": "Blind River reflection", "photo_url": "http://www.panoramio.com/photo/2808348", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2808348.jpg", "longitude": -82.973557, "latitude": 46.193141, "width": 500, "height": 305, "upload_date": "18 June 2007", "owner_id": 555551, "owner_name": "Marilyn Whiteley", "owner_url": "http://www.panoramio.com/user/555551"} + , + {"photo_id": 2534183, "photo_title": "", "photo_url": "http://www.panoramio.com/photo/2534183", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2534183.jpg", "longitude": -69.934587, "latitude": -37.382844, "width": 500, "height": 335, "upload_date": "02 June 2007", "owner_id": 527160, "owner_name": "legui83", "owner_url": "http://www.panoramio.com/user/527160"} + , + {"photo_id": 1008446, "photo_title": "budamist", "photo_url": "http://www.panoramio.com/photo/1008446", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1008446.jpg", "longitude": 19.078649, "latitude": 47.516737, "width": 500, "height": 341, "upload_date": "24 February 2007", "owner_id": 2659, "owner_name": "ozalph", "owner_url": "http://www.panoramio.com/user/2659"} + , + {"photo_id": 2935385, "photo_title": "temporale sul mare di riccione", "photo_url": "http://www.panoramio.com/photo/2935385", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2935385.jpg", "longitude": 12.644491, "latitude": 43.964836, "width": 333, "height": 500, "upload_date": "25 June 2007", "owner_id": 267377, "owner_name": "Valter Galvani", "owner_url": "http://www.panoramio.com/user/267377"} + , + {"photo_id": 7586398, "photo_title": "Al vuelo", "photo_url": "http://www.panoramio.com/photo/7586398", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7586398.jpg", "longitude": -73.152337, "latitude": -37.114747, "width": 375, "height": 500, "upload_date": "04 February 2008", "owner_id": 327310, "owner_name": "Erwin Woenckhaus", "owner_url": "http://www.panoramio.com/user/327310"} + , + {"photo_id": 7624042, "photo_title": "Fairyland 11", "photo_url": "http://www.panoramio.com/photo/7624042", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7624042.jpg", "longitude": 6.067650, "latitude": 52.224684, "width": 352, "height": 500, "upload_date": "06 February 2008", "owner_id": 523564, "owner_name": "Luud Riphagen", "owner_url": "http://www.panoramio.com/user/523564"} + , + {"photo_id": 1186930, "photo_title": "Вид с горы Демерджи - Demergi mountain view", "photo_url": "http://www.panoramio.com/photo/1186930", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1186930.jpg", "longitude": 34.413729, "latitude": 44.749903, "width": 500, "height": 338, "upload_date": "05 March 2007", "owner_id": 244932, "owner_name": "Andrey Jitkov", "owner_url": "http://www.panoramio.com/user/244932"} + , + {"photo_id": 565512, "photo_title": "The staircase star", "photo_url": "http://www.panoramio.com/photo/565512", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/565512.jpg", "longitude": 5.646222, "latitude": 46.261262, "width": 500, "height": 331, "upload_date": "25 January 2007", "owner_id": 121377, "owner_name": "Philippe Buffard", "owner_url": "http://www.panoramio.com/user/121377"} + , + {"photo_id": 3566705, "photo_title": "Pattaya - Big Buddha and seven headed Naga", "photo_url": "http://www.panoramio.com/photo/3566705", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3566705.jpg", "longitude": 100.868155, "latitude": 12.915027, "width": 500, "height": 375, "upload_date": "28 July 2007", "owner_id": 716245, "owner_name": "—Dragon-64— ✈", "owner_url": "http://www.panoramio.com/user/716245"} + , + {"photo_id": 50113, "photo_title": "New York Skyline Panorama", "photo_url": "http://www.panoramio.com/photo/50113", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/50113.jpg", "longitude": -73.997775, "latitude": 40.696581, "width": 500, "height": 55, "upload_date": "20 September 2006", "owner_id": 4957, "owner_name": "Ken Gibson", "owner_url": "http://www.panoramio.com/user/4957"} + , + {"photo_id": 74726, "photo_title": "nuptse 1 sunset", "photo_url": "http://www.panoramio.com/photo/74726", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/74726.jpg", "longitude": 86.865978, "latitude": 27.979243, "width": 500, "height": 334, "upload_date": "02 November 2006", "owner_id": 9812, "owner_name": "wsm earp", "owner_url": "http://www.panoramio.com/user/9812"} + , + {"photo_id": 10552400, "photo_title": "Second Prize \"Travel\" May Contest, HDR, May 2008", "photo_url": "http://www.panoramio.com/photo/10552400", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10552400.jpg", "longitude": -3.705075, "latitude": 47.787960, "width": 500, "height": 333, "upload_date": "24 May 2008", "owner_id": 979901, "owner_name": "DiggaTwigga", "owner_url": "http://www.panoramio.com/user/979901"} + , + {"photo_id": 1605229, "photo_title": "Holdfényáhítat", "photo_url": "http://www.panoramio.com/photo/1605229", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1605229.jpg", "longitude": 17.748413, "latitude": 47.555214, "width": 400, "height": 500, "upload_date": "02 April 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 34669, "photo_title": "Paisaje otoñal - La Rioja - España", "photo_url": "http://www.panoramio.com/photo/34669", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/34669.jpg", "longitude": -2.864685, "latitude": 42.328664, "width": 500, "height": 326, "upload_date": "26 July 2006", "owner_id": 5487, "owner_name": "Joaquín Ramirez", "owner_url": "http://www.panoramio.com/user/5487"} + , + {"photo_id": 4596134, "photo_title": "Le vieux Nice, mars 2007", "photo_url": "http://www.panoramio.com/photo/4596134", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4596134.jpg", "longitude": 7.277198, "latitude": 43.696704, "width": 368, "height": 500, "upload_date": "12 September 2007", "owner_id": 629243, "owner_name": "Olivier Faugeras", "owner_url": "http://www.panoramio.com/user/629243"} + , + {"photo_id": 10576294, "photo_title": "Plaza de Bolívar, Bogotá. 1st. prize Panoramio Contest, May 08.(((Jose Daniel)))", "photo_url": "http://www.panoramio.com/photo/10576294", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10576294.jpg", "longitude": -74.075629, "latitude": 4.597867, "width": 500, "height": 338, "upload_date": "25 May 2008", "owner_id": 1611883, "owner_name": "(((Jose Daniel)))", "owner_url": "http://www.panoramio.com/user/1611883"} + , + {"photo_id": 522151, "photo_title": "Jó volt ott", "photo_url": "http://www.panoramio.com/photo/522151", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/522151.jpg", "longitude": 17.611084, "latitude": 47.602401, "width": 500, "height": 354, "upload_date": "21 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 4247476, "photo_title": "Blick vom Zuckerhut", "photo_url": "http://www.panoramio.com/photo/4247476", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4247476.jpg", "longitude": -43.156872, "latitude": -22.948909, "width": 500, "height": 375, "upload_date": "28 August 2007", "owner_id": 496676, "owner_name": "Quasebart", "owner_url": "http://www.panoramio.com/user/496676"} + , + {"photo_id": 5472461, "photo_title": "Lapland", "photo_url": "http://www.panoramio.com/photo/5472461", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5472461.jpg", "longitude": 29.187653, "latitude": 66.189241, "width": 500, "height": 327, "upload_date": "22 October 2007", "owner_id": 912031, "owner_name": "Kimmo Lyytikäinen", "owner_url": "http://www.panoramio.com/user/912031"} + , + {"photo_id": 472802, "photo_title": "Golden Gate Bridge", "photo_url": "http://www.panoramio.com/photo/472802", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/472802.jpg", "longitude": -122.481366, "latitude": 37.827644, "width": 500, "height": 305, "upload_date": "18 January 2007", "owner_id": 100907, "owner_name": "Julia Wahl", "owner_url": "http://www.panoramio.com/user/100907"} + , + {"photo_id": 506118, "photo_title": "Overcast Pier, Hearst State Beach", "photo_url": "http://www.panoramio.com/photo/506118", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/506118.jpg", "longitude": -121.187868, "latitude": 35.643016, "width": 500, "height": 343, "upload_date": "20 January 2007", "owner_id": 107613, "owner_name": "Tom Grubbe", "owner_url": "http://www.panoramio.com/user/107613"} + , + {"photo_id": 1420841, "photo_title": "Poland ", "photo_url": "http://www.panoramio.com/photo/1420841", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1420841.jpg", "longitude": 20.630060, "latitude": 52.073123, "width": 500, "height": 377, "upload_date": "20 March 2007", "owner_id": 234038, "owner_name": "Jacek M.", "owner_url": "http://www.panoramio.com/user/234038"} + , + {"photo_id": 4088401, "photo_title": "Bird at Hogsback - 198812", "photo_url": "http://www.panoramio.com/photo/4088401", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4088401.jpg", "longitude": -124.339828, "latitude": 47.440860, "width": 500, "height": 355, "upload_date": "21 August 2007", "owner_id": 765658, "owner_name": "Larry Workman QIN", "owner_url": "http://www.panoramio.com/user/765658"} + , + {"photo_id": 8049018, "photo_title": "Eastern Sierra Sunset", "photo_url": "http://www.panoramio.com/photo/8049018", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8049018.jpg", "longitude": -119.220543, "latitude": 38.031698, "width": 500, "height": 333, "upload_date": "23 February 2008", "owner_id": 376395, "owner_name": "JeffSullivan (www.MyPhotoGuides.com)", "owner_url": "http://www.panoramio.com/user/376395"} + , + {"photo_id": 103324, "photo_title": "Lua em São Paulo", "photo_url": "http://www.panoramio.com/photo/103324", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/103324.jpg", "longitude": -46.652606, "latitude": -23.545394, "width": 500, "height": 333, "upload_date": "10 December 2006", "owner_id": 14733, "owner_name": "Luiz Henrique Assunção", "owner_url": "http://www.panoramio.com/user/14733"} + , + {"photo_id": 5694626, "photo_title": "Lake of Varese - Moon and Venus before dawn", "photo_url": "http://www.panoramio.com/photo/5694626", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5694626.jpg", "longitude": 8.717716, "latitude": 45.839025, "width": 339, "height": 500, "upload_date": "02 November 2007", "owner_id": 933456, "owner_name": "© Marco De Candido", "owner_url": "http://www.panoramio.com/user/933456"} + , + {"photo_id": 1235876, "photo_title": "Logs on Lake Moraine", "photo_url": "http://www.panoramio.com/photo/1235876", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1235876.jpg", "longitude": -116.180420, "latitude": 51.326321, "width": 330, "height": 500, "upload_date": "09 March 2007", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 6999770, "photo_title": "Mountain range of Pindos", "photo_url": "http://www.panoramio.com/photo/6999770", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6999770.jpg", "longitude": 21.553481, "latitude": 39.498345, "width": 500, "height": 333, "upload_date": "09 January 2008", "owner_id": 242446, "owner_name": "Ntinos Lagos", "owner_url": "http://www.panoramio.com/user/242446"} + , + {"photo_id": 405727, "photo_title": "awagatake", "photo_url": "http://www.panoramio.com/photo/405727", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/405727.jpg", "longitude": 139.042454, "latitude": 37.563222, "width": 500, "height": 380, "upload_date": "13 January 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 1488363, "photo_title": "", "photo_url": "http://www.panoramio.com/photo/1488363", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1488363.jpg", "longitude": 138.454514, "latitude": 38.308932, "width": 500, "height": 384, "upload_date": "25 March 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 841001, "photo_title": "Central Balkan", "photo_url": "http://www.panoramio.com/photo/841001", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/841001.jpg", "longitude": 24.963917, "latitude": 42.679306, "width": 500, "height": 357, "upload_date": "16 February 2007", "owner_id": 16880, "owner_name": "evgenidinev.com", "owner_url": "http://www.panoramio.com/user/16880"} + , + {"photo_id": 57406, "photo_title": "Burano 4", "photo_url": "http://www.panoramio.com/photo/57406", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/57406.jpg", "longitude": 12.419465, "latitude": 45.484567, "width": 500, "height": 333, "upload_date": "04 October 2006", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 1900891, "photo_title": "Peggys Cove, Nova Scotia La barca ...", "photo_url": "http://www.panoramio.com/photo/1900891", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1900891.jpg", "longitude": -63.918285, "latitude": 44.490873, "width": 375, "height": 500, "upload_date": "24 April 2007", "owner_id": 401966, "owner_name": "Syl de Canada", "owner_url": "http://www.panoramio.com/user/401966"} + , + {"photo_id": 2135721, "photo_title": " Coteau Landing (près de Valleyfield 3)", "photo_url": "http://www.panoramio.com/photo/2135721", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2135721.jpg", "longitude": -74.211960, "latitude": 45.253622, "width": 500, "height": 375, "upload_date": "08 May 2007", "owner_id": 401966, "owner_name": "Syl de Canada", "owner_url": "http://www.panoramio.com/user/401966"} + , + {"photo_id": 426155, "photo_title": "2007'01'14-Aucanada-0233", "photo_url": "http://www.panoramio.com/photo/426155", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/426155.jpg", "longitude": 3.169695, "latitude": 39.837627, "width": 500, "height": 335, "upload_date": "14 January 2007", "owner_id": 61890, "owner_name": "enriquevidalphoto.com", "owner_url": "http://www.panoramio.com/user/61890"} + , + {"photo_id": 4868548, "photo_title": "Goodbye my dear", "photo_url": "http://www.panoramio.com/photo/4868548", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4868548.jpg", "longitude": 16.693211, "latitude": 43.183025, "width": 500, "height": 500, "upload_date": "24 September 2007", "owner_id": 989, "owner_name": "Mrgud", "owner_url": "http://www.panoramio.com/user/989"} + , + {"photo_id": 47069, "photo_title": "Laguna del Inca", "photo_url": "http://www.panoramio.com/photo/47069", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/47069.jpg", "longitude": -70.130786, "latitude": -32.834759, "width": 500, "height": 333, "upload_date": "11 September 2006", "owner_id": 6961, "owner_name": "Santiago Rios", "owner_url": "http://www.panoramio.com/user/6961"} + , + {"photo_id": 1781731, "photo_title": "The Subway", "photo_url": "http://www.panoramio.com/photo/1781731", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1781731.jpg", "longitude": -113.052578, "latitude": 37.310448, "width": 500, "height": 333, "upload_date": "15 April 2007", "owner_id": 376395, "owner_name": "JeffSullivan (www.MyPhotoGuides.com)", "owner_url": "http://www.panoramio.com/user/376395"} + , + {"photo_id": 2279, "photo_title": "Empire State Building", "photo_url": "http://www.panoramio.com/photo/2279", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2279.jpg", "longitude": -73.987073, "latitude": 40.744924, "width": 378, "height": 500, "upload_date": "08 October 2005", "owner_id": 220, "owner_name": "Jeff T. Alu", "owner_url": "http://www.panoramio.com/user/220"} + , + {"photo_id": 1277992, "photo_title": "Cologne-Köln - Dom im Hintergrund der Hohenzollernbrücke bei Nacht (by night)", "photo_url": "http://www.panoramio.com/photo/1277992", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1277992.jpg", "longitude": 6.967220, "latitude": 50.940826, "width": 500, "height": 375, "upload_date": "11 March 2007", "owner_id": 113678, "owner_name": "Canada-Fan", "owner_url": "http://www.panoramio.com/user/113678"} + , + {"photo_id": 207638, "photo_title": "Sunrise at Mont Saint Michel (1 of 2), august 2001", "photo_url": "http://www.panoramio.com/photo/207638", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/207638.jpg", "longitude": -1.509504, "latitude": 48.633547, "width": 331, "height": 500, "upload_date": "21 December 2006", "owner_id": 18925, "owner_name": "Marco Ferrari", "owner_url": "http://www.panoramio.com/user/18925"} + , + {"photo_id": 1452569, "photo_title": "Desierto de La Tatacoa (zona roja)", "photo_url": "http://www.panoramio.com/photo/1452569", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1452569.jpg", "longitude": -75.166667, "latitude": 3.333333, "width": 500, "height": 333, "upload_date": "22 March 2007", "owner_id": 5487, "owner_name": "Joaquín Ramirez", "owner_url": "http://www.panoramio.com/user/5487"} + , + {"photo_id": 3502890, "photo_title": "Monasteries in Meteora", "photo_url": "http://www.panoramio.com/photo/3502890", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3502890.jpg", "longitude": 21.627445, "latitude": 39.712601, "width": 480, "height": 500, "upload_date": "24 July 2007", "owner_id": 686703, "owner_name": "Thodoris Kliafas", "owner_url": "http://www.panoramio.com/user/686703"} + , + {"photo_id": 595505, "photo_title": "Burlington_Village_Square", "photo_url": "http://www.panoramio.com/photo/595505", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/595505.jpg", "longitude": -79.796180, "latitude": 43.326192, "width": 500, "height": 333, "upload_date": "27 January 2007", "owner_id": 17488, "owner_name": "John Gillett", "owner_url": "http://www.panoramio.com/user/17488"} + , + {"photo_id": 60984, "photo_title": "Ventisquero P. Moreno", "photo_url": "http://www.panoramio.com/photo/60984", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/60984.jpg", "longitude": -73.051872, "latitude": -50.488641, "width": 500, "height": 328, "upload_date": "13 October 2006", "owner_id": 8409, "owner_name": "Hector Fabian Garrido", "owner_url": "http://www.panoramio.com/user/8409"} + , + {"photo_id": 6654030, "photo_title": "Va por un incomprendido Vincent Willem van Gogh", "photo_url": "http://www.panoramio.com/photo/6654030", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6654030.jpg", "longitude": 4.776306, "latitude": 51.477962, "width": 500, "height": 375, "upload_date": "24 December 2007", "owner_id": 804986, "owner_name": "VERJAGA", "owner_url": "http://www.panoramio.com/user/804986"} + , + {"photo_id": 3018575, "photo_title": "Abrasado", "photo_url": "http://www.panoramio.com/photo/3018575", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3018575.jpg", "longitude": -73.279324, "latitude": -39.838002, "width": 500, "height": 375, "upload_date": "29 June 2007", "owner_id": 327310, "owner_name": "Erwin Woenckhaus", "owner_url": "http://www.panoramio.com/user/327310"} + , + {"photo_id": 521039, "photo_title": "Fátyolos narancslátomás", "photo_url": "http://www.panoramio.com/photo/521039", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/521039.jpg", "longitude": 17.463455, "latitude": 47.850146, "width": 500, "height": 291, "upload_date": "21 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 208239, "photo_title": "Nuvola danzante, Svizzera 2002", "photo_url": "http://www.panoramio.com/photo/208239", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/208239.jpg", "longitude": 7.321701, "latitude": 46.219515, "width": 334, "height": 500, "upload_date": "22 December 2006", "owner_id": 18925, "owner_name": "Marco Ferrari", "owner_url": "http://www.panoramio.com/user/18925"} + , + {"photo_id": 6443936, "photo_title": "Pajkos vizek", "photo_url": "http://www.panoramio.com/photo/6443936", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6443936.jpg", "longitude": 15.934124, "latitude": 47.915019, "width": 500, "height": 334, "upload_date": "12 December 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 7467941, "photo_title": "A day off for the soul...", "photo_url": "http://www.panoramio.com/photo/7467941", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7467941.jpg", "longitude": -75.126133, "latitude": 40.970106, "width": 500, "height": 375, "upload_date": "30 January 2008", "owner_id": 89499, "owner_name": "Michael Braxenthaler", "owner_url": "http://www.panoramio.com/user/89499"} + , + {"photo_id": 800436, "photo_title": "Eiffel Tower", "photo_url": "http://www.panoramio.com/photo/800436", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/800436.jpg", "longitude": 2.294576, "latitude": 48.858249, "width": 500, "height": 386, "upload_date": "13 February 2007", "owner_id": 165346, "owner_name": "Alan Knox", "owner_url": "http://www.panoramio.com/user/165346"} + , + {"photo_id": 479673, "photo_title": "Summit of Gogsøyra", "photo_url": "http://www.panoramio.com/photo/479673", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/479673.jpg", "longitude": 8.147736, "latitude": 62.642606, "width": 500, "height": 333, "upload_date": "18 January 2007", "owner_id": 39160, "owner_name": "Snemann", "owner_url": "http://www.panoramio.com/user/39160"} + , + {"photo_id": 5378753, "photo_title": "Alps", "photo_url": "http://www.panoramio.com/photo/5378753", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5378753.jpg", "longitude": 6.847916, "latitude": 45.913840, "width": 500, "height": 500, "upload_date": "17 October 2007", "owner_id": 588149, "owner_name": "Adam Salwanowicz", "owner_url": "http://www.panoramio.com/user/588149"} + , + {"photo_id": 382413, "photo_title": "kilimanjaro sunset", "photo_url": "http://www.panoramio.com/photo/382413", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/382413.jpg", "longitude": 37.382355, "latitude": -3.046583, "width": 500, "height": 375, "upload_date": "11 January 2007", "owner_id": 6105, "owner_name": "hackltom", "owner_url": "http://www.panoramio.com/user/6105"} + , + {"photo_id": 290784, "photo_title": "Tormenta Bahía de Pollensa", "photo_url": "http://www.panoramio.com/photo/290784", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/290784.jpg", "longitude": 3.116437, "latitude": 39.928440, "width": 500, "height": 285, "upload_date": "03 January 2007", "owner_id": 61890, "owner_name": "enriquevidalphoto.com", "owner_url": "http://www.panoramio.com/user/61890"} + , + {"photo_id": 519904, "photo_title": "Dombok között felhők alatt", "photo_url": "http://www.panoramio.com/photo/519904", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/519904.jpg", "longitude": 18.680878, "latitude": 47.631851, "width": 500, "height": 314, "upload_date": "21 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 181264, "photo_title": "deer cave", "photo_url": "http://www.panoramio.com/photo/181264", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/181264.jpg", "longitude": 114.824553, "latitude": 4.024121, "width": 428, "height": 500, "upload_date": "18 December 2006", "owner_id": 9198, "owner_name": "Caveranger", "owner_url": "http://www.panoramio.com/user/9198"} + , + {"photo_id": 323533, "photo_title": "Elevador e Mercado Modelo Ssa Ba Br", "photo_url": "http://www.panoramio.com/photo/323533", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/323533.jpg", "longitude": -38.512552, "latitude": -12.974261, "width": 500, "height": 333, "upload_date": "06 January 2007", "owner_id": 63291, "owner_name": "Gastón Dapik", "owner_url": "http://www.panoramio.com/user/63291"} + , + {"photo_id": 512513, "photo_title": "Égi tűz", "photo_url": "http://www.panoramio.com/photo/512513", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/512513.jpg", "longitude": 17.481308, "latitude": 47.796148, "width": 500, "height": 334, "upload_date": "21 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 10237287, "photo_title": "Kentriki's Woods, by Kostas Andreopoulos", "photo_url": "http://www.panoramio.com/photo/10237287", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10237287.jpg", "longitude": 21.916909, "latitude": 38.569223, "width": 500, "height": 375, "upload_date": "14 May 2008", "owner_id": 1690483, "owner_name": "k.andre", "owner_url": "http://www.panoramio.com/user/1690483"} + , + {"photo_id": 52847, "photo_title": "153 The Forth Bridge (Railway) over the Firth of Forth", "photo_url": "http://www.panoramio.com/photo/52847", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/52847.jpg", "longitude": -3.392672, "latitude": 56.007656, "width": 375, "height": 500, "upload_date": "26 September 2006", "owner_id": 7633, "owner_name": "Daniel Meyer", "owner_url": "http://www.panoramio.com/user/7633"} + , + {"photo_id": 11105192, "photo_title": "A bird is free", "photo_url": "http://www.panoramio.com/photo/11105192", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/11105192.jpg", "longitude": -6.953058, "latitude": 52.773901, "width": 375, "height": 500, "upload_date": "11 June 2008", "owner_id": 1867220, "owner_name": "Aubrey :)", "owner_url": "http://www.panoramio.com/user/1867220"} + , + {"photo_id": 196039, "photo_title": "espigón", "photo_url": "http://www.panoramio.com/photo/196039", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/196039.jpg", "longitude": -3.801688, "latitude": 43.461606, "width": 332, "height": 500, "upload_date": "20 December 2006", "owner_id": 38804, "owner_name": "www.oscarsanchez.net", "owner_url": "http://www.panoramio.com/user/38804"} + , + {"photo_id": 70865, "photo_title": "Cataratas de Iguazu", "photo_url": "http://www.panoramio.com/photo/70865", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/70865.jpg", "longitude": -54.440818, "latitude": -25.688447, "width": 374, "height": 500, "upload_date": "26 October 2006", "owner_id": 9080, "owner_name": "Marco Teodonio", "owner_url": "http://www.panoramio.com/user/9080"} + , + {"photo_id": 6188760, "photo_title": "Vihar elött", "photo_url": "http://www.panoramio.com/photo/6188760", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6188760.jpg", "longitude": 17.462082, "latitude": 47.843579, "width": 500, "height": 330, "upload_date": "28 November 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 286439, "photo_title": "Rusted Car Along Route 66", "photo_url": "http://www.panoramio.com/photo/286439", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/286439.jpg", "longitude": -109.804788, "latitude": 35.050024, "width": 500, "height": 333, "upload_date": "03 January 2007", "owner_id": 45308, "owner_name": "Mike Cavaroc", "owner_url": "http://www.panoramio.com/user/45308"} + , + {"photo_id": 1283563, "photo_title": "Kalalau beach", "photo_url": "http://www.panoramio.com/photo/1283563", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1283563.jpg", "longitude": -159.667397, "latitude": 22.164196, "width": 330, "height": 500, "upload_date": "12 March 2007", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 1336919, "photo_title": "Neuschwanstein", "photo_url": "http://www.panoramio.com/photo/1336919", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1336919.jpg", "longitude": 10.750465, "latitude": 47.553128, "width": 500, "height": 371, "upload_date": "15 March 2007", "owner_id": 123698, "owner_name": "© Kojak", "owner_url": "http://www.panoramio.com/user/123698"} + , + {"photo_id": 1343841, "photo_title": "Turning Torsoe in the fog", "photo_url": "http://www.panoramio.com/photo/1343841", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1343841.jpg", "longitude": 12.968073, "latitude": 55.613165, "width": 332, "height": 500, "upload_date": "16 March 2007", "owner_id": 278074, "owner_name": "H. C. Steensen", "owner_url": "http://www.panoramio.com/user/278074"} + , + {"photo_id": 4976484, "photo_title": "Le Bout du Monde avant l'orage", "photo_url": "http://www.panoramio.com/photo/4976484", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4976484.jpg", "longitude": 6.867528, "latitude": 46.108618, "width": 500, "height": 375, "upload_date": "29 September 2007", "owner_id": 359127, "owner_name": "wx", "owner_url": "http://www.panoramio.com/user/359127"} + , + {"photo_id": 1195113, "photo_title": "Берег Сетуни 2 - Setun riverbank 2", "photo_url": "http://www.panoramio.com/photo/1195113", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1195113.jpg", "longitude": 37.486424, "latitude": 55.719367, "width": 332, "height": 500, "upload_date": "06 March 2007", "owner_id": 244932, "owner_name": "Andrey Jitkov", "owner_url": "http://www.panoramio.com/user/244932"} + , + {"photo_id": 1549176, "photo_title": "Erdőtűz", "photo_url": "http://www.panoramio.com/photo/1549176", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1549176.jpg", "longitude": 17.767639, "latitude": 47.582084, "width": 500, "height": 268, "upload_date": "29 March 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 2127008, "photo_title": "Thunderstorm over Thunderbolt", "photo_url": "http://www.panoramio.com/photo/2127008", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2127008.jpg", "longitude": -111.586761, "latitude": 41.605303, "width": 500, "height": 329, "upload_date": "08 May 2007", "owner_id": 395804, "owner_name": "Ralph Maughan", "owner_url": "http://www.panoramio.com/user/395804"} + , + {"photo_id": 2421940, "photo_title": "Twisted Ideas", "photo_url": "http://www.panoramio.com/photo/2421940", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2421940.jpg", "longitude": -112.105286, "latitude": 36.059681, "width": 500, "height": 333, "upload_date": "27 May 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 8197305, "photo_title": "Mar Fantasma", "photo_url": "http://www.panoramio.com/photo/8197305", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8197305.jpg", "longitude": -71.699395, "latitude": -33.407478, "width": 500, "height": 346, "upload_date": "29 February 2008", "owner_id": 730217, "owner_name": "C.e.C.v", "owner_url": "http://www.panoramio.com/user/730217"} + , + {"photo_id": 6126299, "photo_title": "Richmond Squirrel", "photo_url": "http://www.panoramio.com/photo/6126299", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6126299.jpg", "longitude": -0.277609, "latitude": 51.448003, "width": 500, "height": 500, "upload_date": "25 November 2007", "owner_id": 1130880, "owner_name": "marksimms", "owner_url": "http://www.panoramio.com/user/1130880"} + , + {"photo_id": 55016, "photo_title": "Jacaré-do-pantanal. Vazante do Capivari (Caiman crocodilus yacare)", "photo_url": "http://www.panoramio.com/photo/55016", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/55016.jpg", "longitude": -56.258326, "latitude": -18.771278, "width": 500, "height": 333, "upload_date": "30 September 2006", "owner_id": 7562, "owner_name": "Marcelo E. Salgado", "owner_url": "http://www.panoramio.com/user/7562"} + , + {"photo_id": 1640188, "photo_title": "Diagonal", "photo_url": "http://www.panoramio.com/photo/1640188", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1640188.jpg", "longitude": 20.428219, "latitude": 48.953621, "width": 408, "height": 500, "upload_date": "05 April 2007", "owner_id": 346103, "owner_name": "lacitot", "owner_url": "http://www.panoramio.com/user/346103"} + , + {"photo_id": 2935837, "photo_title": "Aitzgorri. Atardecer mirando al sureste", "photo_url": "http://www.panoramio.com/photo/2935837", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2935837.jpg", "longitude": -2.324939, "latitude": 42.951271, "width": 500, "height": 323, "upload_date": "25 June 2007", "owner_id": 129297, "owner_name": "Enrique Ortiz de Zárate", "owner_url": "http://www.panoramio.com/user/129297"} + , + {"photo_id": 355622, "photo_title": "newfoundland iceberg", "photo_url": "http://www.panoramio.com/photo/355622", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/355622.jpg", "longitude": -54.733200, "latitude": 49.710939, "width": 500, "height": 334, "upload_date": "09 January 2007", "owner_id": 69671, "owner_name": "illusandpics.com", "owner_url": "http://www.panoramio.com/user/69671"} + , + {"photo_id": 202578, "photo_title": "Abant Lake (1), Bolu", "photo_url": "http://www.panoramio.com/photo/202578", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/202578.jpg", "longitude": 31.286316, "latitude": 40.612128, "width": 500, "height": 317, "upload_date": "21 December 2006", "owner_id": 2351, "owner_name": "Serdar Bilecen", "owner_url": "http://www.panoramio.com/user/2351"} + , + {"photo_id": 9653590, "photo_title": "Secret Gate, Kentriki - [ PANORAMIO APRIL 08 WINNERS]...by Fotinos", "photo_url": "http://www.panoramio.com/photo/9653590", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9653590.jpg", "longitude": 21.914872, "latitude": 38.571189, "width": 375, "height": 500, "upload_date": "24 April 2008", "owner_id": 1640258, "owner_name": "fotinos andreopoulos", "owner_url": "http://www.panoramio.com/user/1640258"} + , + {"photo_id": 2371950, "photo_title": "Dietro l'Isola dei Conigli", "photo_url": "http://www.panoramio.com/photo/2371950", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2371950.jpg", "longitude": 12.552137, "latitude": 35.514553, "width": 500, "height": 375, "upload_date": "24 May 2007", "owner_id": 476623, "owner_name": "Giulio Botticelli", "owner_url": "http://www.panoramio.com/user/476623"} + , + {"photo_id": 1340803, "photo_title": "Huge oak in monochrome", "photo_url": "http://www.panoramio.com/photo/1340803", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1340803.jpg", "longitude": 11.187515, "latitude": 59.548763, "width": 500, "height": 493, "upload_date": "15 March 2007", "owner_id": 39160, "owner_name": "Snemann", "owner_url": "http://www.panoramio.com/user/39160"} + , + {"photo_id": 520878, "photo_title": "Farewell", "photo_url": "http://www.panoramio.com/photo/520878", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/520878.jpg", "longitude": 17.466202, "latitude": 47.870186, "width": 415, "height": 500, "upload_date": "21 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 4738479, "photo_title": "\"Sovány szárcsavágta\"", "photo_url": "http://www.panoramio.com/photo/4738479", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4738479.jpg", "longitude": 17.571602, "latitude": 47.633354, "width": 500, "height": 347, "upload_date": "18 September 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 2395577, "photo_title": "", "photo_url": "http://www.panoramio.com/photo/2395577", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2395577.jpg", "longitude": -79.844792, "latitude": 43.300310, "width": 500, "height": 333, "upload_date": "25 May 2007", "owner_id": 17488, "owner_name": "John Gillett", "owner_url": "http://www.panoramio.com/user/17488"} + , + {"photo_id": 2470351, "photo_title": "Swans", "photo_url": "http://www.panoramio.com/photo/2470351", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2470351.jpg", "longitude": 23.713217, "latitude": 56.965614, "width": 500, "height": 332, "upload_date": "30 May 2007", "owner_id": 116556, "owner_name": "Pavels Dunaicevs", "owner_url": "http://www.panoramio.com/user/116556"} + , + {"photo_id": 6348257, "photo_title": "Sunset-pallatic", "photo_url": "http://www.panoramio.com/photo/6348257", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6348257.jpg", "longitude": 21.060791, "latitude": 42.004790, "width": 500, "height": 424, "upload_date": "07 December 2007", "owner_id": 695042, "owner_name": "Neim Sejfuli ♦", "owner_url": "http://www.panoramio.com/user/695042"} + , + {"photo_id": 10248178, "photo_title": "LA LUZ DE LA MAÑANA", "photo_url": "http://www.panoramio.com/photo/10248178", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10248178.jpg", "longitude": -2.554321, "latitude": 43.209805, "width": 465, "height": 500, "upload_date": "15 May 2008", "owner_id": 1487989, "owner_name": "mesias", "owner_url": "http://www.panoramio.com/user/1487989"} + , + {"photo_id": 1177785, "photo_title": "Angkor Tom Dawn", "photo_url": "http://www.panoramio.com/photo/1177785", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1177785.jpg", "longitude": 103.858910, "latitude": 13.441383, "width": 401, "height": 500, "upload_date": "05 March 2007", "owner_id": 243825, "owner_name": "DarrinJ", "owner_url": "http://www.panoramio.com/user/243825"} + , + {"photo_id": 4785924, "photo_title": "Antelope Canyon", "photo_url": "http://www.panoramio.com/photo/4785924", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4785924.jpg", "longitude": -111.369422, "latitude": 36.853678, "width": 500, "height": 335, "upload_date": "20 September 2007", "owner_id": 464343, "owner_name": "yves floret", "owner_url": "http://www.panoramio.com/user/464343"} + , + {"photo_id": 459592, "photo_title": "nojiriko", "photo_url": "http://www.panoramio.com/photo/459592", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/459592.jpg", "longitude": 138.140202, "latitude": 36.857510, "width": 500, "height": 383, "upload_date": "16 January 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 377931, "photo_title": "Baobab Avenue after sunset", "photo_url": "http://www.panoramio.com/photo/377931", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/377931.jpg", "longitude": 44.418486, "latitude": -20.250874, "width": 500, "height": 333, "upload_date": "11 January 2007", "owner_id": 70471, "owner_name": "David Thyberg", "owner_url": "http://www.panoramio.com/user/70471"} + , + {"photo_id": 170330, "photo_title": "Petit Palais - Looking Up", "photo_url": "http://www.panoramio.com/photo/170330", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/170330.jpg", "longitude": 2.315115, "latitude": 48.866011, "width": 500, "height": 355, "upload_date": "17 December 2006", "owner_id": 5684, "owner_name": "Brent Townshend", "owner_url": "http://www.panoramio.com/user/5684"} + , + {"photo_id": 5628541, "photo_title": "Pittsburgh", "photo_url": "http://www.panoramio.com/photo/5628541", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5628541.jpg", "longitude": -80.018985, "latitude": 40.438406, "width": 500, "height": 325, "upload_date": "30 October 2007", "owner_id": 31761, "owner_name": "Buck Cash", "owner_url": "http://www.panoramio.com/user/31761"} + , + {"photo_id": 51101, "photo_title": "Morgenstimmung zwischen Bru und Bordeyri ...", "photo_url": "http://www.panoramio.com/photo/51101", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/51101.jpg", "longitude": -21.099930, "latitude": 65.205068, "width": 500, "height": 272, "upload_date": "23 September 2006", "owner_id": 7434, "owner_name": "baldinger reisen ag, waedenswil/switzerland", "owner_url": "http://www.panoramio.com/user/7434"} + , + {"photo_id": 4352968, "photo_title": "Coucher du soleil sur le lac du Môle", "photo_url": "http://www.panoramio.com/photo/4352968", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4352968.jpg", "longitude": 6.426079, "latitude": 46.137084, "width": 500, "height": 374, "upload_date": "03 September 2007", "owner_id": 359127, "owner_name": "wx", "owner_url": "http://www.panoramio.com/user/359127"} + , + {"photo_id": 2345674, "photo_title": "Álomvölgy", "photo_url": "http://www.panoramio.com/photo/2345674", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2345674.jpg", "longitude": 17.791328, "latitude": 47.343243, "width": 500, "height": 334, "upload_date": "22 May 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 3521484, "photo_title": "Ki korán kel...", "photo_url": "http://www.panoramio.com/photo/3521484", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3521484.jpg", "longitude": 17.514782, "latitude": 47.744980, "width": 500, "height": 334, "upload_date": "25 July 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 8868820, "photo_title": "Burime ne malin Shar-Winner March contest -2008 \"Scenery\" Categorie", "photo_url": "http://www.panoramio.com/photo/8868820", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8868820.jpg", "longitude": 20.884666, "latitude": 42.060318, "width": 375, "height": 500, "upload_date": "26 March 2008", "owner_id": 695042, "owner_name": "Neim Sejfuli ♦", "owner_url": "http://www.panoramio.com/user/695042"} + , + {"photo_id": 206560, "photo_title": "Sumela Monastery", "photo_url": "http://www.panoramio.com/photo/206560", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/206560.jpg", "longitude": 39.608116, "latitude": 40.770012, "width": 500, "height": 375, "upload_date": "21 December 2006", "owner_id": 2351, "owner_name": "Serdar Bilecen", "owner_url": "http://www.panoramio.com/user/2351"} + , + {"photo_id": 1488354, "photo_title": "", "photo_url": "http://www.panoramio.com/photo/1488354", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1488354.jpg", "longitude": 138.213072, "latitude": 37.829921, "width": 500, "height": 336, "upload_date": "25 March 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 3334377, "photo_title": "ROSENGARTEN", "photo_url": "http://www.panoramio.com/photo/3334377", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3334377.jpg", "longitude": 11.591349, "latitude": 46.411603, "width": 500, "height": 375, "upload_date": "15 July 2007", "owner_id": 584241, "owner_name": "irene.italy", "owner_url": "http://www.panoramio.com/user/584241"} + , + {"photo_id": 12668091, "photo_title": "lago di Fedaia - 2008 August NPC subject Reflecting on reflection", "photo_url": "http://www.panoramio.com/photo/12668091", "photo_file_url": "http://static4.bareka.com/photos/medium/12668091.jpg", "longitude": 11.864547, "latitude": 46.460164, "width": 385, "height": 500, "upload_date": "31 July 2008", "owner_id": 6033, "owner_name": "► Marco Vanzo", "owner_url": "http://www.panoramio.com/user/6033"} + , + {"photo_id": 11177556, "photo_title": "Early morning ... :)", "photo_url": "http://www.panoramio.com/photo/11177556", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/11177556.jpg", "longitude": 168.307543, "latitude": -46.578215, "width": 500, "height": 340, "upload_date": "13 June 2008", "owner_id": 1256771, "owner_name": "Zsuzsanna W", "owner_url": "http://www.panoramio.com/user/1256771"} + , + {"photo_id": 67333, "photo_title": "Laguna Colorada", "photo_url": "http://www.panoramio.com/photo/67333", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/67333.jpg", "longitude": -67.798176, "latitude": -22.217285, "width": 375, "height": 500, "upload_date": "20 October 2006", "owner_id": 9080, "owner_name": "Marco Teodonio", "owner_url": "http://www.panoramio.com/user/9080"} + , + {"photo_id": 2850309, "photo_title": "Single tree...", "photo_url": "http://www.panoramio.com/photo/2850309", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2850309.jpg", "longitude": 33.571987, "latitude": 27.130876, "width": 500, "height": 375, "upload_date": "20 June 2007", "owner_id": 399963, "owner_name": "Victor Galanin", "owner_url": "http://www.panoramio.com/user/399963"} + , + {"photo_id": 1286406, "photo_title": "Creation", "photo_url": "http://www.panoramio.com/photo/1286406", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1286406.jpg", "longitude": 35.109558, "latitude": -1.460337, "width": 500, "height": 456, "upload_date": "12 March 2007", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 4136208, "photo_title": "Mesél az erdő", "photo_url": "http://www.panoramio.com/photo/4136208", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4136208.jpg", "longitude": 18.062897, "latitude": 47.274105, "width": 500, "height": 334, "upload_date": "23 August 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 8476696, "photo_title": "Coucher de soleil sur Silhouette, Seychelles. Panoramio and ATP first CONTEST, March 2008, category Travel : awarded \"Runner Up\" (second Prize). Many thanks to all voters. #434", "photo_url": "http://www.panoramio.com/photo/8476696", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8476696.jpg", "longitude": 55.493660, "latitude": -4.563249, "width": 500, "height": 339, "upload_date": "12 March 2008", "owner_id": 666755, "owner_name": "Armagnac", "owner_url": "http://www.panoramio.com/user/666755"} + , + {"photo_id": 6189344, "photo_title": "Retenue Courchevel", "photo_url": "http://www.panoramio.com/photo/6189344", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6189344.jpg", "longitude": 6.654494, "latitude": 45.385908, "width": 500, "height": 335, "upload_date": "28 November 2007", "owner_id": 464343, "owner_name": "yves floret", "owner_url": "http://www.panoramio.com/user/464343"} + , + {"photo_id": 6934835, "photo_title": "I feel shivers down my spine... (Coucher de soleil hivernal au cimetière du Père Lachaise)", "photo_url": "http://www.panoramio.com/photo/6934835", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6934835.jpg", "longitude": 2.389634, "latitude": 48.862132, "width": 500, "height": 384, "upload_date": "06 January 2008", "owner_id": 629243, "owner_name": "Olivier Faugeras", "owner_url": "http://www.panoramio.com/user/629243"} + , + {"photo_id": 4214329, "photo_title": "Sunrise of Huangshan", "photo_url": "http://www.panoramio.com/photo/4214329", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4214329.jpg", "longitude": 118.282928, "latitude": 30.139189, "width": 500, "height": 313, "upload_date": "26 August 2007", "owner_id": 161470, "owner_name": "John Su", "owner_url": "http://www.panoramio.com/user/161470"} + , + {"photo_id": 8846650, "photo_title": "Vette Tempestose - Winner of Panoramio Contest of March 2008 - Travel category", "photo_url": "http://www.panoramio.com/photo/8846650", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8846650.jpg", "longitude": 8.456469, "latitude": 45.886752, "width": 500, "height": 215, "upload_date": "25 March 2008", "owner_id": 634000, "owner_name": "© Massimo De Candido", "owner_url": "http://www.panoramio.com/user/634000"} + , + {"photo_id": 945986, "photo_title": "Xerta taronja", "photo_url": "http://www.panoramio.com/photo/945986", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/945986.jpg", "longitude": 0.483055, "latitude": 40.909102, "width": 500, "height": 377, "upload_date": "21 February 2007", "owner_id": 3022, "owner_name": "Arcadi", "owner_url": "http://www.panoramio.com/user/3022"} + , + {"photo_id": 5108615, "photo_title": "El Vado Lake, 1", "photo_url": "http://www.panoramio.com/photo/5108615", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5108615.jpg", "longitude": -106.755394, "latitude": 36.594858, "width": 500, "height": 490, "upload_date": "05 October 2007", "owner_id": 213866, "owner_name": "Nicolas Mertens", "owner_url": "http://www.panoramio.com/user/213866"} + , + {"photo_id": 6095512, "photo_title": "before the snow came - Thunersee - in bad weather", "photo_url": "http://www.panoramio.com/photo/6095512", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6095512.jpg", "longitude": 7.641592, "latitude": 46.744566, "width": 500, "height": 374, "upload_date": "24 November 2007", "owner_id": 635422, "owner_name": "♫ Swissmay", "owner_url": "http://www.panoramio.com/user/635422"} + , + {"photo_id": 1541286, "photo_title": "Wave3", "photo_url": "http://www.panoramio.com/photo/1541286", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1541286.jpg", "longitude": -112.007471, "latitude": 36.994755, "width": 333, "height": 500, "upload_date": "29 March 2007", "owner_id": 40260, "owner_name": "Don Albonico", "owner_url": "http://www.panoramio.com/user/40260"} + , + {"photo_id": 11309226, "photo_title": "Sunset on Portsea", "photo_url": "http://www.panoramio.com/photo/11309226", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/11309226.jpg", "longitude": 144.695692, "latitude": -38.330766, "width": 500, "height": 357, "upload_date": "18 June 2008", "owner_id": 140796, "owner_name": "rosina lamberti", "owner_url": "http://www.panoramio.com/user/140796"} + , + {"photo_id": 76734, "photo_title": "Buitre leonado", "photo_url": "http://www.panoramio.com/photo/76734", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/76734.jpg", "longitude": -5.662347, "latitude": 36.522413, "width": 500, "height": 375, "upload_date": "05 November 2006", "owner_id": 473, "owner_name": "Juanlu", "owner_url": "http://www.panoramio.com/user/473"} + , + {"photo_id": 196037, "photo_title": "camello", "photo_url": "http://www.panoramio.com/photo/196037", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/196037.jpg", "longitude": -3.776196, "latitude": 43.470686, "width": 500, "height": 332, "upload_date": "20 December 2006", "owner_id": 38804, "owner_name": "www.oscarsanchez.net", "owner_url": "http://www.panoramio.com/user/38804"} + , + {"photo_id": 1338852, "photo_title": "Stairs down to Praia dé Paraiso", "photo_url": "http://www.panoramio.com/photo/1338852", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1338852.jpg", "longitude": -8.475040, "latitude": 37.096924, "width": 332, "height": 500, "upload_date": "15 March 2007", "owner_id": 278074, "owner_name": "H. C. Steensen", "owner_url": "http://www.panoramio.com/user/278074"} + , + {"photo_id": 1269734, "photo_title": "Frosty fishermans boat, Nesseby, Finnmark, Norway", "photo_url": "http://www.panoramio.com/photo/1269734", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1269734.jpg", "longitude": 28.851471, "latitude": 70.144796, "width": 500, "height": 323, "upload_date": "11 March 2007", "owner_id": 66734, "owner_name": "Svein Solhaug", "owner_url": "http://www.panoramio.com/user/66734"} + , + {"photo_id": 1075687, "photo_title": "Lake Como sunset", "photo_url": "http://www.panoramio.com/photo/1075687", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1075687.jpg", "longitude": 9.285164, "latitude": 46.009839, "width": 500, "height": 332, "upload_date": "28 February 2007", "owner_id": 107359, "owner_name": "Ron Cooper", "owner_url": "http://www.panoramio.com/user/107359"} + , + {"photo_id": 58363, "photo_title": "Sonnenuntergang bei Bardolino", "photo_url": "http://www.panoramio.com/photo/58363", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/58363.jpg", "longitude": 10.714073, "latitude": 45.556372, "width": 500, "height": 333, "upload_date": "07 October 2006", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 890788, "photo_title": "Kaplička", "photo_url": "http://www.panoramio.com/photo/890788", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/890788.jpg", "longitude": 18.222713, "latitude": 49.491950, "width": 500, "height": 333, "upload_date": "19 February 2007", "owner_id": 187280, "owner_name": "Radek Čampa", "owner_url": "http://www.panoramio.com/user/187280"} + , + {"photo_id": 8730610, "photo_title": "Antelope Canyon", "photo_url": "http://www.panoramio.com/photo/8730610", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8730610.jpg", "longitude": -111.415787, "latitude": 36.918058, "width": 375, "height": 500, "upload_date": "22 March 2008", "owner_id": 1465912, "owner_name": "funtor", "owner_url": "http://www.panoramio.com/user/1465912"} + , + {"photo_id": 3008013, "photo_title": "Infrared Mood of Peyto Lake", "photo_url": "http://www.panoramio.com/photo/3008013", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3008013.jpg", "longitude": -116.509409, "latitude": 51.717989, "width": 500, "height": 334, "upload_date": "29 June 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 565018, "photo_title": "Another one sunset in dubulti", "photo_url": "http://www.panoramio.com/photo/565018", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/565018.jpg", "longitude": 23.765488, "latitude": 56.971626, "width": 500, "height": 333, "upload_date": "25 January 2007", "owner_id": 116556, "owner_name": "Pavels Dunaicevs", "owner_url": "http://www.panoramio.com/user/116556"} + , + {"photo_id": 2217257, "photo_title": "Csermely", "photo_url": "http://www.panoramio.com/photo/2217257", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2217257.jpg", "longitude": 17.986851, "latitude": 47.273755, "width": 500, "height": 334, "upload_date": "14 May 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 3008041, "photo_title": "Lake Louise", "photo_url": "http://www.panoramio.com/photo/3008041", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3008041.jpg", "longitude": -116.219387, "latitude": 51.417409, "width": 500, "height": 335, "upload_date": "29 June 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 636724, "photo_title": "Bora Bora JC", "photo_url": "http://www.panoramio.com/photo/636724", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/636724.jpg", "longitude": -151.714239, "latitude": -16.475926, "width": 500, "height": 375, "upload_date": "31 January 2007", "owner_id": 131113, "owner_name": "Lair Jean Claude", "owner_url": "http://www.panoramio.com/user/131113"} + , + {"photo_id": 511806, "photo_title": "Ezüsterdő", "photo_url": "http://www.panoramio.com/photo/511806", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/511806.jpg", "longitude": 17.748070, "latitude": 47.273056, "width": 366, "height": 500, "upload_date": "21 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 727360, "photo_title": "Hot croissant for breakfast - Crescent sunrise", "photo_url": "http://www.panoramio.com/photo/727360", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/727360.jpg", "longitude": 19.053833, "latitude": 47.605512, "width": 500, "height": 311, "upload_date": "07 February 2007", "owner_id": 57869, "owner_name": "NAGY Albert", "owner_url": "http://www.panoramio.com/user/57869"} + , + {"photo_id": 5148235, "photo_title": "shinagawa", "photo_url": "http://www.panoramio.com/photo/5148235", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5148235.jpg", "longitude": 139.741459, "latitude": 35.627460, "width": 500, "height": 500, "upload_date": "07 October 2007", "owner_id": 128403, "owner_name": "mechanics", "owner_url": "http://www.panoramio.com/user/128403"} + , + {"photo_id": 2082127, "photo_title": "Rejtelmes Szigetköz", "photo_url": "http://www.panoramio.com/photo/2082127", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2082127.jpg", "longitude": 17.508516, "latitude": 47.850088, "width": 500, "height": 316, "upload_date": "05 May 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 1589607, "photo_title": "Baalbek - Temple of Bacchus - Giant Columns", "photo_url": "http://www.panoramio.com/photo/1589607", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1589607.jpg", "longitude": 36.204404, "latitude": 34.006228, "width": 500, "height": 283, "upload_date": "01 April 2007", "owner_id": 73104, "owner_name": "zerega", "owner_url": "http://www.panoramio.com/user/73104"} + , + {"photo_id": 410991, "photo_title": "Burj al Arab", "photo_url": "http://www.panoramio.com/photo/410991", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/410991.jpg", "longitude": 55.187352, "latitude": 25.139282, "width": 500, "height": 342, "upload_date": "13 January 2007", "owner_id": 82662, "owner_name": "Sven Goelles", "owner_url": "http://www.panoramio.com/user/82662"} + , + {"photo_id": 6012, "photo_title": "Rastoke", "photo_url": "http://www.panoramio.com/photo/6012", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6012.jpg", "longitude": 15.584493, "latitude": 45.119144, "width": 343, "height": 500, "upload_date": "18 December 2005", "owner_id": 989, "owner_name": "Mrgud", "owner_url": "http://www.panoramio.com/user/989"} + , + {"photo_id": 4989314, "photo_title": "Range of Light", "photo_url": "http://www.panoramio.com/photo/4989314", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4989314.jpg", "longitude": -118.597283, "latitude": 37.234360, "width": 500, "height": 357, "upload_date": "29 September 2007", "owner_id": 376395, "owner_name": "JeffSullivan (www.MyPhotoGuides.com)", "owner_url": "http://www.panoramio.com/user/376395"} + , + {"photo_id": 2115987, "photo_title": "La Croix de Brume", "photo_url": "http://www.panoramio.com/photo/2115987", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2115987.jpg", "longitude": 0.341520, "latitude": 44.859519, "width": 409, "height": 500, "upload_date": "07 May 2007", "owner_id": 372189, "owner_name": "Phil©", "owner_url": "http://www.panoramio.com/user/372189"} + , + {"photo_id": 229544, "photo_title": "VRT RTBf Toren", "photo_url": "http://www.panoramio.com/photo/229544", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/229544.jpg", "longitude": 4.401634, "latitude": 50.852972, "width": 333, "height": 500, "upload_date": "24 December 2006", "owner_id": 7464, "owner_name": "Pieter", "owner_url": "http://www.panoramio.com/user/7464"} + , + {"photo_id": 58283, "photo_title": "Weg", "photo_url": "http://www.panoramio.com/photo/58283", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/58283.jpg", "longitude": 12.898464, "latitude": 48.059496, "width": 500, "height": 333, "upload_date": "07 October 2006", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 112110, "photo_title": "Toronto_CN-Tower", "photo_url": "http://www.panoramio.com/photo/112110", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/112110.jpg", "longitude": -79.386907, "latitude": 43.641805, "width": 500, "height": 375, "upload_date": "11 December 2006", "owner_id": 17488, "owner_name": "John Gillett", "owner_url": "http://www.panoramio.com/user/17488"} + , + {"photo_id": 4446966, "photo_title": "Álmodó folyó", "photo_url": "http://www.panoramio.com/photo/4446966", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4446966.jpg", "longitude": 17.454357, "latitude": 47.881470, "width": 500, "height": 375, "upload_date": "06 September 2007", "owner_id": 182660, "owner_name": "Bálint Tünde", "owner_url": "http://www.panoramio.com/user/182660"} + , + {"photo_id": 91966, "photo_title": "Bled (Slovenia)", "photo_url": "http://www.panoramio.com/photo/91966", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/91966.jpg", "longitude": 14.087219, "latitude": 46.358184, "width": 500, "height": 375, "upload_date": "04 December 2006", "owner_id": 11403, "owner_name": "Arnáiz", "owner_url": "http://www.panoramio.com/user/11403"} + , + {"photo_id": 6013503, "photo_title": "Kapelle bei Böhmenkirch", "photo_url": "http://www.panoramio.com/photo/6013503", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6013503.jpg", "longitude": 9.943142, "latitude": 48.694756, "width": 500, "height": 375, "upload_date": "19 November 2007", "owner_id": 424589, "owner_name": "PeSchn", "owner_url": "http://www.panoramio.com/user/424589"} + , + {"photo_id": 1781593, "photo_title": "Medusa's Sandbox", "photo_url": "http://www.panoramio.com/photo/1781593", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1781593.jpg", "longitude": -112.006624, "latitude": 36.995852, "width": 375, "height": 500, "upload_date": "15 April 2007", "owner_id": 376395, "owner_name": "JeffSullivan (www.MyPhotoGuides.com)", "owner_url": "http://www.panoramio.com/user/376395"} + , + {"photo_id": 704119, "photo_title": "Izzó Adria", "photo_url": "http://www.panoramio.com/photo/704119", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/704119.jpg", "longitude": 17.056789, "latitude": 43.272206, "width": 500, "height": 285, "upload_date": "05 February 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 85624, "photo_title": "Isla del Fraile Águilas", "photo_url": "http://www.panoramio.com/photo/85624", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/85624.jpg", "longitude": -0.722609, "latitude": 37.924329, "width": 500, "height": 298, "upload_date": "24 November 2006", "owner_id": 10969, "owner_name": "Juanra", "owner_url": "http://www.panoramio.com/user/10969"} + , + {"photo_id": 52350, "photo_title": "Cataratas del Iguazú. Brasil", "photo_url": "http://www.panoramio.com/photo/52350", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/52350.jpg", "longitude": -54.439831, "latitude": -25.687422, "width": 500, "height": 333, "upload_date": "25 September 2006", "owner_id": 6961, "owner_name": "Santiago Rios", "owner_url": "http://www.panoramio.com/user/6961"} + , + {"photo_id": 36482, "photo_title": "Rovinj Harbour", "photo_url": "http://www.panoramio.com/photo/36482", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/36482.jpg", "longitude": 13.632714, "latitude": 45.083938, "width": 500, "height": 332, "upload_date": "02 August 2006", "owner_id": 5703, "owner_name": "dancer", "owner_url": "http://www.panoramio.com/user/5703"} + , + {"photo_id": 7251846, "photo_title": "Azért a víz az úr", "photo_url": "http://www.panoramio.com/photo/7251846", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7251846.jpg", "longitude": 17.629623, "latitude": 47.687334, "width": 500, "height": 329, "upload_date": "20 January 2008", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 1551756, "photo_title": "Templestowe", "photo_url": "http://www.panoramio.com/photo/1551756", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1551756.jpg", "longitude": 145.116667, "latitude": -37.750000, "width": 500, "height": 298, "upload_date": "30 March 2007", "owner_id": 140796, "owner_name": "rosina lamberti", "owner_url": "http://www.panoramio.com/user/140796"} + , + {"photo_id": 2397841, "photo_title": "Storm Season II", "photo_url": "http://www.panoramio.com/photo/2397841", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2397841.jpg", "longitude": -122.439870, "latitude": 37.427928, "width": 407, "height": 500, "upload_date": "26 May 2007", "owner_id": 107613, "owner_name": "Tom Grubbe", "owner_url": "http://www.panoramio.com/user/107613"} + , + {"photo_id": 1237915, "photo_title": "Chlum u Trebone", "photo_url": "http://www.panoramio.com/photo/1237915", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1237915.jpg", "longitude": 14.923811, "latitude": 48.960159, "width": 500, "height": 429, "upload_date": "09 March 2007", "owner_id": 235166, "owner_name": "jirivrobel", "owner_url": "http://www.panoramio.com/user/235166"} + , + {"photo_id": 359324, "photo_title": "Abstraktion in der Kirche von Mogno, Tessin .......", "photo_url": "http://www.panoramio.com/photo/359324", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/359324.jpg", "longitude": 8.663492, "latitude": 46.430966, "width": 500, "height": 380, "upload_date": "09 January 2007", "owner_id": 7434, "owner_name": "baldinger reisen ag, waedenswil/switzerland", "owner_url": "http://www.panoramio.com/user/7434"} + , + {"photo_id": 483742, "photo_title": "Venus at Haleakala", "photo_url": "http://www.panoramio.com/photo/483742", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/483742.jpg", "longitude": -156.239491, "latitude": 20.707468, "width": 500, "height": 375, "upload_date": "18 January 2007", "owner_id": 100907, "owner_name": "Julia Wahl", "owner_url": "http://www.panoramio.com/user/100907"} + , + {"photo_id": 1087397, "photo_title": "Fjellbjerk (Betula) Snøhetta mountain in the background", "photo_url": "http://www.panoramio.com/photo/1087397", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1087397.jpg", "longitude": 9.555531, "latitude": 62.240111, "width": 500, "height": 333, "upload_date": "28 February 2007", "owner_id": 223406, "owner_name": "Sigmund Rise", "owner_url": "http://www.panoramio.com/user/223406"} + , + {"photo_id": 2846123, "photo_title": "新潟 小千谷 風船一揆 2003 niigata ojiya balloon riot Fireworks", "photo_url": "http://www.panoramio.com/photo/2846123", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2846123.jpg", "longitude": 138.791313, "latitude": 37.289350, "width": 500, "height": 497, "upload_date": "20 June 2007", "owner_id": 446937, "owner_name": "y_komatsu", "owner_url": "http://www.panoramio.com/user/446937"} + , + {"photo_id": 2533559, "photo_title": "Great Idea ! Don´t do it !!!", "photo_url": "http://www.panoramio.com/photo/2533559", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2533559.jpg", "longitude": -35.036988, "latitude": -6.241628, "width": 500, "height": 308, "upload_date": "02 June 2007", "owner_id": 1908, "owner_name": "Cleber Lima", "owner_url": "http://www.panoramio.com/user/1908"} + , + {"photo_id": 86246, "photo_title": "Salinas de Santa Pola", "photo_url": "http://www.panoramio.com/photo/86246", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/86246.jpg", "longitude": -0.528374, "latitude": 38.230090, "width": 500, "height": 333, "upload_date": "25 November 2006", "owner_id": 10969, "owner_name": "Juanra", "owner_url": "http://www.panoramio.com/user/10969"} + , + {"photo_id": 405740, "photo_title": "fudoutaki", "photo_url": "http://www.panoramio.com/photo/405740", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/405740.jpg", "longitude": 139.502249, "latitude": 37.580909, "width": 500, "height": 394, "upload_date": "13 January 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 12848417, "photo_title": "Niedrigwasser an der Elbe-Dresden", "photo_url": "http://www.panoramio.com/photo/12848417", "photo_file_url": "http://static2.bareka.com/photos/medium/12848417.jpg", "longitude": 13.745323, "latitude": 51.055093, "width": 500, "height": 268, "upload_date": "05 August 2008", "owner_id": 1465912, "owner_name": "funtor", "owner_url": "http://www.panoramio.com/user/1465912"} + , + {"photo_id": 291091, "photo_title": "Imperia Porto Maurizio Puesta del Sol al Prino", "photo_url": "http://www.panoramio.com/photo/291091", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/291091.jpg", "longitude": 8.006684, "latitude": 43.869312, "width": 500, "height": 465, "upload_date": "03 January 2007", "owner_id": 60898, "owner_name": "esseil", "owner_url": "http://www.panoramio.com/user/60898"} + , + {"photo_id": 1183261, "photo_title": "Az óperencián innen", "photo_url": "http://www.panoramio.com/photo/1183261", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1183261.jpg", "longitude": 15.823574, "latitude": 43.708462, "width": 500, "height": 312, "upload_date": "05 March 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 1637150, "photo_title": "Vista del Misti por encima de las nubes", "photo_url": "http://www.panoramio.com/photo/1637150", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1637150.jpg", "longitude": -71.414566, "latitude": -16.300040, "width": 500, "height": 333, "upload_date": "05 April 2007", "owner_id": 328178, "owner_name": "Mariví Jiménez", "owner_url": "http://www.panoramio.com/user/328178"} + , + {"photo_id": 507703, "photo_title": "Csendes vizek", "photo_url": "http://www.panoramio.com/photo/507703", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/507703.jpg", "longitude": 17.568769, "latitude": 47.633586, "width": 500, "height": 349, "upload_date": "20 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 55100, "photo_title": "Ballesvikskardet", "photo_url": "http://www.panoramio.com/photo/55100", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/55100.jpg", "longitude": 17.122707, "latitude": 69.352910, "width": 500, "height": 375, "upload_date": "30 September 2006", "owner_id": 3574, "owner_name": "blackone", "owner_url": "http://www.panoramio.com/user/3574"} + , + {"photo_id": 291648, "photo_title": "Galway Cathedral", "photo_url": "http://www.panoramio.com/photo/291648", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/291648.jpg", "longitude": -9.057664, "latitude": 53.275627, "width": 500, "height": 336, "upload_date": "03 January 2007", "owner_id": 61285, "owner_name": "kamil krawczak", "owner_url": "http://www.panoramio.com/user/61285"} + , + {"photo_id": 5285701, "photo_title": "Another South Sister reflecting in Sparks Lake", "photo_url": "http://www.panoramio.com/photo/5285701", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5285701.jpg", "longitude": -121.737549, "latitude": 44.014176, "width": 500, "height": 334, "upload_date": "13 October 2007", "owner_id": 128746, "owner_name": "© Michael Hatten", "owner_url": "http://www.panoramio.com/user/128746"} + , + {"photo_id": 761958, "photo_title": "Lake Oulujärvi", "photo_url": "http://www.panoramio.com/photo/761958", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/761958.jpg", "longitude": 27.339649, "latitude": 64.231986, "width": 375, "height": 500, "upload_date": "10 February 2007", "owner_id": 151444, "owner_name": "Timo Rossi", "owner_url": "http://www.panoramio.com/user/151444"} + , + {"photo_id": 3853459, "photo_title": "Its great to be a swan on Hawn Pawn!", "photo_url": "http://www.panoramio.com/photo/3853459", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3853459.jpg", "longitude": -71.154628, "latitude": 42.470625, "width": 389, "height": 500, "upload_date": "10 August 2007", "owner_id": 286174, "owner_name": "kamaly", "owner_url": "http://www.panoramio.com/user/286174"} + , + {"photo_id": 4610197, "photo_title": "Yosemite Valley with Fallen Redwood from V11", "photo_url": "http://www.panoramio.com/photo/4610197", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4610197.jpg", "longitude": -119.661703, "latitude": 37.717214, "width": 500, "height": 281, "upload_date": "12 September 2007", "owner_id": 339677, "owner_name": "Chip Stephan", "owner_url": "http://www.panoramio.com/user/339677"} + , + {"photo_id": 5700759, "photo_title": "Crete senesi", "photo_url": "http://www.panoramio.com/photo/5700759", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5700759.jpg", "longitude": 11.448483, "latitude": 43.280205, "width": 500, "height": 304, "upload_date": "02 November 2007", "owner_id": 158718, "owner_name": "giulio colla", "owner_url": "http://www.panoramio.com/user/158718"} + , + {"photo_id": 1391775, "photo_title": "Arboles al atardecer en Chapala - Trees at sunset in Chapala Lake", "photo_url": "http://www.panoramio.com/photo/1391775", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1391775.jpg", "longitude": -102.775211, "latitude": 20.308730, "width": 500, "height": 341, "upload_date": "19 March 2007", "owner_id": 291650, "owner_name": "J.Ernesto Ortiz Razo", "owner_url": "http://www.panoramio.com/user/291650"} + , + {"photo_id": 57514, "photo_title": "Limone 1", "photo_url": "http://www.panoramio.com/photo/57514", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/57514.jpg", "longitude": 10.792179, "latitude": 45.816298, "width": 500, "height": 333, "upload_date": "04 October 2006", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 2602937, "photo_title": "Alone", "photo_url": "http://www.panoramio.com/photo/2602937", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2602937.jpg", "longitude": -4.001770, "latitude": 31.174035, "width": 500, "height": 320, "upload_date": "06 June 2007", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 117465, "photo_title": "New York in the Afternoon...from Soho.. by Jeremiah Christopher", "photo_url": "http://www.panoramio.com/photo/117465", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/117465.jpg", "longitude": -74.003212, "latitude": 40.724059, "width": 500, "height": 375, "upload_date": "11 December 2006", "owner_id": 16869, "owner_name": "Jeremiah Christopher", "owner_url": "http://www.panoramio.com/user/16869"} + , + {"photo_id": 1331707, "photo_title": "Kastellet (Copenhagen fortress), Aerial", "photo_url": "http://www.panoramio.com/photo/1331707", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1331707.jpg", "longitude": 12.594967, "latitude": 55.691230, "width": 500, "height": 332, "upload_date": "15 March 2007", "owner_id": 278074, "owner_name": "H. C. Steensen", "owner_url": "http://www.panoramio.com/user/278074"} + , + {"photo_id": 11853382, "photo_title": "Railroads by Sunset/ Schienen bei Sonnenuntergang", "photo_url": "http://www.panoramio.com/photo/11853382", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/11853382.jpg", "longitude": 8.283455, "latitude": 51.692644, "width": 500, "height": 332, "upload_date": "06 July 2008", "owner_id": 564436, "owner_name": "Thomas Splietker", "owner_url": "http://www.panoramio.com/user/564436"} + , + {"photo_id": 1558288, "photo_title": "Notre-Dame et Tour Saint Jacques", "photo_url": "http://www.panoramio.com/photo/1558288", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1558288.jpg", "longitude": 2.354808, "latitude": 48.850399, "width": 500, "height": 333, "upload_date": "30 March 2007", "owner_id": 78506, "owner_name": "Philippe Stoop", "owner_url": "http://www.panoramio.com/user/78506"} + , + {"photo_id": 7601425, "photo_title": "Venezianische Impressionen", "photo_url": "http://www.panoramio.com/photo/7601425", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7601425.jpg", "longitude": 12.337024, "latitude": 45.432280, "width": 500, "height": 385, "upload_date": "05 February 2008", "owner_id": 696605, "owner_name": "© alfredschaffer", "owner_url": "http://www.panoramio.com/user/696605"} + , + {"photo_id": 36386, "photo_title": "Half Dome Cables", "photo_url": "http://www.panoramio.com/photo/36386", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/36386.jpg", "longitude": -119.530735, "latitude": 37.746710, "width": 333, "height": 500, "upload_date": "02 August 2006", "owner_id": 5684, "owner_name": "Brent Townshend", "owner_url": "http://www.panoramio.com/user/5684"} + , + {"photo_id": 1089570, "photo_title": "Titokzatos reggel", "photo_url": "http://www.panoramio.com/photo/1089570", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1089570.jpg", "longitude": 17.467575, "latitude": 47.870532, "width": 500, "height": 331, "upload_date": "28 February 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 575276, "photo_title": "Sunrise", "photo_url": "http://www.panoramio.com/photo/575276", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/575276.jpg", "longitude": 2.288809, "latitude": 48.861892, "width": 500, "height": 349, "upload_date": "26 January 2007", "owner_id": 123518, "owner_name": "ERic Pouhier ericpouhier.com", "owner_url": "http://www.panoramio.com/user/123518"} + , + {"photo_id": 486480, "photo_title": "Monte Generoso", "photo_url": "http://www.panoramio.com/photo/486480", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/486480.jpg", "longitude": 9.015055, "latitude": 45.924826, "width": 428, "height": 500, "upload_date": "19 January 2007", "owner_id": 24068, "owner_name": "Daniele Nasi", "owner_url": "http://www.panoramio.com/user/24068"} + , + {"photo_id": 1100378, "photo_title": "Rensbekksetra (summer pasture)", "photo_url": "http://www.panoramio.com/photo/1100378", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1100378.jpg", "longitude": 9.293404, "latitude": 62.712731, "width": 500, "height": 255, "upload_date": "01 March 2007", "owner_id": 223406, "owner_name": "Sigmund Rise", "owner_url": "http://www.panoramio.com/user/223406"} + , + {"photo_id": 5844316, "photo_title": "Hikarigaoka IMA", "photo_url": "http://www.panoramio.com/photo/5844316", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5844316.jpg", "longitude": 139.630048, "latitude": 35.758154, "width": 500, "height": 326, "upload_date": "11 November 2007", "owner_id": 558055, "owner_name": "www.tokyoform.com", "owner_url": "http://www.panoramio.com/user/558055"} + , + {"photo_id": 1345372, "photo_title": "Sunset, Foeniculum vulgare (fennel, is one likely candidate)", "photo_url": "http://www.panoramio.com/photo/1345372", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1345372.jpg", "longitude": 10.727119, "latitude": 55.205080, "width": 332, "height": 500, "upload_date": "16 March 2007", "owner_id": 278074, "owner_name": "H. C. Steensen", "owner_url": "http://www.panoramio.com/user/278074"} + , + {"photo_id": 1317735, "photo_title": "Motu of Bora Bora", "photo_url": "http://www.panoramio.com/photo/1317735", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1317735.jpg", "longitude": -151.698360, "latitude": -16.495843, "width": 500, "height": 355, "upload_date": "14 March 2007", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 1012093, "photo_title": "Sunrise from the east side of Longs Peak", "photo_url": "http://www.panoramio.com/photo/1012093", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1012093.jpg", "longitude": -105.542564, "latitude": 40.274549, "width": 374, "height": 500, "upload_date": "25 February 2007", "owner_id": 87752, "owner_name": "Richard Ryer", "owner_url": "http://www.panoramio.com/user/87752"} + , + {"photo_id": 5035419, "photo_title": "Basilica de San Basilio (Moscow)", "photo_url": "http://www.panoramio.com/photo/5035419", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5035419.jpg", "longitude": 37.622852, "latitude": 55.752622, "width": 398, "height": 500, "upload_date": "01 October 2007", "owner_id": 83865, "owner_name": "Epi F.Villanueva", "owner_url": "http://www.panoramio.com/user/83865"} + , + {"photo_id": 799910, "photo_title": "A Dramatic Turn of the Yangtze River", "photo_url": "http://www.panoramio.com/photo/799910", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/799910.jpg", "longitude": 99.272633, "latitude": 28.255552, "width": 500, "height": 226, "upload_date": "13 February 2007", "owner_id": 164125, "owner_name": "DannyXu", "owner_url": "http://www.panoramio.com/user/164125"} + , + {"photo_id": 765388, "photo_title": "Leh", "photo_url": "http://www.panoramio.com/photo/765388", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/765388.jpg", "longitude": 77.587509, "latitude": 34.164943, "width": 500, "height": 333, "upload_date": "10 February 2007", "owner_id": 78506, "owner_name": "Philippe Stoop", "owner_url": "http://www.panoramio.com/user/78506"} + , + {"photo_id": 2875857, "photo_title": "Elgol, Isle of Skye", "photo_url": "http://www.panoramio.com/photo/2875857", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2875857.jpg", "longitude": -6.107025, "latitude": 57.150023, "width": 500, "height": 500, "upload_date": "22 June 2007", "owner_id": 588149, "owner_name": "Adam Salwanowicz", "owner_url": "http://www.panoramio.com/user/588149"} + , + {"photo_id": 840915, "photo_title": "Island of The Day Before", "photo_url": "http://www.panoramio.com/photo/840915", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/840915.jpg", "longitude": 27.436638, "latitude": 42.441448, "width": 500, "height": 333, "upload_date": "16 February 2007", "owner_id": 16880, "owner_name": "evgenidinev.com", "owner_url": "http://www.panoramio.com/user/16880"} + , + {"photo_id": 1459925, "photo_title": "The last ray", "photo_url": "http://www.panoramio.com/photo/1459925", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1459925.jpg", "longitude": -110.134850, "latitude": 36.955379, "width": 500, "height": 290, "upload_date": "23 March 2007", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 872177, "photo_title": "Sahara Desert sunrise, Chott el Jerid, near Kebili, Tunisia, 1/2007", "photo_url": "http://www.panoramio.com/photo/872177", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/872177.jpg", "longitude": 8.475866, "latitude": 33.930898, "width": 500, "height": 375, "upload_date": "18 February 2007", "owner_id": 183521, "owner_name": "SteveT", "owner_url": "http://www.panoramio.com/user/183521"} + , + {"photo_id": 405753, "photo_title": "sinanogawa", "photo_url": "http://www.panoramio.com/photo/405753", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/405753.jpg", "longitude": 138.822384, "latitude": 37.268589, "width": 500, "height": 386, "upload_date": "13 January 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 548240, "photo_title": "Old Bagan 2002", "photo_url": "http://www.panoramio.com/photo/548240", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/548240.jpg", "longitude": 94.825230, "latitude": 21.137026, "width": 500, "height": 375, "upload_date": "23 January 2007", "owner_id": 64758, "owner_name": "Joly David", "owner_url": "http://www.panoramio.com/user/64758"} + , + {"photo_id": 4868105, "photo_title": "Bled lake", "photo_url": "http://www.panoramio.com/photo/4868105", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4868105.jpg", "longitude": 14.104900, "latitude": 46.369793, "width": 500, "height": 333, "upload_date": "24 September 2007", "owner_id": 989, "owner_name": "Mrgud", "owner_url": "http://www.panoramio.com/user/989"} + , + {"photo_id": 549396, "photo_title": "Råkneset on Storfjellet island, Røst", "photo_url": "http://www.panoramio.com/photo/549396", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/549396.jpg", "longitude": 11.932955, "latitude": 67.457456, "width": 500, "height": 375, "upload_date": "23 January 2007", "owner_id": 95799, "owner_name": "Owen Morgan", "owner_url": "http://www.panoramio.com/user/95799"} + , + {"photo_id": 196121, "photo_title": "canallave", "photo_url": "http://www.panoramio.com/photo/196121", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/196121.jpg", "longitude": -3.960571, "latitude": 43.452358, "width": 500, "height": 332, "upload_date": "20 December 2006", "owner_id": 38804, "owner_name": "www.oscarsanchez.net", "owner_url": "http://www.panoramio.com/user/38804"} + , + {"photo_id": 2422299, "photo_title": "Pacific Weather", "photo_url": "http://www.panoramio.com/photo/2422299", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2422299.jpg", "longitude": -124.097099, "latitude": 44.345704, "width": 500, "height": 333, "upload_date": "27 May 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 821291, "photo_title": "Храм Василия Блаженного (Москва, ноябрь 2006 года)", "photo_url": "http://www.panoramio.com/photo/821291", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/821291.jpg", "longitude": 37.622954, "latitude": 55.752613, "width": 500, "height": 375, "upload_date": "14 February 2007", "owner_id": 55593, "owner_name": "pokatut.photosight.ru", "owner_url": "http://www.panoramio.com/user/55593"} + , + {"photo_id": 3545143, "photo_title": "Rainbow (Regnbue)", "photo_url": "http://www.panoramio.com/photo/3545143", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3545143.jpg", "longitude": 8.598175, "latitude": 62.904445, "width": 500, "height": 223, "upload_date": "26 July 2007", "owner_id": 343934, "owner_name": "Asbjørn999", "owner_url": "http://www.panoramio.com/user/343934"} + , + {"photo_id": 1794618, "photo_title": "Túlélők", "photo_url": "http://www.panoramio.com/photo/1794618", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1794618.jpg", "longitude": 20.803127, "latitude": 48.014157, "width": 399, "height": 500, "upload_date": "15 April 2007", "owner_id": 346103, "owner_name": "lacitot", "owner_url": "http://www.panoramio.com/user/346103"} + , + {"photo_id": 3904091, "photo_title": "Hajnali utakon", "photo_url": "http://www.panoramio.com/photo/3904091", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3904091.jpg", "longitude": 17.512014, "latitude": 47.850319, "width": 500, "height": 334, "upload_date": "13 August 2007", "owner_id": 689769, "owner_name": "Ponty István", "owner_url": "http://www.panoramio.com/user/689769"} + , + {"photo_id": 5649508, "photo_title": "Quiet morning", "photo_url": "http://www.panoramio.com/photo/5649508", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5649508.jpg", "longitude": 12.190876, "latitude": 49.357446, "width": 500, "height": 333, "upload_date": "31 October 2007", "owner_id": 696605, "owner_name": "© alfredschaffer", "owner_url": "http://www.panoramio.com/user/696605"} + , + {"photo_id": 7938965, "photo_title": "Pattaya - Big Buddha - Big Buddha Hill", "photo_url": "http://www.panoramio.com/photo/7938965", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7938965.jpg", "longitude": 100.868343, "latitude": 12.914107, "width": 500, "height": 375, "upload_date": "19 February 2008", "owner_id": 716245, "owner_name": "—Dragon-64— ✈", "owner_url": "http://www.panoramio.com/user/716245"} + , + {"photo_id": 497056, "photo_title": "Japanese Garden maple", "photo_url": "http://www.panoramio.com/photo/497056", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/497056.jpg", "longitude": -122.707999, "latitude": 45.518810, "width": 500, "height": 300, "upload_date": "20 January 2007", "owner_id": 107359, "owner_name": "Ron Cooper", "owner_url": "http://www.panoramio.com/user/107359"} + , + {"photo_id": 438699, "photo_title": "White Sand Dunes", "photo_url": "http://www.panoramio.com/photo/438699", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/438699.jpg", "longitude": -106.262083, "latitude": 32.799324, "width": 371, "height": 500, "upload_date": "15 January 2007", "owner_id": 93560, "owner_name": "Alex Petrov", "owner_url": "http://www.panoramio.com/user/93560"} + , + {"photo_id": 2082221, "photo_title": "\"Bekötött szemmel\"", "photo_url": "http://www.panoramio.com/photo/2082221", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2082221.jpg", "longitude": 17.660522, "latitude": 47.604543, "width": 500, "height": 334, "upload_date": "05 May 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 5836484, "photo_title": "An Autumn's golden dawn on the Lake of Varese", "photo_url": "http://www.panoramio.com/photo/5836484", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5836484.jpg", "longitude": 8.718081, "latitude": 45.838966, "width": 500, "height": 312, "upload_date": "11 November 2007", "owner_id": 933456, "owner_name": "© Marco De Candido", "owner_url": "http://www.panoramio.com/user/933456"} + , + {"photo_id": 5204696, "photo_title": "Scotland", "photo_url": "http://www.panoramio.com/photo/5204696", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5204696.jpg", "longitude": -5.078773, "latitude": 56.558726, "width": 500, "height": 254, "upload_date": "09 October 2007", "owner_id": 588149, "owner_name": "Adam Salwanowicz", "owner_url": "http://www.panoramio.com/user/588149"} + , + {"photo_id": 1343454, "photo_title": "Вулкан Карымский", "photo_url": "http://www.panoramio.com/photo/1343454", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1343454.jpg", "longitude": 159.480286, "latitude": 54.025470, "width": 364, "height": 500, "upload_date": "16 March 2007", "owner_id": 268724, "owner_name": "Korotnev AV", "owner_url": "http://www.panoramio.com/user/268724"} + , + {"photo_id": 507424, "photo_title": "Lankák, ívek, felhőárnyak", "photo_url": "http://www.panoramio.com/photo/507424", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/507424.jpg", "longitude": 17.967281, "latitude": 47.318112, "width": 500, "height": 291, "upload_date": "20 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 5893176, "photo_title": "07-06-11_Camino de Santiago, Castrojeriz_PIXELECTA", "photo_url": "http://www.panoramio.com/photo/5893176", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5893176.jpg", "longitude": -4.182916, "latitude": 42.285723, "width": 500, "height": 333, "upload_date": "13 November 2007", "owner_id": 163655, "owner_name": "[[[ PIXELECTA ]]]", "owner_url": "http://www.panoramio.com/user/163655"} + , + {"photo_id": 186685, "photo_title": "People of Petra, the boy and his job", "photo_url": "http://www.panoramio.com/photo/186685", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/186685.jpg", "longitude": 35.437002, "latitude": 30.322285, "width": 500, "height": 375, "upload_date": "19 December 2006", "owner_id": 24068, "owner_name": "Daniele Nasi", "owner_url": "http://www.panoramio.com/user/24068"} + , + {"photo_id": 355648, "photo_title": "puerto-rico el-yunque", "photo_url": "http://www.panoramio.com/photo/355648", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/355648.jpg", "longitude": -65.788536, "latitude": 18.298795, "width": 500, "height": 334, "upload_date": "09 January 2007", "owner_id": 69671, "owner_name": "illusandpics.com", "owner_url": "http://www.panoramio.com/user/69671"} + , + {"photo_id": 46913, "photo_title": "beachy head", "photo_url": "http://www.panoramio.com/photo/46913", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/46913.jpg", "longitude": 0.216272, "latitude": 50.737969, "width": 500, "height": 291, "upload_date": "11 September 2006", "owner_id": 2575, "owner_name": "mikel ortega", "owner_url": "http://www.panoramio.com/user/2575"} + , + {"photo_id": 6012999, "photo_title": "Wetterumschwung in Murano", "photo_url": "http://www.panoramio.com/photo/6012999", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6012999.jpg", "longitude": 12.357838, "latitude": 45.457557, "width": 500, "height": 336, "upload_date": "19 November 2007", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 590422, "photo_title": "Gyilkos-tó (Killer Lake) - Remains of the forest, which grew here until 1837, conserved by the water", "photo_url": "http://www.panoramio.com/photo/590422", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/590422.jpg", "longitude": 25.785170, "latitude": 46.792597, "width": 500, "height": 352, "upload_date": "27 January 2007", "owner_id": 57869, "owner_name": "NAGY Albert", "owner_url": "http://www.panoramio.com/user/57869"} + , + {"photo_id": 5119067, "photo_title": "Fog In The Forest", "photo_url": "http://www.panoramio.com/photo/5119067", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5119067.jpg", "longitude": 7.667191, "latitude": 49.174283, "width": 500, "height": 375, "upload_date": "05 October 2007", "owner_id": 528834, "owner_name": "©junebug", "owner_url": "http://www.panoramio.com/user/528834"} + , + {"photo_id": 4702558, "photo_title": "Sunset ( Isla de Antigua-Caribe)", "photo_url": "http://www.panoramio.com/photo/4702558", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4702558.jpg", "longitude": -61.833801, "latitude": 17.171627, "width": 500, "height": 375, "upload_date": "16 September 2007", "owner_id": 83865, "owner_name": "Epi F.Villanueva", "owner_url": "http://www.panoramio.com/user/83865"} + , + {"photo_id": 717413, "photo_title": "Singapore Skyline with Esplanade at night", "photo_url": "http://www.panoramio.com/photo/717413", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/717413.jpg", "longitude": 103.856664, "latitude": 1.291589, "width": 391, "height": 500, "upload_date": "06 February 2007", "owner_id": 20398, "owner_name": "boerx", "owner_url": "http://www.panoramio.com/user/20398"} + , + {"photo_id": 6281064, "photo_title": "Latemar Carezza", "photo_url": "http://www.panoramio.com/photo/6281064", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6281064.jpg", "longitude": 11.595447, "latitude": 46.412476, "width": 500, "height": 332, "upload_date": "03 December 2007", "owner_id": 578163, "owner_name": "Margherita-Italy", "owner_url": "http://www.panoramio.com/user/578163"} + , + {"photo_id": 327016, "photo_title": "bryce canyon", "photo_url": "http://www.panoramio.com/photo/327016", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/327016.jpg", "longitude": -112.210836, "latitude": 37.586146, "width": 500, "height": 375, "upload_date": "07 January 2007", "owner_id": 63705, "owner_name": "Karl Wiktorin", "owner_url": "http://www.panoramio.com/user/63705"} + , + {"photo_id": 301678, "photo_title": "Akashi Kaikyo Bridge (Pearl Bridge)", "photo_url": "http://www.panoramio.com/photo/301678", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/301678.jpg", "longitude": 135.028882, "latitude": 34.623002, "width": 443, "height": 500, "upload_date": "04 January 2007", "owner_id": 30202, "owner_name": "S_Mori", "owner_url": "http://www.panoramio.com/user/30202"} + , + {"photo_id": 6055804, "photo_title": "2007 Balsa de SALBURUA_VITORIA (Alava) PIXELECTA", "photo_url": "http://www.panoramio.com/photo/6055804", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6055804.jpg", "longitude": -2.650537, "latitude": 42.859907, "width": 500, "height": 333, "upload_date": "21 November 2007", "owner_id": 163655, "owner_name": "[[[ PIXELECTA ]]]", "owner_url": "http://www.panoramio.com/user/163655"} + , + {"photo_id": 5946759, "photo_title": "Snow Pond", "photo_url": "http://www.panoramio.com/photo/5946759", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5946759.jpg", "longitude": 10.899510, "latitude": 49.694507, "width": 500, "height": 375, "upload_date": "16 November 2007", "owner_id": 884621, "owner_name": "Florian Eichhorn", "owner_url": "http://www.panoramio.com/user/884621"} + , + {"photo_id": 231305, "photo_title": "Cathedral Rock in Sedona, AZ at Sunset", "photo_url": "http://www.panoramio.com/photo/231305", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/231305.jpg", "longitude": -111.792294, "latitude": 34.818657, "width": 500, "height": 327, "upload_date": "25 December 2006", "owner_id": 45308, "owner_name": "Mike Cavaroc", "owner_url": "http://www.panoramio.com/user/45308"} + , + {"photo_id": 582047, "photo_title": "Old Vineyard with the sun trying to break through the fog: Oakley, CA", "photo_url": "http://www.panoramio.com/photo/582047", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/582047.jpg", "longitude": -121.753750, "latitude": 38.001658, "width": 500, "height": 316, "upload_date": "26 January 2007", "owner_id": 99249, "owner_name": "shaunika", "owner_url": "http://www.panoramio.com/user/99249"} + , + {"photo_id": 679332, "photo_title": "forbidden city", "photo_url": "http://www.panoramio.com/photo/679332", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/679332.jpg", "longitude": 116.396177, "latitude": 39.921734, "width": 500, "height": 248, "upload_date": "04 February 2007", "owner_id": 146092, "owner_name": "sid1662", "owner_url": "http://www.panoramio.com/user/146092"} + , + {"photo_id": 3904189, "photo_title": "Hajnal", "photo_url": "http://www.panoramio.com/photo/3904189", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3904189.jpg", "longitude": 17.361488, "latitude": 47.875138, "width": 500, "height": 333, "upload_date": "13 August 2007", "owner_id": 689769, "owner_name": "Ponty István", "owner_url": "http://www.panoramio.com/user/689769"} + , + {"photo_id": 11059137, "photo_title": "Sunset at Kythira Greece by Nikos Demiris", "photo_url": "http://www.panoramio.com/photo/11059137", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/11059137.jpg", "longitude": 23.003998, "latitude": 36.142034, "width": 500, "height": 346, "upload_date": "09 June 2008", "owner_id": 1629713, "owner_name": "demirisn", "owner_url": "http://www.panoramio.com/user/1629713"} + , + {"photo_id": 2334150, "photo_title": "", "photo_url": "http://www.panoramio.com/photo/2334150", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2334150.jpg", "longitude": 0.491531, "latitude": 40.903993, "width": 500, "height": 373, "upload_date": "21 May 2007", "owner_id": 3022, "owner_name": "Arcadi", "owner_url": "http://www.panoramio.com/user/3022"} + , + {"photo_id": 5709301, "photo_title": "Ködvarázs II", "photo_url": "http://www.panoramio.com/photo/5709301", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5709301.jpg", "longitude": 17.998352, "latitude": 47.252903, "width": 333, "height": 500, "upload_date": "05 November 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 55029, "photo_title": "Solar Eclipce, Mt.Elbrus, Refuge of 11", "photo_url": "http://www.panoramio.com/photo/55029", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/55029.jpg", "longitude": 42.451859, "latitude": 43.316186, "width": 448, "height": 500, "upload_date": "30 September 2006", "owner_id": 7707, "owner_name": "Yorix", "owner_url": "http://www.panoramio.com/user/7707"} + , + {"photo_id": 702974, "photo_title": "Hundertwasserhaus", "photo_url": "http://www.panoramio.com/photo/702974", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/702974.jpg", "longitude": 16.393780, "latitude": 48.207594, "width": 375, "height": 500, "upload_date": "05 February 2007", "owner_id": 123698, "owner_name": "© Kojak", "owner_url": "http://www.panoramio.com/user/123698"} + , + {"photo_id": 8811826, "photo_title": "Der Baum im Wasser", "photo_url": "http://www.panoramio.com/photo/8811826", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8811826.jpg", "longitude": 9.293532, "latitude": 52.869078, "width": 375, "height": 500, "upload_date": "24 March 2008", "owner_id": 1431077, "owner_name": "Heiner F.", "owner_url": "http://www.panoramio.com/user/1431077"} + , + {"photo_id": 67843, "photo_title": "Torre Eiffel", "photo_url": "http://www.panoramio.com/photo/67843", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/67843.jpg", "longitude": 2.294587, "latitude": 48.858468, "width": 500, "height": 375, "upload_date": "21 October 2006", "owner_id": 9163, "owner_name": "marathoniano", "owner_url": "http://www.panoramio.com/user/9163"} + , + {"photo_id": 1183509, "photo_title": "Viharpart", "photo_url": "http://www.panoramio.com/photo/1183509", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1183509.jpg", "longitude": 15.917473, "latitude": 43.590587, "width": 500, "height": 334, "upload_date": "05 March 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 449049, "photo_title": "Encantos de Santos", "photo_url": "http://www.panoramio.com/photo/449049", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/449049.jpg", "longitude": -46.307716, "latitude": -23.988605, "width": 500, "height": 342, "upload_date": "16 January 2007", "owner_id": 81574, "owner_name": "Criss RB", "owner_url": "http://www.panoramio.com/user/81574"} + , + {"photo_id": 4669228, "photo_title": "Reif an der naab", "photo_url": "http://www.panoramio.com/photo/4669228", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4669228.jpg", "longitude": 12.113457, "latitude": 49.339105, "width": 500, "height": 333, "upload_date": "15 September 2007", "owner_id": 696605, "owner_name": "© alfredschaffer", "owner_url": "http://www.panoramio.com/user/696605"} + , + {"photo_id": 516653, "photo_title": "Alkonyvarázs", "photo_url": "http://www.panoramio.com/photo/516653", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/516653.jpg", "longitude": 17.451611, "latitude": 47.782424, "width": 404, "height": 500, "upload_date": "21 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 4214320, "photo_title": "暮色", "photo_url": "http://www.panoramio.com/photo/4214320", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4214320.jpg", "longitude": 110.364532, "latitude": 25.201524, "width": 500, "height": 313, "upload_date": "26 August 2007", "owner_id": 161470, "owner_name": "John Su", "owner_url": "http://www.panoramio.com/user/161470"} + , + {"photo_id": 9419312, "photo_title": "Skeleton", "photo_url": "http://www.panoramio.com/photo/9419312", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9419312.jpg", "longitude": -147.929063, "latitude": -15.091723, "width": 500, "height": 326, "upload_date": "16 April 2008", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 642609, "photo_title": "Oia, Santorini, Cyclades, Hellas, Greece", "photo_url": "http://www.panoramio.com/photo/642609", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/642609.jpg", "longitude": 25.377388, "latitude": 36.460778, "width": 500, "height": 333, "upload_date": "01 February 2007", "owner_id": 131038, "owner_name": "wolffystyle", "owner_url": "http://www.panoramio.com/user/131038"} + , + {"photo_id": 354614, "photo_title": "Dresden_Centrum_01", "photo_url": "http://www.panoramio.com/photo/354614", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/354614.jpg", "longitude": 13.740206, "latitude": 51.056934, "width": 500, "height": 332, "upload_date": "09 January 2007", "owner_id": 71628, "owner_name": "Ulrich Hässler, Dresden", "owner_url": "http://www.panoramio.com/user/71628"} + , + {"photo_id": 678200, "photo_title": "Geometria de terrazas", "photo_url": "http://www.panoramio.com/photo/678200", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/678200.jpg", "longitude": -16.841269, "latitude": 28.235525, "width": 500, "height": 333, "upload_date": "03 February 2007", "owner_id": 92750, "owner_name": "Pablo López Ramos", "owner_url": "http://www.panoramio.com/user/92750"} + , + {"photo_id": 436284, "photo_title": "bandaibasi2", "photo_url": "http://www.panoramio.com/photo/436284", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/436284.jpg", "longitude": 139.051423, "latitude": 37.920063, "width": 500, "height": 393, "upload_date": "15 January 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 2235454, "photo_title": "La bonde et la brume", "photo_url": "http://www.panoramio.com/photo/2235454", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2235454.jpg", "longitude": 1.595249, "latitude": 47.313181, "width": 500, "height": 500, "upload_date": "15 May 2007", "owner_id": 372189, "owner_name": "Phil©", "owner_url": "http://www.panoramio.com/user/372189"} + , + {"photo_id": 5983, "photo_title": "Waiting", "photo_url": "http://www.panoramio.com/photo/5983", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5983.jpg", "longitude": 7.796173, "latitude": 33.954752, "width": 344, "height": 500, "upload_date": "17 December 2005", "owner_id": 989, "owner_name": "Mrgud", "owner_url": "http://www.panoramio.com/user/989"} + , + {"photo_id": 97402, "photo_title": "Mostar", "photo_url": "http://www.panoramio.com/photo/97402", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/97402.jpg", "longitude": 17.814803, "latitude": 43.337102, "width": 500, "height": 375, "upload_date": "09 December 2006", "owner_id": 12954, "owner_name": "Ziębol", "owner_url": "http://www.panoramio.com/user/12954"} + , + {"photo_id": 5159548, "photo_title": "Autumn - Herbstfarben - Fall", "photo_url": "http://www.panoramio.com/photo/5159548", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5159548.jpg", "longitude": 7.541599, "latitude": 46.834772, "width": 500, "height": 374, "upload_date": "08 October 2007", "owner_id": 635422, "owner_name": "♫ Swissmay", "owner_url": "http://www.panoramio.com/user/635422"} + , + {"photo_id": 1779072, "photo_title": "Égi érintés", "photo_url": "http://www.panoramio.com/photo/1779072", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1779072.jpg", "longitude": 17.747383, "latitude": 47.556835, "width": 462, "height": 500, "upload_date": "14 April 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 5795973, "photo_title": "Emmental mit 7 Hengsten Hohgant und Berneralpen - Emmental, 7 Stallions and Bernese Alpine Snow Mountains", "photo_url": "http://www.panoramio.com/photo/5795973", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5795973.jpg", "longitude": 7.730427, "latitude": 47.033280, "width": 500, "height": 374, "upload_date": "08 November 2007", "owner_id": 635422, "owner_name": "♫ Swissmay", "owner_url": "http://www.panoramio.com/user/635422"} + , + {"photo_id": 6850694, "photo_title": "2007-VITORIA Alava PIXELECTA", "photo_url": "http://www.panoramio.com/photo/6850694", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6850694.jpg", "longitude": -2.649336, "latitude": 42.861260, "width": 500, "height": 116, "upload_date": "02 January 2008", "owner_id": 163655, "owner_name": "[[[ PIXELECTA ]]]", "owner_url": "http://www.panoramio.com/user/163655"} + , + {"photo_id": 11738506, "photo_title": "Galeria de Itálica", "photo_url": "http://www.panoramio.com/photo/11738506", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/11738506.jpg", "longitude": -6.046858, "latitude": 37.444199, "width": 378, "height": 500, "upload_date": "03 July 2008", "owner_id": 1038666, "owner_name": "Doenjo", "owner_url": "http://www.panoramio.com/user/1038666"} + , + {"photo_id": 4013965, "photo_title": "Pedaleando en la costanera", "photo_url": "http://www.panoramio.com/photo/4013965", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4013965.jpg", "longitude": -73.231012, "latitude": -39.817655, "width": 500, "height": 366, "upload_date": "18 August 2007", "owner_id": 327310, "owner_name": "Erwin Woenckhaus", "owner_url": "http://www.panoramio.com/user/327310"} + , + {"photo_id": 611985, "photo_title": "Toda Temple", "photo_url": "http://www.panoramio.com/photo/611985", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/611985.jpg", "longitude": 76.715459, "latitude": 11.420014, "width": 500, "height": 375, "upload_date": "29 January 2007", "owner_id": 130990, "owner_name": "Eye for India. blogspot .com", "owner_url": "http://www.panoramio.com/user/130990"} + , + {"photo_id": 2689441, "photo_title": "Terepszemle", "photo_url": "http://www.panoramio.com/photo/2689441", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2689441.jpg", "longitude": 17.674255, "latitude": 47.601533, "width": 500, "height": 347, "upload_date": "11 June 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 6599853, "photo_title": "FlowerSun", "photo_url": "http://www.panoramio.com/photo/6599853", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6599853.jpg", "longitude": 21.042938, "latitude": 41.988333, "width": 480, "height": 500, "upload_date": "21 December 2007", "owner_id": 695042, "owner_name": "Neim Sejfuli ♦", "owner_url": "http://www.panoramio.com/user/695042"} + , + {"photo_id": 71855, "photo_title": "British Museum", "photo_url": "http://www.panoramio.com/photo/71855", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/71855.jpg", "longitude": -0.127373, "latitude": 51.519265, "width": 500, "height": 333, "upload_date": "28 October 2006", "owner_id": 1295, "owner_name": "Matthew Walters", "owner_url": "http://www.panoramio.com/user/1295"} + , + {"photo_id": 58291, "photo_title": "Gollinger Wasserfall", "photo_url": "http://www.panoramio.com/photo/58291", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/58291.jpg", "longitude": 13.138103, "latitude": 47.601244, "width": 330, "height": 500, "upload_date": "07 October 2006", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 3903941, "photo_title": "Viharos Pipacsos", "photo_url": "http://www.panoramio.com/photo/3903941", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3903941.jpg", "longitude": 16.638451, "latitude": 47.732396, "width": 500, "height": 331, "upload_date": "13 August 2007", "owner_id": 689769, "owner_name": "Ponty István", "owner_url": "http://www.panoramio.com/user/689769"} + , + {"photo_id": 5363928, "photo_title": "Antelope Slot Canyon", "photo_url": "http://www.panoramio.com/photo/5363928", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5363928.jpg", "longitude": -111.370811, "latitude": 36.856755, "width": 500, "height": 326, "upload_date": "17 October 2007", "owner_id": 358485, "owner_name": "Francesco Villa", "owner_url": "http://www.panoramio.com/user/358485"} + , + {"photo_id": 2688750, "photo_title": "Playa de Strenc,Mallorca", "photo_url": "http://www.panoramio.com/photo/2688750", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2688750.jpg", "longitude": 2.980042, "latitude": 39.348702, "width": 500, "height": 427, "upload_date": "11 June 2007", "owner_id": 83865, "owner_name": "Epi F.Villanueva", "owner_url": "http://www.panoramio.com/user/83865"} + , + {"photo_id": 3148025, "photo_title": "Zuidlede", "photo_url": "http://www.panoramio.com/photo/3148025", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3148025.jpg", "longitude": 3.906112, "latitude": 51.147667, "width": 496, "height": 500, "upload_date": "06 July 2007", "owner_id": 635244, "owner_name": "A.Lebacq", "owner_url": "http://www.panoramio.com/user/635244"} + , + {"photo_id": 809727, "photo_title": "Túl az óperencián", "photo_url": "http://www.panoramio.com/photo/809727", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/809727.jpg", "longitude": 17.062283, "latitude": 43.277580, "width": 500, "height": 334, "upload_date": "13 February 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 11560716, "photo_title": "China's Great Wall, 09 may 2008", "photo_url": "http://www.panoramio.com/photo/11560716", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/11560716.jpg", "longitude": 116.064860, "latitude": 40.287162, "width": 500, "height": 331, "upload_date": "27 June 2008", "owner_id": 1931067, "owner_name": "EugeneTrambo", "owner_url": "http://www.panoramio.com/user/1931067"} + , + {"photo_id": 10484028, "photo_title": "Tuscanny in lower bavaria? Toskana in Niederbayern? near Pfeffenhausen", "photo_url": "http://www.panoramio.com/photo/10484028", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10484028.jpg", "longitude": 11.982479, "latitude": 48.628768, "width": 500, "height": 411, "upload_date": "22 May 2008", "owner_id": 1077251, "owner_name": "picsonthemove", "owner_url": "http://www.panoramio.com/user/1077251"} + , + {"photo_id": 10321724, "photo_title": "Kingston Lacy beech avenue from the middle of the road (don't try this at home...)", "photo_url": "http://www.panoramio.com/photo/10321724", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10321724.jpg", "longitude": -2.051697, "latitude": 50.820469, "width": 500, "height": 473, "upload_date": "17 May 2008", "owner_id": 450216, "owner_name": "Graham Hobbs", "owner_url": "http://www.panoramio.com/user/450216"} + , + {"photo_id": 11847917, "photo_title": "Neda.... The end of an unusual trip! First Prize \"Travel\" Panoramio JULY 2008, a shot by kostas andreopoulos", "photo_url": "http://www.panoramio.com/photo/11847917", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/11847917.jpg", "longitude": 21.776275, "latitude": 37.394711, "width": 500, "height": 484, "upload_date": "06 July 2008", "owner_id": 1690483, "owner_name": "k.andre", "owner_url": "http://www.panoramio.com/user/1690483"} + , + {"photo_id": 723285, "photo_title": "Stonehenge Fisheye View June 2000", "photo_url": "http://www.panoramio.com/photo/723285", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/723285.jpg", "longitude": -1.826195, "latitude": 51.178849, "width": 500, "height": 500, "upload_date": "07 February 2007", "owner_id": 154364, "owner_name": "Edgy01", "owner_url": "http://www.panoramio.com/user/154364"} + , + {"photo_id": 9831198, "photo_title": "Verőfényes hangulat", "photo_url": "http://www.panoramio.com/photo/9831198", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9831198.jpg", "longitude": 18.331053, "latitude": 47.650689, "width": 333, "height": 500, "upload_date": "01 May 2008", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 4670496, "photo_title": "Vuelo rasante entre la niebla", "photo_url": "http://www.panoramio.com/photo/4670496", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4670496.jpg", "longitude": -73.243092, "latitude": -39.809134, "width": 500, "height": 371, "upload_date": "15 September 2007", "owner_id": 327310, "owner_name": "Erwin Woenckhaus", "owner_url": "http://www.panoramio.com/user/327310"} + , + {"photo_id": 2414624, "photo_title": "Triumvirátus", "photo_url": "http://www.panoramio.com/photo/2414624", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2414624.jpg", "longitude": 17.768154, "latitude": 47.510940, "width": 500, "height": 309, "upload_date": "27 May 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 196129, "photo_title": "usgo", "photo_url": "http://www.panoramio.com/photo/196129", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/196129.jpg", "longitude": -3.999882, "latitude": 43.439397, "width": 500, "height": 316, "upload_date": "20 December 2006", "owner_id": 38804, "owner_name": "www.oscarsanchez.net", "owner_url": "http://www.panoramio.com/user/38804"} + , + {"photo_id": 304677, "photo_title": "Allee bei Wilhelmsthal", "photo_url": "http://www.panoramio.com/photo/304677", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/304677.jpg", "longitude": 9.409919, "latitude": 51.392686, "width": 500, "height": 409, "upload_date": "05 January 2007", "owner_id": 63703, "owner_name": "Rainer Kaufhold", "owner_url": "http://www.panoramio.com/user/63703"} + , + {"photo_id": 4924213, "photo_title": "Egy varázslatos estén", "photo_url": "http://www.panoramio.com/photo/4924213", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4924213.jpg", "longitude": 2.151239, "latitude": 41.371278, "width": 500, "height": 335, "upload_date": "26 September 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 189243, "photo_title": "coming in for a landing", "photo_url": "http://www.panoramio.com/photo/189243", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/189243.jpg", "longitude": -123.147984, "latitude": 49.198812, "width": 500, "height": 333, "upload_date": "19 December 2006", "owner_id": 29932, "owner_name": "Rom@nce", "owner_url": "http://www.panoramio.com/user/29932"} + , + {"photo_id": 3121730, "photo_title": "Mers-les-Bains dark clouds looming", "photo_url": "http://www.panoramio.com/photo/3121730", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3121730.jpg", "longitude": 1.383655, "latitude": 50.066878, "width": 500, "height": 375, "upload_date": "04 July 2007", "owner_id": 633531, "owner_name": "ianwstokes", "owner_url": "http://www.panoramio.com/user/633531"} + , + {"photo_id": 5358146, "photo_title": "Lone Rock Rainbows", "photo_url": "http://www.panoramio.com/photo/5358146", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5358146.jpg", "longitude": -111.537795, "latitude": 37.020475, "width": 500, "height": 335, "upload_date": "16 October 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 9633346, "photo_title": "Altstadt von Spello--Winner Contest of April 2008 First Prize of Travel Category", "photo_url": "http://www.panoramio.com/photo/9633346", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9633346.jpg", "longitude": 12.672386, "latitude": 42.989236, "width": 347, "height": 500, "upload_date": "23 April 2008", "owner_id": 1400529, "owner_name": "marita1004", "owner_url": "http://www.panoramio.com/user/1400529"} + , + {"photo_id": 611425, "photo_title": "The Dome of Cologne", "photo_url": "http://www.panoramio.com/photo/611425", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/611425.jpg", "longitude": 6.968604, "latitude": 50.941157, "width": 500, "height": 357, "upload_date": "29 January 2007", "owner_id": 8058, "owner_name": "Ermanec", "owner_url": "http://www.panoramio.com/user/8058"} + , + {"photo_id": 6850661, "photo_title": "Në Fush të Pallaticës", "photo_url": "http://www.panoramio.com/photo/6850661", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6850661.jpg", "longitude": 21.075768, "latitude": 42.007915, "width": 488, "height": 500, "upload_date": "02 January 2008", "owner_id": 695042, "owner_name": "Neim Sejfuli ♦", "owner_url": "http://www.panoramio.com/user/695042"} + , + {"photo_id": 5617509, "photo_title": "Cölöp kiadó", "photo_url": "http://www.panoramio.com/photo/5617509", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5617509.jpg", "longitude": 12.333934, "latitude": 45.425368, "width": 500, "height": 334, "upload_date": "29 October 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 2083687, "photo_title": "Sunrise at Abu Simbel", "photo_url": "http://www.panoramio.com/photo/2083687", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2083687.jpg", "longitude": 31.630840, "latitude": 22.363729, "width": 500, "height": 335, "upload_date": "05 May 2007", "owner_id": 3316, "owner_name": "kristine hannon (www.traveltheglobe.be)", "owner_url": "http://www.panoramio.com/user/3316"} + , + {"photo_id": 7284083, "photo_title": "Japanese garden", "photo_url": "http://www.panoramio.com/photo/7284083", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7284083.jpg", "longitude": -13.673172, "latitude": 21.259301, "width": 335, "height": 500, "upload_date": "22 January 2008", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 5750152, "photo_title": "Earth, Moon and Sky", "photo_url": "http://www.panoramio.com/photo/5750152", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5750152.jpg", "longitude": -117.560234, "latitude": 36.678057, "width": 333, "height": 500, "upload_date": "06 November 2007", "owner_id": 376395, "owner_name": "JeffSullivan (www.MyPhotoGuides.com)", "owner_url": "http://www.panoramio.com/user/376395"} + , + {"photo_id": 5633673, "photo_title": "Ridgely Farm Lane", "photo_url": "http://www.panoramio.com/photo/5633673", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5633673.jpg", "longitude": -78.775320, "latitude": 38.031867, "width": 500, "height": 378, "upload_date": "30 October 2007", "owner_id": 523038, "owner_name": "Yank in Dixie", "owner_url": "http://www.panoramio.com/user/523038"} + , + {"photo_id": 723090, "photo_title": "Grand Canyon (Havasupai)", "photo_url": "http://www.panoramio.com/photo/723090", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/723090.jpg", "longitude": -112.716293, "latitude": 36.270989, "width": 500, "height": 332, "upload_date": "07 February 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 1226915, "photo_title": "Flamants roses sur l'Etang de Vaccarès", "photo_url": "http://www.panoramio.com/photo/1226915", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1226915.jpg", "longitude": 4.627304, "latitude": 43.551285, "width": 500, "height": 333, "upload_date": "08 March 2007", "owner_id": 78506, "owner_name": "Philippe Stoop", "owner_url": "http://www.panoramio.com/user/78506"} + , + {"photo_id": 2738883, "photo_title": "Tormenta", "photo_url": "http://www.panoramio.com/photo/2738883", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2738883.jpg", "longitude": -71.616096, "latitude": -33.042558, "width": 333, "height": 500, "upload_date": "14 June 2007", "owner_id": 477365, "owner_name": "✔chilefoto", "owner_url": "http://www.panoramio.com/user/477365"} + , + {"photo_id": 2875846, "photo_title": "Rannoch Moor, Scotland", "photo_url": "http://www.panoramio.com/photo/2875846", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2875846.jpg", "longitude": -4.745750, "latitude": 56.594467, "width": 500, "height": 462, "upload_date": "22 June 2007", "owner_id": 588149, "owner_name": "Adam Salwanowicz", "owner_url": "http://www.panoramio.com/user/588149"} + , + {"photo_id": 533456, "photo_title": "Zöld symphonia", "photo_url": "http://www.panoramio.com/photo/533456", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/533456.jpg", "longitude": 17.500362, "latitude": 47.843579, "width": 500, "height": 333, "upload_date": "22 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 3078609, "photo_title": "Pagan - Sunset Vista", "photo_url": "http://www.panoramio.com/photo/3078609", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3078609.jpg", "longitude": 94.884624, "latitude": 21.166644, "width": 500, "height": 329, "upload_date": "02 July 2007", "owner_id": 73104, "owner_name": "zerega", "owner_url": "http://www.panoramio.com/user/73104"} + , + {"photo_id": 1599459, "photo_title": "Rosina Lamberti - Templestowe Sunset", "photo_url": "http://www.panoramio.com/photo/1599459", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1599459.jpg", "longitude": 145.145187, "latitude": -37.773700, "width": 500, "height": 332, "upload_date": "02 April 2007", "owner_id": 140796, "owner_name": "rosina lamberti", "owner_url": "http://www.panoramio.com/user/140796"} + , + {"photo_id": 37097, "photo_title": "Burj Al Arab at Night", "photo_url": "http://www.panoramio.com/photo/37097", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/37097.jpg", "longitude": 55.190012, "latitude": 25.144411, "width": 333, "height": 500, "upload_date": "05 August 2006", "owner_id": 1295, "owner_name": "Matthew Walters", "owner_url": "http://www.panoramio.com/user/1295"} + , + {"photo_id": 42988, "photo_title": "Mekhong at Nakhon Phanom, Thailand", "photo_url": "http://www.panoramio.com/photo/42988", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/42988.jpg", "longitude": 104.780045, "latitude": 17.415348, "width": 500, "height": 375, "upload_date": "29 August 2006", "owner_id": 6386, "owner_name": "Uwe Werner", "owner_url": "http://www.panoramio.com/user/6386"} + , + {"photo_id": 4738551, "photo_title": "Aquakatedral", "photo_url": "http://www.panoramio.com/photo/4738551", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4738551.jpg", "longitude": 18.026505, "latitude": 47.279462, "width": 500, "height": 334, "upload_date": "18 September 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 6126327, "photo_title": "Autumnal Morning", "photo_url": "http://www.panoramio.com/photo/6126327", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6126327.jpg", "longitude": 0.209620, "latitude": 51.658827, "width": 500, "height": 500, "upload_date": "25 November 2007", "owner_id": 1130880, "owner_name": "marksimms", "owner_url": "http://www.panoramio.com/user/1130880"} + , + {"photo_id": 1390072, "photo_title": "Winter Wonder Woods", "photo_url": "http://www.panoramio.com/photo/1390072", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1390072.jpg", "longitude": -123.184891, "latitude": 49.400027, "width": 500, "height": 343, "upload_date": "19 March 2007", "owner_id": 164125, "owner_name": "DannyXu", "owner_url": "http://www.panoramio.com/user/164125"} + , + {"photo_id": 8600061, "photo_title": "Templio", "photo_url": "http://www.panoramio.com/photo/8600061", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8600061.jpg", "longitude": 13.600258, "latitude": 37.288703, "width": 500, "height": 375, "upload_date": "17 March 2008", "owner_id": 325031, "owner_name": "Gibrail", "owner_url": "http://www.panoramio.com/user/325031"} + , + {"photo_id": 1232144, "photo_title": "the Wave", "photo_url": "http://www.panoramio.com/photo/1232144", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1232144.jpg", "longitude": -112.006313, "latitude": 36.995921, "width": 497, "height": 500, "upload_date": "08 March 2007", "owner_id": 256348, "owner_name": "DIEZ Jean-Paul", "owner_url": "http://www.panoramio.com/user/256348"} + , + {"photo_id": 12825028, "photo_title": "American Star shipwreck", "photo_url": "http://www.panoramio.com/photo/12825028", "photo_file_url": "http://static1.bareka.com/photos/medium/12825028.jpg", "longitude": -14.178050, "latitude": 28.345596, "width": 500, "height": 375, "upload_date": "05 August 2008", "owner_id": 1465912, "owner_name": "funtor", "owner_url": "http://www.panoramio.com/user/1465912"} + , + {"photo_id": 9705164, "photo_title": "Die blaue Stunde-Dresden", "photo_url": "http://www.panoramio.com/photo/9705164", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9705164.jpg", "longitude": 13.732374, "latitude": 51.061020, "width": 500, "height": 333, "upload_date": "26 April 2008", "owner_id": 1465912, "owner_name": "funtor", "owner_url": "http://www.panoramio.com/user/1465912"} + , + {"photo_id": 9701147, "photo_title": "After the thunderstorm II (Calella de Palafrugell)", "photo_url": "http://www.panoramio.com/photo/9701147", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9701147.jpg", "longitude": 3.185166, "latitude": 41.888413, "width": 500, "height": 347, "upload_date": "26 April 2008", "owner_id": 629243, "owner_name": "Olivier Faugeras", "owner_url": "http://www.panoramio.com/user/629243"} + , + {"photo_id": 3414277, "photo_title": "Morning at Vlixos_Lefkada", "photo_url": "http://www.panoramio.com/photo/3414277", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3414277.jpg", "longitude": 20.698693, "latitude": 38.689111, "width": 500, "height": 333, "upload_date": "20 July 2007", "owner_id": 242446, "owner_name": "Ntinos Lagos", "owner_url": "http://www.panoramio.com/user/242446"} + , + {"photo_id": 1205806, "photo_title": "A tavasz aranya", "photo_url": "http://www.panoramio.com/photo/1205806", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1205806.jpg", "longitude": 17.634773, "latitude": 47.557299, "width": 500, "height": 302, "upload_date": "07 March 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 6430261, "photo_title": "The wet side of winter", "photo_url": "http://www.panoramio.com/photo/6430261", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6430261.jpg", "longitude": 9.531434, "latitude": 48.559611, "width": 500, "height": 375, "upload_date": "11 December 2007", "owner_id": 424589, "owner_name": "PeSchn", "owner_url": "http://www.panoramio.com/user/424589"} + , + {"photo_id": 8116025, "photo_title": "Sale el Sol, Cae la Luna", "photo_url": "http://www.panoramio.com/photo/8116025", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8116025.jpg", "longitude": -71.875992, "latitude": -41.170126, "width": 500, "height": 333, "upload_date": "26 February 2008", "owner_id": 4483, "owner_name": "Miguel Coranti", "owner_url": "http://www.panoramio.com/user/4483"} + , + {"photo_id": 1235514, "photo_title": "Pulau Menjangan", "photo_url": "http://www.panoramio.com/photo/1235514", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1235514.jpg", "longitude": 114.502687, "latitude": -8.095941, "width": 500, "height": 341, "upload_date": "09 March 2007", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 32827, "photo_title": "Xi'an Bell Tower", "photo_url": "http://www.panoramio.com/photo/32827", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/32827.jpg", "longitude": 108.943026, "latitude": 34.260759, "width": 500, "height": 375, "upload_date": "17 July 2006", "owner_id": 5168, "owner_name": "Markus Källander", "owner_url": "http://www.panoramio.com/user/5168"} + , + {"photo_id": 798014, "photo_title": "Porto Canale", "photo_url": "http://www.panoramio.com/photo/798014", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/798014.jpg", "longitude": 12.399648, "latitude": 44.203343, "width": 500, "height": 332, "upload_date": "12 February 2007", "owner_id": 159455, "owner_name": "©Franco Truscello", "owner_url": "http://www.panoramio.com/user/159455"} + , + {"photo_id": 10517317, "photo_title": "Route 66", "photo_url": "http://www.panoramio.com/photo/10517317", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10517317.jpg", "longitude": 18.027492, "latitude": 46.268071, "width": 500, "height": 375, "upload_date": "23 May 2008", "owner_id": 328249, "owner_name": "v.zsoloo", "owner_url": "http://www.panoramio.com/user/328249"} + , + {"photo_id": 416838, "photo_title": "Old Faithful on New Year's Morning", "photo_url": "http://www.panoramio.com/photo/416838", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/416838.jpg", "longitude": -110.827900, "latitude": 44.459354, "width": 500, "height": 375, "upload_date": "13 January 2007", "owner_id": 71099, "owner_name": "Eve in Montana", "owner_url": "http://www.panoramio.com/user/71099"} + , + {"photo_id": 5964, "photo_title": "Skradin bridge", "photo_url": "http://www.panoramio.com/photo/5964", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5964.jpg", "longitude": 15.908031, "latitude": 43.806040, "width": 500, "height": 333, "upload_date": "17 December 2005", "owner_id": 989, "owner_name": "Mrgud", "owner_url": "http://www.panoramio.com/user/989"} + , + {"photo_id": 419923, "photo_title": "bandaibashi2", "photo_url": "http://www.panoramio.com/photo/419923", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/419923.jpg", "longitude": 139.055500, "latitude": 37.920029, "width": 334, "height": 500, "upload_date": "14 January 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 26985, "photo_title": "Cementerio General", "photo_url": "http://www.panoramio.com/photo/26985", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/26985.jpg", "longitude": -84.091458, "latitude": 9.930174, "width": 393, "height": 500, "upload_date": "23 June 2006", "owner_id": 4112, "owner_name": "Roberto Garcia", "owner_url": "http://www.panoramio.com/user/4112"} + , + {"photo_id": 405866, "photo_title": "awasima", "photo_url": "http://www.panoramio.com/photo/405866", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/405866.jpg", "longitude": 139.229908, "latitude": 38.463267, "width": 396, "height": 500, "upload_date": "13 January 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 1319538, "photo_title": "What a place !", "photo_url": "http://www.panoramio.com/photo/1319538", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1319538.jpg", "longitude": -62.542677, "latitude": 6.022092, "width": 329, "height": 500, "upload_date": "14 March 2007", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 444280, "photo_title": "Cigars are for ladies", "photo_url": "http://www.panoramio.com/photo/444280", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/444280.jpg", "longitude": -82.351027, "latitude": 23.139117, "width": 500, "height": 375, "upload_date": "15 January 2007", "owner_id": 57893, "owner_name": "ThoiryK", "owner_url": "http://www.panoramio.com/user/57893"} + , + {"photo_id": 6016, "photo_title": "Šibenik - tiramol", "photo_url": "http://www.panoramio.com/photo/6016", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6016.jpg", "longitude": 15.890865, "latitude": 43.735693, "width": 473, "height": 500, "upload_date": "18 December 2005", "owner_id": 991, "owner_name": "Mario Marotti", "owner_url": "http://www.panoramio.com/user/991"} + , + {"photo_id": 3531661, "photo_title": "Zúzmara", "photo_url": "http://www.panoramio.com/photo/3531661", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3531661.jpg", "longitude": 17.498131, "latitude": 47.847727, "width": 500, "height": 346, "upload_date": "25 July 2007", "owner_id": 689769, "owner_name": "Ponty István", "owner_url": "http://www.panoramio.com/user/689769"} + , + {"photo_id": 723088, "photo_title": "Friendly Evening Haze", "photo_url": "http://www.panoramio.com/photo/723088", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/723088.jpg", "longitude": 25.428715, "latitude": 36.421282, "width": 333, "height": 500, "upload_date": "07 February 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 422813, "photo_title": "tanokami", "photo_url": "http://www.panoramio.com/photo/422813", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/422813.jpg", "longitude": 138.777237, "latitude": 37.581453, "width": 500, "height": 379, "upload_date": "14 January 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 516256, "photo_title": "A hitehagyott", "photo_url": "http://www.panoramio.com/photo/516256", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/516256.jpg", "longitude": 17.533493, "latitude": 47.842139, "width": 500, "height": 291, "upload_date": "21 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 706978, "photo_title": "Snow at full moon", "photo_url": "http://www.panoramio.com/photo/706978", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/706978.jpg", "longitude": 23.878784, "latitude": 69.829207, "width": 500, "height": 334, "upload_date": "05 February 2007", "owner_id": 56091, "owner_name": "Kjetil Vaage Øie", "owner_url": "http://www.panoramio.com/user/56091"} + , + {"photo_id": 4994983, "photo_title": "Camogli - Castello della \"Dragonara\" (north-west looking photograph)", "photo_url": "http://www.panoramio.com/photo/4994983", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4994983.jpg", "longitude": 9.151220, "latitude": 44.350207, "width": 325, "height": 500, "upload_date": "30 September 2007", "owner_id": 180947, "owner_name": "gilberto silvestri", "owner_url": "http://www.panoramio.com/user/180947"} + , + {"photo_id": 1315255, "photo_title": "Tulpen in Holland", "photo_url": "http://www.panoramio.com/photo/1315255", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1315255.jpg", "longitude": 4.556494, "latitude": 52.278451, "width": 500, "height": 321, "upload_date": "14 March 2007", "owner_id": 193467, "owner_name": "Jörg Behmann", "owner_url": "http://www.panoramio.com/user/193467"} + , + {"photo_id": 5204412, "photo_title": "Alaska Range", "photo_url": "http://www.panoramio.com/photo/5204412", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5204412.jpg", "longitude": -150.150146, "latitude": 62.734601, "width": 500, "height": 375, "upload_date": "09 October 2007", "owner_id": 71099, "owner_name": "Eve in Montana", "owner_url": "http://www.panoramio.com/user/71099"} + , + {"photo_id": 5204668, "photo_title": "Scotland", "photo_url": "http://www.panoramio.com/photo/5204668", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5204668.jpg", "longitude": -4.821882, "latitude": 56.634188, "width": 500, "height": 500, "upload_date": "09 October 2007", "owner_id": 588149, "owner_name": "Adam Salwanowicz", "owner_url": "http://www.panoramio.com/user/588149"} + , + {"photo_id": 1706188, "photo_title": "Night", "photo_url": "http://www.panoramio.com/photo/1706188", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1706188.jpg", "longitude": 21.440957, "latitude": 48.427236, "width": 390, "height": 500, "upload_date": "09 April 2007", "owner_id": 346103, "owner_name": "lacitot", "owner_url": "http://www.panoramio.com/user/346103"} + , + {"photo_id": 6366165, "photo_title": "Il Latemar", "photo_url": "http://www.panoramio.com/photo/6366165", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6366165.jpg", "longitude": 11.575856, "latitude": 46.410138, "width": 500, "height": 375, "upload_date": "08 December 2007", "owner_id": 933456, "owner_name": "© Marco De Candido", "owner_url": "http://www.panoramio.com/user/933456"} + , + {"photo_id": 5433048, "photo_title": "moon photoshop", "photo_url": "http://www.panoramio.com/photo/5433048", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5433048.jpg", "longitude": 11.337848, "latitude": 46.460602, "width": 500, "height": 335, "upload_date": "20 October 2007", "owner_id": 578163, "owner_name": "Margherita-Italy", "owner_url": "http://www.panoramio.com/user/578163"} + , + {"photo_id": 611035, "photo_title": "Ice berg", "photo_url": "http://www.panoramio.com/photo/611035", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/611035.jpg", "longitude": -58.886719, "latitude": -63.470145, "width": 333, "height": 500, "upload_date": "29 January 2007", "owner_id": 14940, "owner_name": "elmtree", "owner_url": "http://www.panoramio.com/user/14940"} + , + {"photo_id": 4258269, "photo_title": "Új nap kelte", "photo_url": "http://www.panoramio.com/photo/4258269", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4258269.jpg", "longitude": 17.474785, "latitude": 47.832057, "width": 500, "height": 327, "upload_date": "28 August 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 37088, "photo_title": "Komandoo From The Air", "photo_url": "http://www.panoramio.com/photo/37088", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/37088.jpg", "longitude": 73.422661, "latitude": 5.496900, "width": 500, "height": 278, "upload_date": "05 August 2006", "owner_id": 1295, "owner_name": "Matthew Walters", "owner_url": "http://www.panoramio.com/user/1295"} + , + {"photo_id": 71667, "photo_title": "2006년06월11일(일) 장전계곡 및 단임골 046_resize", "photo_url": "http://www.panoramio.com/photo/71667", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/71667.jpg", "longitude": 128.533516, "latitude": 37.435340, "width": 500, "height": 333, "upload_date": "28 October 2006", "owner_id": 9424, "owner_name": "박범호", "owner_url": "http://www.panoramio.com/user/9424"} + , + {"photo_id": 5300468, "photo_title": "Lac du Vieux Emosson", "photo_url": "http://www.panoramio.com/photo/5300468", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5300468.jpg", "longitude": 6.883256, "latitude": 46.055744, "width": 500, "height": 500, "upload_date": "14 October 2007", "owner_id": 588149, "owner_name": "Adam Salwanowicz", "owner_url": "http://www.panoramio.com/user/588149"} + , + {"photo_id": 591351, "photo_title": "smokestack_8739", "photo_url": "http://www.panoramio.com/photo/591351", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/591351.jpg", "longitude": -79.386027, "latitude": 43.648168, "width": 500, "height": 392, "upload_date": "27 January 2007", "owner_id": 17488, "owner_name": "John Gillett", "owner_url": "http://www.panoramio.com/user/17488"} + , + {"photo_id": 11224316, "photo_title": "Remindful winter season-Vardar river", "photo_url": "http://www.panoramio.com/photo/11224316", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/11224316.jpg", "longitude": 21.084051, "latitude": 42.013782, "width": 214, "height": 500, "upload_date": "15 June 2008", "owner_id": 695042, "owner_name": "Neim Sejfuli ♦", "owner_url": "http://www.panoramio.com/user/695042"} + , + {"photo_id": 5968187, "photo_title": "2007 VITORIA Alava PIXELECTA", "photo_url": "http://www.panoramio.com/photo/5968187", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5968187.jpg", "longitude": -2.650087, "latitude": 42.860206, "width": 500, "height": 333, "upload_date": "17 November 2007", "owner_id": 163655, "owner_name": "[[[ PIXELECTA ]]]", "owner_url": "http://www.panoramio.com/user/163655"} + , + {"photo_id": 1781517, "photo_title": "Yosemite Falls in Winter", "photo_url": "http://www.panoramio.com/photo/1781517", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1781517.jpg", "longitude": -119.590130, "latitude": 37.744318, "width": 500, "height": 400, "upload_date": "15 April 2007", "owner_id": 376395, "owner_name": "JeffSullivan (www.MyPhotoGuides.com)", "owner_url": "http://www.panoramio.com/user/376395"} + , + {"photo_id": 5796376, "photo_title": "Shuto Expressway Loop Line in Nihombashi", "photo_url": "http://www.panoramio.com/photo/5796376", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5796376.jpg", "longitude": 139.776344, "latitude": 35.684536, "width": 327, "height": 500, "upload_date": "08 November 2007", "owner_id": 558055, "owner_name": "www.tokyoform.com", "owner_url": "http://www.panoramio.com/user/558055"} + , + {"photo_id": 5523741, "photo_title": "Saskatchewan Sunset October 24/07 (and there is the flat land of the prairies at the bottom of this pic ;)", "photo_url": "http://www.panoramio.com/photo/5523741", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5523741.jpg", "longitude": -105.535011, "latitude": 50.502073, "width": 375, "height": 500, "upload_date": "24 October 2007", "owner_id": 133037, "owner_name": "Lilypon", "owner_url": "http://www.panoramio.com/user/133037"} + , + {"photo_id": 196125, "photo_title": "arnía y covachos", "photo_url": "http://www.panoramio.com/photo/196125", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/196125.jpg", "longitude": -3.914223, "latitude": 43.474349, "width": 500, "height": 337, "upload_date": "20 December 2006", "owner_id": 38804, "owner_name": "www.oscarsanchez.net", "owner_url": "http://www.panoramio.com/user/38804"} + , + {"photo_id": 349726, "photo_title": "thailand ko-samui sunset", "photo_url": "http://www.panoramio.com/photo/349726", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/349726.jpg", "longitude": 99.930954, "latitude": 9.472344, "width": 500, "height": 334, "upload_date": "08 January 2007", "owner_id": 69671, "owner_name": "illusandpics.com", "owner_url": "http://www.panoramio.com/user/69671"} + , + {"photo_id": 280106, "photo_title": "dune01", "photo_url": "http://www.panoramio.com/photo/280106", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/280106.jpg", "longitude": -5.089073, "latitude": 30.229408, "width": 500, "height": 345, "upload_date": "01 January 2007", "owner_id": 58867, "owner_name": "Lachaud Franck", "owner_url": "http://www.panoramio.com/user/58867"} + , + {"photo_id": 4446015, "photo_title": "Mennyei fényjáték", "photo_url": "http://www.panoramio.com/photo/4446015", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4446015.jpg", "longitude": 17.818108, "latitude": 47.525084, "width": 500, "height": 333, "upload_date": "06 September 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 4644180, "photo_title": "Bridalveil Falls from Valley View", "photo_url": "http://www.panoramio.com/photo/4644180", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4644180.jpg", "longitude": -119.661723, "latitude": 37.717419, "width": 500, "height": 357, "upload_date": "14 September 2007", "owner_id": 376395, "owner_name": "JeffSullivan (www.MyPhotoGuides.com)", "owner_url": "http://www.panoramio.com/user/376395"} + , + {"photo_id": 457302, "photo_title": "Matterhorn Zermatt", "photo_url": "http://www.panoramio.com/photo/457302", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/457302.jpg", "longitude": 7.746391, "latitude": 46.016992, "width": 500, "height": 375, "upload_date": "16 January 2007", "owner_id": 47930, "owner_name": "werni", "owner_url": "http://www.panoramio.com/user/47930"} + , + {"photo_id": 4258138, "photo_title": "Szentkút", "photo_url": "http://www.panoramio.com/photo/4258138", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4258138.jpg", "longitude": 17.731848, "latitude": 47.243755, "width": 500, "height": 334, "upload_date": "28 August 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 26986, "photo_title": "Cementerio General", "photo_url": "http://www.panoramio.com/photo/26986", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/26986.jpg", "longitude": -84.091158, "latitude": 9.930047, "width": 500, "height": 373, "upload_date": "23 June 2006", "owner_id": 4112, "owner_name": "Roberto Garcia", "owner_url": "http://www.panoramio.com/user/4112"} + , + {"photo_id": 1269869, "photo_title": "Barents Sea at night, Finnmark, Norway", "photo_url": "http://www.panoramio.com/photo/1269869", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1269869.jpg", "longitude": 30.868149, "latitude": 70.438638, "width": 500, "height": 324, "upload_date": "11 March 2007", "owner_id": 66734, "owner_name": "Svein Solhaug", "owner_url": "http://www.panoramio.com/user/66734"} + , + {"photo_id": 515971, "photo_title": "A hosszútávfutó magányossága", "photo_url": "http://www.panoramio.com/photo/515971", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/515971.jpg", "longitude": 17.870121, "latitude": 47.373012, "width": 500, "height": 276, "upload_date": "21 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 36486, "photo_title": "Sunrise on Trondheimsfjord", "photo_url": "http://www.panoramio.com/photo/36486", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/36486.jpg", "longitude": 10.333843, "latitude": 63.456186, "width": 500, "height": 332, "upload_date": "02 August 2006", "owner_id": 5703, "owner_name": "dancer", "owner_url": "http://www.panoramio.com/user/5703"} + , + {"photo_id": 4950702, "photo_title": "Abandoned Gas Stand, Hachimantai, Iwate, Japan", "photo_url": "http://www.panoramio.com/photo/4950702", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4950702.jpg", "longitude": 141.062308, "latitude": 39.955547, "width": 500, "height": 335, "upload_date": "28 September 2007", "owner_id": 699984, "owner_name": "Fried Toast", "owner_url": "http://www.panoramio.com/user/699984"} + , + {"photo_id": 2345653, "photo_title": "planet mars", "photo_url": "http://www.panoramio.com/photo/2345653", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2345653.jpg", "longitude": 33.631908, "latitude": 27.380118, "width": 500, "height": 322, "upload_date": "22 May 2007", "owner_id": 223374, "owner_name": "voutsen", "owner_url": "http://www.panoramio.com/user/223374"} + , + {"photo_id": 4612307, "photo_title": "Sitges - Spinaker", "photo_url": "http://www.panoramio.com/photo/4612307", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4612307.jpg", "longitude": 1.859436, "latitude": 41.211722, "width": 500, "height": 371, "upload_date": "13 September 2007", "owner_id": 138691, "owner_name": "Josep Maria Alegre", "owner_url": "http://www.panoramio.com/user/138691"} + , + {"photo_id": 4644311, "photo_title": "Through the Looking Glass", "photo_url": "http://www.panoramio.com/photo/4644311", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4644311.jpg", "longitude": -119.649745, "latitude": 37.722019, "width": 333, "height": 500, "upload_date": "14 September 2007", "owner_id": 376395, "owner_name": "JeffSullivan (www.MyPhotoGuides.com)", "owner_url": "http://www.panoramio.com/user/376395"} + , + {"photo_id": 1480664, "photo_title": "Királyi szurkolótábor", "photo_url": "http://www.panoramio.com/photo/1480664", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1480664.jpg", "longitude": 17.300034, "latitude": 47.190646, "width": 500, "height": 269, "upload_date": "24 March 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 8492774, "photo_title": "Lago Fedaia in estate Panoramio and ATP first CONTEST, March 2008, category Scenery : awarded \" Honorable Mention\". Many thanks to all voters", "photo_url": "http://www.panoramio.com/photo/8492774", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8492774.jpg", "longitude": 11.867519, "latitude": 46.463128, "width": 500, "height": 375, "upload_date": "12 March 2008", "owner_id": 6033, "owner_name": "► Marco Vanzo", "owner_url": "http://www.panoramio.com/user/6033"} + , + {"photo_id": 57835, "photo_title": "Seewaldsee 2 - St.Koloman", "photo_url": "http://www.panoramio.com/photo/57835", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/57835.jpg", "longitude": 13.274918, "latitude": 47.630115, "width": 500, "height": 333, "upload_date": "05 October 2006", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 57837, "photo_title": "Der Hraunfossar an einem kalten Wintertag .....(MS)", "photo_url": "http://www.panoramio.com/photo/57837", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/57837.jpg", "longitude": -20.939941, "latitude": 64.698078, "width": 500, "height": 264, "upload_date": "05 October 2006", "owner_id": 7434, "owner_name": "baldinger reisen ag, waedenswil/switzerland", "owner_url": "http://www.panoramio.com/user/7434"} + , + {"photo_id": 70641, "photo_title": "Lake Nakuru (Kenya)", "photo_url": "http://www.panoramio.com/photo/70641", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/70641.jpg", "longitude": 36.114979, "latitude": -0.324782, "width": 500, "height": 333, "upload_date": "25 October 2006", "owner_id": 8975, "owner_name": "Laura Sayalero", "owner_url": "http://www.panoramio.com/user/8975"} + , + {"photo_id": 766205, "photo_title": "posta sol porto colom", "photo_url": "http://www.panoramio.com/photo/766205", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/766205.jpg", "longitude": 3.264495, "latitude": 39.425093, "width": 500, "height": 335, "upload_date": "10 February 2007", "owner_id": 134682, "owner_name": "------ Cafate ------", "owner_url": "http://www.panoramio.com/user/134682"} + , + {"photo_id": 10662910, "photo_title": "Megvilágosodván", "photo_url": "http://www.panoramio.com/photo/10662910", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10662910.jpg", "longitude": 17.718544, "latitude": 47.460130, "width": 500, "height": 334, "upload_date": "27 May 2008", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 8703547, "photo_title": "Lonely bike-rider", "photo_url": "http://www.panoramio.com/photo/8703547", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8703547.jpg", "longitude": 6.039004, "latitude": 52.208974, "width": 500, "height": 467, "upload_date": "21 March 2008", "owner_id": 523564, "owner_name": "Luud Riphagen", "owner_url": "http://www.panoramio.com/user/523564"} + , + {"photo_id": 11669907, "photo_title": "Alba sulle pale di San Martino", "photo_url": "http://www.panoramio.com/photo/11669907", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/11669907.jpg", "longitude": 11.568518, "latitude": 46.345269, "width": 500, "height": 361, "upload_date": "30 June 2008", "owner_id": 6033, "owner_name": "► Marco Vanzo", "owner_url": "http://www.panoramio.com/user/6033"} + , + {"photo_id": 11403916, "photo_title": "Lonely", "photo_url": "http://www.panoramio.com/photo/11403916", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/11403916.jpg", "longitude": 18.164520, "latitude": 46.345269, "width": 500, "height": 375, "upload_date": "21 June 2008", "owner_id": 328249, "owner_name": "v.zsoloo", "owner_url": "http://www.panoramio.com/user/328249"} + , + {"photo_id": 289803, "photo_title": "Rain Clouds", "photo_url": "http://www.panoramio.com/photo/289803", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/289803.jpg", "longitude": -57.733154, "latitude": -51.661908, "width": 500, "height": 335, "upload_date": "03 January 2007", "owner_id": 61890, "owner_name": "enriquevidalphoto.com", "owner_url": "http://www.panoramio.com/user/61890"} + , + {"photo_id": 123413, "photo_title": "Paisaje cromático de Landmanalaugar", "photo_url": "http://www.panoramio.com/photo/123413", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/123413.jpg", "longitude": -19.085140, "latitude": 63.918285, "width": 500, "height": 332, "upload_date": "12 December 2006", "owner_id": 20549, "owner_name": "oscarvg", "owner_url": "http://www.panoramio.com/user/20549"} + , + {"photo_id": 595734, "photo_title": "Sphinx profile", "photo_url": "http://www.panoramio.com/photo/595734", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/595734.jpg", "longitude": 31.137791, "latitude": 29.975034, "width": 500, "height": 330, "upload_date": "27 January 2007", "owner_id": 124418, "owner_name": "Pierre-Jean Durieu", "owner_url": "http://www.panoramio.com/user/124418"} + , + {"photo_id": 3282726, "photo_title": "Shanghai - Inside the Jinmao Tower", "photo_url": "http://www.panoramio.com/photo/3282726", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3282726.jpg", "longitude": 121.501153, "latitude": 31.237519, "width": 500, "height": 335, "upload_date": "13 July 2007", "owner_id": 578163, "owner_name": "Margherita-Italy", "owner_url": "http://www.panoramio.com/user/578163"} + , + {"photo_id": 1346342, "photo_title": "nemrut", "photo_url": "http://www.panoramio.com/photo/1346342", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1346342.jpg", "longitude": 38.761826, "latitude": 38.042413, "width": 340, "height": 500, "upload_date": "16 March 2007", "owner_id": 2659, "owner_name": "ozalph", "owner_url": "http://www.panoramio.com/user/2659"} + , + {"photo_id": 151849, "photo_title": "panoramas photo @ the cross at Xin-Yi and Kee-Lung road ( my 2nd try )", "photo_url": "http://www.panoramio.com/photo/151849", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/151849.jpg", "longitude": 121.559209, "latitude": 25.033073, "width": 500, "height": 348, "upload_date": "15 December 2006", "owner_id": 27791, "owner_name": "Jerome Chen", "owner_url": "http://www.panoramio.com/user/27791"} + , + {"photo_id": 1212973, "photo_title": "Perhaps Neruda's View", "photo_url": "http://www.panoramio.com/photo/1212973", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1212973.jpg", "longitude": 14.398935, "latitude": 50.084752, "width": 500, "height": 333, "upload_date": "07 March 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 809789, "photo_title": "Pihike", "photo_url": "http://www.panoramio.com/photo/809789", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/809789.jpg", "longitude": 17.457018, "latitude": 47.881010, "width": 500, "height": 387, "upload_date": "13 February 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 88150, "photo_title": "Marmore Falls - Umbria - Italy", "photo_url": "http://www.panoramio.com/photo/88150", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/88150.jpg", "longitude": 12.716667, "latitude": 42.550000, "width": 375, "height": 500, "upload_date": "28 November 2006", "owner_id": 11098, "owner_name": "Michele Masnata", "owner_url": "http://www.panoramio.com/user/11098"} + , + {"photo_id": 624990, "photo_title": "Mélyrepülés", "photo_url": "http://www.panoramio.com/photo/624990", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/624990.jpg", "longitude": 17.455988, "latitude": 47.881931, "width": 500, "height": 288, "upload_date": "30 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 612449, "photo_title": "Rio de Janeiro - Vista do Corcovado ©G.Schüür", "photo_url": "http://www.panoramio.com/photo/612449", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/612449.jpg", "longitude": -43.210323, "latitude": -22.951463, "width": 500, "height": 400, "upload_date": "29 January 2007", "owner_id": 120756, "owner_name": "Germano Schüür", "owner_url": "http://www.panoramio.com/user/120756"} + , + {"photo_id": 1545313, "photo_title": "Tempestade", "photo_url": "http://www.panoramio.com/photo/1545313", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1545313.jpg", "longitude": -48.678703, "latitude": -26.643470, "width": 500, "height": 341, "upload_date": "29 March 2007", "owner_id": 160342, "owner_name": "Jakson Santos", "owner_url": "http://www.panoramio.com/user/160342"} + , + {"photo_id": 1595492, "photo_title": "Explosión Rosa", "photo_url": "http://www.panoramio.com/photo/1595492", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1595492.jpg", "longitude": -73.250393, "latitude": -39.813481, "width": 500, "height": 375, "upload_date": "02 April 2007", "owner_id": 327310, "owner_name": "Erwin Woenckhaus", "owner_url": "http://www.panoramio.com/user/327310"} + , + {"photo_id": 5501284, "photo_title": "Da qui passano i sogni...", "photo_url": "http://www.panoramio.com/photo/5501284", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5501284.jpg", "longitude": 12.335930, "latitude": 45.435563, "width": 375, "height": 500, "upload_date": "23 October 2007", "owner_id": 325031, "owner_name": "Gibrail", "owner_url": "http://www.panoramio.com/user/325031"} + , + {"photo_id": 444265, "photo_title": "Cafe, Calle and Capitol of Cuba", "photo_url": "http://www.panoramio.com/photo/444265", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/444265.jpg", "longitude": -82.350453, "latitude": 23.136354, "width": 500, "height": 375, "upload_date": "15 January 2007", "owner_id": 57893, "owner_name": "ThoiryK", "owner_url": "http://www.panoramio.com/user/57893"} + , + {"photo_id": 9590, "photo_title": "South Street Seaport and Financial Center Skyline [007783]", "photo_url": "http://www.panoramio.com/photo/9590", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9590.jpg", "longitude": -74.001760, "latitude": 40.704937, "width": 500, "height": 375, "upload_date": "04 February 2006", "owner_id": 1489, "owner_name": "Thorsten", "owner_url": "http://www.panoramio.com/user/1489"} + , + {"photo_id": 204153, "photo_title": "Stormheimfjell and Hamperokken mountains near Brevikeidet ", "photo_url": "http://www.panoramio.com/photo/204153", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/204153.jpg", "longitude": 19.650421, "latitude": 69.668899, "width": 500, "height": 375, "upload_date": "21 December 2006", "owner_id": 39160, "owner_name": "Snemann", "owner_url": "http://www.panoramio.com/user/39160"} + , + {"photo_id": 916095, "photo_title": "Before daybreak on Mount Etna (as seen from Piano Provenzana)", "photo_url": "http://www.panoramio.com/photo/916095", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/916095.jpg", "longitude": 15.038610, "latitude": 37.793881, "width": 500, "height": 375, "upload_date": "20 February 2007", "owner_id": 67714, "owner_name": "Robert Gulyas", "owner_url": "http://www.panoramio.com/user/67714"} + , + {"photo_id": 680320, "photo_title": "A severe storm approaches Nyngan, NSW www.ozthunder.com", "photo_url": "http://www.panoramio.com/photo/680320", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/680320.jpg", "longitude": 147.154312, "latitude": -31.563910, "width": 500, "height": 378, "upload_date": "04 February 2007", "owner_id": 67208, "owner_name": "Michael Thompson", "owner_url": "http://www.panoramio.com/user/67208"} + , + {"photo_id": 6018, "photo_title": "Jadrija - barke", "photo_url": "http://www.panoramio.com/photo/6018", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6018.jpg", "longitude": 15.841599, "latitude": 43.725026, "width": 500, "height": 176, "upload_date": "18 December 2005", "owner_id": 991, "owner_name": "Mario Marotti", "owner_url": "http://www.panoramio.com/user/991"} + , + {"photo_id": 36485, "photo_title": "Great Belt Bridge", "photo_url": "http://www.panoramio.com/photo/36485", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/36485.jpg", "longitude": 11.029501, "latitude": 55.342130, "width": 500, "height": 332, "upload_date": "02 August 2006", "owner_id": 5703, "owner_name": "dancer", "owner_url": "http://www.panoramio.com/user/5703"} + , + {"photo_id": 19098, "photo_title": "Jökulsárlón", "photo_url": "http://www.panoramio.com/photo/19098", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/19098.jpg", "longitude": -16.355896, "latitude": 64.037351, "width": 500, "height": 333, "upload_date": "02 May 2006", "owner_id": 2885, "owner_name": "Luis Rodríguez Baena", "owner_url": "http://www.panoramio.com/user/2885"} + , + {"photo_id": 55458, "photo_title": "034 Troianisches Pferd", "photo_url": "http://www.panoramio.com/photo/55458", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/55458.jpg", "longitude": 26.240464, "latitude": 39.957188, "width": 375, "height": 500, "upload_date": "01 October 2006", "owner_id": 7633, "owner_name": "Daniel Meyer", "owner_url": "http://www.panoramio.com/user/7633"} + , + {"photo_id": 1800357, "photo_title": "Beach & Evening Light - Garrapata State Park Big Sur, CA", "photo_url": "http://www.panoramio.com/photo/1800357", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1800357.jpg", "longitude": -121.925915, "latitude": 36.455437, "width": 500, "height": 345, "upload_date": "16 April 2007", "owner_id": 107613, "owner_name": "Tom Grubbe", "owner_url": "http://www.panoramio.com/user/107613"} + , + {"photo_id": 1447086, "photo_title": "Odyssey", "photo_url": "http://www.panoramio.com/photo/1447086", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1447086.jpg", "longitude": 15.923395, "latitude": 43.589530, "width": 500, "height": 323, "upload_date": "22 March 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 10378421, "photo_title": "Red Bus", "photo_url": "http://www.panoramio.com/photo/10378421", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10378421.jpg", "longitude": -0.124497, "latitude": 51.500809, "width": 414, "height": 500, "upload_date": "19 May 2008", "owner_id": 325031, "owner_name": "Gibrail", "owner_url": "http://www.panoramio.com/user/325031"} + , + {"photo_id": 1087672, "photo_title": "És azután menydörgést hallottunk...", "photo_url": "http://www.panoramio.com/photo/1087672", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1087672.jpg", "longitude": 15.917473, "latitude": 43.590836, "width": 500, "height": 299, "upload_date": "28 February 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 74950, "photo_title": "高千穂", "photo_url": "http://www.panoramio.com/photo/74950", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/74950.jpg", "longitude": 131.019516, "latitude": 32.320504, "width": 500, "height": 375, "upload_date": "03 November 2006", "owner_id": 9556, "owner_name": "shigesato", "owner_url": "http://www.panoramio.com/user/9556"} + , + {"photo_id": 1749978, "photo_title": "Campos de Criptana", "photo_url": "http://www.panoramio.com/photo/1749978", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1749978.jpg", "longitude": -3.123207, "latitude": 39.409805, "width": 500, "height": 334, "upload_date": "12 April 2007", "owner_id": 10969, "owner_name": "Juanra", "owner_url": "http://www.panoramio.com/user/10969"} + , + {"photo_id": 94171, "photo_title": "Matsumoto Castle", "photo_url": "http://www.panoramio.com/photo/94171", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/94171.jpg", "longitude": 137.967778, "latitude": 36.239194, "width": 408, "height": 500, "upload_date": "09 December 2006", "owner_id": 11781, "owner_name": "ANDRE GARDELLA", "owner_url": "http://www.panoramio.com/user/11781"} + , + {"photo_id": 2053084, "photo_title": "Blue lagoon, Melchior islands", "photo_url": "http://www.panoramio.com/photo/2053084", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2053084.jpg", "longitude": -62.830811, "latitude": -64.415921, "width": 500, "height": 336, "upload_date": "03 May 2007", "owner_id": 3316, "owner_name": "kristine hannon (www.traveltheglobe.be)", "owner_url": "http://www.panoramio.com/user/3316"} + , + {"photo_id": 86244, "photo_title": "Palmeras", "photo_url": "http://www.panoramio.com/photo/86244", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/86244.jpg", "longitude": -1.116829, "latitude": 37.930930, "width": 333, "height": 500, "upload_date": "25 November 2006", "owner_id": 10969, "owner_name": "Juanra", "owner_url": "http://www.panoramio.com/user/10969"} + , + {"photo_id": 629489, "photo_title": "Hare in winter fur...beast of the Cave of Caerbannog.", "photo_url": "http://www.panoramio.com/photo/629489", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/629489.jpg", "longitude": -105.645390, "latitude": 40.296593, "width": 500, "height": 376, "upload_date": "31 January 2007", "owner_id": 87752, "owner_name": "Richard Ryer", "owner_url": "http://www.panoramio.com/user/87752"} + , + {"photo_id": 8459506, "photo_title": "Baltic sunrise in Kiel", "photo_url": "http://www.panoramio.com/photo/8459506", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8459506.jpg", "longitude": 10.169671, "latitude": 54.430970, "width": 500, "height": 375, "upload_date": "11 March 2008", "owner_id": 73946, "owner_name": "pembo", "owner_url": "http://www.panoramio.com/user/73946"} + , + {"photo_id": 36599, "photo_title": "ц Зачатия Анны на Углу", "photo_url": "http://www.panoramio.com/photo/36599", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/36599.jpg", "longitude": 37.630963, "latitude": 55.750159, "width": 500, "height": 375, "upload_date": "03 August 2006", "owner_id": 5641, "owner_name": "sergey duhanin", "owner_url": "http://www.panoramio.com/user/5641"} + , + {"photo_id": 62716, "photo_title": "Amanecer en la Sauceda", "photo_url": "http://www.panoramio.com/photo/62716", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/62716.jpg", "longitude": -5.591730, "latitude": 36.521630, "width": 500, "height": 330, "upload_date": "15 October 2006", "owner_id": 473, "owner_name": "Juanlu", "owner_url": "http://www.panoramio.com/user/473"} + , + {"photo_id": 4709631, "photo_title": "The sun sets in the East....", "photo_url": "http://www.panoramio.com/photo/4709631", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4709631.jpg", "longitude": -112.624583, "latitude": 45.211038, "width": 500, "height": 375, "upload_date": "17 September 2007", "owner_id": 71099, "owner_name": "Eve in Montana", "owner_url": "http://www.panoramio.com/user/71099"} + , + {"photo_id": 11408203, "photo_title": "05-08-31_Paramo de MASA_PIXELECTA", "photo_url": "http://www.panoramio.com/photo/11408203", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/11408203.jpg", "longitude": -3.536568, "latitude": 42.669357, "width": 500, "height": 375, "upload_date": "21 June 2008", "owner_id": 163655, "owner_name": "[[[ PIXELECTA ]]]", "owner_url": "http://www.panoramio.com/user/163655"} + , + {"photo_id": 416263, "photo_title": "Mt. Meeker at Dawn", "photo_url": "http://www.panoramio.com/photo/416263", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/416263.jpg", "longitude": -105.579643, "latitude": 40.270472, "width": 500, "height": 374, "upload_date": "13 January 2007", "owner_id": 87752, "owner_name": "Richard Ryer", "owner_url": "http://www.panoramio.com/user/87752"} + , + {"photo_id": 1289233, "photo_title": " High Dades", "photo_url": "http://www.panoramio.com/photo/1289233", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1289233.jpg", "longitude": -5.838375, "latitude": 31.652066, "width": 500, "height": 329, "upload_date": "12 March 2007", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 1567767, "photo_title": "Rosina Lamberti - Sunset Templestowe, 31 March 2007", "photo_url": "http://www.panoramio.com/photo/1567767", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1567767.jpg", "longitude": 145.133858, "latitude": -37.765015, "width": 500, "height": 237, "upload_date": "31 March 2007", "owner_id": 140796, "owner_name": "rosina lamberti", "owner_url": "http://www.panoramio.com/user/140796"} + , + {"photo_id": 4130842, "photo_title": "Árvore Solar", "photo_url": "http://www.panoramio.com/photo/4130842", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4130842.jpg", "longitude": -51.830320, "latitude": -22.939424, "width": 427, "height": 500, "upload_date": "23 August 2007", "owner_id": 465654, "owner_name": "Carlos Sica", "owner_url": "http://www.panoramio.com/user/465654"} + , + {"photo_id": 340508, "photo_title": "Sunset from Camelback Mountain Echo Trail", "photo_url": "http://www.panoramio.com/photo/340508", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/340508.jpg", "longitude": -111.969969, "latitude": 33.520820, "width": 333, "height": 500, "upload_date": "08 January 2007", "owner_id": 45308, "owner_name": "Mike Cavaroc", "owner_url": "http://www.panoramio.com/user/45308"} + , + {"photo_id": 74792, "photo_title": "annapurna south", "photo_url": "http://www.panoramio.com/photo/74792", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/74792.jpg", "longitude": 83.804398, "latitude": 28.524813, "width": 500, "height": 334, "upload_date": "03 November 2006", "owner_id": 9812, "owner_name": "wsm earp", "owner_url": "http://www.panoramio.com/user/9812"} + , + {"photo_id": 4445995, "photo_title": "Ködvarázs", "photo_url": "http://www.panoramio.com/photo/4445995", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4445995.jpg", "longitude": 18.053970, "latitude": 47.276783, "width": 500, "height": 334, "upload_date": "06 September 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 3032620, "photo_title": "Mira sin bueyes", "photo_url": "http://www.panoramio.com/photo/3032620", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3032620.jpg", "longitude": -8.802710, "latitude": 40.459324, "width": 500, "height": 327, "upload_date": "30 June 2007", "owner_id": 129297, "owner_name": "Enrique Ortiz de Zárate", "owner_url": "http://www.panoramio.com/user/129297"} + , + {"photo_id": 415533, "photo_title": "Manila Sunset", "photo_url": "http://www.panoramio.com/photo/415533", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/415533.jpg", "longitude": 120.984208, "latitude": 14.572339, "width": 333, "height": 500, "upload_date": "13 January 2007", "owner_id": 20398, "owner_name": "boerx", "owner_url": "http://www.panoramio.com/user/20398"} + , + {"photo_id": 723004, "photo_title": "Bouncing Light", "photo_url": "http://www.panoramio.com/photo/723004", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/723004.jpg", "longitude": 25.379276, "latitude": 36.461468, "width": 500, "height": 332, "upload_date": "07 February 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 2514494, "photo_title": "klatschmohn bis zum Horizont", "photo_url": "http://www.panoramio.com/photo/2514494", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2514494.jpg", "longitude": 12.025051, "latitude": 54.145244, "width": 500, "height": 334, "upload_date": "01 June 2007", "owner_id": 82603, "owner_name": "HelgeNug", "owner_url": "http://www.panoramio.com/user/82603"} + , + {"photo_id": 436289, "photo_title": "koaganogawa", "photo_url": "http://www.panoramio.com/photo/436289", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/436289.jpg", "longitude": 139.065456, "latitude": 37.831548, "width": 500, "height": 341, "upload_date": "15 January 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 73027, "photo_title": "Concourse, British Museum", "photo_url": "http://www.panoramio.com/photo/73027", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/73027.jpg", "longitude": -0.127201, "latitude": 51.519532, "width": 500, "height": 326, "upload_date": "29 October 2006", "owner_id": 1295, "owner_name": "Matthew Walters", "owner_url": "http://www.panoramio.com/user/1295"} + , + {"photo_id": 9766996, "photo_title": "Racetrack Playa", "photo_url": "http://www.panoramio.com/photo/9766996", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9766996.jpg", "longitude": -117.558091, "latitude": 36.664815, "width": 388, "height": 500, "upload_date": "29 April 2008", "owner_id": 308300, "owner_name": "Tony R Immoos", "owner_url": "http://www.panoramio.com/user/308300"} + , + {"photo_id": 1455193, "photo_title": "Вулкан Карымский, со склона вулкана Малый Семячик", "photo_url": "http://www.panoramio.com/photo/1455193", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1455193.jpg", "longitude": 159.626970, "latitude": 54.133227, "width": 500, "height": 345, "upload_date": "23 March 2007", "owner_id": 268724, "owner_name": "Korotnev AV", "owner_url": "http://www.panoramio.com/user/268724"} + , + {"photo_id": 1234797, "photo_title": "Sahalie Falls, Mckenzie River", "photo_url": "http://www.panoramio.com/photo/1234797", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1234797.jpg", "longitude": -121.997187, "latitude": 44.348769, "width": 500, "height": 420, "upload_date": "09 March 2007", "owner_id": 128746, "owner_name": "© Michael Hatten", "owner_url": "http://www.panoramio.com/user/128746"} + , + {"photo_id": 3989102, "photo_title": "El Gran Miércoles", "photo_url": "http://www.panoramio.com/photo/3989102", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3989102.jpg", "longitude": -17.991056, "latitude": 27.797638, "width": 500, "height": 375, "upload_date": "17 August 2007", "owner_id": 787217, "owner_name": "♣ Víctor S de Lara ♣", "owner_url": "http://www.panoramio.com/user/787217"} + , + {"photo_id": 85625, "photo_title": "Cañón de Valdeinfiernos", "photo_url": "http://www.panoramio.com/photo/85625", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/85625.jpg", "longitude": -1.961060, "latitude": 37.801511, "width": 333, "height": 500, "upload_date": "24 November 2006", "owner_id": 10969, "owner_name": "Juanra", "owner_url": "http://www.panoramio.com/user/10969"} + , + {"photo_id": 4558716, "photo_title": "Corsica - West Coast", "photo_url": "http://www.panoramio.com/photo/4558716", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4558716.jpg", "longitude": 8.655338, "latitude": 42.253108, "width": 500, "height": 341, "upload_date": "10 September 2007", "owner_id": 49870, "owner_name": "Jean-Michel Raggioli", "owner_url": "http://www.panoramio.com/user/49870"} + , + {"photo_id": 3201916, "photo_title": "Mönch", "photo_url": "http://www.panoramio.com/photo/3201916", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3201916.jpg", "longitude": 7.640026, "latitude": 46.745537, "width": 500, "height": 374, "upload_date": "09 July 2007", "owner_id": 635422, "owner_name": "♫ Swissmay", "owner_url": "http://www.panoramio.com/user/635422"} + , + {"photo_id": 4365440, "photo_title": "a piece of wood", "photo_url": "http://www.panoramio.com/photo/4365440", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4365440.jpg", "longitude": -1.254158, "latitude": 44.480463, "width": 221, "height": 500, "upload_date": "03 September 2007", "owner_id": 521836, "owner_name": "KLEFER", "owner_url": "http://www.panoramio.com/user/521836"} + , + {"photo_id": 124545, "photo_title": "66_St-Cyp_vagues_01", "photo_url": "http://www.panoramio.com/photo/124545", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/124545.jpg", "longitude": 3.037736, "latitude": 42.623436, "width": 500, "height": 333, "upload_date": "12 December 2006", "owner_id": 18696, "owner_name": "Besnard", "owner_url": "http://www.panoramio.com/user/18696"} + , + {"photo_id": 65666, "photo_title": "Barco fantasma", "photo_url": "http://www.panoramio.com/photo/65666", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/65666.jpg", "longitude": -14.179380, "latitude": 28.344878, "width": 500, "height": 375, "upload_date": "18 October 2006", "owner_id": 8658, "owner_name": "Canarina", "owner_url": "http://www.panoramio.com/user/8658"} + , + {"photo_id": 573064, "photo_title": "Looking west across Isfjorden", "photo_url": "http://www.panoramio.com/photo/573064", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/573064.jpg", "longitude": 7.681332, "latitude": 62.558395, "width": 500, "height": 332, "upload_date": "26 January 2007", "owner_id": 39160, "owner_name": "Snemann", "owner_url": "http://www.panoramio.com/user/39160"} + , + {"photo_id": 859786, "photo_title": "Aurora Borealis, Andøya, Vesterålen, Norway", "photo_url": "http://www.panoramio.com/photo/859786", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/859786.jpg", "longitude": 15.605392, "latitude": 69.118548, "width": 500, "height": 377, "upload_date": "17 February 2007", "owner_id": 66734, "owner_name": "Svein Solhaug", "owner_url": "http://www.panoramio.com/user/66734"} + , + {"photo_id": 507024, "photo_title": "Agrárcolorgeometria", "photo_url": "http://www.panoramio.com/photo/507024", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/507024.jpg", "longitude": 18.014488, "latitude": 47.316017, "width": 500, "height": 300, "upload_date": "20 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 6665111, "photo_title": "Coucher du soleil depuis les Crêts", "photo_url": "http://www.panoramio.com/photo/6665111", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6665111.jpg", "longitude": 6.172214, "latitude": 46.129129, "width": 500, "height": 375, "upload_date": "24 December 2007", "owner_id": 359127, "owner_name": "wx", "owner_url": "http://www.panoramio.com/user/359127"} + , + {"photo_id": 679331, "photo_title": "wentworth falls", "photo_url": "http://www.panoramio.com/photo/679331", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/679331.jpg", "longitude": 150.371124, "latitude": -33.727111, "width": 498, "height": 500, "upload_date": "04 February 2007", "owner_id": 146092, "owner_name": "sid1662", "owner_url": "http://www.panoramio.com/user/146092"} + , + {"photo_id": 459436, "photo_title": "aikawa", "photo_url": "http://www.panoramio.com/photo/459436", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/459436.jpg", "longitude": 138.234701, "latitude": 37.998936, "width": 500, "height": 341, "upload_date": "16 January 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 31662, "photo_title": "NY_7_GE", "photo_url": "http://www.panoramio.com/photo/31662", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/31662.jpg", "longitude": -73.977041, "latitude": 40.761528, "width": 452, "height": 500, "upload_date": "11 July 2006", "owner_id": 4657, "owner_name": "Giuseppe Grande", "owner_url": "http://www.panoramio.com/user/4657"} + , + {"photo_id": 1488304, "photo_title": "", "photo_url": "http://www.panoramio.com/photo/1488304", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1488304.jpg", "longitude": 138.135223, "latitude": 36.848719, "width": 383, "height": 500, "upload_date": "25 March 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 181939, "photo_title": "The Eiffel Tower, Paris", "photo_url": "http://www.panoramio.com/photo/181939", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/181939.jpg", "longitude": 2.288718, "latitude": 48.861920, "width": 384, "height": 500, "upload_date": "18 December 2006", "owner_id": 12954, "owner_name": "Ziębol", "owner_url": "http://www.panoramio.com/user/12954"} + , + {"photo_id": 2422198, "photo_title": "In the Pine's Shade", "photo_url": "http://www.panoramio.com/photo/2422198", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2422198.jpg", "longitude": -112.393484, "latitude": 44.580075, "width": 500, "height": 333, "upload_date": "27 May 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 2363576, "photo_title": "Cienfuegos Yacht Club", "photo_url": "http://www.panoramio.com/photo/2363576", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2363576.jpg", "longitude": -80.450901, "latitude": 22.126499, "width": 500, "height": 306, "upload_date": "23 May 2007", "owner_id": 2575, "owner_name": "mikel ortega", "owner_url": "http://www.panoramio.com/user/2575"} + , + {"photo_id": 58296, "photo_title": "Liechtensteinklamm 2", "photo_url": "http://www.panoramio.com/photo/58296", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/58296.jpg", "longitude": 13.190546, "latitude": 47.310140, "width": 333, "height": 500, "upload_date": "07 October 2006", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 507328, "photo_title": "Pillantás a hídról", "photo_url": "http://www.panoramio.com/photo/507328", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/507328.jpg", "longitude": 17.629859, "latitude": 47.687102, "width": 500, "height": 334, "upload_date": "20 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 468161, "photo_title": "Honfleur", "photo_url": "http://www.panoramio.com/photo/468161", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/468161.jpg", "longitude": 0.234833, "latitude": 49.421806, "width": 500, "height": 350, "upload_date": "17 January 2007", "owner_id": 78506, "owner_name": "Philippe Stoop", "owner_url": "http://www.panoramio.com/user/78506"} + , + {"photo_id": 2521031, "photo_title": "Derűs délután", "photo_url": "http://www.panoramio.com/photo/2521031", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2521031.jpg", "longitude": 17.523537, "latitude": 47.751790, "width": 380, "height": 500, "upload_date": "02 June 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 934105, "photo_title": "Times Square", "photo_url": "http://www.panoramio.com/photo/934105", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/934105.jpg", "longitude": -73.986762, "latitude": 40.756652, "width": 375, "height": 500, "upload_date": "21 February 2007", "owner_id": 123698, "owner_name": "© Kojak", "owner_url": "http://www.panoramio.com/user/123698"} + , + {"photo_id": 57824, "photo_title": "Hallstatt 3", "photo_url": "http://www.panoramio.com/photo/57824", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/57824.jpg", "longitude": 13.642616, "latitude": 47.556372, "width": 500, "height": 333, "upload_date": "05 October 2006", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 1370861, "photo_title": "Wanganui Sunrise", "photo_url": "http://www.panoramio.com/photo/1370861", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1370861.jpg", "longitude": 175.053218, "latitude": -39.927193, "width": 500, "height": 400, "upload_date": "17 March 2007", "owner_id": 286729, "owner_name": "jimwitkowski", "owner_url": "http://www.panoramio.com/user/286729"} + , + {"photo_id": 4823023, "photo_title": "Cielo en llamas ( Sky on fire )", "photo_url": "http://www.panoramio.com/photo/4823023", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4823023.jpg", "longitude": -0.471725, "latitude": 39.601588, "width": 500, "height": 375, "upload_date": "22 September 2007", "owner_id": 787217, "owner_name": "♣ Víctor S de Lara ♣", "owner_url": "http://www.panoramio.com/user/787217"} + , + {"photo_id": 520945, "photo_title": "Estvarázs", "photo_url": "http://www.panoramio.com/photo/520945", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/520945.jpg", "longitude": 17.627692, "latitude": 47.665156, "width": 500, "height": 334, "upload_date": "21 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 818423, "photo_title": "Karst Countryside in Guangxi, China", "photo_url": "http://www.panoramio.com/photo/818423", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/818423.jpg", "longitude": 106.953964, "latitude": 22.716023, "width": 500, "height": 206, "upload_date": "14 February 2007", "owner_id": 164125, "owner_name": "DannyXu", "owner_url": "http://www.panoramio.com/user/164125"} + , + {"photo_id": 532730, "photo_title": "Nightfall and fog at lake Helgeren", "photo_url": "http://www.panoramio.com/photo/532730", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/532730.jpg", "longitude": 10.708923, "latitude": 60.074348, "width": 419, "height": 500, "upload_date": "22 January 2007", "owner_id": 39160, "owner_name": "Snemann", "owner_url": "http://www.panoramio.com/user/39160"} + , + {"photo_id": 650237, "photo_title": "Aruba, Eagle Beach, Divi Divi Tree", "photo_url": "http://www.panoramio.com/photo/650237", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/650237.jpg", "longitude": -70.055099, "latitude": 12.555003, "width": 500, "height": 375, "upload_date": "01 February 2007", "owner_id": 136446, "owner_name": "© Wim", "owner_url": "http://www.panoramio.com/user/136446"} + , + {"photo_id": 2414590, "photo_title": "Egy csendes estén", "photo_url": "http://www.panoramio.com/photo/2414590", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2414590.jpg", "longitude": 17.626448, "latitude": 47.662613, "width": 500, "height": 334, "upload_date": "27 May 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 10544520, "photo_title": "Plansee", "photo_url": "http://www.panoramio.com/photo/10544520", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10544520.jpg", "longitude": 10.799389, "latitude": 47.473011, "width": 500, "height": 242, "upload_date": "24 May 2008", "owner_id": 634000, "owner_name": "© Massimo De Candido", "owner_url": "http://www.panoramio.com/user/634000"} + , + {"photo_id": 11341211, "photo_title": "AMAPOLAS AL SOL", "photo_url": "http://www.panoramio.com/photo/11341211", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/11341211.jpg", "longitude": -1.995735, "latitude": 42.471844, "width": 500, "height": 374, "upload_date": "19 June 2008", "owner_id": 1487989, "owner_name": "mesias", "owner_url": "http://www.panoramio.com/user/1487989"} + , + {"photo_id": 134748, "photo_title": "20060813_9795_raw", "photo_url": "http://www.panoramio.com/photo/134748", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/134748.jpg", "longitude": 30.452921, "latitude": 50.358700, "width": 500, "height": 333, "upload_date": "13 December 2006", "owner_id": 17090, "owner_name": "Pavel Danko", "owner_url": "http://www.panoramio.com/user/17090"} + , + {"photo_id": 66816, "photo_title": "desierto cerca de Tolar Grande", "photo_url": "http://www.panoramio.com/photo/66816", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/66816.jpg", "longitude": -67.394257, "latitude": -24.584593, "width": 374, "height": 500, "upload_date": "19 October 2006", "owner_id": 9080, "owner_name": "Marco Teodonio", "owner_url": "http://www.panoramio.com/user/9080"} + , + {"photo_id": 70148, "photo_title": "Grotto Azure, Capris: The cave is lit by light refracting through the water.", "photo_url": "http://www.panoramio.com/photo/70148", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/70148.jpg", "longitude": 14.203262, "latitude": 40.560895, "width": 500, "height": 375, "upload_date": "25 October 2006", "owner_id": 1634, "owner_name": "Rick Guthrie", "owner_url": "http://www.panoramio.com/user/1634"} + , + {"photo_id": 1409801, "photo_title": "Hedges, Aerial", "photo_url": "http://www.panoramio.com/photo/1409801", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1409801.jpg", "longitude": 9.027843, "latitude": 56.130772, "width": 332, "height": 500, "upload_date": "20 March 2007", "owner_id": 278074, "owner_name": "H. C. Steensen", "owner_url": "http://www.panoramio.com/user/278074"} + , + {"photo_id": 840971, "photo_title": "Upper Thracian Lowlands", "photo_url": "http://www.panoramio.com/photo/840971", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/840971.jpg", "longitude": 26.364269, "latitude": 42.717759, "width": 500, "height": 400, "upload_date": "16 February 2007", "owner_id": 16880, "owner_name": "evgenidinev.com", "owner_url": "http://www.panoramio.com/user/16880"} + , + {"photo_id": 9557772, "photo_title": "Le Shan Giant Buddha Statue - Geotagged April 08 Photo Contest Heritage Category Honorable Mentions", "photo_url": "http://www.panoramio.com/photo/9557772", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9557772.jpg", "longitude": 103.769115, "latitude": 29.547084, "width": 375, "height": 500, "upload_date": "20 April 2008", "owner_id": 964751, "owner_name": "jymsn123", "owner_url": "http://www.panoramio.com/user/964751"} + , + {"photo_id": 4716049, "photo_title": "Sol-edad", "photo_url": "http://www.panoramio.com/photo/4716049", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4716049.jpg", "longitude": -73.228008, "latitude": -39.820720, "width": 366, "height": 500, "upload_date": "17 September 2007", "owner_id": 327310, "owner_name": "Erwin Woenckhaus", "owner_url": "http://www.panoramio.com/user/327310"} + , + {"photo_id": 1419283, "photo_title": "Sunset in Boka", "photo_url": "http://www.panoramio.com/photo/1419283", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1419283.jpg", "longitude": 18.703022, "latitude": 42.479883, "width": 500, "height": 375, "upload_date": "20 March 2007", "owner_id": 239453, "owner_name": "Šovran Nikša", "owner_url": "http://www.panoramio.com/user/239453"} + , + {"photo_id": 3507222, "photo_title": "The sheperd of the Glen", "photo_url": "http://www.panoramio.com/photo/3507222", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3507222.jpg", "longitude": -4.840164, "latitude": 56.641504, "width": 500, "height": 334, "upload_date": "24 July 2007", "owner_id": 599676, "owner_name": "mossip", "owner_url": "http://www.panoramio.com/user/599676"} + , + {"photo_id": 3521820, "photo_title": "Utolsó pillantás", "photo_url": "http://www.panoramio.com/photo/3521820", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3521820.jpg", "longitude": 17.809353, "latitude": 47.528097, "width": 500, "height": 334, "upload_date": "25 July 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 521264, "photo_title": "Felhőátvonulás", "photo_url": "http://www.panoramio.com/photo/521264", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/521264.jpg", "longitude": 17.760429, "latitude": 47.555329, "width": 500, "height": 280, "upload_date": "21 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 636723, "photo_title": "ASZFALTOZÓK", "photo_url": "http://www.panoramio.com/photo/636723", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/636723.jpg", "longitude": 19.038105, "latitude": 47.520041, "width": 500, "height": 318, "upload_date": "31 January 2007", "owner_id": 137538, "owner_name": "BALÁS ISTVÁN", "owner_url": "http://www.panoramio.com/user/137538"} + , + {"photo_id": 153144, "photo_title": "cierny_vah01", "photo_url": "http://www.panoramio.com/photo/153144", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/153144.jpg", "longitude": 19.907227, "latitude": 49.020084, "width": 500, "height": 332, "upload_date": "15 December 2006", "owner_id": 28092, "owner_name": "Design d15", "owner_url": "http://www.panoramio.com/user/28092"} + , + {"photo_id": 7485246, "photo_title": "Túl mindenen", "photo_url": "http://www.panoramio.com/photo/7485246", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7485246.jpg", "longitude": 17.624259, "latitude": 47.662092, "width": 500, "height": 334, "upload_date": "31 January 2008", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 4884030, "photo_title": "A Cloud is Born", "photo_url": "http://www.panoramio.com/photo/4884030", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4884030.jpg", "longitude": -119.631693, "latitude": 37.724208, "width": 333, "height": 500, "upload_date": "24 September 2007", "owner_id": 376395, "owner_name": "JeffSullivan (www.MyPhotoGuides.com)", "owner_url": "http://www.panoramio.com/user/376395"} + , + {"photo_id": 6126146, "photo_title": "North Weald Park", "photo_url": "http://www.panoramio.com/photo/6126146", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6126146.jpg", "longitude": 0.264530, "latitude": 51.624631, "width": 500, "height": 333, "upload_date": "25 November 2007", "owner_id": 1130880, "owner_name": "marksimms", "owner_url": "http://www.panoramio.com/user/1130880"} + , + {"photo_id": 438342, "photo_title": "Sunrise in Sierra Nevada", "photo_url": "http://www.panoramio.com/photo/438342", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/438342.jpg", "longitude": -119.225607, "latitude": 37.945213, "width": 500, "height": 318, "upload_date": "15 January 2007", "owner_id": 93560, "owner_name": "Alex Petrov", "owner_url": "http://www.panoramio.com/user/93560"} + , + {"photo_id": 91978, "photo_title": "Dubrovnik (Croatia)", "photo_url": "http://www.panoramio.com/photo/91978", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/91978.jpg", "longitude": 18.108457, "latitude": 42.642909, "width": 500, "height": 375, "upload_date": "04 December 2006", "owner_id": 11403, "owner_name": "Arnáiz", "owner_url": "http://www.panoramio.com/user/11403"} + , + {"photo_id": 10816587, "photo_title": "Cementiri de Carcassonne", "photo_url": "http://www.panoramio.com/photo/10816587", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10816587.jpg", "longitude": 2.365751, "latitude": 43.205551, "width": 500, "height": 333, "upload_date": "01 June 2008", "owner_id": 599233, "owner_name": "SílviaPrats", "owner_url": "http://www.panoramio.com/user/599233"} + , + {"photo_id": 292943, "photo_title": "Aekingerzand", "photo_url": "http://www.panoramio.com/photo/292943", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/292943.jpg", "longitude": 6.296024, "latitude": 52.935293, "width": 500, "height": 333, "upload_date": "03 January 2007", "owner_id": 62613, "owner_name": "erik van den Ham", "owner_url": "http://www.panoramio.com/user/62613"} + , + {"photo_id": 4696655, "photo_title": "Old boat", "photo_url": "http://www.panoramio.com/photo/4696655", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4696655.jpg", "longitude": 27.399902, "latitude": 42.414079, "width": 500, "height": 357, "upload_date": "16 September 2007", "owner_id": 16880, "owner_name": "evgenidinev.com", "owner_url": "http://www.panoramio.com/user/16880"} + , + {"photo_id": 348752, "photo_title": "_Cariniana legalis_ (Lecythidaceae), Santa Rita do Passa Quatro, SP,Brasil", "photo_url": "http://www.panoramio.com/photo/348752", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/348752.jpg", "longitude": -47.618523, "latitude": -21.691885, "width": 500, "height": 375, "upload_date": "08 January 2007", "owner_id": 56214, "owner_name": "Vinícius Antonio de Oliveira Dittrich", "owner_url": "http://www.panoramio.com/user/56214"} + , + {"photo_id": 3724631, "photo_title": "Abbazia di Chiaravalle in un'alba nebbiosa", "photo_url": "http://www.panoramio.com/photo/3724631", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3724631.jpg", "longitude": 9.201404, "latitude": 45.424284, "width": 500, "height": 375, "upload_date": "04 August 2007", "owner_id": 732643, "owner_name": "La Mugna", "owner_url": "http://www.panoramio.com/user/732643"} + , + {"photo_id": 405853, "photo_title": "oyasirazu", "photo_url": "http://www.panoramio.com/photo/405853", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/405853.jpg", "longitude": 137.747955, "latitude": 37.009133, "width": 500, "height": 384, "upload_date": "13 January 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 1192286, "photo_title": "Ojos del mar - 1", "photo_url": "http://www.panoramio.com/photo/1192286", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1192286.jpg", "longitude": -67.369022, "latitude": -24.630634, "width": 500, "height": 337, "upload_date": "06 March 2007", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 589411, "photo_title": "Sunset, London, UK.", "photo_url": "http://www.panoramio.com/photo/589411", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/589411.jpg", "longitude": -0.123596, "latitude": 51.500942, "width": 500, "height": 346, "upload_date": "27 January 2007", "owner_id": 44319, "owner_name": "André Bonacin", "owner_url": "http://www.panoramio.com/user/44319"} + , + {"photo_id": 7586406, "photo_title": "Sol naciente en Villarrica", "photo_url": "http://www.panoramio.com/photo/7586406", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7586406.jpg", "longitude": -72.219400, "latitude": -39.289273, "width": 500, "height": 375, "upload_date": "04 February 2008", "owner_id": 327310, "owner_name": "Erwin Woenckhaus", "owner_url": "http://www.panoramio.com/user/327310"} + , + {"photo_id": 621, "photo_title": "Cape Drastis / Corfu", "photo_url": "http://www.panoramio.com/photo/621", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/621.jpg", "longitude": 19.701061, "latitude": 39.795744, "width": 500, "height": 375, "upload_date": "27 September 2005", "owner_id": 30, "owner_name": "eSHa", "owner_url": "http://www.panoramio.com/user/30"} + , + {"photo_id": 2379636, "photo_title": "Detail from the valley below Holmbukttind", "photo_url": "http://www.panoramio.com/photo/2379636", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2379636.jpg", "longitude": 19.781570, "latitude": 69.476339, "width": 500, "height": 375, "upload_date": "24 May 2007", "owner_id": 39160, "owner_name": "Snemann", "owner_url": "http://www.panoramio.com/user/39160"} + , + {"photo_id": 5725557, "photo_title": "Kardzhali lake - Panorama", "photo_url": "http://www.panoramio.com/photo/5725557", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5725557.jpg", "longitude": 25.242250, "latitude": 41.668667, "width": 500, "height": 187, "upload_date": "05 November 2007", "owner_id": 16880, "owner_name": "evgenidinev.com", "owner_url": "http://www.panoramio.com/user/16880"} + , + {"photo_id": 22393, "photo_title": "View from Bosphorus Bridge", "photo_url": "http://www.panoramio.com/photo/22393", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/22393.jpg", "longitude": 28.999443, "latitude": 41.027053, "width": 500, "height": 355, "upload_date": "04 June 2006", "owner_id": 3504, "owner_name": "zeytinbass", "owner_url": "http://www.panoramio.com/user/3504"} + , + {"photo_id": 5611129, "photo_title": "Torrent de Pareis - Sa Calobra (Mallorca)", "photo_url": "http://www.panoramio.com/photo/5611129", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5611129.jpg", "longitude": 2.807093, "latitude": 39.851709, "width": 500, "height": 373, "upload_date": "29 October 2007", "owner_id": 83865, "owner_name": "Epi F.Villanueva", "owner_url": "http://www.panoramio.com/user/83865"} + , + {"photo_id": 3457918, "photo_title": "Walk of Venus", "photo_url": "http://www.panoramio.com/photo/3457918", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3457918.jpg", "longitude": 14.721851, "latitude": 44.838891, "width": 500, "height": 367, "upload_date": "22 July 2007", "owner_id": 346103, "owner_name": "lacitot", "owner_url": "http://www.panoramio.com/user/346103"} + , + {"photo_id": 21135, "photo_title": "icebergs in the Channel", "photo_url": "http://www.panoramio.com/photo/21135", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/21135.jpg", "longitude": -63.017578, "latitude": -64.774125, "width": 500, "height": 338, "upload_date": "24 May 2006", "owner_id": 3316, "owner_name": "kristine hannon (www.traveltheglobe.be)", "owner_url": "http://www.panoramio.com/user/3316"} + , + {"photo_id": 1288597, "photo_title": "Gift", "photo_url": "http://www.panoramio.com/photo/1288597", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1288597.jpg", "longitude": 72.920036, "latitude": 4.038077, "width": 337, "height": 500, "upload_date": "12 March 2007", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 708502, "photo_title": "A single skier from Gogsøyra tw Litjskjorta mountain", "photo_url": "http://www.panoramio.com/photo/708502", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/708502.jpg", "longitude": 8.160782, "latitude": 62.645604, "width": 424, "height": 500, "upload_date": "05 February 2007", "owner_id": 39160, "owner_name": "Snemann", "owner_url": "http://www.panoramio.com/user/39160"} + , + {"photo_id": 4386456, "photo_title": "good bye", "photo_url": "http://www.panoramio.com/photo/4386456", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4386456.jpg", "longitude": -1.254845, "latitude": 44.463191, "width": 500, "height": 405, "upload_date": "04 September 2007", "owner_id": 521836, "owner_name": "KLEFER", "owner_url": "http://www.panoramio.com/user/521836"} + , + {"photo_id": 902303, "photo_title": "Kék", "photo_url": "http://www.panoramio.com/photo/902303", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/902303.jpg", "longitude": 17.941017, "latitude": 47.650703, "width": 334, "height": 500, "upload_date": "19 February 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 3660960, "photo_title": "Angkor - Ta Prohm IV", "photo_url": "http://www.panoramio.com/photo/3660960", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3660960.jpg", "longitude": 103.890334, "latitude": 13.435028, "width": 338, "height": 500, "upload_date": "01 August 2007", "owner_id": 73104, "owner_name": "zerega", "owner_url": "http://www.panoramio.com/user/73104"} + , + {"photo_id": 902570, "photo_title": "Tavitündér", "photo_url": "http://www.panoramio.com/photo/902570", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/902570.jpg", "longitude": 17.468948, "latitude": 47.871914, "width": 500, "height": 345, "upload_date": "19 February 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 2521005, "photo_title": "Megvilágosodás elött", "photo_url": "http://www.panoramio.com/photo/2521005", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2521005.jpg", "longitude": 17.515984, "latitude": 47.743825, "width": 500, "height": 286, "upload_date": "02 June 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 586159, "photo_title": "Central Park", "photo_url": "http://www.panoramio.com/photo/586159", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/586159.jpg", "longitude": -73.971816, "latitude": 40.775789, "width": 500, "height": 375, "upload_date": "27 January 2007", "owner_id": 123698, "owner_name": "© Kojak", "owner_url": "http://www.panoramio.com/user/123698"} + , + {"photo_id": 23475, "photo_title": "Good Morning", "photo_url": "http://www.panoramio.com/photo/23475", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/23475.jpg", "longitude": -28.210895, "latitude": 38.680351, "width": 500, "height": 375, "upload_date": "11 June 2006", "owner_id": 3760, "owner_name": "Frank Pustlauck", "owner_url": "http://www.panoramio.com/user/3760"} + , + {"photo_id": 1006005, "photo_title": "04-09-07_\"La Nube Sangrante\"_017_PIXELECTA", "photo_url": "http://www.panoramio.com/photo/1006005", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1006005.jpg", "longitude": -0.896330, "latitude": 41.738016, "width": 500, "height": 375, "upload_date": "24 February 2007", "owner_id": 163655, "owner_name": "[[[ PIXELECTA ]]]", "owner_url": "http://www.panoramio.com/user/163655"} + , + {"photo_id": 3473597, "photo_title": "Sails in the sunset", "photo_url": "http://www.panoramio.com/photo/3473597", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3473597.jpg", "longitude": -87.173424, "latitude": 45.158317, "width": 500, "height": 375, "upload_date": "22 July 2007", "owner_id": 555551, "owner_name": "Marilyn Whiteley", "owner_url": "http://www.panoramio.com/user/555551"} + , + {"photo_id": 3809992, "photo_title": "Długie Pobrzeże latem/ Las casas narcisistas que se pasan el día mirándose en el espejo del agua - gracias Arturo García!", "photo_url": "http://www.panoramio.com/photo/3809992", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3809992.jpg", "longitude": 18.658776, "latitude": 54.350679, "width": 500, "height": 375, "upload_date": "08 August 2007", "owner_id": 277750, "owner_name": "Karolina P.", "owner_url": "http://www.panoramio.com/user/277750"} + , + {"photo_id": 2280401, "photo_title": "Hetyke-egyke", "photo_url": "http://www.panoramio.com/photo/2280401", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2280401.jpg", "longitude": 17.829094, "latitude": 47.206508, "width": 500, "height": 308, "upload_date": "18 May 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 290772, "photo_title": "Tormenta Bahía de Pollensa", "photo_url": "http://www.panoramio.com/photo/290772", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/290772.jpg", "longitude": 3.116437, "latitude": 39.928440, "width": 500, "height": 335, "upload_date": "03 January 2007", "owner_id": 61890, "owner_name": "enriquevidalphoto.com", "owner_url": "http://www.panoramio.com/user/61890"} + , + {"photo_id": 57822, "photo_title": "Maria Alm - Pfarrkirche", "photo_url": "http://www.panoramio.com/photo/57822", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/57822.jpg", "longitude": 12.903442, "latitude": 47.407877, "width": 346, "height": 500, "upload_date": "05 October 2006", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 516322, "photo_title": "A völgy", "photo_url": "http://www.panoramio.com/photo/516322", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/516322.jpg", "longitude": 17.774162, "latitude": 47.292504, "width": 338, "height": 500, "upload_date": "21 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 12271085, "photo_title": "Ein Bild für meine Freunde", "photo_url": "http://www.panoramio.com/photo/12271085", "photo_file_url": "http://static2.bareka.com/photos/medium/12271085.jpg", "longitude": 9.284134, "latitude": 51.510933, "width": 500, "height": 333, "upload_date": "19 July 2008", "owner_id": 497213, "owner_name": "UlrichSchnuerer", "owner_url": "http://www.panoramio.com/user/497213"} + , + {"photo_id": 5050864, "photo_title": "Álmok útján", "photo_url": "http://www.panoramio.com/photo/5050864", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5050864.jpg", "longitude": 12.333773, "latitude": 45.436466, "width": 500, "height": 354, "upload_date": "02 October 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 617461, "photo_title": "Miravet", "photo_url": "http://www.panoramio.com/photo/617461", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/617461.jpg", "longitude": 0.593348, "latitude": 41.035568, "width": 500, "height": 334, "upload_date": "29 January 2007", "owner_id": 3022, "owner_name": "Arcadi", "owner_url": "http://www.panoramio.com/user/3022"} + , + {"photo_id": 2689526, "photo_title": "Égszakadás", "photo_url": "http://www.panoramio.com/photo/2689526", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2689526.jpg", "longitude": 17.503624, "latitude": 47.749481, "width": 500, "height": 325, "upload_date": "11 June 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 38135, "photo_title": "Amanecer en el sur", "photo_url": "http://www.panoramio.com/photo/38135", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/38135.jpg", "longitude": -64.983333, "latitude": -31.900000, "width": 500, "height": 375, "upload_date": "11 August 2006", "owner_id": 4483, "owner_name": "Miguel Coranti", "owner_url": "http://www.panoramio.com/user/4483"} + , + {"photo_id": 1087737, "photo_title": "Szeles nyárelő", "photo_url": "http://www.panoramio.com/photo/1087737", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1087737.jpg", "longitude": 17.605934, "latitude": 47.603154, "width": 500, "height": 333, "upload_date": "28 February 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 8411394, "photo_title": "Dead Vlei", "photo_url": "http://www.panoramio.com/photo/8411394", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8411394.jpg", "longitude": 15.295715, "latitude": -24.764914, "width": 500, "height": 341, "upload_date": "09 March 2008", "owner_id": 1204358, "owner_name": "aldenc", "owner_url": "http://www.panoramio.com/user/1204358"} + , + {"photo_id": 8491464, "photo_title": "Horsetail Falls on El Capitan", "photo_url": "http://www.panoramio.com/photo/8491464", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8491464.jpg", "longitude": -119.623947, "latitude": 37.723512, "width": 357, "height": 500, "upload_date": "12 March 2008", "owner_id": 376395, "owner_name": "JeffSullivan (www.MyPhotoGuides.com)", "owner_url": "http://www.panoramio.com/user/376395"} + , + {"photo_id": 58134, "photo_title": "Chateaux Lake Louise from the head of the lake", "photo_url": "http://www.panoramio.com/photo/58134", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/58134.jpg", "longitude": -116.239901, "latitude": 51.407291, "width": 500, "height": 375, "upload_date": "06 October 2006", "owner_id": 8118, "owner_name": "Michael Gerstmann", "owner_url": "http://www.panoramio.com/user/8118"} + , + {"photo_id": 11237087, "photo_title": " Ein Strand zum träumen", "photo_url": "http://www.panoramio.com/photo/11237087", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/11237087.jpg", "longitude": 15.914984, "latitude": 38.683366, "width": 500, "height": 294, "upload_date": "15 June 2008", "owner_id": 1400529, "owner_name": "marita1004", "owner_url": "http://www.panoramio.com/user/1400529"} + , + {"photo_id": 8384850, "photo_title": "Winter has gone", "photo_url": "http://www.panoramio.com/photo/8384850", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8384850.jpg", "longitude": 12.428112, "latitude": 49.084351, "width": 500, "height": 333, "upload_date": "08 March 2008", "owner_id": 696605, "owner_name": "© alfredschaffer", "owner_url": "http://www.panoramio.com/user/696605"} + , + {"photo_id": 3947779, "photo_title": "Mont-Saint-Michel floating in water", "photo_url": "http://www.panoramio.com/photo/3947779", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3947779.jpg", "longitude": -1.508625, "latitude": 48.634561, "width": 500, "height": 335, "upload_date": "15 August 2007", "owner_id": 57893, "owner_name": "ThoiryK", "owner_url": "http://www.panoramio.com/user/57893"} + , + {"photo_id": 1069321, "photo_title": "The old Temple N2", "photo_url": "http://www.panoramio.com/photo/1069321", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1069321.jpg", "longitude": 37.426300, "latitude": 56.370622, "width": 500, "height": 333, "upload_date": "27 February 2007", "owner_id": 212477, "owner_name": "Cherepanov Timofey", "owner_url": "http://www.panoramio.com/user/212477"} + , + {"photo_id": 5756689, "photo_title": "Tokyo Metropolitan Government", "photo_url": "http://www.panoramio.com/photo/5756689", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5756689.jpg", "longitude": 139.690722, "latitude": 35.689906, "width": 500, "height": 339, "upload_date": "06 November 2007", "owner_id": 558055, "owner_name": "www.tokyoform.com", "owner_url": "http://www.panoramio.com/user/558055"} + , + {"photo_id": 1599763, "photo_title": "Atomium", "photo_url": "http://www.panoramio.com/photo/1599763", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1599763.jpg", "longitude": 4.341531, "latitude": 50.894805, "width": 500, "height": 375, "upload_date": "02 April 2007", "owner_id": 18137, "owner_name": "digitaler lumpensammler", "owner_url": "http://www.panoramio.com/user/18137"} + , + {"photo_id": 516375, "photo_title": "A zöld folyó", "photo_url": "http://www.panoramio.com/photo/516375", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/516375.jpg", "longitude": 17.724895, "latitude": 46.297137, "width": 369, "height": 500, "upload_date": "21 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 1538329, "photo_title": "View east from Empire State Building by night", "photo_url": "http://www.panoramio.com/photo/1538329", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1538329.jpg", "longitude": -73.986332, "latitude": 40.748346, "width": 500, "height": 332, "upload_date": "28 March 2007", "owner_id": 278074, "owner_name": "H. C. Steensen", "owner_url": "http://www.panoramio.com/user/278074"} + , + {"photo_id": 1838875, "photo_title": "Modern art in Mainz", "photo_url": "http://www.panoramio.com/photo/1838875", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1838875.jpg", "longitude": 8.276659, "latitude": 50.001071, "width": 500, "height": 393, "upload_date": "19 April 2007", "owner_id": 12954, "owner_name": "Ziębol", "owner_url": "http://www.panoramio.com/user/12954"} + , + {"photo_id": 4740891, "photo_title": "The golden path - Az aranyozott ösvény", "photo_url": "http://www.panoramio.com/photo/4740891", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4740891.jpg", "longitude": 17.599239, "latitude": 47.639948, "width": 500, "height": 334, "upload_date": "18 September 2007", "owner_id": 217370, "owner_name": "Borbély Márk", "owner_url": "http://www.panoramio.com/user/217370"} + , + {"photo_id": 441376, "photo_title": "Bolungarvik", "photo_url": "http://www.panoramio.com/photo/441376", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/441376.jpg", "longitude": -23.197975, "latitude": 66.151698, "width": 500, "height": 333, "upload_date": "15 January 2007", "owner_id": 78506, "owner_name": "Philippe Stoop", "owner_url": "http://www.panoramio.com/user/78506"} + , + {"photo_id": 3354401, "photo_title": "Alkonyi színjáték", "photo_url": "http://www.panoramio.com/photo/3354401", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3354401.jpg", "longitude": 17.504225, "latitude": 47.745730, "width": 500, "height": 334, "upload_date": "16 July 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 809506, "photo_title": "Szivárványhorizont", "photo_url": "http://www.panoramio.com/photo/809506", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/809506.jpg", "longitude": 15.969830, "latitude": 43.626632, "width": 500, "height": 334, "upload_date": "13 February 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 36387, "photo_title": "Adobe Headquarters - Looking Up", "photo_url": "http://www.panoramio.com/photo/36387", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/36387.jpg", "longitude": -121.893804, "latitude": 37.330959, "width": 351, "height": 500, "upload_date": "02 August 2006", "owner_id": 5684, "owner_name": "Brent Townshend", "owner_url": "http://www.panoramio.com/user/5684"} + , + {"photo_id": 722982, "photo_title": "Antelope-Light", "photo_url": "http://www.panoramio.com/photo/722982", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/722982.jpg", "longitude": -111.371326, "latitude": 36.857236, "width": 333, "height": 500, "upload_date": "07 February 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 138030, "photo_title": "Kinderdijk", "photo_url": "http://www.panoramio.com/photo/138030", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/138030.jpg", "longitude": 4.645500, "latitude": 51.879458, "width": 500, "height": 335, "upload_date": "13 December 2006", "owner_id": 18131, "owner_name": "ron zoeteweij", "owner_url": "http://www.panoramio.com/user/18131"} + , + {"photo_id": 9725235, "photo_title": "railway / Małopolska / województwo małopolskie", "photo_url": "http://www.panoramio.com/photo/9725235", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9725235.jpg", "longitude": 20.363159, "latitude": 49.748443, "width": 321, "height": 500, "upload_date": "28 April 2008", "owner_id": 454219, "owner_name": "Rafal Ociepka", "owner_url": "http://www.panoramio.com/user/454219"} + , + {"photo_id": 945984, "photo_title": "El canal", "photo_url": "http://www.panoramio.com/photo/945984", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/945984.jpg", "longitude": 0.484858, "latitude": 40.901901, "width": 378, "height": 500, "upload_date": "21 February 2007", "owner_id": 3022, "owner_name": "Arcadi", "owner_url": "http://www.panoramio.com/user/3022"} + , + {"photo_id": 677953, "photo_title": "Shuto Expressway over the Sumida River", "photo_url": "http://www.panoramio.com/photo/677953", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/677953.jpg", "longitude": 139.788644, "latitude": 35.690411, "width": 500, "height": 364, "upload_date": "03 February 2007", "owner_id": 78856, "owner_name": "chrisjongkind • archive", "owner_url": "http://www.panoramio.com/user/78856"} + , + {"photo_id": 2723655, "photo_title": "Orciano Pisano", "photo_url": "http://www.panoramio.com/photo/2723655", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2723655.jpg", "longitude": 10.505505, "latitude": 43.491911, "width": 366, "height": 500, "upload_date": "13 June 2007", "owner_id": 65478, "owner_name": "Gabriele Marabotti", "owner_url": "http://www.panoramio.com/user/65478"} + , + {"photo_id": 444745, "photo_title": "Pres de Nefta", "photo_url": "http://www.panoramio.com/photo/444745", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/444745.jpg", "longitude": 7.904320, "latitude": 33.766590, "width": 500, "height": 333, "upload_date": "15 January 2007", "owner_id": 78506, "owner_name": "Philippe Stoop", "owner_url": "http://www.panoramio.com/user/78506"} + , + {"photo_id": 1388623, "photo_title": "El Aviario (Parque Ecológico, Puebla, México)", "photo_url": "http://www.panoramio.com/photo/1388623", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1388623.jpg", "longitude": -98.187540, "latitude": 19.025552, "width": 500, "height": 488, "upload_date": "18 March 2007", "owner_id": 274633, "owner_name": "D4v17 ]7. G.", "owner_url": "http://www.panoramio.com/user/274633"} + , + {"photo_id": 792658, "photo_title": "Reichtag in the dome, Berlin HDR", "photo_url": "http://www.panoramio.com/photo/792658", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/792658.jpg", "longitude": 13.376133, "latitude": 52.518610, "width": 376, "height": 500, "upload_date": "12 February 2007", "owner_id": 161254, "owner_name": "fotoartistry", "owner_url": "http://www.panoramio.com/user/161254"} + , + {"photo_id": 324694, "photo_title": "Thachted houses", "photo_url": "http://www.panoramio.com/photo/324694", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/324694.jpg", "longitude": 137.235117, "latitude": 36.132095, "width": 500, "height": 265, "upload_date": "06 January 2007", "owner_id": 11781, "owner_name": "ANDRE GARDELLA", "owner_url": "http://www.panoramio.com/user/11781"} + , + {"photo_id": 2353496, "photo_title": "рассвет над вулканом Жупановский", "photo_url": "http://www.panoramio.com/photo/2353496", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2353496.jpg", "longitude": 158.591080, "latitude": 53.497850, "width": 500, "height": 337, "upload_date": "23 May 2007", "owner_id": 268724, "owner_name": "Korotnev AV", "owner_url": "http://www.panoramio.com/user/268724"} + , + {"photo_id": 7251801, "photo_title": "Fellegek közt", "photo_url": "http://www.panoramio.com/photo/7251801", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7251801.jpg", "longitude": 18.314981, "latitude": 47.638820, "width": 500, "height": 329, "upload_date": "20 January 2008", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 35422, "photo_title": "caracas", "photo_url": "http://www.panoramio.com/photo/35422", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/35422.jpg", "longitude": -66.904507, "latitude": 10.498193, "width": 500, "height": 375, "upload_date": "29 July 2006", "owner_id": 3360, "owner_name": "ozzy", "owner_url": "http://www.panoramio.com/user/3360"} + , + {"photo_id": 405861, "photo_title": "myoukou", "photo_url": "http://www.panoramio.com/photo/405861", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/405861.jpg", "longitude": 138.295898, "latitude": 37.099003, "width": 500, "height": 383, "upload_date": "13 January 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 2719848, "photo_title": "Idaho relic", "photo_url": "http://www.panoramio.com/photo/2719848", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2719848.jpg", "longitude": -111.398749, "latitude": 42.286707, "width": 500, "height": 375, "upload_date": "13 June 2007", "owner_id": 555551, "owner_name": "Marilyn Whiteley", "owner_url": "http://www.panoramio.com/user/555551"} + , + {"photo_id": 599401, "photo_title": "Hozenji", "photo_url": "http://www.panoramio.com/photo/599401", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/599401.jpg", "longitude": 135.502450, "latitude": 34.668002, "width": 500, "height": 500, "upload_date": "28 January 2007", "owner_id": 128403, "owner_name": "mechanics", "owner_url": "http://www.panoramio.com/user/128403"} + , + {"photo_id": 53101, "photo_title": "Night Auadkhara", "photo_url": "http://www.panoramio.com/photo/53101", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/53101.jpg", "longitude": 40.631331, "latitude": 43.525806, "width": 500, "height": 323, "upload_date": "27 September 2006", "owner_id": 7707, "owner_name": "Yorix", "owner_url": "http://www.panoramio.com/user/7707"} + , + {"photo_id": 112752, "photo_title": "V-35-003b", "photo_url": "http://www.panoramio.com/photo/112752", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/112752.jpg", "longitude": 12.339267, "latitude": 45.433696, "width": 500, "height": 338, "upload_date": "11 December 2006", "owner_id": 17599, "owner_name": "Dmitry Andreev", "owner_url": "http://www.panoramio.com/user/17599"} + , + {"photo_id": 1946749, "photo_title": "Mt Hood and a John Deer Tractor over the Wooden Shoe Tulip Fields Monitor Oregon", "photo_url": "http://www.panoramio.com/photo/1946749", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1946749.jpg", "longitude": -122.740974, "latitude": 45.119326, "width": 500, "height": 351, "upload_date": "27 April 2007", "owner_id": 128746, "owner_name": "© Michael Hatten", "owner_url": "http://www.panoramio.com/user/128746"} + , + {"photo_id": 723074, "photo_title": "September Twilight in Thira", "photo_url": "http://www.panoramio.com/photo/723074", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/723074.jpg", "longitude": 25.430603, "latitude": 36.416862, "width": 500, "height": 223, "upload_date": "07 February 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 1658251, "photo_title": "Behold the moon", "photo_url": "http://www.panoramio.com/photo/1658251", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1658251.jpg", "longitude": 15.589085, "latitude": 78.170125, "width": 333, "height": 500, "upload_date": "06 April 2007", "owner_id": 3574, "owner_name": "blackone", "owner_url": "http://www.panoramio.com/user/3574"} + , + {"photo_id": 2225571, "photo_title": "Landscape (Via Di Porta Castello Street) ~ Tarquinia, Italy", "photo_url": "http://www.panoramio.com/photo/2225571", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2225571.jpg", "longitude": 11.751836, "latitude": 42.255808, "width": 500, "height": 335, "upload_date": "15 May 2007", "owner_id": 395380, "owner_name": "Rafael (Retrocool)", "owner_url": "http://www.panoramio.com/user/395380"} + , + {"photo_id": 348071, "photo_title": "Perfect ice for skating, Svartlögafjärden", "photo_url": "http://www.panoramio.com/photo/348071", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/348071.jpg", "longitude": 19.021196, "latitude": 59.558766, "width": 500, "height": 375, "upload_date": "08 January 2007", "owner_id": 70471, "owner_name": "David Thyberg", "owner_url": "http://www.panoramio.com/user/70471"} + , + {"photo_id": 1408683, "photo_title": "Dragon", "photo_url": "http://www.panoramio.com/photo/1408683", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1408683.jpg", "longitude": 11.099625, "latitude": 24.203758, "width": 334, "height": 500, "upload_date": "20 March 2007", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 58293, "photo_title": "Hundeschlittenrennen in Werfenweng", "photo_url": "http://www.panoramio.com/photo/58293", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/58293.jpg", "longitude": 13.263245, "latitude": 47.465062, "width": 500, "height": 377, "upload_date": "07 October 2006", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 1488328, "photo_title": "", "photo_url": "http://www.panoramio.com/photo/1488328", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1488328.jpg", "longitude": 139.290161, "latitude": 37.860218, "width": 500, "height": 383, "upload_date": "25 March 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 5439200, "photo_title": "shinjuku", "photo_url": "http://www.panoramio.com/photo/5439200", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5439200.jpg", "longitude": 139.693281, "latitude": 35.690921, "width": 500, "height": 500, "upload_date": "20 October 2007", "owner_id": 128403, "owner_name": "mechanics", "owner_url": "http://www.panoramio.com/user/128403"} + , + {"photo_id": 86241, "photo_title": "camino", "photo_url": "http://www.panoramio.com/photo/86241", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/86241.jpg", "longitude": -1.145668, "latitude": 38.170464, "width": 333, "height": 500, "upload_date": "25 November 2006", "owner_id": 10969, "owner_name": "Juanra", "owner_url": "http://www.panoramio.com/user/10969"} + , + {"photo_id": 4757733, "photo_title": "MASSIVE WAVE", "photo_url": "http://www.panoramio.com/photo/4757733", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4757733.jpg", "longitude": -1.262569, "latitude": 44.426793, "width": 259, "height": 500, "upload_date": "19 September 2007", "owner_id": 521836, "owner_name": "KLEFER", "owner_url": "http://www.panoramio.com/user/521836"} + , + {"photo_id": 941286, "photo_title": "Mesa Arch (3x1 pano)", "photo_url": "http://www.panoramio.com/photo/941286", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/941286.jpg", "longitude": -109.863667, "latitude": 38.388159, "width": 500, "height": 181, "upload_date": "21 February 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 1284843, "photo_title": "Озеро Хангар в кратере вулкана", "photo_url": "http://www.panoramio.com/photo/1284843", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1284843.jpg", "longitude": 157.393055, "latitude": 54.764255, "width": 500, "height": 197, "upload_date": "12 March 2007", "owner_id": 268724, "owner_name": "Korotnev AV", "owner_url": "http://www.panoramio.com/user/268724"} + , + {"photo_id": 2602988, "photo_title": "The best beach of Manihi", "photo_url": "http://www.panoramio.com/photo/2602988", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2602988.jpg", "longitude": -145.847282, "latitude": -14.348134, "width": 500, "height": 333, "upload_date": "06 June 2007", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 2273013, "photo_title": "Another View of Vedra Island", "photo_url": "http://www.panoramio.com/photo/2273013", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2273013.jpg", "longitude": 1.247164, "latitude": 38.859406, "width": 500, "height": 465, "upload_date": "18 May 2007", "owner_id": 213866, "owner_name": "Nicolas Mertens", "owner_url": "http://www.panoramio.com/user/213866"} + , + {"photo_id": 8857011, "photo_title": "The Subway,Zion NP", "photo_url": "http://www.panoramio.com/photo/8857011", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8857011.jpg", "longitude": -113.055840, "latitude": 37.308741, "width": 500, "height": 375, "upload_date": "26 March 2008", "owner_id": 1465912, "owner_name": "funtor", "owner_url": "http://www.panoramio.com/user/1465912"} + , + {"photo_id": 167606, "photo_title": "Rainy Causeway Bay", "photo_url": "http://www.panoramio.com/photo/167606", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/167606.jpg", "longitude": 114.169595, "latitude": 22.293028, "width": 500, "height": 238, "upload_date": "16 December 2006", "owner_id": 31693, "owner_name": "Huw Thomas", "owner_url": "http://www.panoramio.com/user/31693"} + , + {"photo_id": 11077834, "photo_title": "In sunset", "photo_url": "http://www.panoramio.com/photo/11077834", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/11077834.jpg", "longitude": 174.865694, "latitude": -41.330162, "width": 500, "height": 357, "upload_date": "10 June 2008", "owner_id": 1248894, "owner_name": "Eva Kaprinay", "owner_url": "http://www.panoramio.com/user/1248894"} + , + {"photo_id": 10919439, "photo_title": "Majestic Møøse", "photo_url": "http://www.panoramio.com/photo/10919439", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10919439.jpg", "longitude": -110.549712, "latitude": 43.866322, "width": 500, "height": 400, "upload_date": "04 June 2008", "owner_id": 376395, "owner_name": "JeffSullivan (www.MyPhotoGuides.com)", "owner_url": "http://www.panoramio.com/user/376395"} + , + {"photo_id": 4892928, "photo_title": "tsukudajima", "photo_url": "http://www.panoramio.com/photo/4892928", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4892928.jpg", "longitude": 139.788172, "latitude": 35.672141, "width": 430, "height": 500, "upload_date": "25 September 2007", "owner_id": 128403, "owner_name": "mechanics", "owner_url": "http://www.panoramio.com/user/128403"} + , + {"photo_id": 5798660, "photo_title": "Guiding Light", "photo_url": "http://www.panoramio.com/photo/5798660", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5798660.jpg", "longitude": -111.374674, "latitude": 36.861974, "width": 333, "height": 500, "upload_date": "08 November 2007", "owner_id": 376395, "owner_name": "JeffSullivan (www.MyPhotoGuides.com)", "owner_url": "http://www.panoramio.com/user/376395"} + , + {"photo_id": 94219, "photo_title": "Bridge of Manganji", "photo_url": "http://www.panoramio.com/photo/94219", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/94219.jpg", "longitude": 137.821137, "latitude": 36.329284, "width": 500, "height": 375, "upload_date": "09 December 2006", "owner_id": 11781, "owner_name": "ANDRE GARDELLA", "owner_url": "http://www.panoramio.com/user/11781"} + , + {"photo_id": 3772695, "photo_title": "Fotomontaggio di Arquata & Andromeda", "photo_url": "http://www.panoramio.com/photo/3772695", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3772695.jpg", "longitude": 13.304100, "latitude": 42.773731, "width": 500, "height": 375, "upload_date": "07 August 2007", "owner_id": 646873, "owner_name": "Fabio Roman", "owner_url": "http://www.panoramio.com/user/646873"} + , + {"photo_id": 1314842, "photo_title": "Река Сим с моста (1729 км)", "photo_url": "http://www.panoramio.com/photo/1314842", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1314842.jpg", "longitude": 57.309623, "latitude": 55.013544, "width": 500, "height": 335, "upload_date": "14 March 2007", "owner_id": 268724, "owner_name": "Korotnev AV", "owner_url": "http://www.panoramio.com/user/268724"} + , + {"photo_id": 5333278, "photo_title": "hong kong, early evening", "photo_url": "http://www.panoramio.com/photo/5333278", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5333278.jpg", "longitude": 114.151651, "latitude": 22.280112, "width": 375, "height": 500, "upload_date": "15 October 2007", "owner_id": 90373, "owner_name": "michael habla", "owner_url": "http://www.panoramio.com/user/90373"} + , + {"photo_id": 2574624, "photo_title": "Mount Everest", "photo_url": "http://www.panoramio.com/photo/2574624", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2574624.jpg", "longitude": 86.933270, "latitude": 27.979546, "width": 500, "height": 375, "upload_date": "04 June 2007", "owner_id": 534045, "owner_name": "Lucjon", "owner_url": "http://www.panoramio.com/user/534045"} + , + {"photo_id": 160808, "photo_title": "Luquillo Beach", "photo_url": "http://www.panoramio.com/photo/160808", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/160808.jpg", "longitude": -65.677128, "latitude": 18.364871, "width": 500, "height": 375, "upload_date": "16 December 2006", "owner_id": 28766, "owner_name": "Tim Jansa", "owner_url": "http://www.panoramio.com/user/28766"} + , + {"photo_id": 2883625, "photo_title": "Sokorói impresszió", "photo_url": "http://www.panoramio.com/photo/2883625", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2883625.jpg", "longitude": 17.678204, "latitude": 47.533661, "width": 500, "height": 332, "upload_date": "22 June 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 287785, "photo_title": "Cascada Fuente del Algar © (Foto_Seb)", "photo_url": "http://www.panoramio.com/photo/287785", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/287785.jpg", "longitude": -0.095959, "latitude": 38.659359, "width": 500, "height": 332, "upload_date": "03 January 2007", "owner_id": 55833, "owner_name": "Sebastien Pigneur Jans (Outdoor Photographer) seolta@terra.es", "owner_url": "http://www.panoramio.com/user/55833"} + , + {"photo_id": 354350, "photo_title": "Bondhus icefall up close", "photo_url": "http://www.panoramio.com/photo/354350", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/354350.jpg", "longitude": 6.296539, "latitude": 60.071436, "width": 500, "height": 332, "upload_date": "09 January 2007", "owner_id": 39160, "owner_name": "Snemann", "owner_url": "http://www.panoramio.com/user/39160"} + , + {"photo_id": 3625784, "photo_title": "P.N.P.J.(Croacia)", "photo_url": "http://www.panoramio.com/photo/3625784", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3625784.jpg", "longitude": 15.612602, "latitude": 44.883911, "width": 500, "height": 375, "upload_date": "30 July 2007", "owner_id": 83865, "owner_name": "Epi F.Villanueva", "owner_url": "http://www.panoramio.com/user/83865"} + , + {"photo_id": 4866107, "photo_title": "Milkdrop sunset", "photo_url": "http://www.panoramio.com/photo/4866107", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4866107.jpg", "longitude": 16.693897, "latitude": 43.183338, "width": 334, "height": 500, "upload_date": "24 September 2007", "owner_id": 989, "owner_name": "Mrgud", "owner_url": "http://www.panoramio.com/user/989"} + , + {"photo_id": 5217595, "photo_title": "kolory...", "photo_url": "http://www.panoramio.com/photo/5217595", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5217595.jpg", "longitude": 17.990541, "latitude": 54.253292, "width": 375, "height": 500, "upload_date": "10 October 2007", "owner_id": 277750, "owner_name": "Karolina P.", "owner_url": "http://www.panoramio.com/user/277750"} + , + {"photo_id": 1235515, "photo_title": "Gangga sunset", "photo_url": "http://www.panoramio.com/photo/1235515", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1235515.jpg", "longitude": 115.063634, "latitude": -8.586962, "width": 332, "height": 500, "upload_date": "09 March 2007", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 88143, "photo_title": "Anse Cocos - La Digue - Seychelles", "photo_url": "http://www.panoramio.com/photo/88143", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/88143.jpg", "longitude": 55.850029, "latitude": -4.365924, "width": 500, "height": 375, "upload_date": "28 November 2006", "owner_id": 11098, "owner_name": "Michele Masnata", "owner_url": "http://www.panoramio.com/user/11098"} + , + {"photo_id": 993105, "photo_title": "Dinos", "photo_url": "http://www.panoramio.com/photo/993105", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/993105.jpg", "longitude": 47.267990, "latitude": 34.392321, "width": 432, "height": 500, "upload_date": "24 February 2007", "owner_id": 83972, "owner_name": "Maxim Popov (http://www.popovm.ru)", "owner_url": "http://www.panoramio.com/user/83972"} + , + {"photo_id": 3382098, "photo_title": "Golden sunset", "photo_url": "http://www.panoramio.com/photo/3382098", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3382098.jpg", "longitude": -9.231960, "latitude": 38.652899, "width": 500, "height": 375, "upload_date": "18 July 2007", "owner_id": 465080, "owner_name": "Vasco Pires", "owner_url": "http://www.panoramio.com/user/465080"} + , + {"photo_id": 4689747, "photo_title": "La disipación de un ensueño", "photo_url": "http://www.panoramio.com/photo/4689747", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4689747.jpg", "longitude": -73.231199, "latitude": -39.817288, "width": 500, "height": 375, "upload_date": "16 September 2007", "owner_id": 327310, "owner_name": "Erwin Woenckhaus", "owner_url": "http://www.panoramio.com/user/327310"} + , + {"photo_id": 2520917, "photo_title": "Két vihar közt alkonyatkor", "photo_url": "http://www.panoramio.com/photo/2520917", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2520917.jpg", "longitude": 17.514782, "latitude": 47.747057, "width": 500, "height": 334, "upload_date": "02 June 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 419927, "photo_title": "echigoheiya", "photo_url": "http://www.panoramio.com/photo/419927", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/419927.jpg", "longitude": 138.885427, "latitude": 37.568562, "width": 500, "height": 334, "upload_date": "14 January 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 1977433, "photo_title": "Victoria Falls, devils cauldron natural hot tub at lip of falls", "photo_url": "http://www.panoramio.com/photo/1977433", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1977433.jpg", "longitude": 25.853426, "latitude": -17.923924, "width": 500, "height": 375, "upload_date": "29 April 2007", "owner_id": 165455, "owner_name": "snorth", "owner_url": "http://www.panoramio.com/user/165455"} + , + {"photo_id": 3417691, "photo_title": "Völgy-Zugoly", "photo_url": "http://www.panoramio.com/photo/3417691", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3417691.jpg", "longitude": 17.826734, "latitude": 47.359293, "width": 500, "height": 346, "upload_date": "20 July 2007", "owner_id": 689769, "owner_name": "Ponty István", "owner_url": "http://www.panoramio.com/user/689769"} + , + {"photo_id": 4166241, "photo_title": "Egy másik világ", "photo_url": "http://www.panoramio.com/photo/4166241", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4166241.jpg", "longitude": 18.056545, "latitude": 47.276667, "width": 333, "height": 500, "upload_date": "25 August 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 3976033, "photo_title": "Sunrise Blüemlisalp Switzerland", "photo_url": "http://www.panoramio.com/photo/3976033", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3976033.jpg", "longitude": 7.779844, "latitude": 46.528974, "width": 500, "height": 333, "upload_date": "16 August 2007", "owner_id": 47930, "owner_name": "werni", "owner_url": "http://www.panoramio.com/user/47930"} + , + {"photo_id": 1449570, "photo_title": "Akabat", "photo_url": "http://www.panoramio.com/photo/1449570", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1449570.jpg", "longitude": 28.286717, "latitude": 27.484675, "width": 500, "height": 304, "upload_date": "22 March 2007", "owner_id": 304324, "owner_name": "OxyPhoto.ru - O x y", "owner_url": "http://www.panoramio.com/user/304324"} + , + {"photo_id": 8802, "photo_title": "Statue of Liberty [003393]", "photo_url": "http://www.panoramio.com/photo/8802", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8802.jpg", "longitude": -74.044375, "latitude": 40.688871, "width": 500, "height": 375, "upload_date": "27 January 2006", "owner_id": 1489, "owner_name": "Thorsten", "owner_url": "http://www.panoramio.com/user/1489"} + , + {"photo_id": 6015859, "photo_title": "Amazing place to drink ouzo", "photo_url": "http://www.panoramio.com/photo/6015859", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6015859.jpg", "longitude": 23.057030, "latitude": 36.687990, "width": 500, "height": 333, "upload_date": "19 November 2007", "owner_id": 242446, "owner_name": "Ntinos Lagos", "owner_url": "http://www.panoramio.com/user/242446"} + , + {"photo_id": 653941, "photo_title": "Mt. Moran across Jackson Lake", "photo_url": "http://www.panoramio.com/photo/653941", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/653941.jpg", "longitude": -110.656099, "latitude": 43.897336, "width": 500, "height": 374, "upload_date": "02 February 2007", "owner_id": 87752, "owner_name": "Richard Ryer", "owner_url": "http://www.panoramio.com/user/87752"} + , + {"photo_id": 354695, "photo_title": "Dresden_Zwinger_01", "photo_url": "http://www.panoramio.com/photo/354695", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/354695.jpg", "longitude": 13.734369, "latitude": 51.053481, "width": 399, "height": 500, "upload_date": "09 January 2007", "owner_id": 71628, "owner_name": "Ulrich Hässler, Dresden", "owner_url": "http://www.panoramio.com/user/71628"} + , + {"photo_id": 8327051, "photo_title": "Anelito di .... luce", "photo_url": "http://www.panoramio.com/photo/8327051", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8327051.jpg", "longitude": 13.717203, "latitude": 45.699706, "width": 500, "height": 375, "upload_date": "06 March 2008", "owner_id": 1121720, "owner_name": "▬ Mauro Antonini ▬", "owner_url": "http://www.panoramio.com/user/1121720"} + , + {"photo_id": 522126, "photo_title": "Íme a ludas hogy Márton lemaradt", "photo_url": "http://www.panoramio.com/photo/522126", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/522126.jpg", "longitude": 16.855431, "latitude": 47.653594, "width": 500, "height": 319, "upload_date": "21 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 3948179, "photo_title": " petit matin en Vendée, sur la rive droite du Jaunay, 11 août 2007. #921, 933", "photo_url": "http://www.panoramio.com/photo/3948179", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3948179.jpg", "longitude": -1.901278, "latitude": 46.663487, "width": 500, "height": 343, "upload_date": "15 August 2007", "owner_id": 666755, "owner_name": "Armagnac", "owner_url": "http://www.panoramio.com/user/666755"} + , + {"photo_id": 1781399, "photo_title": "Dawn in Yosemite Valley", "photo_url": "http://www.panoramio.com/photo/1781399", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1781399.jpg", "longitude": -119.590645, "latitude": 37.743775, "width": 333, "height": 500, "upload_date": "15 April 2007", "owner_id": 376395, "owner_name": "JeffSullivan (www.MyPhotoGuides.com)", "owner_url": "http://www.panoramio.com/user/376395"} + , + {"photo_id": 905112, "photo_title": "Searea buildings in Odaiba", "photo_url": "http://www.panoramio.com/photo/905112", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/905112.jpg", "longitude": 139.773039, "latitude": 35.635670, "width": 500, "height": 372, "upload_date": "19 February 2007", "owner_id": 78856, "owner_name": "chrisjongkind • archive", "owner_url": "http://www.panoramio.com/user/78856"} + , + {"photo_id": 6935706, "photo_title": "poranek w ogniu - morning on fire", "photo_url": "http://www.panoramio.com/photo/6935706", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6935706.jpg", "longitude": 20.319901, "latitude": 49.730028, "width": 500, "height": 332, "upload_date": "06 January 2008", "owner_id": 454219, "owner_name": "Rafal Ociepka", "owner_url": "http://www.panoramio.com/user/454219"} + , + {"photo_id": 29606, "photo_title": "Romance entre el Agua y la Roca", "photo_url": "http://www.panoramio.com/photo/29606", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/29606.jpg", "longitude": -64.859161, "latitude": -31.991480, "width": 500, "height": 375, "upload_date": "01 July 2006", "owner_id": 4483, "owner_name": "Miguel Coranti", "owner_url": "http://www.panoramio.com/user/4483"} + , + {"photo_id": 58290, "photo_title": "Taurachbahn", "photo_url": "http://www.panoramio.com/photo/58290", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/58290.jpg", "longitude": 13.688021, "latitude": 47.130418, "width": 500, "height": 369, "upload_date": "07 October 2006", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 44982, "photo_title": "Paris200412PJDSC_9304l", "photo_url": "http://www.panoramio.com/photo/44982", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/44982.jpg", "longitude": 2.301636, "latitude": 48.853760, "width": 500, "height": 332, "upload_date": "02 September 2006", "owner_id": 6703, "owner_name": "Peter Jansen", "owner_url": "http://www.panoramio.com/user/6703"} + , + {"photo_id": 532669, "photo_title": "Closeup of wheatfield in november", "photo_url": "http://www.panoramio.com/photo/532669", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/532669.jpg", "longitude": 11.276093, "latitude": 59.644239, "width": 375, "height": 500, "upload_date": "22 January 2007", "owner_id": 39160, "owner_name": "Snemann", "owner_url": "http://www.panoramio.com/user/39160"} + , + {"photo_id": 723648, "photo_title": "Elk near Jasper", "photo_url": "http://www.panoramio.com/photo/723648", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/723648.jpg", "longitude": -118.046207, "latitude": 52.923290, "width": 500, "height": 332, "upload_date": "07 February 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 535234, "photo_title": "Cathedral Cove near Hahei, New Zealand", "photo_url": "http://www.panoramio.com/photo/535234", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/535234.jpg", "longitude": 175.790222, "latitude": -36.828611, "width": 500, "height": 375, "upload_date": "22 January 2007", "owner_id": 101257, "owner_name": "Denis Campbell", "owner_url": "http://www.panoramio.com/user/101257"} + , + {"photo_id": 15299, "photo_title": "Bodrum Sunset", "photo_url": "http://www.panoramio.com/photo/15299", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/15299.jpg", "longitude": 27.425308, "latitude": 37.028595, "width": 500, "height": 375, "upload_date": "19 March 2006", "owner_id": 2351, "owner_name": "Serdar Bilecen", "owner_url": "http://www.panoramio.com/user/2351"} + , + {"photo_id": 1932227, "photo_title": "Mono Lake 3", "photo_url": "http://www.panoramio.com/photo/1932227", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1932227.jpg", "longitude": -119.023819, "latitude": 37.940068, "width": 333, "height": 500, "upload_date": "26 April 2007", "owner_id": 40260, "owner_name": "Don Albonico", "owner_url": "http://www.panoramio.com/user/40260"} + , + {"photo_id": 744906, "photo_title": "Tsukahara Highland", "photo_url": "http://www.panoramio.com/photo/744906", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/744906.jpg", "longitude": 131.403952, "latitude": 33.320201, "width": 500, "height": 375, "upload_date": "08 February 2007", "owner_id": 11781, "owner_name": "ANDRE GARDELLA", "owner_url": "http://www.panoramio.com/user/11781"} + , + {"photo_id": 490198, "photo_title": "Jal Mahal, Jaipur", "photo_url": "http://www.panoramio.com/photo/490198", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/490198.jpg", "longitude": 75.842797, "latitude": 26.954571, "width": 500, "height": 403, "upload_date": "19 January 2007", "owner_id": 10456, "owner_name": "eulogio", "owner_url": "http://www.panoramio.com/user/10456"} + , + {"photo_id": 451032, "photo_title": "Mono Lake", "photo_url": "http://www.panoramio.com/photo/451032", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/451032.jpg", "longitude": -119.017537, "latitude": 37.941803, "width": 363, "height": 500, "upload_date": "16 January 2007", "owner_id": 93560, "owner_name": "Alex Petrov", "owner_url": "http://www.panoramio.com/user/93560"} + , + {"photo_id": 5808345, "photo_title": "Majesty in the snow", "photo_url": "http://www.panoramio.com/photo/5808345", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5808345.jpg", "longitude": 9.944987, "latitude": 48.684866, "width": 367, "height": 500, "upload_date": "09 November 2007", "owner_id": 424589, "owner_name": "PeSchn", "owner_url": "http://www.panoramio.com/user/424589"} + , + {"photo_id": 2718436, "photo_title": "BKCC view northwest", "photo_url": "http://www.panoramio.com/photo/2718436", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2718436.jpg", "longitude": 139.752048, "latitude": 35.708102, "width": 500, "height": 365, "upload_date": "12 June 2007", "owner_id": 558055, "owner_name": "www.tokyoform.com", "owner_url": "http://www.panoramio.com/user/558055"} + , + {"photo_id": 5446639, "photo_title": "Осень", "photo_url": "http://www.panoramio.com/photo/5446639", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5446639.jpg", "longitude": 23.824694, "latitude": 53.680547, "width": 500, "height": 375, "upload_date": "21 October 2007", "owner_id": 937915, "owner_name": "HiV", "owner_url": "http://www.panoramio.com/user/937915"} + , + {"photo_id": 3393267, "photo_title": "Barco hundido (pecio) /Shipwreck /épave ", "photo_url": "http://www.panoramio.com/photo/3393267", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3393267.jpg", "longitude": -81.680587, "latitude": 45.255181, "width": 329, "height": 500, "upload_date": "18 July 2007", "owner_id": 401966, "owner_name": "Syl de Canada", "owner_url": "http://www.panoramio.com/user/401966"} + , + {"photo_id": 4369140, "photo_title": "Beach on Håja", "photo_url": "http://www.panoramio.com/photo/4369140", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4369140.jpg", "longitude": 18.096886, "latitude": 69.740825, "width": 500, "height": 375, "upload_date": "03 September 2007", "owner_id": 39160, "owner_name": "Snemann", "owner_url": "http://www.panoramio.com/user/39160"} + , + {"photo_id": 3711738, "photo_title": "Safe", "photo_url": "http://www.panoramio.com/photo/3711738", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3711738.jpg", "longitude": 1.787220, "latitude": 41.224610, "width": 500, "height": 375, "upload_date": "04 August 2007", "owner_id": 138691, "owner_name": "Josep Maria Alegre", "owner_url": "http://www.panoramio.com/user/138691"} + , + {"photo_id": 7415554, "photo_title": "Sunrise at Hae-keum-gang, Korea", "photo_url": "http://www.panoramio.com/photo/7415554", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7415554.jpg", "longitude": 128.605957, "latitude": 34.698719, "width": 500, "height": 500, "upload_date": "28 January 2008", "owner_id": 1221287, "owner_name": "TS Jeung", "owner_url": "http://www.panoramio.com/user/1221287"} + , + {"photo_id": 10129080, "photo_title": "Polish Silesia sunset.", "photo_url": "http://www.panoramio.com/photo/10129080", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10129080.jpg", "longitude": 18.819752, "latitude": 49.789798, "width": 500, "height": 335, "upload_date": "11 May 2008", "owner_id": 548131, "owner_name": "murart", "owner_url": "http://www.panoramio.com/user/548131"} + , + {"photo_id": 11827263, "photo_title": ": Casa Rustica", "photo_url": "http://www.panoramio.com/photo/11827263", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/11827263.jpg", "longitude": -8.644395, "latitude": 42.795039, "width": 500, "height": 375, "upload_date": "05 July 2008", "owner_id": 546858, "owner_name": "Lazariparcero", "owner_url": "http://www.panoramio.com/user/546858"} + , + {"photo_id": 9185096, "photo_title": "E per cambiare... oggi è nevicato ! 07.04.2008", "photo_url": "http://www.panoramio.com/photo/9185096", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9185096.jpg", "longitude": 11.469633, "latitude": 46.304547, "width": 500, "height": 375, "upload_date": "07 April 2008", "owner_id": 6033, "owner_name": "► Marco Vanzo", "owner_url": "http://www.panoramio.com/user/6033"} + , + {"photo_id": 691, "photo_title": "Monasterio de Santa Catalina. Arequipa, Perú", "photo_url": "http://www.panoramio.com/photo/691", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/691.jpg", "longitude": -71.536671, "latitude": -16.395835, "width": 500, "height": 375, "upload_date": "05 October 2005", "owner_id": 7, "owner_name": "Eduardo Manchón", "owner_url": "http://www.panoramio.com/user/7"} + , + {"photo_id": 672525, "photo_title": "Pyramid", "photo_url": "http://www.panoramio.com/photo/672525", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/672525.jpg", "longitude": 31.132421, "latitude": 29.978283, "width": 500, "height": 474, "upload_date": "03 February 2007", "owner_id": 123698, "owner_name": "© Kojak", "owner_url": "http://www.panoramio.com/user/123698"} + , + {"photo_id": 275730, "photo_title": "Oberalp - 2033 m", "photo_url": "http://www.panoramio.com/photo/275730", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/275730.jpg", "longitude": 8.668191, "latitude": 46.661528, "width": 500, "height": 333, "upload_date": "01 January 2007", "owner_id": 57869, "owner_name": "NAGY Albert", "owner_url": "http://www.panoramio.com/user/57869"} + , + {"photo_id": 3661332, "photo_title": "Angkor - Temple vs Trees", "photo_url": "http://www.panoramio.com/photo/3661332", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3661332.jpg", "longitude": 103.855079, "latitude": 13.449099, "width": 500, "height": 461, "upload_date": "01 August 2007", "owner_id": 73104, "owner_name": "zerega", "owner_url": "http://www.panoramio.com/user/73104"} + , + {"photo_id": 336151, "photo_title": "Lake north of Tupaassat", "photo_url": "http://www.panoramio.com/photo/336151", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/336151.jpg", "longitude": -44.307861, "latitude": 60.376030, "width": 500, "height": 333, "upload_date": "07 January 2007", "owner_id": 62557, "owner_name": "Dirk Jenrich", "owner_url": "http://www.panoramio.com/user/62557"} + , + {"photo_id": 423705, "photo_title": "Bouche du Pu`u `Ō`ō", "photo_url": "http://www.panoramio.com/photo/423705", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/423705.jpg", "longitude": -155.106182, "latitude": 19.390101, "width": 500, "height": 349, "upload_date": "14 January 2007", "owner_id": 75602, "owner_name": "Lloulhy", "owner_url": "http://www.panoramio.com/user/75602"} + , + {"photo_id": 1344795, "photo_title": "Tree in a field, Aerial", "photo_url": "http://www.panoramio.com/photo/1344795", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1344795.jpg", "longitude": 12.058611, "latitude": 55.471581, "width": 500, "height": 332, "upload_date": "16 March 2007", "owner_id": 278074, "owner_name": "H. C. Steensen", "owner_url": "http://www.panoramio.com/user/278074"} + , + {"photo_id": 5591839, "photo_title": "Can I touch the clouds?", "photo_url": "http://www.panoramio.com/photo/5591839", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5591839.jpg", "longitude": 130.689411, "latitude": 33.305569, "width": 333, "height": 500, "upload_date": "28 October 2007", "owner_id": 775356, "owner_name": "ascesis.image", "owner_url": "http://www.panoramio.com/user/775356"} + , + {"photo_id": 5476386, "photo_title": "Nuages crépusculaires sur le Lauterbrunnental", "photo_url": "http://www.panoramio.com/photo/5476386", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5476386.jpg", "longitude": 7.908010, "latitude": 46.592490, "width": 500, "height": 375, "upload_date": "22 October 2007", "owner_id": 359127, "owner_name": "wx", "owner_url": "http://www.panoramio.com/user/359127"} + , + {"photo_id": 459556, "photo_title": "minatopia", "photo_url": "http://www.panoramio.com/photo/459556", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/459556.jpg", "longitude": 139.058182, "latitude": 37.930041, "width": 381, "height": 500, "upload_date": "16 January 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 1407525, "photo_title": "Mackinac Bridge, Michigan", "photo_url": "http://www.panoramio.com/photo/1407525", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1407525.jpg", "longitude": -84.729652, "latitude": 45.788250, "width": 500, "height": 313, "upload_date": "20 March 2007", "owner_id": 60173, "owner_name": "Lars Jensen", "owner_url": "http://www.panoramio.com/user/60173"} + , + {"photo_id": 74790, "photo_title": "kang taiga with moon in sunset", "photo_url": "http://www.panoramio.com/photo/74790", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/74790.jpg", "longitude": 86.830101, "latitude": 27.811750, "width": 500, "height": 334, "upload_date": "03 November 2006", "owner_id": 9812, "owner_name": "wsm earp", "owner_url": "http://www.panoramio.com/user/9812"} + , + {"photo_id": 4025902, "photo_title": "Coloured Poznań ", "photo_url": "http://www.panoramio.com/photo/4025902", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4025902.jpg", "longitude": 16.934255, "latitude": 52.407878, "width": 500, "height": 316, "upload_date": "19 August 2007", "owner_id": 369127, "owner_name": "♥ Caterpillar", "owner_url": "http://www.panoramio.com/user/369127"} + , + {"photo_id": 88121, "photo_title": "View from Punta Martin - Liguria - Italy", "photo_url": "http://www.panoramio.com/photo/88121", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/88121.jpg", "longitude": 8.795028, "latitude": 44.468489, "width": 500, "height": 375, "upload_date": "28 November 2006", "owner_id": 11098, "owner_name": "Michele Masnata", "owner_url": "http://www.panoramio.com/user/11098"} + , + {"photo_id": 8214845, "photo_title": "Molino Albolafia,cauce del Guadalquivir(Córdoba)", "photo_url": "http://www.panoramio.com/photo/8214845", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8214845.jpg", "longitude": -4.780898, "latitude": 37.876242, "width": 500, "height": 375, "upload_date": "01 March 2008", "owner_id": 83865, "owner_name": "Epi F.Villanueva", "owner_url": "http://www.panoramio.com/user/83865"} + , + {"photo_id": 23364, "photo_title": "Alanya, Taurus-Mountains of Kemer", "photo_url": "http://www.panoramio.com/photo/23364", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/23364.jpg", "longitude": 31.979656, "latitude": 36.548466, "width": 500, "height": 375, "upload_date": "10 June 2006", "owner_id": 3760, "owner_name": "Frank Pustlauck", "owner_url": "http://www.panoramio.com/user/3760"} + , + {"photo_id": 6128452, "photo_title": "В осеннем парке - In autumn park", "photo_url": "http://www.panoramio.com/photo/6128452", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6128452.jpg", "longitude": 37.458926, "latitude": 55.737422, "width": 500, "height": 500, "upload_date": "25 November 2007", "owner_id": 244932, "owner_name": "Andrey Jitkov", "owner_url": "http://www.panoramio.com/user/244932"} + , + {"photo_id": 4356679, "photo_title": "Old Santa Fe Caboose", "photo_url": "http://www.panoramio.com/photo/4356679", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4356679.jpg", "longitude": -119.699687, "latitude": 36.707083, "width": 500, "height": 335, "upload_date": "03 September 2007", "owner_id": 339677, "owner_name": "Chip Stephan", "owner_url": "http://www.panoramio.com/user/339677"} + , + {"photo_id": 436312, "photo_title": "tokimesse", "photo_url": "http://www.panoramio.com/photo/436312", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/436312.jpg", "longitude": 139.059105, "latitude": 37.932013, "width": 396, "height": 500, "upload_date": "15 January 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 1089381, "photo_title": "Szabadon szélben", "photo_url": "http://www.panoramio.com/photo/1089381", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1089381.jpg", "longitude": 17.604561, "latitude": 47.588799, "width": 332, "height": 500, "upload_date": "28 February 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 5667175, "photo_title": "Northen Lights", "photo_url": "http://www.panoramio.com/photo/5667175", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5667175.jpg", "longitude": 28.482399, "latitude": 66.227860, "width": 500, "height": 333, "upload_date": "01 November 2007", "owner_id": 897591, "owner_name": "markku pirttimaa www.karhukuusamo.com", "owner_url": "http://www.panoramio.com/user/897591"} + , + {"photo_id": 1317737, "photo_title": "Bora Bora", "photo_url": "http://www.panoramio.com/photo/1317737", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1317737.jpg", "longitude": -151.739988, "latitude": -16.538715, "width": 500, "height": 351, "upload_date": "14 March 2007", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 993129, "photo_title": "Würzburg", "photo_url": "http://www.panoramio.com/photo/993129", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/993129.jpg", "longitude": 9.931523, "latitude": 49.793310, "width": 500, "height": 395, "upload_date": "24 February 2007", "owner_id": 83972, "owner_name": "Maxim Popov (http://www.popovm.ru)", "owner_url": "http://www.panoramio.com/user/83972"} + , + {"photo_id": 1836922, "photo_title": "Fountain Place / Dallas / Texas", "photo_url": "http://www.panoramio.com/photo/1836922", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1836922.jpg", "longitude": -96.802940, "latitude": 32.785236, "width": 500, "height": 405, "upload_date": "19 April 2007", "owner_id": 57778, "owner_name": "William Lile", "owner_url": "http://www.panoramio.com/user/57778"} + , + {"photo_id": 3409786, "photo_title": "Molinos de Elguea con Gorbea al fondo", "photo_url": "http://www.panoramio.com/photo/3409786", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3409786.jpg", "longitude": -2.325025, "latitude": 42.951271, "width": 500, "height": 303, "upload_date": "19 July 2007", "owner_id": 129297, "owner_name": "Enrique Ortiz de Zárate", "owner_url": "http://www.panoramio.com/user/129297"} + , + {"photo_id": 476284, "photo_title": "Place \"Poda\"", "photo_url": "http://www.panoramio.com/photo/476284", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/476284.jpg", "longitude": 27.471657, "latitude": 42.447655, "width": 500, "height": 357, "upload_date": "18 January 2007", "owner_id": 16880, "owner_name": "evgenidinev.com", "owner_url": "http://www.panoramio.com/user/16880"} + , + {"photo_id": 3499645, "photo_title": "Tükör-kép", "photo_url": "http://www.panoramio.com/photo/3499645", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3499645.jpg", "longitude": 17.503667, "latitude": 47.843522, "width": 500, "height": 333, "upload_date": "24 July 2007", "owner_id": 689769, "owner_name": "Ponty István", "owner_url": "http://www.panoramio.com/user/689769"} + , + {"photo_id": 1419901, "photo_title": "Øresundsbroen seen from Sweden (The Dragon Tail), Aerial", "photo_url": "http://www.panoramio.com/photo/1419901", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1419901.jpg", "longitude": 12.885418, "latitude": 55.566213, "width": 332, "height": 500, "upload_date": "20 March 2007", "owner_id": 278074, "owner_name": "H. C. Steensen", "owner_url": "http://www.panoramio.com/user/278074"} + , + {"photo_id": 441727, "photo_title": "Фортеця у Кам'янці-Подільському", "photo_url": "http://www.panoramio.com/photo/441727", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/441727.jpg", "longitude": 26.563311, "latitude": 48.672486, "width": 375, "height": 500, "upload_date": "15 January 2007", "owner_id": 13058, "owner_name": "Kyryl", "owner_url": "http://www.panoramio.com/user/13058"} + , + {"photo_id": 309122, "photo_title": "Standing Stone, Spittal of Glenshee", "photo_url": "http://www.panoramio.com/photo/309122", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/309122.jpg", "longitude": -3.461593, "latitude": 56.814745, "width": 500, "height": 332, "upload_date": "05 January 2007", "owner_id": 64815, "owner_name": "PigleT", "owner_url": "http://www.panoramio.com/user/64815"} + , + {"photo_id": 2599560, "photo_title": "Isigaki Island Hirakubosaki lighthouse 石垣島 平久保崎灯台", "photo_url": "http://www.panoramio.com/photo/2599560", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2599560.jpg", "longitude": 124.315994, "latitude": 24.610064, "width": 500, "height": 328, "upload_date": "06 June 2007", "owner_id": 446937, "owner_name": "y_komatsu", "owner_url": "http://www.panoramio.com/user/446937"} + , + {"photo_id": 6545801, "photo_title": "Front Range of the Canadian Rocky Mountains", "photo_url": "http://www.panoramio.com/photo/6545801", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6545801.jpg", "longitude": -115.248213, "latitude": 51.026389, "width": 500, "height": 338, "upload_date": "18 December 2007", "owner_id": 85489, "owner_name": "Bruce MacIver", "owner_url": "http://www.panoramio.com/user/85489"} + , + {"photo_id": 1254026, "photo_title": "Hagia Sophia (inside)", "photo_url": "http://www.panoramio.com/photo/1254026", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1254026.jpg", "longitude": 28.979831, "latitude": 41.008548, "width": 500, "height": 408, "upload_date": "10 March 2007", "owner_id": 258322, "owner_name": "www.tatjana.ingold.ch", "owner_url": "http://www.panoramio.com/user/258322"} + , + {"photo_id": 911501, "photo_title": "View from Nordenskiöldtoppen, Svalbard", "photo_url": "http://www.panoramio.com/photo/911501", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/911501.jpg", "longitude": 15.402832, "latitude": 78.184088, "width": 500, "height": 308, "upload_date": "20 February 2007", "owner_id": 66734, "owner_name": "Svein Solhaug", "owner_url": "http://www.panoramio.com/user/66734"} + , + {"photo_id": 3797140, "photo_title": "Mas Francesc", "photo_url": "http://www.panoramio.com/photo/3797140", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3797140.jpg", "longitude": 2.408388, "latitude": 41.962346, "width": 500, "height": 332, "upload_date": "08 August 2007", "owner_id": 756267, "owner_name": "Albert Codina", "owner_url": "http://www.panoramio.com/user/756267"} + , + {"photo_id": 150165, "photo_title": "Aso crater from the air", "photo_url": "http://www.panoramio.com/photo/150165", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/150165.jpg", "longitude": 131.083159, "latitude": 32.885390, "width": 500, "height": 375, "upload_date": "14 December 2006", "owner_id": 11781, "owner_name": "ANDRE GARDELLA", "owner_url": "http://www.panoramio.com/user/11781"} + , + {"photo_id": 532631, "photo_title": "Last bath in Oslofjorden - self portrait", "photo_url": "http://www.panoramio.com/photo/532631", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/532631.jpg", "longitude": 10.782223, "latitude": 59.854773, "width": 500, "height": 205, "upload_date": "22 January 2007", "owner_id": 39160, "owner_name": "Snemann", "owner_url": "http://www.panoramio.com/user/39160"} + , + {"photo_id": 3978149, "photo_title": "Les Mines 3", "photo_url": "http://www.panoramio.com/photo/3978149", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3978149.jpg", "longitude": 1.315312, "latitude": 45.921961, "width": 500, "height": 500, "upload_date": "16 August 2007", "owner_id": 372189, "owner_name": "Phil©", "owner_url": "http://www.panoramio.com/user/372189"} + , + {"photo_id": 848807, "photo_title": "mystic morning", "photo_url": "http://www.panoramio.com/photo/848807", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/848807.jpg", "longitude": 10.144372, "latitude": 54.323031, "width": 375, "height": 500, "upload_date": "17 February 2007", "owner_id": 73946, "owner_name": "pembo", "owner_url": "http://www.panoramio.com/user/73946"} + , + {"photo_id": 4097972, "photo_title": "Dry Land", "photo_url": "http://www.panoramio.com/photo/4097972", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4097972.jpg", "longitude": 25.936694, "latitude": 41.660906, "width": 500, "height": 333, "upload_date": "22 August 2007", "owner_id": 16880, "owner_name": "evgenidinev.com", "owner_url": "http://www.panoramio.com/user/16880"} + , + {"photo_id": 479927, "photo_title": "Monterosso at night", "photo_url": "http://www.panoramio.com/photo/479927", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/479927.jpg", "longitude": 9.655094, "latitude": 44.144461, "width": 500, "height": 357, "upload_date": "18 January 2007", "owner_id": 100907, "owner_name": "Julia Wahl", "owner_url": "http://www.panoramio.com/user/100907"} + , + {"photo_id": 50872, "photo_title": "Düne 40 auf dem Weg nach Sossusvlei ...", "photo_url": "http://www.panoramio.com/photo/50872", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/50872.jpg", "longitude": 15.593033, "latitude": -24.720950, "width": 500, "height": 192, "upload_date": "22 September 2006", "owner_id": 7434, "owner_name": "baldinger reisen ag, waedenswil/switzerland", "owner_url": "http://www.panoramio.com/user/7434"} + , + {"photo_id": 2903483, "photo_title": "Reggeli", "photo_url": "http://www.panoramio.com/photo/2903483", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2903483.jpg", "longitude": 17.469549, "latitude": 47.868977, "width": 410, "height": 500, "upload_date": "23 June 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 4226249, "photo_title": "Rainbow", "photo_url": "http://www.panoramio.com/photo/4226249", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4226249.jpg", "longitude": 9.615569, "latitude": 62.529150, "width": 500, "height": 230, "upload_date": "27 August 2007", "owner_id": 223406, "owner_name": "Sigmund Rise", "owner_url": "http://www.panoramio.com/user/223406"} + , + {"photo_id": 2267849, "photo_title": "Rayos vistos desde mi ventana", "photo_url": "http://www.panoramio.com/photo/2267849", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2267849.jpg", "longitude": -89.203963, "latitude": 13.728734, "width": 500, "height": 375, "upload_date": "17 May 2007", "owner_id": 170919, "owner_name": "Wilber Calderón - El Salvador", "owner_url": "http://www.panoramio.com/user/170919"} + , + {"photo_id": 459470, "photo_title": "bandaibashi4", "photo_url": "http://www.panoramio.com/photo/459470", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/459470.jpg", "longitude": 139.051123, "latitude": 37.919081, "width": 500, "height": 399, "upload_date": "16 January 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 5279707, "photo_title": "Jægervasstindane", "photo_url": "http://www.panoramio.com/photo/5279707", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5279707.jpg", "longitude": 19.651279, "latitude": 69.771296, "width": 500, "height": 375, "upload_date": "13 October 2007", "owner_id": 39160, "owner_name": "Snemann", "owner_url": "http://www.panoramio.com/user/39160"} + , + {"photo_id": 1057758, "photo_title": "Giant dragonfly in rice field", "photo_url": "http://www.panoramio.com/photo/1057758", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1057758.jpg", "longitude": 137.115641, "latitude": 34.862834, "width": 500, "height": 375, "upload_date": "27 February 2007", "owner_id": 11781, "owner_name": "ANDRE GARDELLA", "owner_url": "http://www.panoramio.com/user/11781"} + , + {"photo_id": 479454, "photo_title": "Morning sun over lake Øymarksjøen", "photo_url": "http://www.panoramio.com/photo/479454", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/479454.jpg", "longitude": 11.637611, "latitude": 59.338617, "width": 333, "height": 500, "upload_date": "18 January 2007", "owner_id": 39160, "owner_name": "Snemann", "owner_url": "http://www.panoramio.com/user/39160"} + , + {"photo_id": 87263, "photo_title": "Payun - Mendoza - Argentina", "photo_url": "http://www.panoramio.com/photo/87263", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/87263.jpg", "longitude": -69.280128, "latitude": -36.643080, "width": 500, "height": 333, "upload_date": "27 November 2006", "owner_id": 8409, "owner_name": "Hector Fabian Garrido", "owner_url": "http://www.panoramio.com/user/8409"} + , + {"photo_id": 11430112, "photo_title": "Tramonto dalla Pietra Parcellara", "photo_url": "http://www.panoramio.com/photo/11430112", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/11430112.jpg", "longitude": 9.476480, "latitude": 44.843334, "width": 500, "height": 375, "upload_date": "22 June 2008", "owner_id": 22921, "owner_name": "Francesco Favalesi - VAL LURETTA", "owner_url": "http://www.panoramio.com/user/22921"} + , + {"photo_id": 33760, "photo_title": "Yu Yuan Gardens", "photo_url": "http://www.panoramio.com/photo/33760", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/33760.jpg", "longitude": 121.487803, "latitude": 31.228821, "width": 500, "height": 375, "upload_date": "21 July 2006", "owner_id": 5168, "owner_name": "Markus Källander", "owner_url": "http://www.panoramio.com/user/5168"} + , + {"photo_id": 1935332, "photo_title": "Lafayette", "photo_url": "http://www.panoramio.com/photo/1935332", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1935332.jpg", "longitude": 2.311839, "latitude": 48.864475, "width": 384, "height": 500, "upload_date": "26 April 2007", "owner_id": 372189, "owner_name": "Phil©", "owner_url": "http://www.panoramio.com/user/372189"} + , + {"photo_id": 2558954, "photo_title": "Two Thumbs Morning", "photo_url": "http://www.panoramio.com/photo/2558954", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2558954.jpg", "longitude": 170.463352, "latitude": -43.999792, "width": 500, "height": 400, "upload_date": "04 June 2007", "owner_id": 286729, "owner_name": "jimwitkowski", "owner_url": "http://www.panoramio.com/user/286729"} + , + {"photo_id": 94190, "photo_title": "morning light", "photo_url": "http://www.panoramio.com/photo/94190", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/94190.jpg", "longitude": 138.362846, "latitude": 35.981896, "width": 500, "height": 375, "upload_date": "09 December 2006", "owner_id": 11781, "owner_name": "ANDRE GARDELLA", "owner_url": "http://www.panoramio.com/user/11781"} + , + {"photo_id": 1283054, "photo_title": "Panorama - Bahia desde la playa", "photo_url": "http://www.panoramio.com/photo/1283054", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1283054.jpg", "longitude": -1.990094, "latitude": 43.316053, "width": 500, "height": 167, "upload_date": "12 March 2007", "owner_id": 218075, "owner_name": "fotoramas", "owner_url": "http://www.panoramio.com/user/218075"} + , + {"photo_id": 2541040, "photo_title": "Színförgeteg", "photo_url": "http://www.panoramio.com/photo/2541040", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2541040.jpg", "longitude": 17.506886, "latitude": 47.744403, "width": 500, "height": 334, "upload_date": "03 June 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 837872, "photo_title": "Midnight Sunset", "photo_url": "http://www.panoramio.com/photo/837872", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/837872.jpg", "longitude": -14.670181, "latitude": 65.142363, "width": 500, "height": 333, "upload_date": "16 February 2007", "owner_id": 175423, "owner_name": "Fabien Barrau", "owner_url": "http://www.panoramio.com/user/175423"} + , + {"photo_id": 1706995, "photo_title": "Cantera de Manresa", "photo_url": "http://www.panoramio.com/photo/1706995", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1706995.jpg", "longitude": 3.131152, "latitude": 39.868942, "width": 335, "height": 500, "upload_date": "09 April 2007", "owner_id": 61890, "owner_name": "enriquevidalphoto.com", "owner_url": "http://www.panoramio.com/user/61890"} + , + {"photo_id": 575731, "photo_title": "Le Mont Saint-Michel (Francia)", "photo_url": "http://www.panoramio.com/photo/575731", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/575731.jpg", "longitude": -1.498604, "latitude": 48.636085, "width": 500, "height": 334, "upload_date": "26 January 2007", "owner_id": 38814, "owner_name": "Romeo Ferrari", "owner_url": "http://www.panoramio.com/user/38814"} + , + {"photo_id": 1960951, "photo_title": "Utah Autumn Aspen", "photo_url": "http://www.panoramio.com/photo/1960951", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1960951.jpg", "longitude": -111.620750, "latitude": 40.441721, "width": 500, "height": 332, "upload_date": "28 April 2007", "owner_id": 107359, "owner_name": "Ron Cooper", "owner_url": "http://www.panoramio.com/user/107359"} + , + {"photo_id": 162298, "photo_title": "Nuvole (Effetto Dio) sopra Marano Ticino (2 of 2), settembre 2005", "photo_url": "http://www.panoramio.com/photo/162298", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/162298.jpg", "longitude": 8.623238, "latitude": 45.629825, "width": 500, "height": 375, "upload_date": "16 December 2006", "owner_id": 18925, "owner_name": "Marco Ferrari", "owner_url": "http://www.panoramio.com/user/18925"} + , + {"photo_id": 9358587, "photo_title": "Sicilia, a me bedda!", "photo_url": "http://www.panoramio.com/photo/9358587", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9358587.jpg", "longitude": 14.652908, "latitude": 38.068172, "width": 500, "height": 375, "upload_date": "14 April 2008", "owner_id": 325031, "owner_name": "Gibrail", "owner_url": "http://www.panoramio.com/user/325031"} + , + {"photo_id": 11271799, "photo_title": "Candelaria, version completa ( Candelaria, full version )", "photo_url": "http://www.panoramio.com/photo/11271799", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/11271799.jpg", "longitude": -18.005776, "latitude": 27.750886, "width": 334, "height": 500, "upload_date": "16 June 2008", "owner_id": 787217, "owner_name": "♣ Víctor S de Lara ♣", "owner_url": "http://www.panoramio.com/user/787217"} + , + {"photo_id": 81, "photo_title": "North Cape from plane", "photo_url": "http://www.panoramio.com/photo/81", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/81.jpg", "longitude": 25.786285, "latitude": 71.171196, "width": 500, "height": 340, "upload_date": "30 July 2005", "owner_id": 7, "owner_name": "Eduardo Manchón", "owner_url": "http://www.panoramio.com/user/7"} + , + {"photo_id": 6548480, "photo_title": "珠峰晓月", "photo_url": "http://www.panoramio.com/photo/6548480", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6548480.jpg", "longitude": 86.857567, "latitude": 28.119833, "width": 500, "height": 332, "upload_date": "18 December 2007", "owner_id": 1201050, "owner_name": "黄河影人", "owner_url": "http://www.panoramio.com/user/1201050"} + , + {"photo_id": 1989382, "photo_title": "", "photo_url": "http://www.panoramio.com/photo/1989382", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1989382.jpg", "longitude": 20.628827, "latitude": 52.062874, "width": 500, "height": 375, "upload_date": "29 April 2007", "owner_id": 234038, "owner_name": "Jacek M.", "owner_url": "http://www.panoramio.com/user/234038"} + , + {"photo_id": 3186699, "photo_title": "Ruta del Cares: Paredón de los Collainos -más 400 m. de vertical-", "photo_url": "http://www.panoramio.com/photo/3186699", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3186699.jpg", "longitude": -4.863296, "latitude": 43.253174, "width": 335, "height": 500, "upload_date": "08 July 2007", "owner_id": 129297, "owner_name": "Enrique Ortiz de Zárate", "owner_url": "http://www.panoramio.com/user/129297"} + , + {"photo_id": 9899533, "photo_title": "Grado: Are you Ready? . . . . . . . . . Honorable mention \"Scenery\" May Contest 2008", "photo_url": "http://www.panoramio.com/photo/9899533", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9899533.jpg", "longitude": 13.395016, "latitude": 45.676262, "width": 500, "height": 375, "upload_date": "04 May 2008", "owner_id": 381221, "owner_name": "Flavio Snidero", "owner_url": "http://www.panoramio.com/user/381221"} + , + {"photo_id": 324623, "photo_title": "richmond bridge", "photo_url": "http://www.panoramio.com/photo/324623", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/324623.jpg", "longitude": 147.439506, "latitude": -42.734358, "width": 500, "height": 375, "upload_date": "06 January 2007", "owner_id": 66974, "owner_name": "lieskovec", "owner_url": "http://www.panoramio.com/user/66974"} + , + {"photo_id": 4450585, "photo_title": "Giorno di riposo", "photo_url": "http://www.panoramio.com/photo/4450585", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4450585.jpg", "longitude": 35.440521, "latitude": 33.732906, "width": 500, "height": 375, "upload_date": "06 September 2007", "owner_id": 407625, "owner_name": "Lyana Luna", "owner_url": "http://www.panoramio.com/user/407625"} + , + {"photo_id": 1088801, "photo_title": "Kalászos impresszió", "photo_url": "http://www.panoramio.com/photo/1088801", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1088801.jpg", "longitude": 17.727127, "latitude": 47.444575, "width": 500, "height": 360, "upload_date": "28 February 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 290083, "photo_title": "Beach full of life", "photo_url": "http://www.panoramio.com/photo/290083", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/290083.jpg", "longitude": -59.072113, "latitude": -52.430478, "width": 335, "height": 500, "upload_date": "03 January 2007", "owner_id": 61890, "owner_name": "enriquevidalphoto.com", "owner_url": "http://www.panoramio.com/user/61890"} + , + {"photo_id": 5734694, "photo_title": "Virginia Horse Country", "photo_url": "http://www.panoramio.com/photo/5734694", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5734694.jpg", "longitude": -78.754292, "latitude": 38.014964, "width": 500, "height": 375, "upload_date": "05 November 2007", "owner_id": 523038, "owner_name": "Yank in Dixie", "owner_url": "http://www.panoramio.com/user/523038"} + , + {"photo_id": 6012970, "photo_title": "Herbstliches Venedig", "photo_url": "http://www.panoramio.com/photo/6012970", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6012970.jpg", "longitude": 12.343435, "latitude": 45.433752, "width": 500, "height": 336, "upload_date": "19 November 2007", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 6321454, "photo_title": "Sea Storm III - \" Dragonara \" Castle", "photo_url": "http://www.panoramio.com/photo/6321454", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6321454.jpg", "longitude": 9.151177, "latitude": 44.350211, "width": 444, "height": 500, "upload_date": "05 December 2007", "owner_id": 180947, "owner_name": "gilberto silvestri", "owner_url": "http://www.panoramio.com/user/180947"} + , + {"photo_id": 459569, "photo_title": "mt hakkai", "photo_url": "http://www.panoramio.com/photo/459569", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/459569.jpg", "longitude": 138.921432, "latitude": 37.092157, "width": 500, "height": 389, "upload_date": "16 January 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 940337, "photo_title": "Sunrising Monuments", "photo_url": "http://www.panoramio.com/photo/940337", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/940337.jpg", "longitude": -110.110474, "latitude": 36.980255, "width": 500, "height": 287, "upload_date": "21 February 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 2400305, "photo_title": "Cape of Favaritx, Gateway to Another Planet", "photo_url": "http://www.panoramio.com/photo/2400305", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2400305.jpg", "longitude": 4.264122, "latitude": 39.996608, "width": 500, "height": 352, "upload_date": "26 May 2007", "owner_id": 213866, "owner_name": "Nicolas Mertens", "owner_url": "http://www.panoramio.com/user/213866"} + , + {"photo_id": 398130, "photo_title": "Aiguille du Chardonnet", "photo_url": "http://www.panoramio.com/photo/398130", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/398130.jpg", "longitude": 7.013569, "latitude": 45.979190, "width": 500, "height": 333, "upload_date": "12 January 2007", "owner_id": 78506, "owner_name": "Philippe Stoop", "owner_url": "http://www.panoramio.com/user/78506"} + , + {"photo_id": 283954, "photo_title": "Dong-ao:The most beautiful coast of Taiwan", "photo_url": "http://www.panoramio.com/photo/283954", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/283954.jpg", "longitude": 121.850481, "latitude": 24.524822, "width": 500, "height": 375, "upload_date": "02 January 2007", "owner_id": 60214, "owner_name": "swinelin", "owner_url": "http://www.panoramio.com/user/60214"} + , + {"photo_id": 5115188, "photo_title": "Iceland", "photo_url": "http://www.panoramio.com/photo/5115188", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5115188.jpg", "longitude": -23.008804, "latitude": 64.947976, "width": 500, "height": 333, "upload_date": "05 October 2007", "owner_id": 588149, "owner_name": "Adam Salwanowicz", "owner_url": "http://www.panoramio.com/user/588149"} + , + {"photo_id": 1865268, "photo_title": "Rainbow Ridge Sunset", "photo_url": "http://www.panoramio.com/photo/1865268", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1865268.jpg", "longitude": -112.404728, "latitude": 36.426808, "width": 500, "height": 333, "upload_date": "21 April 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 1633076, "photo_title": "Parliament", "photo_url": "http://www.panoramio.com/photo/1633076", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1633076.jpg", "longitude": 19.046752, "latitude": 47.512998, "width": 500, "height": 500, "upload_date": "04 April 2007", "owner_id": 52226, "owner_name": "jenoapu", "owner_url": "http://www.panoramio.com/user/52226"} + , + {"photo_id": 800056, "photo_title": "Karst Landscape in Guangxi, China", "photo_url": "http://www.panoramio.com/photo/800056", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/800056.jpg", "longitude": 107.121944, "latitude": 23.605000, "width": 500, "height": 191, "upload_date": "13 February 2007", "owner_id": 164125, "owner_name": "DannyXu", "owner_url": "http://www.panoramio.com/user/164125"} + , + {"photo_id": 21304, "photo_title": "Matterhorn", "photo_url": "http://www.panoramio.com/photo/21304", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/21304.jpg", "longitude": 7.718582, "latitude": 45.994577, "width": 375, "height": 500, "upload_date": "28 May 2006", "owner_id": 3404, "owner_name": "Csongor Böröczky", "owner_url": "http://www.panoramio.com/user/3404"} + , + {"photo_id": 402493, "photo_title": "Burg-Eltz", "photo_url": "http://www.panoramio.com/photo/402493", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/402493.jpg", "longitude": 7.336400, "latitude": 50.206104, "width": 369, "height": 500, "upload_date": "12 January 2007", "owner_id": 6105, "owner_name": "hackltom", "owner_url": "http://www.panoramio.com/user/6105"} + , + {"photo_id": 411453, "photo_title": "Dune 45 in Sosussvlei", "photo_url": "http://www.panoramio.com/photo/411453", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/411453.jpg", "longitude": 15.397339, "latitude": -24.739972, "width": 500, "height": 333, "upload_date": "13 January 2007", "owner_id": 78506, "owner_name": "Philippe Stoop", "owner_url": "http://www.panoramio.com/user/78506"} + , + {"photo_id": 1813822, "photo_title": "Csendes délután", "photo_url": "http://www.panoramio.com/photo/1813822", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1813822.jpg", "longitude": 17.779655, "latitude": 47.507229, "width": 500, "height": 334, "upload_date": "17 April 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 798783, "photo_title": "Georgia, Antelope Canyon, AZ", "photo_url": "http://www.panoramio.com/photo/798783", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/798783.jpg", "longitude": -111.385489, "latitude": 36.873441, "width": 376, "height": 500, "upload_date": "12 February 2007", "owner_id": 52440, "owner_name": "Hank Waxman", "owner_url": "http://www.panoramio.com/user/52440"} + , + {"photo_id": 5193281, "photo_title": "The park at Gamlehaugen a bautiful day in September 2007, Bergen - Norway", "photo_url": "http://www.panoramio.com/photo/5193281", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5193281.jpg", "longitude": 5.336909, "latitude": 60.341253, "width": 500, "height": 279, "upload_date": "09 October 2007", "owner_id": 121518, "owner_name": "S.M Tunli - www.tunliweb.no", "owner_url": "http://www.panoramio.com/user/121518"} + , + {"photo_id": 642882, "photo_title": "La Presolana e la Cometa Hale-Bopp", "photo_url": "http://www.panoramio.com/photo/642882", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/642882.jpg", "longitude": 10.094032, "latitude": 45.927991, "width": 500, "height": 375, "upload_date": "01 February 2007", "owner_id": 38814, "owner_name": "Romeo Ferrari", "owner_url": "http://www.panoramio.com/user/38814"} + , + {"photo_id": 304963, "photo_title": "Calanque d'En Vau 2", "photo_url": "http://www.panoramio.com/photo/304963", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/304963.jpg", "longitude": 5.500288, "latitude": 43.201422, "width": 500, "height": 375, "upload_date": "05 January 2007", "owner_id": 64344, "owner_name": "Seb - Lyon", "owner_url": "http://www.panoramio.com/user/64344"} + , + {"photo_id": 6126154, "photo_title": "Swan - EPping Forest", "photo_url": "http://www.panoramio.com/photo/6126154", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6126154.jpg", "longitude": 0.025658, "latitude": 51.638836, "width": 499, "height": 500, "upload_date": "25 November 2007", "owner_id": 1130880, "owner_name": "marksimms", "owner_url": "http://www.panoramio.com/user/1130880"} + , + {"photo_id": 441426, "photo_title": "Dettifoss", "photo_url": "http://www.panoramio.com/photo/441426", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/441426.jpg", "longitude": -16.390743, "latitude": 65.819939, "width": 500, "height": 350, "upload_date": "15 January 2007", "owner_id": 78506, "owner_name": "Philippe Stoop", "owner_url": "http://www.panoramio.com/user/78506"} + , + {"photo_id": 4105301, "photo_title": "Eikesdalsvatnet. Norway.", "photo_url": "http://www.panoramio.com/photo/4105301", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4105301.jpg", "longitude": 8.171768, "latitude": 62.561718, "width": 500, "height": 326, "upload_date": "22 August 2007", "owner_id": 806637, "owner_name": "Bjørn Fransgjerde", "owner_url": "http://www.panoramio.com/user/806637"} + , + {"photo_id": 519765, "photo_title": "Derűs szeglet", "photo_url": "http://www.panoramio.com/photo/519765", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/519765.jpg", "longitude": 17.173862, "latitude": 46.633997, "width": 500, "height": 282, "upload_date": "21 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 4401751, "photo_title": "Fire Escape", "photo_url": "http://www.panoramio.com/photo/4401751", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4401751.jpg", "longitude": -2.315347, "latitude": 52.644873, "width": 366, "height": 500, "upload_date": "04 September 2007", "owner_id": 1295, "owner_name": "Matthew Walters", "owner_url": "http://www.panoramio.com/user/1295"} + , + {"photo_id": 1747294, "photo_title": "Red Fort II / Fuerte rojo II", "photo_url": "http://www.panoramio.com/photo/1747294", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1747294.jpg", "longitude": 73.017197, "latitude": 26.296801, "width": 500, "height": 375, "upload_date": "12 April 2007", "owner_id": 414, "owner_name": "Sonia Villegas", "owner_url": "http://www.panoramio.com/user/414"} + , + {"photo_id": 2856289, "photo_title": "Copacabana Praia", "photo_url": "http://www.panoramio.com/photo/2856289", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2856289.jpg", "longitude": -43.179188, "latitude": -22.969457, "width": 500, "height": 375, "upload_date": "20 June 2007", "owner_id": 496676, "owner_name": "Quasebart", "owner_url": "http://www.panoramio.com/user/496676"} + , + {"photo_id": 3116906, "photo_title": "Mototaki Falls", "photo_url": "http://www.panoramio.com/photo/3116906", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3116906.jpg", "longitude": 139.954662, "latitude": 39.158750, "width": 500, "height": 375, "upload_date": "04 July 2007", "owner_id": 164173, "owner_name": "tsushima", "owner_url": "http://www.panoramio.com/user/164173"} + , + {"photo_id": 8919659, "photo_title": "Bavarian Forest", "photo_url": "http://www.panoramio.com/photo/8919659", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8919659.jpg", "longitude": 12.429099, "latitude": 49.084548, "width": 500, "height": 332, "upload_date": "28 March 2008", "owner_id": 696605, "owner_name": "© alfredschaffer", "owner_url": "http://www.panoramio.com/user/696605"} + , + {"photo_id": 2040174, "photo_title": "Looking east from Sognefjellet - april 29", "photo_url": "http://www.panoramio.com/photo/2040174", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2040174.jpg", "longitude": 7.974873, "latitude": 61.561141, "width": 375, "height": 500, "upload_date": "03 May 2007", "owner_id": 39160, "owner_name": "Snemann", "owner_url": "http://www.panoramio.com/user/39160"} + , + {"photo_id": 1195122, "photo_title": "Cerro Macon", "photo_url": "http://www.panoramio.com/photo/1195122", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1195122.jpg", "longitude": -67.356405, "latitude": -24.528540, "width": 335, "height": 500, "upload_date": "06 March 2007", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 1182587, "photo_title": "Gaggenau-Moosbronn, Wallfahrtskirche", "photo_url": "http://www.panoramio.com/photo/1182587", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1182587.jpg", "longitude": 8.384285, "latitude": 48.840486, "width": 382, "height": 500, "upload_date": "05 March 2007", "owner_id": 66229, "owner_name": "Mast", "owner_url": "http://www.panoramio.com/user/66229"} + , + {"photo_id": 4787323, "photo_title": "Hell's Gate(Antigua-Caribe)", "photo_url": "http://www.panoramio.com/photo/4787323", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4787323.jpg", "longitude": -61.722651, "latitude": 17.140052, "width": 500, "height": 375, "upload_date": "20 September 2007", "owner_id": 83865, "owner_name": "Epi F.Villanueva", "owner_url": "http://www.panoramio.com/user/83865"} + , + {"photo_id": 5474175, "photo_title": "Chemin bucolique au Lauterbrunnental 2", "photo_url": "http://www.panoramio.com/photo/5474175", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5474175.jpg", "longitude": 7.909877, "latitude": 46.580479, "width": 500, "height": 384, "upload_date": "22 October 2007", "owner_id": 359127, "owner_name": "wx", "owner_url": "http://www.panoramio.com/user/359127"} + , + {"photo_id": 479364, "photo_title": "The Earth Above Us II", "photo_url": "http://www.panoramio.com/photo/479364", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/479364.jpg", "longitude": 19.053029, "latitude": 47.601392, "width": 500, "height": 317, "upload_date": "18 January 2007", "owner_id": 57869, "owner_name": "NAGY Albert", "owner_url": "http://www.panoramio.com/user/57869"} + , + {"photo_id": 575110, "photo_title": "A huge wave crashes against the front of Kiama Blowhole www.ozthunder.com", "photo_url": "http://www.panoramio.com/photo/575110", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/575110.jpg", "longitude": 150.863657, "latitude": -34.671264, "width": 500, "height": 338, "upload_date": "26 January 2007", "owner_id": 67208, "owner_name": "Michael Thompson", "owner_url": "http://www.panoramio.com/user/67208"} + , + {"photo_id": 543624, "photo_title": "Dalmát álom", "photo_url": "http://www.panoramio.com/photo/543624", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/543624.jpg", "longitude": 15.969143, "latitude": 43.624768, "width": 500, "height": 333, "upload_date": "23 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 121224, "photo_title": "ParadisePW", "photo_url": "http://www.panoramio.com/photo/121224", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/121224.jpg", "longitude": -62.907715, "latitude": -64.830254, "width": 500, "height": 329, "upload_date": "12 December 2006", "owner_id": 19856, "owner_name": "Juan Kratzmaier", "owner_url": "http://www.panoramio.com/user/19856"} + , + {"photo_id": 10074505, "photo_title": "Volcàn Chaitèn, Chaitèn, Palena, Chile Por Daniel Basualto", "photo_url": "http://www.panoramio.com/photo/10074505", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10074505.jpg", "longitude": -72.759705, "latitude": -42.908160, "width": 375, "height": 500, "upload_date": "10 May 2008", "owner_id": 88547, "owner_name": "Patricia Santini", "owner_url": "http://www.panoramio.com/user/88547"} + , + {"photo_id": 10378, "photo_title": "Chiang Mai, temple", "photo_url": "http://www.panoramio.com/photo/10378", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10378.jpg", "longitude": 98.921596, "latitude": 18.805157, "width": 319, "height": 500, "upload_date": "06 February 2006", "owner_id": 414, "owner_name": "Sonia Villegas", "owner_url": "http://www.panoramio.com/user/414"} + , + {"photo_id": 532620, "photo_title": "Morning mist near Skjønhaug", "photo_url": "http://www.panoramio.com/photo/532620", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/532620.jpg", "longitude": 11.297293, "latitude": 59.639511, "width": 333, "height": 500, "upload_date": "22 January 2007", "owner_id": 39160, "owner_name": "Snemann", "owner_url": "http://www.panoramio.com/user/39160"} + , + {"photo_id": 625805, "photo_title": "Primosten blue(s)", "photo_url": "http://www.panoramio.com/photo/625805", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/625805.jpg", "longitude": 15.932236, "latitude": 43.575168, "width": 500, "height": 334, "upload_date": "30 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 247704, "photo_title": "Paris in the night", "photo_url": "http://www.panoramio.com/photo/247704", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/247704.jpg", "longitude": 2.294512, "latitude": 48.858052, "width": 327, "height": 500, "upload_date": "27 December 2006", "owner_id": 51517, "owner_name": "threshold2000", "owner_url": "http://www.panoramio.com/user/51517"} + , + {"photo_id": 73888, "photo_title": "Fitz-Roy", "photo_url": "http://www.panoramio.com/photo/73888", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/73888.jpg", "longitude": -72.987328, "latitude": -49.277885, "width": 500, "height": 204, "upload_date": "01 November 2006", "owner_id": 7372, "owner_name": "vuillet", "owner_url": "http://www.panoramio.com/user/7372"} + , + {"photo_id": 6065568, "photo_title": "Amigos para siempre Paris-Francia", "photo_url": "http://www.panoramio.com/photo/6065568", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6065568.jpg", "longitude": 2.288697, "latitude": 48.861906, "width": 375, "height": 500, "upload_date": "22 November 2007", "owner_id": 83865, "owner_name": "Epi F.Villanueva", "owner_url": "http://www.panoramio.com/user/83865"} + , + {"photo_id": 9643938, "photo_title": "Occhio indiscreto ... sulla città ... illuminata ", "photo_url": "http://www.panoramio.com/photo/9643938", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9643938.jpg", "longitude": 13.818569, "latitude": 45.641329, "width": 500, "height": 449, "upload_date": "23 April 2008", "owner_id": 1121720, "owner_name": "▬ Mauro Antonini ▬", "owner_url": "http://www.panoramio.com/user/1121720"} + , + {"photo_id": 532643, "photo_title": "Icecarved granite at Herføl", "photo_url": "http://www.panoramio.com/photo/532643", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/532643.jpg", "longitude": 11.054649, "latitude": 58.986512, "width": 375, "height": 500, "upload_date": "22 January 2007", "owner_id": 39160, "owner_name": "Snemann", "owner_url": "http://www.panoramio.com/user/39160"} + , + {"photo_id": 112298, "photo_title": "paris06_004IR", "photo_url": "http://www.panoramio.com/photo/112298", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/112298.jpg", "longitude": 2.343779, "latitude": 48.887746, "width": 500, "height": 500, "upload_date": "11 December 2006", "owner_id": 17599, "owner_name": "Dmitry Andreev", "owner_url": "http://www.panoramio.com/user/17599"} + , + {"photo_id": 525997, "photo_title": "Grand Canyon Desert View", "photo_url": "http://www.panoramio.com/photo/525997", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/525997.jpg", "longitude": -111.824341, "latitude": 36.043547, "width": 500, "height": 333, "upload_date": "22 January 2007", "owner_id": 85489, "owner_name": "Bruce MacIver", "owner_url": "http://www.panoramio.com/user/85489"} + , + {"photo_id": 2972849, "photo_title": "Donadea Forest", "photo_url": "http://www.panoramio.com/photo/2972849", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2972849.jpg", "longitude": -6.743374, "latitude": 53.346555, "width": 500, "height": 377, "upload_date": "27 June 2007", "owner_id": 137785, "owner_name": "W@Z", "owner_url": "http://www.panoramio.com/user/137785"} + , + {"photo_id": 1175992, "photo_title": "Mt. Roberts Tram, Juneau, Alaska", "photo_url": "http://www.panoramio.com/photo/1175992", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1175992.jpg", "longitude": -134.391643, "latitude": 58.294679, "width": 500, "height": 347, "upload_date": "05 March 2007", "owner_id": 52440, "owner_name": "Hank Waxman", "owner_url": "http://www.panoramio.com/user/52440"} + , + {"photo_id": 462521, "photo_title": "Fontaine de Trevi", "photo_url": "http://www.panoramio.com/photo/462521", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/462521.jpg", "longitude": 12.483280, "latitude": 41.901047, "width": 500, "height": 333, "upload_date": "17 January 2007", "owner_id": 78506, "owner_name": "Philippe Stoop", "owner_url": "http://www.panoramio.com/user/78506"} + , + {"photo_id": 848316, "photo_title": "Malyovitsa, Rila", "photo_url": "http://www.panoramio.com/photo/848316", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/848316.jpg", "longitude": 23.383627, "latitude": 42.201517, "width": 500, "height": 357, "upload_date": "17 February 2007", "owner_id": 16880, "owner_name": "evgenidinev.com", "owner_url": "http://www.panoramio.com/user/16880"} + , + {"photo_id": 459453, "photo_title": "bandaibashi3", "photo_url": "http://www.panoramio.com/photo/459453", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/459453.jpg", "longitude": 139.055586, "latitude": 37.920436, "width": 500, "height": 382, "upload_date": "16 January 2007", "owner_id": 86411, "owner_name": "中村脩-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 968639, "photo_title": "张永富 黄山风光06 Huangshan", "photo_url": "http://www.panoramio.com/photo/968639", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/968639.jpg", "longitude": 118.166199, "latitude": 30.105633, "width": 348, "height": 500, "upload_date": "23 February 2007", "owner_id": 203011, "owner_name": "SammyZhang", "owner_url": "http://www.panoramio.com/user/203011"} + , + {"photo_id": 97731, "photo_title": "Kaimondake", "photo_url": "http://www.panoramio.com/photo/97731", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/97731.jpg", "longitude": 130.652161, "latitude": 31.247443, "width": 500, "height": 212, "upload_date": "09 December 2006", "owner_id": 11781, "owner_name": "ANDRE GARDELLA", "owner_url": "http://www.panoramio.com/user/11781"} + , + {"photo_id": 2859205, "photo_title": "Lundy Lake Sunset", "photo_url": "http://www.panoramio.com/photo/2859205", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2859205.jpg", "longitude": -119.221230, "latitude": 38.031597, "width": 400, "height": 500, "upload_date": "21 June 2007", "owner_id": 376395, "owner_name": "JeffSullivan (www.MyPhotoGuides.com)", "owner_url": "http://www.panoramio.com/user/376395"} + , + {"photo_id": 309190, "photo_title": "Populonia, sunset", "photo_url": "http://www.panoramio.com/photo/309190", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/309190.jpg", "longitude": 10.490313, "latitude": 42.989581, "width": 308, "height": 500, "upload_date": "05 January 2007", "owner_id": 65478, "owner_name": "Gabriele Marabotti", "owner_url": "http://www.panoramio.com/user/65478"} + , + {"photo_id": 54982, "photo_title": "Baia dos Porcos", "photo_url": "http://www.panoramio.com/photo/54982", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/54982.jpg", "longitude": -32.443485, "latitude": -3.855177, "width": 500, "height": 333, "upload_date": "30 September 2006", "owner_id": 7562, "owner_name": "Marcelo E. Salgado", "owner_url": "http://www.panoramio.com/user/7562"} + , + {"photo_id": 58316, "photo_title": "800_Schafberg03", "photo_url": "http://www.panoramio.com/photo/58316", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/58316.jpg", "longitude": 13.429413, "latitude": 47.775445, "width": 500, "height": 316, "upload_date": "07 October 2006", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 423887, "photo_title": "Dunes near Zagora", "photo_url": "http://www.panoramio.com/photo/423887", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/423887.jpg", "longitude": -5.872707, "latitude": 30.280713, "width": 500, "height": 333, "upload_date": "14 January 2007", "owner_id": 78506, "owner_name": "Philippe Stoop", "owner_url": "http://www.panoramio.com/user/78506"} + , + {"photo_id": 4136144, "photo_title": "Égi jel", "photo_url": "http://www.panoramio.com/photo/4136144", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4136144.jpg", "longitude": 17.564564, "latitude": 47.633181, "width": 500, "height": 376, "upload_date": "23 August 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 6620113, "photo_title": "Winterlandschaft - Winter Scenery - Emmental", "photo_url": "http://www.panoramio.com/photo/6620113", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6620113.jpg", "longitude": 7.787676, "latitude": 47.055856, "width": 500, "height": 374, "upload_date": "22 December 2007", "owner_id": 635422, "owner_name": "♫ Swissmay", "owner_url": "http://www.panoramio.com/user/635422"} + , + {"photo_id": 2702545, "photo_title": "Church at Oia, Santorini", "photo_url": "http://www.panoramio.com/photo/2702545", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2702545.jpg", "longitude": 25.376015, "latitude": 36.461330, "width": 375, "height": 500, "upload_date": "11 June 2007", "owner_id": 555551, "owner_name": "Marilyn Whiteley", "owner_url": "http://www.panoramio.com/user/555551"} + , + {"photo_id": 416472, "photo_title": "Ice Crystal Clouds", "photo_url": "http://www.panoramio.com/photo/416472", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/416472.jpg", "longitude": -105.650969, "latitude": 40.294126, "width": 500, "height": 374, "upload_date": "13 January 2007", "owner_id": 87752, "owner_name": "Richard Ryer", "owner_url": "http://www.panoramio.com/user/87752"} + , + {"photo_id": 6080988, "photo_title": "Zion Tree (HDR)", "photo_url": "http://www.panoramio.com/photo/6080988", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6080988.jpg", "longitude": -112.946116, "latitude": 37.213331, "width": 500, "height": 333, "upload_date": "23 November 2007", "owner_id": 17488, "owner_name": "John Gillett", "owner_url": "http://www.panoramio.com/user/17488"} + , + {"photo_id": 2321382, "photo_title": "Old Wreck at Bannack", "photo_url": "http://www.panoramio.com/photo/2321382", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2321382.jpg", "longitude": -112.997518, "latitude": 45.162614, "width": 500, "height": 375, "upload_date": "21 May 2007", "owner_id": 71099, "owner_name": "Eve in Montana", "owner_url": "http://www.panoramio.com/user/71099"} + , + {"photo_id": 122858, "photo_title": "Antelope Canyon - Page, Arizona", "photo_url": "http://www.panoramio.com/photo/122858", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/122858.jpg", "longitude": -111.399908, "latitude": 36.887447, "width": 332, "height": 500, "upload_date": "12 December 2006", "owner_id": 20332, "owner_name": "RJ", "owner_url": "http://www.panoramio.com/user/20332"} + , + {"photo_id": 4445933, "photo_title": "Tavi alkony", "photo_url": "http://www.panoramio.com/photo/4445933", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4445933.jpg", "longitude": 17.465172, "latitude": 47.864486, "width": 500, "height": 350, "upload_date": "06 September 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 1238515, "photo_title": "EDEN", "photo_url": "http://www.panoramio.com/photo/1238515", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1238515.jpg", "longitude": -83.677711, "latitude": 22.661542, "width": 500, "height": 345, "upload_date": "09 March 2007", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 398585, "photo_title": "Near Glittertind", "photo_url": "http://www.panoramio.com/photo/398585", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/398585.jpg", "longitude": 8.489170, "latitude": 61.621820, "width": 500, "height": 333, "upload_date": "12 January 2007", "owner_id": 78506, "owner_name": "Philippe Stoop", "owner_url": "http://www.panoramio.com/user/78506"} + , + {"photo_id": 10240311, "photo_title": "two planes", "photo_url": "http://www.panoramio.com/photo/10240311", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10240311.jpg", "longitude": 20.306683, "latitude": 49.750107, "width": 332, "height": 500, "upload_date": "15 May 2008", "owner_id": 454219, "owner_name": "Rafal Ociepka", "owner_url": "http://www.panoramio.com/user/454219"} + , + {"photo_id": 7593894, "photo_title": "桂林名胜百景——遇龙河", "photo_url": "http://www.panoramio.com/photo/7593894", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7593894.jpg", "longitude": 110.424957, "latitude": 24.781747, "width": 500, "height": 375, "upload_date": "04 February 2008", "owner_id": 161470, "owner_name": "John Su", "owner_url": "http://www.panoramio.com/user/161470"} + ]}; +} + diff --git a/markerclustererplus/markerclustererplus.d.ts b/markerclustererplus/markerclustererplus.d.ts new file mode 100644 index 000000000..24a2b2636 --- /dev/null +++ b/markerclustererplus/markerclustererplus.d.ts @@ -0,0 +1,834 @@ +// Type definitions for MarkerClustererPlus for Google Maps V3 2.1.1 +// Project: http://github.com/mahnunchik/markerclustererplus +// Definitions by: Mathias Rodriguez +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +/// + +/** + * @name ClusterIconStyle + * @class This class represents the object for values in the styles array passed + * to the {@link MarkerClusterer} constructor. The element in this array that is used to + * style the cluster icon is determined by calling the calculator function. + * + * @property {string} url The URL of the cluster icon image file. Required. + * @property {number} height The display height (in pixels) of the cluster icon. Required. + * @property {number} width The display width (in pixels) of the cluster icon. Required. + * @property {Array} [anchorText] The position (in pixels) from the center of the cluster icon to + * where the text label is to be centered and drawn. The format is [yoffset, xoffset] + * where yoffset increases as you go down from center and xoffset + * increases to the right of center. The default is [0, 0]. + * @property {Array} [anchorIcon] The anchor position (in pixels) of the cluster icon. This is the + * spot on the cluster icon that is to be aligned with the cluster position. The format is + * [yoffset, xoffset] where yoffset increases as you go down and + * xoffset increases to the right of the top-left corner of the icon. The default + * anchor position is the center of the cluster icon. + * @property {string} [textColor="black"] The color of the label text shown on the + * cluster icon. + * @property {number} [textSize=11] The size (in pixels) of the label text shown on the + * cluster icon. + * @property {string} [textDecoration="none"] The value of the CSS text-decoration + * property for the label text shown on the cluster icon. + * @property {string} [fontWeight="bold"] The value of the CSS font-weight + * property for the label text shown on the cluster icon. + * @property {string} [fontStyle="normal"] The value of the CSS font-style + * property for the label text shown on the cluster icon. + * @property {string} [fontFamily="Arial,sans-serif"] The value of the CSS font-family + * property for the label text shown on the cluster icon. + * @property {string} [backgroundPosition="0 0"] The position of the cluster icon image + * within the image defined by url. The format is "xpos ypos" + * (the same format as for the CSS background-position property). You must set + * this property appropriately when the image defined by url represents a sprite + * containing multiple images. Note that the position must be specified in px units. + */ + +declare class ClusterIconStyle { + url: string; + height: number; + width: number; + anchorText: number[]; + anchorIcon: number[]; + textColor: string; + textSize: number; + textDecoration: string; + fontWeight: string; + fontStyle: string; + fontFamily: string; + backgroundPosition: string; +} + +/** + * @name ClusterIconInfo + * @class This class is an object containing general information about a cluster icon. This is + * the object that a calculator function returns. + * + * @property {string} text The text of the label to be shown on the cluster icon. + * @property {number} index The index plus 1 of the element in the styles + * array to be used to style the cluster icon. + * @property {string} title The tooltip to display when the mouse moves over the cluster icon. + * If this value is undefined or "", title is set to the + * value of the title property passed to the MarkerClusterer. + */ + +declare class ClusterIconInfo extends google.maps.OverlayView { + text: string; + index: number; + title: string; + /** + * A cluster icon. + * + * @constructor + * @extends google.maps.OverlayView + * @param {Cluster} cluster The cluster with which the icon is to be associated. + * @param {Array} [styles] An array of {@link ClusterIconStyle} defining the cluster icons + * to use for various cluster sizes. + * @private + */ + constructor(cluster: Cluster, styles: ClusterIconStyle[]); + + /** + * Adds the icon to the DOM. + */ + onAdd(): void; + + /** + * Removes the icon from the DOM. + */ + onRemove(): void; + + /** + * Draws the icon. + */ + draw(): void; + + /** + * Hides the icon. + */ + hide(): void; + + /** + * Positions and shows the icon. + */ + show(): void; + + /** + * Sets the icon styles to the appropriate element in the styles array. + * + * @param {ClusterIconInfo} sums The icon label text and styles index. + */ + useStyle(sums: ClusterIconInfo[]): void; + + /** + * Sets the position at which to center the icon. + * + * @param {google.maps.LatLng} center The latlng to set as the center. + */ + setCenter(center: google.maps.LatLng): void; + + /** + * Creates the cssText style parameter based on the position of the icon. + * + * @param {google.maps.Point} pos The position of the icon. + * @return {string} The CSS style text. + */ + createCss(pos: google.maps.Point): string; + + /** + * Returns the position at which to place the DIV depending on the latlng. + * + * @param {google.maps.LatLng} latlng The position in latlng. + * @return {google.maps.Point} The position in pixels. + */ + getPosFromLatLng_(latLng: google.maps.LatLng): google.maps.Point; +} + +interface Cluster { + /** + * Creates a single cluster that manages a group of proximate markers. + * Used internally, do not call this constructor directly. + * @constructor + * @param {MarkerClusterer} mc The MarkerClusterer object with which this + * cluster is associated. + */ + new (mc: MarkerClusterer): Cluster; + + /** + * Returns the number of markers managed by the cluster. You can call this from + * a click, mouseover, or mouseout event handler + * for the MarkerClusterer object. + * + * @return {number} The number of markers in the cluster. + */ + getSize(): number; + + /** + * Returns the array of markers managed by the cluster. You can call this from + * a click, mouseover, or mouseout event handler + * for the MarkerClusterer object. + * + * @return {Array} The array of markers in the cluster. + */ + getMarkers(): google.maps.Marker[]; + + /** + * Returns the center of the cluster. You can call this from + * a click, mouseover, or mouseout event handler + * for the MarkerClusterer object. + * + * @return {google.maps.LatLng} The center of the cluster. + */ + getCenter(): google.maps.LatLng; + + /** + * Returns the map with which the cluster is associated. + * + * @return {google.maps.Map} The map. + * @ignore + */ + getMap(): google.maps.Map; + + /** + * Returns the MarkerClusterer object with which the cluster is associated. + * + * @return {MarkerClusterer} The associated marker clusterer. + * @ignore + */ + getMarkerClusterer(): MarkerClusterer; + + /** + * Returns the bounds of the cluster. + * + * @return {google.maps.LatLngBounds} the cluster bounds. + * @ignore + */ + getBounds(): google.maps.LatLngBounds; + + /** + * Removes the cluster from the map. + * + * @ignore + */ + remove(): void; + + /** + * Adds a marker to the cluster. + * + * @param {google.maps.Marker} marker The marker to be added. + * @return {boolean} True if the marker was added. + * @ignore + */ + addMarker(marker: google.maps.Marker): boolean; + + /** + * Determines if a marker lies within the cluster's bounds. + * + * @param {google.maps.Marker} marker The marker to check. + * @return {boolean} True if the marker lies in the bounds. + * @ignore + */ + isMarkerInClusterBounds(marker: google.maps.Marker): boolean; + + /** + * Calculates the extended bounds of the cluster with the grid. + */ + calculateBounds_(): void; + + /** + * Updates the cluster icon. + */ + updateIcon_(): void; + + /** + * Determines if a marker has already been added to the cluster. + * + * @param {google.maps.Marker} marker The marker to check. + * @return {boolean} True if the marker has already been added. + */ + isMarkerAlreadyAdded_(marker: google.maps.Marker): boolean; +} + +/** + * @name MarkerClustererOptions + * @class This class represents the optional parameter passed to + * the {@link MarkerClusterer} constructor. + * @property {number} [gridSize=60] The grid size of a cluster in pixels. The grid is a square. + * @property {number} [maxZoom=null] The maximum zoom level at which clustering is enabled or + * null if clustering is to be enabled at all zoom levels. + * @property {boolean} [zoomOnClick=true] Whether to zoom the map when a cluster marker is + * clicked. You may want to set this to false if you have installed a handler + * for the click event and it deals with zooming on its own. + * @property {boolean} [averageCenter=false] Whether the position of a cluster marker should be + * the average position of all markers in the cluster. If set to false, the + * cluster marker is positioned at the location of the first marker added to the cluster. + * @property {number} [minimumClusterSize=2] The minimum number of markers needed in a cluster + * before the markers are hidden and a cluster marker appears. + * @property {boolean} [ignoreHidden=false] Whether to ignore hidden markers in clusters. You + * may want to set this to true to ensure that hidden markers are not included + * in the marker count that appears on a cluster marker (this count is the value of the + * text property of the result returned by the default calculator). + * If set to true and you change the visibility of a marker being clustered, be + * sure to also call MarkerClusterer.repaint(). + * @property {string} [title=""] The tooltip to display when the mouse moves over a cluster + * marker. (Alternatively, you can use a custom calculator function to specify a + * different tooltip for each cluster marker.) + * @property {function} [calculator=MarkerClusterer.CALCULATOR] The function used to determine + * the text to be displayed on a cluster marker and the index indicating which style to use + * for the cluster marker. The input parameters for the function are (1) the array of markers + * represented by a cluster marker and (2) the number of cluster icon styles. It returns a + * {@link ClusterIconInfo} object. The default calculator returns a + * text property which is the number of markers in the cluster and an + * index property which is one higher than the lowest integer such that + * 10^i exceeds the number of markers in the cluster, or the size of the styles + * array, whichever is less. The styles array element used has an index of + * index minus 1. For example, the default calculator returns a + * text value of "125" and an index of 3 + * for a cluster icon representing 125 markers so the element used in the styles + * array is 2. A calculator may also return a title + * property that contains the text of the tooltip to be used for the cluster marker. If + * title is not defined, the tooltip is set to the value of the title + * property for the MarkerClusterer. + * @property {string} [clusterClass="cluster"] The name of the CSS class defining general styles + * for the cluster markers. Use this class to define CSS styles that are not set up by the code + * that processes the styles array. + * @property {Array} [styles] An array of {@link ClusterIconStyle} elements defining the styles + * of the cluster markers to be used. The element to be used to style a given cluster marker + * is determined by the function defined by the calculator property. + * The default is an array of {@link ClusterIconStyle} elements whose properties are derived + * from the values for imagePath, imageExtension, and + * imageSizes. + * @property {boolean} [enableRetinaIcons=false] Whether to allow the use of cluster icons that + * have sizes that are some multiple (typically double) of their actual display size. Icons such + * as these look better when viewed on high-resolution monitors such as Apple's Retina displays. + * Note: if this property is true, sprites cannot be used as cluster icons. + * @property {number} [batchSize=MarkerClusterer.BATCH_SIZE] Set this property to the + * number of markers to be processed in a single batch when using a browser other than + * Internet Explorer (for Internet Explorer, use the batchSizeIE property instead). + * @property {number} [batchSizeIE=MarkerClusterer.BATCH_SIZE_IE] When Internet Explorer is + * being used, markers are processed in several batches with a small delay inserted between + * each batch in an attempt to avoid Javascript timeout errors. Set this property to the + * number of markers to be processed in a single batch; select as high a number as you can + * without causing a timeout error in the browser. This number might need to be as low as 100 + * if 15,000 markers are being managed, for example. + * @property {string} [imagePath=MarkerClusterer.IMAGE_PATH] + * The full URL of the root name of the group of image files to use for cluster icons. + * The complete file name is of the form imagePathn.imageExtension + * where n is the image file number (1, 2, etc.). + * @property {string} [imageExtension=MarkerClusterer.IMAGE_EXTENSION] + * The extension name for the cluster icon image files (e.g., "png" or + * "jpg"). + * @property {Array} [imageSizes=MarkerClusterer.IMAGE_SIZES] + * An array of numbers containing the widths of the group of + * imagePathn.imageExtension image files. + * (The images are assumed to be square.) + **/ +interface MarkerClustererOptions { + gridSize: number; + maxZoom: number; + zoomOnClick: boolean; + averageCenter: boolean; + minimumClusterSize: number; + ignoreHidden: boolean; + title: string; + calculator(): Function; + clusterClass: string; + styles: ClusterIconStyle[]; + enableRetinaIcons: boolean; + batchSize: number; + batchSizeIE: number; + imagePath: string; + imageExtension: string; + imageSizes: number[]; +} + +interface MarkerClusterer extends google.maps.OverlayView { + /** + * Creates a MarkerClusterer object with the options specified in {@link MarkerClustererOptions}. + * @constructor + * @extends google.maps.OverlayView + * @param {google.maps.Map} map The Google map to attach to. + * @param {Array.} [opt_markers] The markers to be added to the cluster. + * @param {MarkerClustererOptions} [opt_options] The optional parameters. + */ + new (map: google.maps.Map, opt_markers: google.maps.Marker[], opt_options?: MarkerClustererOptions): MarkerClusterer; + + /** + * Implementation of the onAdd interface method. + * @ignore + */ + onAdd(): void; + + /** + * Implementation of the onRemove interface method. + * Removes map event listeners and all cluster icons from the DOM. + * All managed markers are also put back on the map. + * @ignore + */ + onRemove(): void; + + /** + * Implementation of the draw interface method. + * @ignore + */ + draw(): void; + + /** + * Sets up the styles object. + */ + setupStyles_(): void; + + /** + * Fits the map to the bounds of the markers managed by the clusterer. + */ + fitMapToMarkers(): void; + + /** + * Returns the value of the gridSize property. + * + * @return {number} The grid size. + */ + getGridSize(): number; + + /** + * Sets the value of the gridSize property. + * + * @param {number} gridSize The grid size. + */ + setGridSize(gridSize: number): void; + + /** + * Returns the value of the minimumClusterSize property. + * + * @return {number} The minimum cluster size. + */ + getMinimumClusterSize(): number; + + /** + * Sets the value of the minimumClusterSize property. + * + * @param {number} minimumClusterSize The minimum cluster size. + */ + setMinimumClusterSize(minimumClusterSize: number): void; + + /** + * Returns the value of the maxZoom property. + * + * @return {number} The maximum zoom level. + */ + getMaxZoom(): number; + + /** + * Sets the value of the maxZoom property. + * + * @param {number} maxZoom The maximum zoom level. + */ + setMaxZoom(maxZoom: number): void; + + /** + * Returns the value of the styles property. + * + * @return {Array} The array of styles defining the cluster markers to be used. + */ + getStyles(): ClusterIconStyle[]; + + /** + * Sets the value of the styles property. + * + * @param {Array.} styles The array of styles to use. + */ + setStyles(styles: ClusterIconStyle[]): void; + + /** + * Returns the value of the title property. + * + * @return {string} The content of the title text. + */ + getTitle(): string; + + /** + * Sets the value of the title property. + * + * @param {string} title The value of the title property. + */ + setTitle(title: string): void; + + /** + * Returns the value of the zoomOnClick property. + * + * @return {boolean} True if zoomOnClick property is set. + */ + getZoomOnClick(): boolean; + + /** + * Sets the value of the zoomOnClick property. + * + * @param {boolean} zoomOnClick The value of the zoomOnClick property. + */ + setZoomOnClick(zoomOnClick: boolean): void; + + /** + * Returns the value of the averageCenter property. + * + * @return {boolean} True if averageCenter property is set. + */ + getAverageCenter(): boolean; + + /** + * Sets the value of the averageCenter property. + * + * @param {boolean} averageCenter The value of the averageCenter property. + */ + setAverageCenter(averageCenter: boolean): void; + + /** + * Returns the value of the ignoreHidden property. + * + * @return {boolean} True if ignoreHidden property is set. + */ + getIgnoreHidden(): boolean; + + /** + * Sets the value of the ignoreHidden property. + * + * @param {boolean} ignoreHidden The value of the ignoreHidden property. + */ + setIgnoreHidden(ignoreHidden: boolean): void; + + /** + * Returns the value of the enableRetinaIcons property. + * + * @return {boolean} True if enableRetinaIcons property is set. + */ + getEnableRetinaIcons(): boolean; + + /** + * Sets the value of the enableRetinaIcons property. + * + * @param {boolean} enableRetinaIcons The value of the enableRetinaIcons property. + */ + setEnableRetinaIcons(enableRetinaIcons: boolean): void; + + /** + * Returns the value of the imageExtension property. + * + * @return {string} The value of the imageExtension property. + */ + getImageExtension(): string; + + /** + * Sets the value of the imageExtension property. + * + * @param {string} imageExtension The value of the imageExtension property. + */ + setImageExtension(imageExtension: string): void; + + /** + * Returns the value of the imagePath property. + * + * @return {string} The value of the imagePath property. + */ + getImagePath(): string; + + /** + * Sets the value of the imagePath property. + * + * @param {string} imagePath The value of the imagePath property. + */ + setImagePath(imagePath: string): void; + + /** + * Returns the value of the imageSizes property. + * + * @return {Array} The value of the imageSizes property. + */ + getImageSizes(): number[]; + + /** + * Sets the value of the imageSizes property. + * + * @param {Array} imageSizes The value of the imageSizes property. + */ + setImageSizes(imageSizes: number[]): void; + + /** + * Returns the value of the calculator property. + * + * @return {function} the value of the calculator property. + */ + getCalculator(): Function; + + /** + * Sets the value of the calculator property. + * + * @param {function(Array., number)} calculator The value + * of the calculator property. + */ + setCalculator(calculator: (marker: google.maps.Marker, value: number) => Function): void; + + /** + * Sets the value of the hideLabel property. + * + * @param {boolean} printable The value of the hideLabel property. + */ + setHideLabel(printable: boolean): void; + + /** + * Returns the value of the hideLabel property. + * + * @return {boolean} the value of the hideLabel property. + */ + getHideLabel(): boolean; + + /** + * Returns the value of the batchSizeIE property. + * + * @return {number} the value of the batchSizeIE property. + */ + getBatchSizeIE(): number; + + /** + * Sets the value of the batchSizeIE property. + * + * @param {number} batchSizeIE The value of the batchSizeIE property. + */ + setBatchSizeIE(batchSizeIE: number): void; + + /** + * Returns the value of the clusterClass property. + * + * @return {string} the value of the clusterClass property. + */ + getClusterClass(): string; + + /** + * Sets the value of the clusterClass property. + * + * @param {string} clusterClass The value of the clusterClass property. + */ + setClusterClass(clusterClass: string): void; + + /** + * Returns the array of markers managed by the clusterer. + * + * @return {Array} The array of markers managed by the clusterer. + */ + getMarkers(): google.maps.Marker[]; + + /** + * Returns the number of markers managed by the clusterer. + * + * @return {number} The number of markers. + */ + getTotalMarkers(): number; + + /** + * Returns the current array of clusters formed by the clusterer. + * + * @return {Array} The array of clusters formed by the clusterer. + */ + getClusters(): Cluster[]; + + /** + * Returns the number of clusters formed by the clusterer. + * + * @return {number} The number of clusters formed by the clusterer. + */ + getTotalClusters(): number; + + /** + * Adds a marker to the clusterer. The clusters are redrawn unless + * opt_nodraw is set to true. + * + * @param {google.maps.Marker} marker The marker to add. + * @param {boolean} [opt_nodraw] Set to true to prevent redrawing. + */ + addMarker(marker: google.maps.Marker, opt_nodraw: boolean): void; + + /** + * Adds an array of markers to the clusterer. The clusters are redrawn unless + * opt_nodraw is set to true. + * + * @param {Array.} markers The markers to add. + * @param {boolean} [opt_nodraw] Set to true to prevent redrawing. + */ + addMarkers(markers: google.maps.Marker[], opt_nodraw: boolean): void; + + /** + * Pushes a marker to the clusterer. + * + * @param {google.maps.Marker} marker The marker to add. + */ + pushMarkerTo_(marker: google.maps.Marker): void; + + /** + * Removes a marker from the cluster and map. The clusters are redrawn unless + * opt_nodraw is set to true. Returns true if the + * marker was removed from the clusterer. + * + * @param {google.maps.Marker} marker The marker to remove. + * @param {boolean} [opt_nodraw] Set to true to prevent redrawing. + * @param {boolean} [opt_noMapRemove] Set to true to prevent removal from map but still removing from cluster management + * @return {boolean} True if the marker was removed from the clusterer. + */ + removeMarker(marker: google.maps.Marker, opt_nodraw: boolean, noMapRemove: boolean): boolean; + + /** + * Removes an array of markers from the cluster and map. The clusters are redrawn unless + * opt_nodraw is set to true. Returns true if markers + * were removed from the clusterer. + * + * @param {Array.} markers The markers to remove. + * @param {boolean} [opt_nodraw] Set to true to prevent redrawing. + * @param {boolean} [opt_noMapRemove] Set to true to prevent removal from map but still removing from cluster management + * @return {boolean} True if markers were removed from the clusterer. + */ + removeMarkers(markers: google.maps.Marker[], opt_nodraw: boolean, opt_noMapRemove: boolean): boolean; + + /** + * Removes a marker and returns true if removed, false if not. + * + * @param {google.maps.Marker} marker The marker to remove + * @param {boolean} removeFromMap set to true to explicitly remove from map as well as cluster manangement + * @return {boolean} Whether the marker was removed or not + */ + removeMarker_(marker: google.maps.Marker, removeFromMap: boolean): boolean; + + /** + * Removes all clusters and markers from the map and also removes all markers + * managed by the clusterer. + */ + clearMarkers(): void; + + /** + * Recalculates and redraws all the marker clusters from scratch. + * Call this after changing any properties. + */ + repaint(): void; + + /** + * Returns the current bounds extended by the grid size. + * + * @param {google.maps.LatLngBounds} bounds The bounds to extend. + * @return {google.maps.LatLngBounds} The extended bounds. + * @ignore + */ + getExtendedBounds(bounds: google.maps.LatLngBounds): google.maps.LatLngBounds; + + /** + * Redraws all the clusters. + */ + redraw_(): void; + + /** + * Removes all clusters from the map. The markers are also removed from the map + * if opt_hide is set to true. + * + * @param {boolean} [opt_hide] Set to true to also remove the markers + * from the map. + */ + resetViewport_(opt_hide: boolean): void; + + /** + * Calculates the distance between two latlng locations in km. + * + * @param {google.maps.LatLng} p1 The first lat lng point. + * @param {google.maps.LatLng} p2 The second lat lng point. + * @return {number} The distance between the two points in km. + * @see http://www.movable-type.co.uk/scripts/latlong.html + */ + distanceBetweenPoints_(p1: google.maps.LatLng, p2: google.maps.LatLng): number; + + /** + * Determines if a marker is contained in a bounds. + * + * @param {google.maps.Marker} marker The marker to check. + * @param {google.maps.LatLngBounds} bounds The bounds to check against. + * @return {boolean} True if the marker is in the bounds. + */ + isMarkerInBounds_(marker: google.maps.Marker, bounds: google.maps.LatLngBounds): boolean; + + /** + * Adds a marker to a cluster, or creates a new cluster. + * + * @param {google.maps.Marker} marker The marker to add. + */ + addToClosestCluster_(marker: google.maps.Marker): void; + + /** + * Creates the clusters. This is done in batches to avoid timeout errors + * in some browsers when there is a huge number of markers. + * + * @param {number} iFirst The index of the first marker in the batch of + * markers to be added to clusters. + */ + createClusters_(iFirst: number): void; + + /** + * Extends an object's prototype by another's. + * + * @param {Object} obj1 The object to be extended. + * @param {Object} obj2 The object to extend with. + * @return {Object} The new extended object. + * @ignore + */ + extend(obj1: Object, obj2: Object): Object; + + /** + * The default function for determining the label text and style + * for a cluster icon. + * + * @param {Array.} markers The array of markers represented by the cluster. + * @param {number} numStyles The number of marker styles available. + * @return {ClusterIconInfo} The information resource for the cluster. + * @constant + * @ignore + */ + CALCULATOR(markers: google.maps.Marker[], numStyles: number): ClusterIconInfo; + + /** + * The number of markers to process in one batch. + * + * @type {number} + * @constant + */ + BATCH_SIZE: number; + + /** + * The number of markers to process in one batch (IE only). + * + * @type {number} + * @constant + */ + BATCH_SIZE_IE: number; + + /** + * The default root name for the marker cluster images. + * + * @type {string} + * @constant + */ + IMAGE_PATH: string; + + /** + * The default extension name for the marker cluster images. + * + * @type {string} + * @constant + */ + IMAGE_EXTENSION: string; + + /** + * The default array of sizes for the marker cluster images. + * + * @type {Array.} + * @constant + */ + IMAGE_SIZES: number[]; + +} + +declare var MarkerClusterer: MarkerClusterer; + +interface String { + trim(): string; +} From 550e5bfee2c882c2641967325c14ac935d0e6e68 Mon Sep 17 00:00:00 2001 From: Seulgi Kim Date: Fri, 22 May 2015 23:23:59 +0900 Subject: [PATCH 131/179] Add declaration for mpromise --- mpromise/mpromise-tests.ts | 134 +++++++++++++++++++++++++++++++++++++ mpromise/mpromise.d.ts | 42 ++++++++++++ 2 files changed, 176 insertions(+) create mode 100644 mpromise/mpromise-tests.ts create mode 100644 mpromise/mpromise.d.ts diff --git a/mpromise/mpromise-tests.ts b/mpromise/mpromise-tests.ts new file mode 100644 index 000000000..cb09df475 --- /dev/null +++ b/mpromise/mpromise-tests.ts @@ -0,0 +1,134 @@ +/// +/// + +var assert = require('assert'); +import Promise = require('mpromise'); + +function ex1() { + var promise = new Promise; +} + +function ex2() { + var promise = new Promise (function(reason: string, ...args: number[]) { + return; + }); +} + +function ex3() { + var promise = new Promise(); + promise.onResolve(function(reason: string, ...args: number[]) { + return; + }); +} + +function fulfill() { + var promise = new Promise(); + promise.fulfill(1, 2, 3); +} + +function reject() { + var promise = new Promise(); + promise.reject('reason'); +} + +function onFulfill1() { + var promise = new Promise(); + promise.onFulfill(function (...args: number[]) { + assert.equal(3, args[0] + args[1]); + }); + promise.fulfill(1, 2); +} + +function onFulfill2() { + var promise = new Promise(); + promise.fulfill(" :D "); + promise.onFulfill(function (arg: string) { + console.log(arg); // logs " :D " + }); +} + +function onReject1() { + var promise = new Promise(); + promise.onReject(function (reason: string) { + assert.equal('sad', reason); + }); + promise.reject('sad'); +} + +function onReject2() { + var promise = new Promise(); + promise.reject(" :( "); + promise.onReject(function (reason: string) { + console.log(reason); // logs " :( " + }); +} + +function onResolve1() { + var promise = new Promise(); + promise.onResolve(function (err: R, ...args: number[]) { + console.log(args[0] + args[1]); // logs 3 + }); + promise.fulfill(1, 2); +} + +function onResolve2() { + // rejection + var promise = new Promise(); + promise.onResolve(function (err: Error) { + if (err) { + console.log(err.message); // logs "failed" + } + }); + promise.reject(new Error('failed')); +} + +function then() { + var promise = new Promise(); + + promise.then(function (arg: number) { + return arg + 1; + }).then(function (arg: number) { + throw new Error(arg + ' is an error!'); + }).then(null, function (err: Error) { + assert.ok(err instanceof Error); + assert.equal('2 is an error', err.message); + }); + promise.fulfill(1); +} + +function end1() { + var promise = new Promise(); + promise.then(function(){ throw new Error('shucks') }); + setTimeout(function () { + promise.fulfill(); + // error was caught and swallowed by the promise returned from + // p.then(). we either have to always register handlers on + // the returned promises or we can do the following... + }, 10); +} + +function end2() { + // this time we use .end() which prevents catching thrown errors + var promise = new Promise(); + setTimeout(function () { + promise.fulfill(); // throws "shucks" + }, 10); + return promise.then(function(){ throw new Error('shucks') }).end(); // <-- +} + +function chain() { + function makeMeAPromise(i: number) { + var p = new Promise(); + p.fulfill(i); + return p; + } + + var initialPromise = new Promise(); + var returnPromise = initialPromise; + for (var i=0; i<10; ++i) { + returnPromise = returnPromise.chain(makeMeAPromise(i)); + } + + initialPromise.fulfill(); + return returnPromise; +} diff --git a/mpromise/mpromise.d.ts b/mpromise/mpromise.d.ts new file mode 100644 index 000000000..ba6961362 --- /dev/null +++ b/mpromise/mpromise.d.ts @@ -0,0 +1,42 @@ +// Type definitions for mpromise 0.5.4 +// Project: https://github.com/aheckmann/mpromise +// Definitions by: Seulgi Kim +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "mpromise" { + interface IFulfillFunction { + (...args: F[]): void; + (arg: F): void; + } + interface IRejectFunction { + (err: R): void; + } + interface IResolveFunction { + (err: R, ...args: F[]): void; + (err: R, arg: F): void; + } + + class Promise { + constructor(fn?: IResolveFunction); + + static FAILURE: string; + static SUCCESS: string; + + fulfill(...args: F[]): Promise; + fulfill(arg: F): Promise; + reject(reason: R): Promise; + resolve(reason: R, ...args: F[]): Promise; + resolve(reason: R, arg: F): Promise; + + onFulfill(callback: IFulfillFunction): Promise; + onReject(callback: IRejectFunction): Promise; + onResolve(callback: IResolveFunction): Promise; + + then(onFulfilled: IFulfillFunction, onRejected?: IRejectFunction): Promise; + end(): void; + + chain(promise: Promise): Promise; + } + + export = Promise; +} From 1f0b864b9d63574481c8ab39c84ca8378a6dce9c Mon Sep 17 00:00:00 2001 From: Guilherme Bernal Date: Mon, 25 May 2015 00:17:41 -0300 Subject: [PATCH 132/179] Add definitions for the Piwik NodeJS tracker Piwik.org is a tracker similar to Google Analitics, but can run on your own server. These definitions are for the node api. --- piwik-tracker/piwik-tracker.d.ts | 91 ++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 piwik-tracker/piwik-tracker.d.ts diff --git a/piwik-tracker/piwik-tracker.d.ts b/piwik-tracker/piwik-tracker.d.ts new file mode 100644 index 000000000..a1c18b627 --- /dev/null +++ b/piwik-tracker/piwik-tracker.d.ts @@ -0,0 +1,91 @@ +// Type definitions for PiwikTracker v0.1.1 +// Project: http://piwik.org - https://www.npmjs.com/package/piwik-tracker +// Definitions by: Guilherme Bernal +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "piwik-tracker" { + + export = PiwikTracker; + + // refer to http://developer.piwik.org/api-reference/tracking-api + interface PiwikTrackOptions { + // Required parameters + url : string; + + // Recommended parameters + action_name? : string; + _id? : string; + rand? : string; + apiv? : number; + + // Optional User info + urlref? : string; + _cvar? : string; + _idvc? : string; + _viewts? : string; + _idts? : string; + _rcn? : string; + _rck? : string; + res? : string; + h? : number; + m? : number; + s? : number; + ua? : string; + lang? : string; + uid? : string; + cid? : string; + new_visit? : number; + + // Optional Action info + cvar? : string; + link? : string; + download? : string; + search? : string; + search_cat? : string; + search_count? : number; + idgoal? : number; + revenue? : number; + gt_ms? : number; + cs? : string; + + // Optional Event Tracking info + e_c? : string; + e_a? : string; + e_n? : string; + e_v? : string; + + // Optional Content Tracking info + c_n? : string; + c_p? : string; + c_t? : string; + c_i? : string; + + // Optional Ecommerce info + ec_id? : string; + ec_items? : string; + ec_st? : number; + ec_tx? : number; + ec_sh? : number; + ec_dt? : number; + _ects? : number; + + // Other parameters (require authentication via token_auth) + token_auth? : string; + cip? : string; + cdt? : string; + country? : string; + region? : string; + city? : string; + lat? : string; + long? : string; + + // Other parameters + send_image? : number; + } + + class PiwikTracker { + constructor(siteId : number, trackerUrl : string); + track(options : PiwikTrackOptions) : void; + } + +} From ca873b08a38c57559d4eebe949737710343dd177 Mon Sep 17 00:00:00 2001 From: Guilherme Bernal Date: Mon, 25 May 2015 00:23:31 -0300 Subject: [PATCH 133/179] piwik-tracker: Update project url --- piwik-tracker/piwik-tracker.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/piwik-tracker/piwik-tracker.d.ts b/piwik-tracker/piwik-tracker.d.ts index a1c18b627..ddb1ae133 100644 --- a/piwik-tracker/piwik-tracker.d.ts +++ b/piwik-tracker/piwik-tracker.d.ts @@ -1,5 +1,5 @@ // Type definitions for PiwikTracker v0.1.1 -// Project: http://piwik.org - https://www.npmjs.com/package/piwik-tracker +// Project: https://www.npmjs.com/package/piwik-tracker // Definitions by: Guilherme Bernal // Definitions: https://github.com/borisyankov/DefinitelyTyped From 16c6bbf0c9771581b4a01ea7b0c13ee8ec283772 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elis=C3=A9e?= Date: Mon, 25 May 2015 08:11:12 +0200 Subject: [PATCH 134/179] express: Request.host deprecated, use .hostname --- express/express.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/express/express.d.ts b/express/express.d.ts index 0a7aa0057..0bd42b82f 100644 --- a/express/express.d.ts +++ b/express/express.d.ts @@ -349,6 +349,11 @@ declare module "express" { /** * Parse the "Host" header field hostname. */ + hostname: string; + + /** + * @deprecated Use hostname instead. + */ host: string; /** From 179b684deb12f0660ec06ac7d71211dd216c493d Mon Sep 17 00:00:00 2001 From: Ruslan Grabovoy Date: Mon, 25 May 2015 12:57:56 +0300 Subject: [PATCH 135/179] Make errback an optional argument (Squire.js) --- squirejs/squirejs.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/squirejs/squirejs.d.ts b/squirejs/squirejs.d.ts index 693ca7d90..a6ee7ec20 100644 --- a/squirejs/squirejs.d.ts +++ b/squirejs/squirejs.d.ts @@ -9,7 +9,7 @@ declare module 'Squire' { constructor(context: string); mock(name: string, mock: any): Squire; mock(mocks: {[name: string]: any}): Squire; - require(dependencies: string[], callback: Function, errback: Function): Squire; + require(dependencies: string[], callback: Function, errback?: Function): Squire; store(name: string | string[]): Squire; clean(): Squire; clean(name: string | string[]): Squire; From 4c960b46b3a841bccf7c26b3d575ea45cb97172f Mon Sep 17 00:00:00 2001 From: Brian Surowiec Date: Fri, 24 Apr 2015 22:20:21 -0400 Subject: [PATCH 136/179] Move to uri namespace --- urijs/URI-tests.ts | 16 ++ urijs/URI.d.ts | 377 +++++++++++++++++++++++++-------------------- 2 files changed, 222 insertions(+), 171 deletions(-) create mode 100644 urijs/URI-tests.ts diff --git a/urijs/URI-tests.ts b/urijs/URI-tests.ts new file mode 100644 index 000000000..4ab69219e --- /dev/null +++ b/urijs/URI-tests.ts @@ -0,0 +1,16 @@ +/// + +new URI(); +new URI('http://user:pass@example.org:80/foo/bar.html?foo=bar&bar=baz#frag'); +new URI({ + protocol: 'http', + username: 'user', + password: 'pass', + hostname: 'example.org', + port: '80', + path: '/foo/bar.html', + query: 'foo=bar&bar=baz', + fragment: 'frag' +}); + +var uri: uri.URI = $('a').uri(); diff --git a/urijs/URI.d.ts b/urijs/URI.d.ts index 448365762..2f40b1a46 100644 --- a/urijs/URI.d.ts +++ b/urijs/URI.d.ts @@ -1,186 +1,221 @@ // Type definitions for URI.js // Project: https://github.com/medialize/URI.js -// Definitions by: RodneyJT +// Definitions by: RodneyJT , Brian Surowiec // Definitions: https://github.com/borisyankov/DefinitelyTyped /// -interface URIOptions { - protocol?: string; - username?: string; - password?: string; - hostname?: string; - port?: string; - path?: string; - query?: string; - fragment?: string; -} +declare module uri { -declare class URI { - constructor(); - constructor(uri: string); - constructor(options: URIOptions); - clone(): URI; - href(): string; - href(url: string): void; - valueOf(): string; - scheme(): string; - protocol(): string; - scheme(protocol: string): URI; - protocol(protocol: string): URI; - username(): string; - username(uname: string): URI; - password(): string; - password(pw: string): URI; - port(): string; - port(port: string): URI; - hostname(): string; - hostname(hostname: string): URI; - host(): string; - host(host: string): URI; - userinfo(): string; - userinfo(userinfo: string): URI; - authority(): string; - authority(authority: string): URI; - domain(): string; - domain(domain: boolean): string; - domain(domain: string): URI; - subdomain(): string; - subdomain(subdomain: string): URI; - tld(): string; - tld(tld: boolean): string; - tld(tld: string): URI; - path(): string; - path(path: boolean): string; - path(path: string): URI; - pathname(): string; - pathname(path: boolean): string; - pathname(path: string): URI; - directory(): string; - directory(dir: boolean): string; - directory(dir: string): URI; - filename(): string; - filename(file: boolean): string; - filename(file: string): URI; - suffix(): string; - suffix(suffix: boolean): string; - suffix(suffix: string): URI; - segment(): string[]; - segment(segments: string[]): string; - segment(position: number): string; - segment(position: number, level: string): string; - segment(level: string): string; - search(): string; - search(qry: string): URI; - search(qry: boolean): any; - search(qry: Object): URI; - query(): string; - query(qry: string): URI; - query(qry: boolean): Object; - query(qry: Object): URI; - hash(): string; - hash(hash: string): URI; - fragment(): string; - fragment(fragment: string): URI; - resource(): string; - resource(resource: string): URI; - is(qry: string): boolean; - addSearch(qry: string): URI; - addSearch(qry: Object): URI; - addQuery(qry: string): URI; - addQuery(qry: Object): URI; - removeSearch(qry: string): URI; - removeSearch(qry: Object): URI; - removeQuery(qry: string): URI; - removeQuery(qry: Object): URI; - addFragment(fragment: string): URI; - //fragmentPrefix: string; - fragmentPrefix(prefix: string): URI; - normalize(): URI; - normalizeProtocol(): URI; - normalizeHostname(): URI; - normalizePort(): URI; - normalizePathname(): URI; - normalizePath(): URI; - normalizeSearch(): URI; - normalizeQuery(): URI; - normalizeHash(): URI; - normalizeFragment(): URI; - iso8859(): URI; - unicode(): URI; - readable(): string; - relativeTo(path: string): URI; - absoluteTo(path: string): URI; - equals(): boolean; - equals(url: string): boolean; - static parse(url: string): { - protocol: string; - username: string; - password: string; - hostname: string; - port: string; - path: string; - query: string; - fragment: string; - }; - static parseAuthority(url: string, parts: { + interface URI { + absoluteTo(path: string): URI; + addFragment(fragment: string): URI; + addQuery(qry: string): URI; + addQuery(qry: Object): URI; + addSearch(qry: string): URI; + addSearch(qry: Object): URI; + authority(): string; + authority(authority: string): URI; + + clone(): URI; + + directory(): string; + directory(dir: boolean): string; + directory(dir: string): URI; + domain(): string; + domain(domain: boolean): string; + domain(domain: string): URI; + + equals(): boolean; + equals(url: string): boolean; + + filename(): string; + filename(file: boolean): string; + filename(file: string): URI; + fragment(): string; + fragment(fragment: string): URI; + fragmentPrefix(prefix: string): URI; + + hash(): string; + hash(hash: string): URI; + host(): string; + host(host: string): URI; + hostname(): string; + hostname(hostname: string): URI; + href(): string; + href(url: string): void; + + is(qry: string): boolean; + iso8859(): URI; + + normalize(): URI; + normalizeFragment(): URI; + normalizeHash(): URI; + normalizeHostname(): URI; + normalizePath(): URI; + normalizePathname(): URI; + normalizePort(): URI; + normalizeProtocol(): URI; + normalizeQuery(): URI; + normalizeSearch(): URI; + + password(): string; + password(pw: string): URI; + path(): string; + path(path: boolean): string; + path(path: string): URI; + pathname(): string; + pathname(path: boolean): string; + pathname(path: string): URI; + port(): string; + port(port: string): URI; + protocol(): string; + protocol(protocol: string): URI; + + query(): string; + query(qry: string): URI; + query(qry: boolean): Object; + query(qry: Object): URI; + + readable(): string; + relativeTo(path: string): URI; + removeQuery(qry: string): URI; + removeQuery(qry: Object): URI; + removeSearch(qry: string): URI; + removeSearch(qry: Object): URI; + resource(): string; + resource(resource: string): URI; + + scheme(): string; + scheme(protocol: string): URI; + search(): string; + search(qry: string): URI; + search(qry: boolean): any; + search(qry: Object): URI; + segment(): string[]; + segment(segments: string[]): string; + segment(position: number): string; + segment(position: number, level: string): string; + segment(level: string): string; + subdomain(): string; + subdomain(subdomain: string): URI; + suffix(): string; + suffix(suffix: boolean): string; + suffix(suffix: string): URI; + + tld(): string; + tld(tld: boolean): string; + tld(tld: string): URI; + + unicode(): URI; + userinfo(): string; + userinfo(userinfo: string): URI; + username(): string; + username(uname: string): URI; + + valueOf(): string; + } + + interface URIOptions { + protocol?: string; username?: string; password?: string; hostname?: string; port?: string; - }): string; - static parseUserinfo(url: string, parts: { - username?: string; - password?: string; - }): string; - static parseHost(url: string, parts: { - hostname?: string; - port?: string; - }): string; - static parseQuery(url: string): Object; - static build(parts: { - protocol: string; - username: string; - password: string; - hostname: string; - port: string; - path: string; - query: string; - fragment: string; - }): string; - static buildAuthority(parts: { - username?: string; - password?: string; - hostname?: string; - port?: string; - }): string; - static buildUserinfo(parts: { - username?: string; - password?: string; - }): string; - static buildHost(parts: { - hostname?: string; - port?: string; - }): string; - static buildQuery(qry: Object): string; - static buildQuery(qry: Object, duplicates: boolean): string; - static encode(str: string): string; - static decode(str: string): string; - static encodeReserved(str: string): string; - static encodeQuery(qry: string): string; - static decodeQuery(qry: string): string; - static addQuery(data: Object, prop: string, value: string): Object; - static addQuery(data: Object, qryObj: Object): Object; - static removeQuery(data: Object, prop: string, value: string): Object; - static removeQuery(data: Object, props: string[]): Object; - static removeQuery(data: Object, props: Object): Object; - static commonPath(path1: string, path2: string): string; - static withinString(source: string, func: (url: string) => string): string; - static iso8859(): void; - static unicode(): void; - static expand(template: string, vals: Object): URI; + path?: string; + query?: string; + fragment?: string; + } + + interface URIStatic { + new (): URI; + new (value: string | URIOptions): URI; + + addQuery(data: Object, prop: string, value: string): Object; + addQuery(data: Object, qryObj: Object): Object; + + build(parts: { + protocol: string; + username: string; + password: string; + hostname: string; + port: string; + path: string; + query: string; + fragment: string; + }): string; + buildAuthority(parts: { + username?: string; + password?: string; + hostname?: string; + port?: string; + }): string; + buildHost(parts: { + hostname?: string; + port?: string; + }): string; + buildQuery(qry: Object): string; + buildQuery(qry: Object, duplicates: boolean): string; + buildUserinfo(parts: { + username?: string; + password?: string; + }): string; + + commonPath(path1: string, path2: string): string; + + decode(str: string): string; + decodeQuery(qry: string): string; + + encode(str: string): string; + encodeQuery(qry: string): string; + encodeReserved(str: string): string; + expand(template: string, vals: Object): URI; + + iso8859(): void; + + parse(url: string): { + protocol: string; + username: string; + password: string; + hostname: string; + port: string; + path: string; + query: string; + fragment: string; + }; + parseAuthority(url: string, parts: { + username?: string; + password?: string; + hostname?: string; + port?: string; + }): string; + parseHost(url: string, parts: { + hostname?: string; + port?: string; + }): string; + parseQuery(url: string): Object; + parseUserinfo(url: string, parts: { + username?: string; + password?: string; + }): string; + + removeQuery(data: Object, prop: string, value: string): Object; + removeQuery(data: Object, props: string[]): Object; + removeQuery(data: Object, props: Object): Object; + + unicode(): void; + + withinString(source: string, func: (url: string) => string): string; + } + } interface JQuery { - uri(): URI; + uri(): uri.URI; +} + +declare var URI: uri.URIStatic; + +declare module 'URI' { + export = URI; } From 74eeac855c6e93bc6a780700cc06ba0b5059ae0a Mon Sep 17 00:00:00 2001 From: Brian Surowiec Date: Fri, 24 Apr 2015 22:21:50 -0400 Subject: [PATCH 137/179] Add support for URI() --- urijs/URI-tests.ts | 13 +++++++++++++ urijs/URI.d.ts | 5 ++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/urijs/URI-tests.ts b/urijs/URI-tests.ts index 4ab69219e..75e999140 100644 --- a/urijs/URI-tests.ts +++ b/urijs/URI-tests.ts @@ -1,5 +1,18 @@ /// +URI(); +URI('http://user:pass@example.org:80/foo/bar.html?foo=bar&bar=baz#frag'); +URI({ + protocol: 'http', + username: 'user', + password: 'pass', + hostname: 'example.org', + port: '80', + path: '/foo/bar.html', + query: 'foo=bar&bar=baz', + fragment: 'frag' +}); + new URI(); new URI('http://user:pass@example.org:80/foo/bar.html?foo=bar&bar=baz#frag'); new URI({ diff --git a/urijs/URI.d.ts b/urijs/URI.d.ts index 2f40b1a46..b140df400 100644 --- a/urijs/URI.d.ts +++ b/urijs/URI.d.ts @@ -1,4 +1,4 @@ -// Type definitions for URI.js +// Type definitions for URI.js 1.15.1 // Project: https://github.com/medialize/URI.js // Definitions by: RodneyJT , Brian Surowiec // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -128,6 +128,9 @@ declare module uri { } interface URIStatic { + (): URI; + (value: string | URIOptions): URI; + new (): URI; new (value: string | URIOptions): URI; From e15a4e3df3674496cc08f17cb97b0b8ac9af65aa Mon Sep 17 00:00:00 2001 From: Brian Surowiec Date: Fri, 24 Apr 2015 23:29:27 -0400 Subject: [PATCH 138/179] Add setQuery and setSearch methods --- urijs/URI-tests.ts | 5 +++++ urijs/URI.d.ts | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/urijs/URI-tests.ts b/urijs/URI-tests.ts index 75e999140..0c5efc8c7 100644 --- a/urijs/URI-tests.ts +++ b/urijs/URI-tests.ts @@ -26,4 +26,9 @@ new URI({ fragment: 'frag' }); +URI('').setQuery('foo', 'bar'); +URI('').setQuery({ foo: 'bar' }); +URI('').setSearch('foo', 'bar'); +URI('').setSearch({ foo: 'bar' }); + var uri: uri.URI = $('a').uri(); diff --git a/urijs/URI.d.ts b/urijs/URI.d.ts index b140df400..f745c6164 100644 --- a/urijs/URI.d.ts +++ b/urijs/URI.d.ts @@ -97,6 +97,10 @@ declare module uri { segment(position: number): string; segment(position: number, level: string): string; segment(level: string): string; + setQuery(key: string, value: string): URI; + setQuery(qry: Object): URI; + setSearch(key: string, value: string): URI; + setSearch(qry: Object): URI; subdomain(): string; subdomain(subdomain: string): URI; suffix(): string; From ab3cc6e0e0c362472527c174c2e7c1f6e21968c1 Mon Sep 17 00:00:00 2001 From: Brian Surowiec Date: Fri, 24 Apr 2015 23:30:16 -0400 Subject: [PATCH 139/179] Add html element constructors --- urijs/URI-tests.ts | 2 ++ urijs/URI.d.ts | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/urijs/URI-tests.ts b/urijs/URI-tests.ts index 0c5efc8c7..2ccd29d9c 100644 --- a/urijs/URI-tests.ts +++ b/urijs/URI-tests.ts @@ -12,6 +12,7 @@ URI({ query: 'foo=bar&bar=baz', fragment: 'frag' }); +URI(document.createElement('a')); new URI(); new URI('http://user:pass@example.org:80/foo/bar.html?foo=bar&bar=baz#frag'); @@ -25,6 +26,7 @@ new URI({ query: 'foo=bar&bar=baz', fragment: 'frag' }); +new URI(document.createElement('a')); URI('').setQuery('foo', 'bar'); URI('').setQuery({ foo: 'bar' }); diff --git a/urijs/URI.d.ts b/urijs/URI.d.ts index f745c6164..b59dad6aa 100644 --- a/urijs/URI.d.ts +++ b/urijs/URI.d.ts @@ -133,10 +133,10 @@ declare module uri { interface URIStatic { (): URI; - (value: string | URIOptions): URI; + (value: string | URIOptions | HTMLElement): URI; new (): URI; - new (value: string | URIOptions): URI; + new (value: string | URIOptions | HTMLElement): URI; addQuery(data: Object, prop: string, value: string): Object; addQuery(data: Object, qryObj: Object): Object; From 6c7eba43d4560122032c8504450725645f38832a Mon Sep 17 00:00:00 2001 From: Brian Surowiec Date: Mon, 25 May 2015 15:28:02 -0400 Subject: [PATCH 140/179] Rename files to match project name --- urijs/{URI-tests.ts => URIjs-tests.ts} | 2 +- urijs/{URI.d.ts => URIjs.d.ts} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename urijs/{URI-tests.ts => URIjs-tests.ts} (95%) rename urijs/{URI.d.ts => URIjs.d.ts} (100%) diff --git a/urijs/URI-tests.ts b/urijs/URIjs-tests.ts similarity index 95% rename from urijs/URI-tests.ts rename to urijs/URIjs-tests.ts index 2ccd29d9c..2dfd15618 100644 --- a/urijs/URI-tests.ts +++ b/urijs/URIjs-tests.ts @@ -1,4 +1,4 @@ -/// +/// URI(); URI('http://user:pass@example.org:80/foo/bar.html?foo=bar&bar=baz#frag'); diff --git a/urijs/URI.d.ts b/urijs/URIjs.d.ts similarity index 100% rename from urijs/URI.d.ts rename to urijs/URIjs.d.ts From eed636e1e9b4a9de3d15c157f79e22fbafcb27ba Mon Sep 17 00:00:00 2001 From: Guilherme Bernal Date: Mon, 25 May 2015 21:45:59 -0300 Subject: [PATCH 141/179] piwik-tracker: Add test file --- piwik-tracker/piwik-tracker-tests.ts | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 piwik-tracker/piwik-tracker-tests.ts diff --git a/piwik-tracker/piwik-tracker-tests.ts b/piwik-tracker/piwik-tracker-tests.ts new file mode 100644 index 000000000..f509fe57e --- /dev/null +++ b/piwik-tracker/piwik-tracker-tests.ts @@ -0,0 +1,28 @@ +/// +/// + +// Example code taken from https://www.npmjs.com/package/piwik-tracker + +var PiwikTracker = require('piwik-tracker'); + +// Initialize with your site ID and Piwik URL +var piwik = new PiwikTracker(1, 'http://mywebsite.com/piwik.php'); + +// Optional: Respond to tracking errors +piwik.on('error', function(err) { + console.log('error tracking request: ', err) +}) + +// Track a request URL: +// Either as a simple string … +piwik.track('http://example.com/track/this/url'); + +// … or provide further options: +piwik.track({ + url: 'http://example.com/track/this/url', + action_name: 'This will be shown in your dashboard', + ua: 'Node.js v0.10.24', + cvar: JSON.stringify({ + '1': ['custom variable name', 'custom variable value'] + }) +}); From 513a7049f9df45546d28291dea522c2fa7c4ffa9 Mon Sep 17 00:00:00 2001 From: Guilherme Bernal Date: Mon, 25 May 2015 21:50:59 -0300 Subject: [PATCH 142/179] piwik-tracker: PiwikTracker should inherit EventEmitter --- piwik-tracker/piwik-tracker.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/piwik-tracker/piwik-tracker.d.ts b/piwik-tracker/piwik-tracker.d.ts index ddb1ae133..c40a834b0 100644 --- a/piwik-tracker/piwik-tracker.d.ts +++ b/piwik-tracker/piwik-tracker.d.ts @@ -83,7 +83,7 @@ declare module "piwik-tracker" { send_image? : number; } - class PiwikTracker { + class PiwikTracker extends EventEmitter { constructor(siteId : number, trackerUrl : string); track(options : PiwikTrackOptions) : void; } From abee08ec189f0ea50e16d4b82c37fdf16a799517 Mon Sep 17 00:00:00 2001 From: Guilherme Bernal Date: Mon, 25 May 2015 21:51:26 -0300 Subject: [PATCH 143/179] piwik-tracker-test: Fix parameter type (implicity any) --- piwik-tracker/piwik-tracker-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/piwik-tracker/piwik-tracker-tests.ts b/piwik-tracker/piwik-tracker-tests.ts index f509fe57e..7d06d6bdc 100644 --- a/piwik-tracker/piwik-tracker-tests.ts +++ b/piwik-tracker/piwik-tracker-tests.ts @@ -9,7 +9,7 @@ var PiwikTracker = require('piwik-tracker'); var piwik = new PiwikTracker(1, 'http://mywebsite.com/piwik.php'); // Optional: Respond to tracking errors -piwik.on('error', function(err) { +piwik.on('error', function(err : Error) { console.log('error tracking request: ', err) }) From 3c378d7859679798d2b859e2087c095d93f6e2c9 Mon Sep 17 00:00:00 2001 From: Guilherme Bernal Date: Mon, 25 May 2015 21:53:01 -0300 Subject: [PATCH 144/179] piwik-tracker: Should refer node.d.ts --- piwik-tracker/piwik-tracker.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/piwik-tracker/piwik-tracker.d.ts b/piwik-tracker/piwik-tracker.d.ts index c40a834b0..498757002 100644 --- a/piwik-tracker/piwik-tracker.d.ts +++ b/piwik-tracker/piwik-tracker.d.ts @@ -3,6 +3,8 @@ // Definitions by: Guilherme Bernal // Definitions: https://github.com/borisyankov/DefinitelyTyped +/// + declare module "piwik-tracker" { export = PiwikTracker; From 917e0a59a0240ccbd59c62edbd399e526993272f Mon Sep 17 00:00:00 2001 From: Guilherme Bernal Date: Mon, 25 May 2015 21:55:53 -0300 Subject: [PATCH 145/179] piwik-tracker: Properly import EventEmitter --- piwik-tracker/piwik-tracker.d.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/piwik-tracker/piwik-tracker.d.ts b/piwik-tracker/piwik-tracker.d.ts index 498757002..129b714ca 100644 --- a/piwik-tracker/piwik-tracker.d.ts +++ b/piwik-tracker/piwik-tracker.d.ts @@ -7,6 +7,8 @@ declare module "piwik-tracker" { + import events = require('events'); + export = PiwikTracker; // refer to http://developer.piwik.org/api-reference/tracking-api @@ -85,7 +87,7 @@ declare module "piwik-tracker" { send_image? : number; } - class PiwikTracker extends EventEmitter { + class PiwikTracker extends events.EventEmitter { constructor(siteId : number, trackerUrl : string); track(options : PiwikTrackOptions) : void; } From 3eb36c97b6a438a44709d7c06ad0f98abb63cc2c Mon Sep 17 00:00:00 2001 From: Frank Bille Date: Tue, 26 May 2015 16:04:25 +0200 Subject: [PATCH 146/179] Return Firebase as type from $ref This is what really happens in the source code for AngularFire 1.1.1 (and always has), for both AngularFireObject and AngularFireArray. See https://github.com/firebase/angularfire/blob/1aa81906cdfb3e35e7c31fc6dee8a4922b1470ae/src/FirebaseObject.js#L125 --- angularfire/angularfire.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/angularfire/angularfire.d.ts b/angularfire/angularfire.d.ts index 46d95750c..04af445d9 100644 --- a/angularfire/angularfire.d.ts +++ b/angularfire/angularfire.d.ts @@ -33,7 +33,7 @@ interface AngularFireObject extends AngularFireSimpleObject { $loaded(resolve?: (x: AngularFireObject) => ng.IHttpPromise<{}>, reject?: (err: any) => any): ng.IPromise; $loaded(resolve?: (x: AngularFireObject) => ng.IPromise<{}>, reject?: (err: any) => any): ng.IPromise; $loaded(resolve?: (x: AngularFireObject) => void, reject?: (err: any) => any): ng.IPromise; - $ref(): AngularFire; + $ref(): Firebase; $bindTo(scope: ng.IScope, varName: string): ng.IPromise; $watch(callback: Function, context?: any): Function; $destroy(): void; @@ -53,7 +53,7 @@ interface AngularFireArray extends Array { $loaded(resolve?: (x: AngularFireArray) => ng.IHttpPromise<{}>, reject?: (err: any) => any): ng.IPromise; $loaded(resolve?: (x: AngularFireArray) => ng.IPromise<{}>, reject?: (err: any) => any): ng.IPromise; $loaded(resolve?: (x: AngularFireArray) => void, reject?: (err: any) => any): ng.IPromise; - $ref(): AngularFire; + $ref(): Firebase; $watch(cb: (event: string, key: string, prevChild: string) => void, context?: any): Function; $destroy(): void; } From b67ca7586142caf806555e3bc17ed3586fe22b04 Mon Sep 17 00:00:00 2001 From: Frank Bille Date: Tue, 26 May 2015 16:21:44 +0200 Subject: [PATCH 147/179] Fix tests to expect correct return type. Also stop using deprecated methods and use $firebase(Object|Array) directly instead. --- angularfire/angularfire-tests.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/angularfire/angularfire-tests.ts b/angularfire/angularfire-tests.ts index d636c88e6..c649301e3 100644 --- a/angularfire/angularfire-tests.ts +++ b/angularfire/angularfire-tests.ts @@ -46,7 +46,7 @@ myapp.controller("MyController", ["$scope", "$firebase", '$FirebaseObject', '$Fi // AngularFireObject { - var obj = sync.$asObject(); + var obj = $FirebaseObject(ref); // $id if (obj.$id !== ref.name()) throw "error"; @@ -63,7 +63,7 @@ myapp.controller("MyController", ["$scope", "$firebase", '$FirebaseObject', '$Fi }); // $ref() - if (obj.$ref() !== sync) throw "error"; + if (obj.$ref() !== ref) throw "error"; // $bindTo() obj.$bindTo($scope, "data").then(function () { @@ -92,10 +92,10 @@ myapp.controller("MyController", ["$scope", "$firebase", '$FirebaseObject', '$Fi // AngularFireArray { - var list = sync.$asArray(); + var list = $FirebaseArray(ref); // $ref() - if (list.$ref() !== sync) throw "error"; + if (list.$ref() !== ref) throw "error"; // $add() list.$add({ foo: "foo value" }); From f35df7ab4ca0747450182d5da657d6eec486c363 Mon Sep 17 00:00:00 2001 From: Frank Bille Date: Tue, 26 May 2015 17:05:10 +0200 Subject: [PATCH 148/179] Added documentation from AngularFire Copied the jsdoc directly from https://github.com/firebase/angularfire/tree/master/src --- angularfire/angularfire.d.ts | 385 +++++++++++++++++++++++++++++++++++ 1 file changed, 385 insertions(+) diff --git a/angularfire/angularfire.d.ts b/angularfire/angularfire.d.ts index 46d95750c..9370b2c98 100644 --- a/angularfire/angularfire.d.ts +++ b/angularfire/angularfire.d.ts @@ -10,6 +10,9 @@ interface AngularFireService { (firebase: Firebase, config?: any): AngularFire; } +/** + * @deprecated. Not possible with AngularFire 1.0+ + */ interface AngularFire { $asArray(): AngularFireArray; $asObject(): AngularFireObject; @@ -24,37 +27,279 @@ interface AngularFire { $transaction(key:string, updateFn: (currentData: any) => any, applyLocally?: boolean): ng.IPromise; } +/** + * Creates and maintains a synchronized object, with 2-way bindings between Angular and Firebase. + */ interface AngularFireObject extends AngularFireSimpleObject { $id: string; $priority: number; $value: any; + + /** + * Removes all keys from the FirebaseObject and also removes + * the remote data from the server. + * + * @returns a promise which will resolve after the op completes + */ + $remove(): ng.IPromise; + /** + * Saves all data on the FirebaseObject back to Firebase. + * @returns a promise which will resolve after the save is completed. + */ $save(): ng.IPromise; + + /** + * The loaded method is invoked after the initial batch of data arrives from the server. + * When this resolves, all data which existed prior to calling $asObject() is now cached + * locally in the object. + * + * As a shortcut is also possible to pass resolve/reject methods directly into this + * method just as they would be passed to .then() + * + * @param {Function} resolve + * @param {Function} reject + * @returns a promise which resolves after initial data is downloaded from Firebase + */ $loaded(resolve?: (x: AngularFireObject) => ng.IHttpPromise<{}>, reject?: (err: any) => any): ng.IPromise; + + /** + * The loaded method is invoked after the initial batch of data arrives from the server. + * When this resolves, all data which existed prior to calling $asObject() is now cached + * locally in the object. + * + * As a shortcut is also possible to pass resolve/reject methods directly into this + * method just as they would be passed to .then() + * + * @param {Function} resolve + * @param {Function} reject + * @returns a promise which resolves after initial data is downloaded from Firebase + */ $loaded(resolve?: (x: AngularFireObject) => ng.IPromise<{}>, reject?: (err: any) => any): ng.IPromise; + + /** + * The loaded method is invoked after the initial batch of data arrives from the server. + * When this resolves, all data which existed prior to calling $asObject() is now cached + * locally in the object. + * + * As a shortcut is also possible to pass resolve/reject methods directly into this + * method just as they would be passed to .then() + * + * @param {Function} resolve + * @param {Function} reject + * @returns a promise which resolves after initial data is downloaded from Firebase + */ $loaded(resolve?: (x: AngularFireObject) => void, reject?: (err: any) => any): ng.IPromise; + + /** + * @returns {Firebase} the original Firebase instance used to create this object. + */ $ref(): AngularFire; + + /** + * Creates a 3-way data sync between this object, the Firebase server, and a + * scope variable. This means that any changes made to the scope variable are + * pushed to Firebase, and vice versa. + * + * If scope emits a $destroy event, the binding is automatically severed. Otherwise, + * it is possible to unbind the scope variable by using the `unbind` function + * passed into the resolve method. + * + * Can only be bound to one scope variable at a time. If a second is attempted, + * the promise will be rejected with an error. + * + * @param {object} scope + * @param {string} varName + * @returns a promise which resolves to an unbind method after data is set in scope + */ $bindTo(scope: ng.IScope, varName: string): ng.IPromise; + + /** + * Listeners passed into this method are notified whenever a new change is received + * from the server. Each invocation is sent an object containing + * { type: 'value', key: 'my_firebase_id' } + * + * This method returns an unbind function that can be used to detach the listener. + * + * @param {Function} cb + * @param {Object} [context] + * @returns {Function} invoke to stop observing events + */ $watch(callback: Function, context?: any): Function; + + /** + * Informs $firebase to stop sending events and clears memory being used + * by this object (delete's its local content). + */ $destroy(): void; } interface AngularFireObjectService { + /** + * Creates a synchronized object with 2-way bindings between Angular and Firebase. + * + * @param {Firebase} ref + * @returns {FirebaseObject} + */ (firebase: Firebase): AngularFireObject; $extend(ChildClass: Object, methods?: Object): Object; } +/** + * Creates and maintains a synchronized list of data. This is a pseudo-read-only array. One should + * not call splice(), push(), pop(), et al directly on this array, but should instead use the + * $remove and $add methods. + * + * It is acceptable to .sort() this array, but it is important to use this in conjunction with + * $watch(), so that it will be re-sorted any time the server data changes. Examples of this are + * included in the $watch documentation. + */ interface AngularFireArray extends Array { + /** + * Create a new record with a unique ID and add it to the end of the array. + * This should be used instead of Array.prototype.push, since those changes will not be + * synchronized with the server. + * + * Any value, including a primitive, can be added in this way. Note that when the record + * is created, the primitive value would be stored in $value (records are always objects + * by default). + * + * Returns a future which is resolved when the data has successfully saved to the server. + * The resolve callback will be passed a Firebase ref representing the new data element. + * + * @param data + * @returns a promise resolved after data is added + */ $add(newData: any): ng.IPromise; + + /** + * Pass either an item in the array or the index of an item and it will be saved back + * to Firebase. While the array is read-only and its structure should not be changed, + * it is okay to modify properties on the objects it contains and then save those back + * individually. + * + * Returns a future which is resolved when the data has successfully saved to the server. + * The resolve callback will be passed a Firebase ref representing the saved element. + * If passed an invalid index or an object which is not a record in this array, + * the promise will be rejected. + * + * @param {int|object} indexOrItem + * @returns a promise resolved after data is saved + */ $save(recordOrIndex: any): ng.IPromise; + + /** + * Pass either an existing item in this array or the index of that item and it will + * be removed both locally and in Firebase. This should be used in place of + * Array.prototype.splice for removing items out of the array, as calling splice + * will not update the value on the server. + * + * Returns a future which is resolved when the data has successfully removed from the + * server. The resolve callback will be passed a Firebase ref representing the deleted + * element. If passed an invalid index or an object which is not a record in this array, + * the promise will be rejected. + * + * @param {int|object} indexOrItem + * @returns a promise which resolves after data is removed + */ $remove(recordOrIndex: any): ng.IPromise; + + /** + * Returns the record for a given Firebase key (record.$id). If the record is not found + * then returns null. + * + * @param {string} key + * @returns {Object|null} a record in this array + */ $getRecord(key: string): AngularFireSimpleObject; + + /** + * Given an item in this array or the index of an item in the array, this returns the + * Firebase key (record.$id) for that record. If passed an invalid key or an item which + * does not exist in this array, it will return null. + * + * @param {int|object} indexOrItem + * @returns {null|string} + */ $keyAt(recordOrIndex: any): string; + + /** + * The inverse of $keyAt, this method takes a Firebase key (record.$id) and returns the + * index in the array where that record is stored. If the record is not in the array, + * this method returns -1. + * + * @param {String} key + * @returns {int} -1 if not found + */ $indexFor(key: string): number; + + /** + * The loaded method is invoked after the initial batch of data arrives from the server. + * When this resolves, all data which existed prior to calling $asArray() is now cached + * locally in the array. + * + * As a shortcut is also possible to pass resolve/reject methods directly into this + * method just as they would be passed to .then() + * + * @param {Function} [resolve] + * @param {Function} [reject] + * @returns a promise + */ $loaded(resolve?: (x: AngularFireArray) => ng.IHttpPromise<{}>, reject?: (err: any) => any): ng.IPromise; + + /** + * The loaded method is invoked after the initial batch of data arrives from the server. + * When this resolves, all data which existed prior to calling $asArray() is now cached + * locally in the array. + * + * As a shortcut is also possible to pass resolve/reject methods directly into this + * method just as they would be passed to .then() + * + * @param {Function} [resolve] + * @param {Function} [reject] + * @returns a promise + */ $loaded(resolve?: (x: AngularFireArray) => ng.IPromise<{}>, reject?: (err: any) => any): ng.IPromise; + + /** + * The loaded method is invoked after the initial batch of data arrives from the server. + * When this resolves, all data which existed prior to calling $asArray() is now cached + * locally in the array. + * + * As a shortcut is also possible to pass resolve/reject methods directly into this + * method just as they would be passed to .then() + * + * @param {Function} [resolve] + * @param {Function} [reject] + * @returns a promise + */ $loaded(resolve?: (x: AngularFireArray) => void, reject?: (err: any) => any): ng.IPromise; + + /** + * @returns {Firebase} the original Firebase ref used to create this object. + */ $ref(): AngularFire; + + /** + * Listeners passed into this method are notified whenever a new change (add, updated, + * move, remove) is received from the server. Each invocation is sent an object + * containing { type: 'child_added|child_updated|child_moved|child_removed', + * key: 'key_of_item_affected'} + * + * Additionally, added and moved events receive a prevChild parameter, containing the + * key of the item before this one in the array. + * + * This method returns a function which can be invoked to stop observing events. + * + * @param {Function} cb + * @param {Object} [context] + * @returns {Function} used to stop observing + */ $watch(cb: (event: string, key: string, prevChild: string) => void, context?: any): Function; + + /** + * Informs $firebase to stop sending events and clears memory being used + * by this array (delete's its local content). + */ $destroy(): void; } interface AngularFireArrayService { @@ -75,20 +320,160 @@ interface AngularFireAuthService { } interface AngularFireAuth { + /** + * Authenticates the Firebase reference with a custom authentication token. + * + * @param {string} authToken An authentication token or a Firebase Secret. A Firebase Secret + * should only be used for authenticating a server process and provides full read / write + * access to the entire Firebase. + * @param {Object} [options] An object containing optional client arguments, such as configuring + * session persistence. + * @return {Promise} A promise fulfilled with an object containing authentication data. + */ $authWithCustomToken(authToken: string, options?: Object): ng.IPromise; + + /** + * Authenticates the Firebase reference anonymously. + * + * @param {Object} [options] An object containing optional client arguments, such as configuring + * session persistence. + * @return {Promise} A promise fulfilled with an object containing authentication data. + */ $authAnonymously(options?: Object): ng.IPromise; + + /** + * Authenticates the Firebase reference with an email/password user. + * + * @param {Object} credentials An object containing email and password attributes corresponding + * to the user account. + * @param {Object} [options] An object containing optional client arguments, such as configuring + * session persistence. + * @return {Promise} A promise fulfilled with an object containing authentication data. + */ $authWithPassword(credentials: FirebaseCredentials, options?: Object): ng.IPromise; + + /** + * Authenticates the Firebase reference with the OAuth popup flow. + * + * @param {string} provider The unique string identifying the OAuth provider to authenticate + * with, e.g. google. + * @param {Object} [options] An object containing optional client arguments, such as configuring + * session persistence. + * @return {Promise} A promise fulfilled with an object containing authentication data. + */ $authWithOAuthPopup(provider: string, options?: Object): ng.IPromise; + + /** + * Authenticates the Firebase reference with the OAuth redirect flow. + * + * @param {string} provider The unique string identifying the OAuth provider to authenticate + * with, e.g. google. + * @param {Object} [options] An object containing optional client arguments, such as configuring + * session persistence. + * @return {Promise} A promise fulfilled with an object containing authentication data. + */ $authWithOAuthRedirect(provider: string, options?: Object): ng.IPromise; + + /** + * Authenticates the Firebase reference with an OAuth token. + * + * @param {string} provider The unique string identifying the OAuth provider to authenticate + * with, e.g. google. + * @param {string|Object} credentials Either a string, such as an OAuth 2.0 access token, or an + * Object of key / value pairs, such as a set of OAuth 1.0a credentials. + * @param {Object} [options] An object containing optional client arguments, such as configuring + * session persistence. + * @return {Promise} A promise fulfilled with an object containing authentication data. + */ $authWithOAuthToken(provider: string, credentials: Object|string, options?: Object): ng.IPromise; + + /** + * Synchronously retrieves the current authentication data. + * + * @return {Object} The client's authentication data. + */ $getAuth(): FirebaseAuthData; + + /** + * Asynchronously fires the provided callback with the current authentication data every time + * the authentication data changes. It also fires as soon as the authentication data is + * retrieved from the server. + * + * @param {function} callback A callback that fires when the client's authenticate state + * changes. If authenticated, the callback will be passed an object containing authentication + * data according to the provider used to authenticate. Otherwise, it will be passed null. + * @param {string} [context] If provided, this object will be used as this when calling your + * callback. + * @return {function} A function which can be used to deregister the provided callback. + */ $onAuth(callback: Function, context?: any): Function; + + /** + * Unauthenticates the Firebase reference. + */ $unauth(): void; + + /** + * Utility method which can be used in a route's resolve() method to grab the current + * authentication data. + * + * @returns {Promise} A promise fulfilled with the client's current authentication + * state, which will be null if the client is not authenticated. + */ $waitForAuth(): ng.IPromise; + + /** + * Utility method which can be used in a route's resolve() method to require that a route has + * a logged in client. + * + * @returns {Promise} A promise fulfilled with the client's current authentication + * state or rejected if the client is not authenticated. + */ $requireAuth(): ng.IPromise; + + /** + * Creates a new email/password user. Note that this function only creates the user, if you + * wish to log in as the newly created user, call $authWithPassword() after the promise for + * this method has been resolved. + * + * @param {Object} credentials An object containing the email and password of the user to create. + * @return {Promise} A promise fulfilled with the user object, which contains the + * uid of the created user. + */ $createUser(credentials: FirebaseCredentials): ng.IPromise; + + /** + * Removes an email/password user. + * + * @param {Object} credentials An object containing the email and password of the user to remove. + * @return {Promise<>} An empty promise fulfilled once the user is removed. + */ $removeUser(credentials: FirebaseCredentials): ng.IPromise; + + /** + * Changes the email for an email/password user. + * + * @param {Object} credentials An object containing the old email, new email, and password of + * the user whose email is to change. + * @return {Promise<>} An empty promise fulfilled once the email change is complete. + */ $changeEmail(credentials: FirebaseChangeEmailCredentials): ng.IPromise; + + /** + * Changes the password for an email/password user. + * + * @param {Object} credentials An object containing the email, old password, and new password of + * the user whose password is to change. + * @return {Promise<>} An empty promise fulfilled once the password change is complete. + */ $changePassword(credentials: FirebaseChangePasswordCredentials): ng.IPromise; + + /** + * Sends a password reset email to an email/password user. + * + * @param {Object} credentials An object containing the email of the user to send a reset + * password email to. + * @return {Promise<>} An empty promise fulfilled once the reset password email is sent. + */ $resetPassword(credentials: FirebaseResetPasswordCredentials): ng.IPromise; } From 767f577db3fb20d624ba635a00faf1f4210b7833 Mon Sep 17 00:00:00 2001 From: Neil Culver Date: Tue, 26 May 2015 16:51:50 +0100 Subject: [PATCH 149/179] Added overload for definition of a custom CSS class Bumped version number. Added to definitions by. Corrected return type of JQuery method. --- jquery.placeholder/jquery.placeholder-tests.ts | 4 ++++ jquery.placeholder/jquery.placeholder.d.ts | 9 ++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/jquery.placeholder/jquery.placeholder-tests.ts b/jquery.placeholder/jquery.placeholder-tests.ts index 072c03721..b0e7629f3 100644 --- a/jquery.placeholder/jquery.placeholder-tests.ts +++ b/jquery.placeholder/jquery.placeholder-tests.ts @@ -2,3 +2,7 @@ /// $('input').placeholder(); + +// specify custom class +$('input').placeholder({ customClass: 'my-placeholder' }); + diff --git a/jquery.placeholder/jquery.placeholder.d.ts b/jquery.placeholder/jquery.placeholder.d.ts index b9af72494..d475adfce 100644 --- a/jquery.placeholder/jquery.placeholder.d.ts +++ b/jquery.placeholder/jquery.placeholder.d.ts @@ -1,13 +1,12 @@ -// Type definitions for jquery.placeholder.js 2.0.7 +// Type definitions for jquery.placeholder.js 2.1.1 // Project: https://github.com/mathiasbynens/jquery-placeholder -// Definitions by: Peter Gill +// Definitions by: Peter Gill , Neil Culver // Definitions: https://github.com/borisyankov/DefinitelyTyped /// interface JQuery { - - placeholder() : void; - + placeholder(options: { customClass: string }) : JQuery + placeholder() : JQuery } From 010acb155eb6db6baeaa4a08d713da80534a0573 Mon Sep 17 00:00:00 2001 From: Matt Brooks Date: Tue, 26 May 2015 16:51:49 +0100 Subject: [PATCH 150/179] Added new definition for Farbtastic jQuery plugin Added definition for Farbtastic jQuery color wheel plugin with accompanying tests file. --- farbtastic/farbtastic-tests.ts | 100 +++++++++++++++++++++++++++++++++ farbtastic/farbtastic.d.ts | 40 +++++++++++++ 2 files changed, 140 insertions(+) create mode 100644 farbtastic/farbtastic-tests.ts create mode 100644 farbtastic/farbtastic.d.ts diff --git a/farbtastic/farbtastic-tests.ts b/farbtastic/farbtastic-tests.ts new file mode 100644 index 000000000..ac5eb4074 --- /dev/null +++ b/farbtastic/farbtastic-tests.ts @@ -0,0 +1,100 @@ +/// + +var callback = () => {}; +var domNode = document.createElement("div"); + +// Basic usage + +// Can add a ready() handler to the document which initializes the color picker and links it to the text field +$(document).ready(function() { + $("#colorpicker").farbtastic("#color"); +}); + +// Advanced Usage: jQuery Method + +// Create color pickers in the selected objects +$("#colorpicker").farbtastic(); + +// Optional callback using a callback function +$("#colorpicker").farbtastic(callback); +$("#colourpicker").farbtastic(function (color) { + console.log(typeof color === "string"); +}); + +// Optional callback using a DOM node +$("#colorpicker").farbtastic(domNode); + +// Optional callback using a jQuery object +$("#colorpicker").farbtastic($("#color")); + +// Optional callback using a jQuery selector +$("#colorpicker").farbtastic("#color"); + +// Advanced Usage: Object + +// Can invoke method for returning Farbtastic object instead of a jQuery object +$.farbtastic(domNode); +$.farbtastic($("#color")); +$.farbtastic("#color"); + +// Optional callback using a callback function +$.farbtastic(domNode, callback); +$.farbtastic($("#color"), callback); +$.farbtastic("#color", callback); + +// Optional callback using a DOM node +$.farbtastic(domNode, domNode); +$.farbtastic($("#color"), domNode); +$.farbtastic("#color", domNode); + +// Optional callback using a jQuery object +$.farbtastic(domNode, $("#color")); +$.farbtastic($("#color"), $("#color")); +$.farbtastic("#color", $("#color")); + +// Optional callback using a jQuery selector +$.farbtastic(domNode, "#color"); +$.farbtastic($("#color"), "#color"); +$.farbtastic("#color", "#color"); + +// Advanced Usage: Options +$("#colorpicker").farbtastic({ + callback: (color) => { + console.log(color); + } +}); +$.farbtastic(domNode, { + width: 500 +}); +$.farbtastic($("#color"), { + wheelWidth: 300 +}); +$.farbtastic("#color", {}); + +// Advanced Usage: Methods +$.farbtastic("#colorpicker").linkTo(callback); +$.farbtastic("#colorpicker").linkTo(domNode); +$.farbtastic("#colorpicker").linkTo("#color"); +$.farbtastic("#colorpicker").linkTo($("#color")); + +$.farbtastic("#colorpicker").setColor("#aabbcc"); +$.farbtastic("#colorpicker").setColor([0.1, 0.2, 0.3]); +$.farbtastic("#colorpicker").setHSL([0.1, 0.2, 0.3]); + +// Advanced Usage: Properties +$.farbtastic("#colorpicker").color === "#aabbcc"; +$.farbtastic("#colorpicker").hsl === [0.1, 0.2, 0.3]; +$.farbtastic("#colorpicker").linked === $("#colorpicker"); +$.farbtastic("#colorpicker").linked === callback; + +// Can chain jQuery methods +$("#colorpicker") + .farbtastic() + .addClass("color-picker"); + +// Can chain Farbtastic methods +$.farbtastic("#colorpicker") + .linkTo(domNode) + .setColor("#000000") + .setHSL([0, 0, 0]); + \ No newline at end of file diff --git a/farbtastic/farbtastic.d.ts b/farbtastic/farbtastic.d.ts new file mode 100644 index 000000000..30e93d6f6 --- /dev/null +++ b/farbtastic/farbtastic.d.ts @@ -0,0 +1,40 @@ +// Type definitions for Farbtastic: jQuery Color Wheel v2.0.0-alpha.1 +// Project: http://mattfarina.github.io/farbtastic/ +// Definitions by: Matt Brooks +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module JQueryFarbtastic { + type Placeholder = string | Element | JQuery; + type CallbackFunction = (color: string) => any; + type Callback = CallbackFunction | Placeholder; + + interface Options { + callback?: Callback; + width?: number; + wheelWidth?: number; + } + + interface Farbtastic { + linked: CallbackFunction | JQuery; + color: string; + hsl: number[]; + + linkTo(callback: Callback): Farbtastic; + setColor(color: string | number[]): Farbtastic; + setHSL(hsl: number[]): Farbtastic; + } +} + +interface JQueryStatic { + farbtastic(placeholder: JQueryFarbtastic.Placeholder, callback: JQueryFarbtastic.Callback): JQueryFarbtastic.Farbtastic; + farbtastic(placeholder: JQueryFarbtastic.Placeholder, options: JQueryFarbtastic.Options): JQueryFarbtastic.Farbtastic; + farbtastic(placeholder: JQueryFarbtastic.Placeholder): JQueryFarbtastic.Farbtastic; +} + +interface JQuery { + farbtastic(callback: JQueryFarbtastic.Callback): JQuery; + farbtastic(options: JQueryFarbtastic.Options): JQuery; + farbtastic(): JQuery; +} \ No newline at end of file From 244a4c42774617e240d6a3116cc20ecf476b7c82 Mon Sep 17 00:00:00 2001 From: Kamyar Nazeri Date: Tue, 26 May 2015 23:33:57 +0430 Subject: [PATCH 151/179] Add definitions for multiplexjs --- multiplexjs/multiplexjs-tests.ts | 2496 +++++++++++++++++++++++++++++ multiplexjs/multiplexjs.d.ts | 2551 ++++++++++++++++++++++++++++++ 2 files changed, 5047 insertions(+) create mode 100644 multiplexjs/multiplexjs-tests.ts create mode 100644 multiplexjs/multiplexjs.d.ts diff --git a/multiplexjs/multiplexjs-tests.ts b/multiplexjs/multiplexjs-tests.ts new file mode 100644 index 000000000..2b9d7e9e9 --- /dev/null +++ b/multiplexjs/multiplexjs-tests.ts @@ -0,0 +1,2496 @@ +/// +/// + + +module MxTests { + + "use strict"; + + import Enumerator = mx.Enumerator; + import Enumerable = mx.Enumerable; + import Comparer = mx.Comparer; + import EqualityComparer = mx.EqualityComparer; + import Collection = mx.Collection; + import List = mx.List; + import ReadOnlyCollection = mx.ReadOnlyCollection; + import Dictionary = mx.Dictionary; + import SortedList = mx.SortedList; + import HashSet = mx.HashSet; + import LinkedList = mx.LinkedList; + import Queue = mx.Queue; + import Stack = mx.Stack; + import Lookup = mx.Lookup; + import RuntimeComparer = mx.RuntimeComparer; + + + var Enumerator = mx.Enumerator, + Enumerable = mx.Enumerable, + Comparer = mx.Comparer, + EqualityComparer = mx.EqualityComparer, + Collection = mx.Collection, + List = mx.List, + ReadOnlyCollection = mx.ReadOnlyCollection, + KeyValuePair = mx.KeyValuePair, + Dictionary = mx.Dictionary, + SortedList = mx.SortedList, + HashSet = mx.HashSet, + LinkedList = mx.LinkedList, + LinkedListNode = mx.LinkedListNode, + Queue = mx.Queue, + Stack = mx.Stack; + + + + + + + /* Classes + ---------------------------------------------------------------------- */ + + interface SimpleObject { + name: string; + value: number; + } + + // class without equality-comparer + class SimpleClass { + }; + + + // class overriding '__hash__' and '__equals__' methods. + class SimpleClassWithComparer implements RuntimeComparer, SimpleObject { + + constructor(val: number) { + this.value = val; + this.name = val.toString(); + } + + public name: string; + public value: number; + + __hash__(): number { + return mx.hash(this.value, this.name); + } + + __equals__(obj: any) { + return obj instanceof SimpleClassWithComparer && obj.value === this.value && obj.name === this.name; + } + }; + + + + + + + /* Tests + ---------------------------------------------------------------------- */ + + module MultiplexTests { + + QUnit.module("Multiplex"); + + + QUnit.test("Multiplex Array", function (assert) { + + var _source = mx([1, 2, 3, 4]); + assert.ok(MxCount(_source) === 4, "Passed!"); + }); + + + QUnit.test("Multiplex String", function (assert) { + var _source = mx("Multiplex"); + assert.ok(MxCount(_source) === 9, "Passed!"); + }); + + + QUnit.test("Multiplex Object", function (assert) { + var _source = mx({ name: "mx", id: 1 }); + assert.ok(MxCount(_source) === 2, "Passed!"); + }); + + + QUnit.test("Multiplex Array-like", function (assert) { + var _source = mx(arguments); + assert.ok(MxCount(_source) === 1, "Passed!"); + }); + + + //QUnit.test("Multiplex Iterable", function (assert) { + // var _set = new Set(), + // _source = mx(_set); + + // _set.add(1); + // _set.add(2); + // _set.add(3); + // assert.ok(MxCount(_source) === 3, "Passed!"); + //}); + + + QUnit.test("Multiplex Custom Enumerator", function (assert) { + var _source = mx(>{ + getEnumerator: function (): Enumerator { + var count = 3, index = 0; + return { + current: undefined, + next: function () { + if (index++ < count) { + this.current = index; + return true; + } + else { + this.current = undefined; + return false; + } + } + }; + } + }); + assert.ok(MxCount(_source) === 3, "Passed!"); + }); + + + QUnit.test("Multiplex Generator", function (assert) { + try { + var _source = eval("mx(function* () { yield 1; yield 2; yield 3; })"); + assert.ok(MxCount(_source) === 3, "Passed!"); + } + catch (e) { assert.ok(true, "Generator not implemented by the browser"); } + }); + + + QUnit.test("Multiplex Legacy Generator", function (assert) { + var _source = mx(function () { + var count = 3, + index = 0; + + return new Enumerator(function (yielder) { + if (index++ < count) { + yielder(index); + } + }); + }); + assert.ok(MxCount(_source) === 3, "Passed!"); + }); + + + QUnit.test("mx.range", function (assert) { + var _source = mx.range(0, 4); + assert.deepEqual(_source.toArray(), [0, 1, 2, 3], "Passed!"); + }); + + + QUnit.test("mx.repeat", function (assert) { + var _source = mx.repeat(1, 4); + assert.deepEqual(_source.toArray(), [1, 1, 1, 1], "Passed!"); + }); + + + QUnit.test("mx.empty", function (assert) { + var _source = mx.empty(); + assert.ok(MxCount(_source) === 0, "Passed!"); + }); + + + QUnit.test("mx.is", function (assert) { + assert.ok(mx.is(mx.range(1, 10)), "Enumerable Passed!"); + assert.ok(mx.is([1]), "Array Passed!"); + assert.ok(mx.is("mx"), "String Passed!"); + //assert.ok(mx.is(new Set()), "Iterable Passed!"); + + assert.ok(mx.is({ + getEnumerator: function (): Enumerator { + var count = 3, index = 0; + return { + current: undefined, + next: function () { + if (index++ < count) { + this.current = index; + return true; + } + else { + this.current = undefined; + return false; + } + } + }; + } + }), "Custom Enumerator Passed!"); + + try { + assert.ok(mx.is(eval("mx(function* () { yield 1; yield 2; yield 3; })")), "Generator Passed!"); + } + catch (e) { assert.ok(true, "Generator not implemented by the browser"); } + }); + + + + /* Factory methods + ---------------------------------------------------------------------- */ + + function MxCount(source: Enumerable): number { + var _e = source.getEnumerator(), + _i = 0; + + while (_e.next()) { + _i++; + } + + return _i; + } + } + + + module RuntimeTests { + + QUnit.module("Runtime"); + + + QUnit.test("hash", function (assert) { + + assert.ok(mx.hash(null) === 0, "hash null!"); + assert.ok(mx.hash(undefined) === 0, "hash undefined!"); + assert.ok(mx.hash(10) === mx.hash(10), "hash integer number!"); + assert.ok(mx.hash(10.5) === mx.hash(10.5), "hash float number!"); + assert.ok(mx.hash("string") === mx.hash("string"), "hash string!"); + assert.ok(mx.hash(true) === mx.hash(true), "hash boolean!"); + assert.ok(mx.hash(new Date(2015, 0, 1)) === mx.hash(new Date(2015, 0, 1)), "hash date!"); + assert.ok(mx.hash({ name: "A" }) === mx.hash({ name: "A" }), "hash object literal!"); + assert.ok(mx.hash(new SimpleClass()) !== mx.hash(new SimpleClass()), "hash class instance!"); + assert.ok(mx.hash(new SimpleClassWithComparer(10)) === mx.hash(new SimpleClassWithComparer(10)), "hash class instance overriding __hash__ method!"); + assert.ok(mx.hash(10, 10.5, "string", new Date(2015, 0, 1)) === mx.hash(10, 10.5, "string", new Date(2015, 0, 1)), "combine hash codes!"); + }); + + + QUnit.test("equals", function (assert) { + + assert.ok(mx.equals(null, null) === true, "equals null!"); + assert.ok(mx.equals(undefined, undefined) === true, "equals undefined!"); + assert.ok(mx.equals(10, 10), "equals integer number!"); + assert.ok(mx.equals(10.5, 10.5), "equals float number!"); + assert.ok(mx.equals("string", "string"), "equals string!"); + assert.ok(mx.equals(true, true), "equals boolean!"); + assert.ok(mx.equals(new Date(2015, 0, 1), new Date(2015, 0, 1)), "equals date!"); + assert.ok(mx.equals({ name: "A" }, { name: "A" }), "equals object literal!"); + assert.ok(mx.equals(new SimpleClass(), new SimpleClass()) === false, "equals class instance!"); + assert.ok(mx.equals(new SimpleClass(), new SimpleClass(), EqualityComparer.create((obj) => 0, (a, b) => true)), "equals class instance using comparer!"); + assert.ok(mx.equals(new SimpleClassWithComparer(10), new SimpleClassWithComparer(10)), "equals class instance overriding __equals__ method!"); + }); + + + QUnit.test("compare", function (assert) { + + assert.ok(mx.compare(1, null) === 1 && mx.compare(null, 1) === -1 && mx.compare(null, null) === 0, "compare null!"); + assert.ok(mx.compare(1, 0) === 1 && mx.compare(0, 1) === -1 && mx.compare(1, 1) === 0, "compare numbers!"); + assert.ok(mx.compare("B", "A") === 1 && mx.compare("A", "B") === -1 && mx.compare("A", "A") === 0, "compare string!"); + assert.ok(mx.compare(true, false) === 1 && mx.compare(false, true) === -1 && mx.compare(true, true) === 0, "compare bolean!"); + assert.ok(mx.compare(new Date(2015, 0, 2), new Date(2015, 0, 1)) === 1 && mx.compare(new Date(2015, 0, 1), new Date(2015, 0, 2)) === -1 && mx.compare(new Date(2015, 0, 1), new Date(2015, 0, 1)) === 0, "compare date!"); + assert.ok(mx.compare({ name: "A" }, { name: "B" }) === 0, "compare objects!"); + }); + + + QUnit.test("lambda", function (assert) { + + var _f1 = mx.runtime.lambda("t => t * t"), + _f2 = mx.runtime.lambda("(t, u) => t + u"), + _f3 = mx.runtime.lambda("(t, u, r) => t + u + r"), + _f4 = mx.runtime.lambda("(t, u) => {id:t, name:u}"); + + assert.ok(_f1(2) === 4, "square root lambda!"); + assert.ok(_f2(1, 2) === 3, "sum of 2 numbers lambda!"); + assert.ok(_f3(1, 2, 3) === 6, "sum of 3 numbers lambda!"); + assert.ok(_f4(1, "A").id === 1 && _f4(1, "A").name === "A", "object literal lambda!"); + }); + } + + + module LinqTests { + + QUnit.module("Linq"); + + + QUnit.test("aggregate", function (assert) { + + var _arr = CreateNumberArray(); + + assert.ok(mx(_arr).aggregate((a, b) => a + b) === 45, "Aggregate 10 numbers without seed!"); + assert.ok(mx(_arr).aggregate(10, (a, b) => a + b) === 55, "Aggregate 10 numbers with seed!"); + assert.ok(mx(_arr).aggregate(10, (a, b) => a + b, t => t * 2) === 110, "Aggregate 10 numbers with seed and result selector!"); + }); + + + QUnit.test("all", function (assert) { + + var _arr = CreateNumberArray(); + + assert.ok(mx(_arr).all(t => t < 100) === true, "First 10 numbers less than 100!"); + assert.ok(mx(_arr).all(t => t < 5) === false, "First 10 numbers less than 5!"); + }); + + + QUnit.test("any", function (assert) { + + var _arr = CreateNumberArray(); + + assert.ok(mx(_arr).any() === true, "First 10 numbers!"); + assert.ok(mx(_arr).any(t => t % 2 === 0) === true, "Any of the first 10 numbers is even!"); + assert.ok(mx(_arr).any(t => t > 10) === false, "Any of the first 10 numbers greater than 10!"); + }); + + + QUnit.test("average", function (assert) { + + assert.ok(mx(CreateNumberArray()).average() === 4.5, "Average of the first 10 numbers!"); + assert.throws(() => mx(CreateObjectLiteralArray()).average(), "throws an exception for average of non numeric values!"); + assert.throws(() => mx([]).average(), "throws an exception for average of empty collection!"); + }); + + + QUnit.test("concat", function (assert) { + var _s1 = [1, 2, 3], + _s2 = [3, 4], + _arr = CreateNumberArray(); + + assert.deepEqual(mx(_s1).concat(_s2).toArray(), [1, 2, 3, 3, 4], "Concat two array!"); + assert.ok(mx(_arr).concat(_arr).count() === 20, "Concat the first 10 numbers to itself!"); + }); + + + QUnit.test("contains", function (assert) { + + var _arr1 = CreateNumberArray(), + _arr2 = CreateSimpleClassArray(), + _arr3 = CreateSimpleClassWithComparerArray(), + _arr4 = CreateComplexObjectLiteralArray(); + + assert.ok(mx(_arr1).contains(1) === true, "1 contains in the first 10 numbers!"); + assert.ok(mx(_arr1).contains(10) === false, "10 does not contains in the first 10 numbers!"); + + assert.ok(mx(_arr2).contains(new SimpleClass()) === false, "Class instance without equality-comparer!"); + assert.ok(mx(_arr2).contains(new SimpleClass(), { hash: () => 0, equals: () => true }) === true, "Class instance with equality-comparer!"); + + assert.ok(mx(_arr3).contains(new SimpleClassWithComparer(5)) === true, "Class instance overriding equality-comparer!"); + + assert.ok(mx(_arr4).contains({ name: "n5", inner: { index: 5, val: {} } }) === true, "Object literal without equality-comparer!"); + assert.ok(mx(_arr4).contains({ name: "n5", inner: null }, { + hash: o => mx.hash(o.name), + equals: (a, b) => a.name === b.name + }) === true, "Object literal with equality-comparer!"); + }); + + + QUnit.test("count", function (assert) { + + var _arr = CreateNumberArray(); + + assert.ok(mx(_arr).count() === 10, "Count of the first 10 numbers!"); + assert.ok(mx(_arr).count(t => t % 2 === 0) === 5, "Count of the first even 10 numbers!"); + }); + + + QUnit.test("defaultIfEmpty", function (assert) { + + var _arr = CreateNumberArray(); + + assert.deepEqual(mx([]).defaultIfEmpty(1).toArray(), [1], "Empty array devalut value!"); + assert.ok(mx(_arr).defaultIfEmpty(1).count() === 10, "Count of the first 10 numbers with defaultIfEmpty!"); + assert.ok(mx(_arr).where(t => t > 100).defaultIfEmpty(10).count() === 1, "Count of the first 10 numbers greater than 100 with defaultIfEmpty!"); + }); + + + QUnit.test("distinct", function (assert) { + + var _arr1 = CreateObjectLiteralArray(), + _arr2 = CreateComplexObjectLiteralArray(), + _arr3 = CreateNumberArray(), + _arr4 = CreateFloatNumberArray(), + _arr5 = CreateStringArray(), + _arr6 = CreateDateArray(), + _arr7 = CreateBooleanArray(), + _arr8 = CreateSimpleClassWithComparerArray(), + _arr9 = CreateSimpleClassArray(); + + assert.ok(mx(_arr1).distinct().count() === 1, "Array of 10 empty object literal!"); + assert.ok(mx(_arr2).distinct().count() === 10, "Array of 10 distinct complex object literal!"); + assert.ok(mx(_arr3).distinct().count() === 10, "Array of 10 distinct numbers!"); + assert.ok(mx(_arr4).distinct().count() === 10, "Array of 10 distinct float numbers!"); + assert.ok(mx(_arr5).distinct().count() === 10, "Array of 10 distinct strings!"); + assert.ok(mx(_arr6).distinct().count() === 10, "Array of 10 distinct date objects!"); + assert.ok(mx(_arr7).distinct().count() === 2, "Array of 10 boolean values!"); + assert.ok(mx(_arr8).distinct().count() === 10, "Array of 10 distinct class instances overriding equality-comparer!"); + assert.ok(mx(_arr9).distinct().count() === 10, "Array of 10 distinct class instances!"); + assert.ok(mx(_arr2).distinct({ + hash: o => mx.hash(o.name), + equals: (a, b) => a.name === b.name + }).count() === 10, "Array of 10 distinct complex object literal with equality-comparer!"); + }); + + + QUnit.test("except", function (assert) { + + var _arr1 = CreateNumberArray(), + _arr2 = CreateObjectLiteralArray(), + _arr3 = CreateComplexObjectLiteralArray(); + + assert.ok(mx(_arr1).except(CreateNumberArray()).count() === 0, "Array of first 10 numbers except first 10 numbers!"); + assert.deepEqual(mx(_arr1).except([0, 1, 2, 3, 4]).toArray(), [5, 6, 7, 8, 9], "Array of first 10 numbers except first 5 numbers!"); + assert.ok(mx(_arr2).except([{}]).count() === 0, "Array of 10 empty object literal except an empty object literal!"); + assert.ok(mx(_arr3).except([{ name: "n5", inner: null }]).count() === 10, "Array of 10 distinct complex object literal without equality-comparer!"); + assert.ok(mx(_arr3).except([{ name: "n5", inner: null }], { + hash: o => mx.hash(o.name), + equals: (a, b) => a.name === b.name + }).count() === 9, "Array of 10 distinct complex object literal with equality-comparer!"); + }); + + + QUnit.test("elementAt", function (assert) { + + var _arr = CreateNumberArray(); + + assert.ok(mx(_arr).elementAt(0) === 0, "First element of the first 10 numbers!"); + assert.throws(() => mx(_arr).elementAt(100), "throws an exception for 100th element of the first 10 numbers!"); + }); + + + QUnit.test("first", function (assert) { + + var _arr = CreateNumberArray(); + + assert.ok(mx(_arr).first() === 0, "First element of the first 10 numbers!"); + assert.ok(mx(_arr).first(t => t > 5) === 6, "First element greater than 5 of the first 10 numbers!"); + assert.throws(() => mx([]).first(), "throws an exception getting first element of an empty collection!"); + assert.throws(() => mx(_arr).first(t => t > 100), "throws an exception getting first element greater than 100 of the first 10 numbers!"); + }); + + + QUnit.test("firstOrDefault", function (assert) { + + var _arr = CreateNumberArray(); + + assert.ok(mx(_arr).firstOrDefault() === 0, "First element of the first 10 numbers or default!"); + assert.ok(mx(_arr).firstOrDefault(t => t > 5) === 6, "First element greater than 5 of the first 10 numbers or default!"); + assert.ok(mx(_arr).firstOrDefault(t => t > 100) === null, "First element greater than 100 of the first 10 numbers or default!"); + assert.ok(mx(_arr).firstOrDefault(t => t > 100, 100) === 100, "First element greater than 100 of the first 10 numbers or 100 as default!"); + }); + + + QUnit.test("forEach", function (assert) { + + var _arr = CreateNumberArray(), + _sum = 0; + + mx(_arr).forEach(t => _sum += t); + assert.ok(_sum === 45, "ForEach operation on the first 10 numbers!"); + }); + + + QUnit.test("groupBy", function (assert) { + + var _arr1 = CreateObjectLiteralArray(), + _arr2 = CreateComplexObjectLiteralArray(); + + assert.ok(mx(_arr1).groupBy(t => t).count() === 1, "Group 10 distinct empty object literals!"); + assert.ok(mx(_arr2).groupBy(t => t.name).count() === 10, "Group 10 distinct complex object literals by name!"); + assert.ok(mx(_arr2).groupBy(t => t.name).first().key === "n0", "Group 10 distinct complex object literals by name, retrieve first key!"); + assert.ok(mx(_arr2).groupBy(t => t.name).first().count() === 1, "Group 10 distinct complex object literals by name, retrieve first group count!"); + }); + + + QUnit.test("groupJoin", function (assert) { + + var _arr1 = [{ name: "A", val: 1 }, { name: "B", val: 2 }, { name: "C", val: 3 }, { name: "D", val: 4 }], + _arr2 = [{ code: "A" }, { code: "A" }, { code: "B" }, { code: "B" }, { code: "C" }], + _result = mx(_arr1).groupJoin(_arr2, t => t.name, u => u.code, (t, u) => ({ item: t, group: u })); + + assert.ok(_result.count() === 4, "groupJoin 2 complex-object array, getting count"); + assert.ok(_result.first().item.name === "A", "groupJoin 2 complex-object array, getting item"); + assert.ok(_result.first().group.count() === 2, "groupJoin 2 complex-object array, getting group count"); + assert.ok(_result.last().group.count() === 0, "groupJoin 2 complex-object array, getting empty group count"); + }); + + + QUnit.test("intersect", function (assert) { + + var _arr1 = CreateNumberArray(), + _arr2 = CreateObjectLiteralArray(), + _arr3 = CreateComplexObjectLiteralArray(); + + assert.ok(mx(_arr1).intersect(CreateNumberArray()).count() === 10, "Array of first 10 numbers intersect with first 10 numbers!"); + assert.deepEqual(mx(_arr1).intersect([2, 3, 4]).toArray(), [2, 3, 4], "Array of first 10 numbers intersect with 3 numbers!"); + assert.ok(mx(_arr2).intersect([{}]).count() === 10, "Array of 10 empty object literal intersect with an empty object literal!"); + assert.ok(mx(_arr3).intersect([{ name: "n5", inner: null }]).count() === 0, "Array of 10 distinct complex object literal without equality-comparer!"); + assert.ok(mx(_arr3).intersect([{ name: "n5", inner: null }], { + hash: o => mx.hash(o.name), + equals: (a, b) => a.name === b.name + }).count() === 1, "Array of 10 distinct complex object literal with equality-comparer!"); + }); + + + QUnit.test("join", function (assert) { + var _arr1 = [{ name: "A", val: 1 }, { name: "B", val: 2 }, { name: "C", val: 3 }, { name: "D", val: 4 }], + _arr2 = [{ code: "A" }, { code: "A" }, { code: "B" }, { code: "B" }, { code: "C" }], + _arr3 = CreateObjectLiteralArray(), + _result = mx(_arr1).join(_arr2, t => t.name, u => u.code, (t, u) => ({ item1: t, item2: u })); + + assert.ok(_result.count() === 5, "join 2 complex-object array, getting count"); + assert.ok(_result.first().item1.name === "A" && _result.first().item2.code === "A", "join 2 complex-object array, getting item"); + assert.ok(mx(_arr3).join(mx(CreateObjectLiteralArray()), t => t, u => u, (t, u) => t).count() === 100, "join 2 empty object-literal array"); + assert.ok(mx(mx.empty()).join(mx(_arr3), t => t, u => u, (t, u) => t).count() === 0, "join empty collection with an array"); + }); + + + QUnit.test("last", function (assert) { + + var _arr = CreateNumberArray(); + + assert.ok(mx(_arr).last() === 9, "Last element of the first 10 numbers!"); + assert.ok(mx(_arr).last(t => t < 5) === 4, "Last element less than 5 of the first 10 numbers!"); + assert.throws(() => mx([]).last(), "throws an exception getting last element of an empty collection!"); + assert.throws(() => mx(_arr).last(t => t > 100), "throws an exception getting first element greater than 100 of the first 10 numbers!"); + }); + + + QUnit.test("lastOrDefault", function (assert) { + + var _arr = CreateNumberArray(); + + assert.ok(mx(_arr).lastOrDefault() === 9, "Last element of the first 10 numbers or default!"); + assert.ok(mx(_arr).lastOrDefault(t => t < 5) === 4, "Last element greater than 5 of the first 10 numbers or default!"); + assert.ok(mx(_arr).lastOrDefault(t => t > 100) === null, "Last element greater than 100 of the first 10 numbers or default!"); + assert.ok(mx(_arr).lastOrDefault(t => t > 100, 100) === 100, "Last element greater than 100 of the first 10 numbers or 100 as default!"); + }); + + + QUnit.test("max", function (assert) { + + var _arr1 = CreateNumberArray(), + _arr2 = CreateStringArray(), + _arr3 = CreateComplexObjectLiteralArray(); + + assert.ok(mx(_arr1).max() === 9, "Maximum of the first 10 numbers!"); + assert.ok(mx(_arr2).max() === "9_string", "Maximum of the 10 string array!"); + assert.ok(mx(_arr3).max(t => t.name) === "n9", "Maximum of a complex array by selector!"); + assert.throws(() => mx([]).max(), "throws an exception getting maximum of an empty collection!"); + }); + + + QUnit.test("min", function (assert) { + + var _arr1 = CreateNumberArray(), + _arr2 = CreateStringArray(), + _arr3 = CreateComplexObjectLiteralArray(); + + assert.ok(mx(_arr1).min() === 0, "Minimum of the first 10 numbers!"); + assert.ok(mx(_arr2).min() === "0_string", "Minimum of the 10 string array!"); + assert.ok(mx(_arr3).min(t => t.name) === "n0", "Minimum of a complex array by selector!"); + assert.throws(() => mx([]).min(), "throws an exception getting minimum of an empty collection!"); + }); + + + QUnit.test("ofType", function (assert) { + + var _arr = CreateNumberArray(); + + assert.ok(mx(_arr).ofType(Number).count() === 10, "Cast array of numbers to number!"); + assert.ok(mx(_arr).ofType(String).count() === 0, "Cast array of numbers to string!"); + }); + + + QUnit.test("orderBy", function (assert) { + + var _arr1 = CreateNumberArray(), + _arr2 = CreateComplexObjectLiteralArray(), + _arr3 = [{ name: "a", val: 1 }, { name: "a", val: 2 }, { name: "b", val: 1 }, { name: "c", val: 2 }], + _result = [{ name: "a", val: 1 }, { name: "b", val: 1 }, { name: "a", val: 2 }, { name: "c", val: 2 }] + + assert.deepEqual(mx(_arr1).orderBy(t => t).take(5).toArray(), [0, 1, 2, 3, 4], "Order array of numbers ascending!"); + assert.ok(mx(_arr2).orderBy(t => t.name).thenByDescending(t => t.inner.index).first().name === "n0", "Order array of complex object by 'name' ascending then by 'inner.index' descending !"); + assert.deepEqual(mx(_arr3).orderBy(t => t.val).thenBy(t => t.name).toArray(), _result, "Order and thenBy!"); + assert.ok(mx(_arr2).orderBy(t => t.name, { + hash: o => mx.hash(o), + equals: (a, b) => a === b + }).first().name === "n0", "Order array of complex object ascending with comparer!"); + }); + + + QUnit.test("orderByDescending", function (assert) { + + var _arr1 = CreateNumberArray(), + _arr2 = CreateComplexObjectLiteralArray(), + _arr3 = [{ name: "a", val: 1 }, { name: "a", val: 2 }, { name: "b", val: 1 }, { name: "c", val: 2 }], + _result = [{ name: "a", val: 2 }, { name: "c", val: 2 }, { name: "a", val: 1 }, { name: "b", val: 1 }]; + + assert.deepEqual(mx(_arr1).orderByDescending(t => t).take(5).toArray(), [9, 8, 7, 6, 5], "Order array of numbers descending!"); + assert.ok(mx(_arr2).orderByDescending(t => t.name).thenByDescending(t => t.inner.index).first().name === "n9", "Order array of complex object by 'name' descending then by 'inner.index' descending !"); + assert.deepEqual(mx(_arr3).orderByDescending(t => t.val).thenBy(t => t.name).toArray(), _result, "Order descending and thenBy!"); + assert.ok(mx(_arr2).orderByDescending(t => t.name, { + hash: o => mx.hash(o), + equals: (a, b) => a === b + }).first().name === "n9", "Order array of complex object descending with comparer!"); + }); + + + QUnit.test("reverse", function (assert) { + + var _arr1 = CreateNumberArray(), + _arr2 = CreateStringArray(); + + assert.deepEqual(mx(_arr1).reverse().take(5).toArray(), [9, 8, 7, 6, 5], "Reverse array of first 10 numbers!"); + assert.ok(mx(_arr2).reverse().first() === "9_string", "Reverse array of strings!"); + }); + + + QUnit.test("sequenceEqual", function (assert) { + + var _arr = CreateNumberArray(); + + assert.ok(mx(_arr).sequenceEqual(mx(CreateNumberArray())), "sequenceEqual on array of numbers!"); + assert.ok(mx([1, 2, 3]).sequenceEqual(mx([1, 2])) === false, "sequenceEqual on inharmonic arrays of numbers!"); + assert.ok(mx([{ name: "a" }]).sequenceEqual(mx([{ name: "a", val: 1 }]), { + hash: o => mx.hash(o.name), + equals: (a, b) => a.name === b.name + }), "sequenceEqual on arrays of objects with comparer!"); + }); + + + QUnit.test("select", function (assert) { + + var _arr = CreateNumberArray(); + + assert.ok(mx(_arr).select(t => t + 100).first() === 100, "select first 10 numbers plus 100!"); + assert.ok(mx(_arr).select((t, i) => i).last() === 9, "select index while enumerating 10 numbers!"); + }); + + + QUnit.test("selectMany", function (assert) { + + var _arr = [{ name: "A", values: [1, 2, 3, 4] }, { name: "B", values: [5, 6, 7, 8] }]; + + assert.ok(mx(_arr).selectMany(t => t.values).count() === 8, "selectMany on complex objects!"); + assert.deepEqual(mx(_arr).selectMany(t => t.values, (t, u) => ({ name: t.name, value: u })).first(), { name: "A", value: 1 }, "selectMany on complex objects with result selector!"); + }); + + + QUnit.test("single", function (assert) { + + var _arr = CreateNumberArray(); + + assert.ok(mx([1]).single() === 1, "Single element of a single array!"); + assert.ok(mx(_arr).single(t => t === 1) === 1, "Single element equal to 1 of the first 10 numbers!"); + assert.throws(() => mx([]).single(), "throws an exception getting single element of an empty collection!"); + assert.throws(() => mx(_arr).single(), "throws an exception getting single element of an collection containing more than one element!"); + assert.throws(() => mx(_arr).single(t => t > 100), "throws an exception getting single element greater than 100 of the first 10 numbers!"); + assert.throws(() => mx(_arr).single(t => t < 10), "throws an exception getting single element less than 10 of the first 10 numbers!"); + }); + + + QUnit.test("singleOrDefault", function (assert) { + + var _arr = CreateNumberArray(); + + assert.ok(mx([1]).singleOrDefault() === 1, "Single element of a single array or default!"); + assert.ok(mx([]).singleOrDefault() === null, "Single element of an empty array or default!"); + assert.ok(mx(_arr).singleOrDefault(t => t === 1) === 1, "Single element equal to 1 of the first 10 numbers or default!"); + assert.ok(mx(_arr).singleOrDefault(t => t === 100, 100) === 100, "Single element of an empty array or default!"); + assert.throws(() => mx(_arr).singleOrDefault(), "throws an exception getting single element of an collection containing more than one element!"); + assert.throws(() => mx(_arr).singleOrDefault(t => t < 10), "throws an exception getting single element less than 10 of the first 10 numbers!"); + }); + + + QUnit.test("skip", function (assert) { + + var _arr = CreateNumberArray(); + + assert.deepEqual(mx(_arr).skip(5).toArray(), [5, 6, 7, 8, 9], "Skip 5 element of a the first 10 numbers!"); + assert.deepEqual(mx(_arr).where(t => t % 2 === 0).skip(3).toArray(), [6, 8], "Skip 3 element of a the first 10 even numbers!"); + assert.ok(mx(_arr).skip(0).count() === 10, "Skip no items!"); + assert.ok(mx(_arr).skip(100).count() === 0, "Skip more than count of the collection!"); + }); + + + QUnit.test("skipWhile", function (assert) { + + var _arr = CreateNumberArray(); + + assert.deepEqual(mx(_arr).skipWhile(t => t < 5).toArray(), [5, 6, 7, 8, 9], "Skip while elements are less than 5 from the first 10 even numbers!"); + assert.ok(mx(_arr).skipWhile(t => t > 5).count() === 10, "Skip while elements are greater than 5 from the first 10 even numbers!"); + }); + + + QUnit.test("sum", function (assert) { + + var _arr = CreateNumberArray(); + + assert.ok(mx(_arr).sum() === 45, "Sum of the first 10 numbers!"); + assert.ok(mx(_arr).sum(t => t * 2) === 90, "Sum of the first 10 numbers multiply by 2!"); + assert.throws(() => mx(CreateObjectLiteralArray()).sum(), "throws an exception getting sum of non numeric elements!"); + assert.throws(() => mx(CreateComplexObjectLiteralArray()).sum(t => t.name), "throws an exception getting sum of non numeric properties!"); + }); + + + QUnit.test("take", function (assert) { + + var _arr = CreateNumberArray(); + + assert.deepEqual(mx(_arr).take(5).toArray(), [0, 1, 2, 3, 4], "Take 5 element of a the first 10 numbers!"); + assert.deepEqual(mx(_arr).where(t => t % 2 === 0).take(3).toArray(), [0, 2, 4], "Take 3 element of a the first 10 even numbers!"); + assert.ok(mx(_arr).take(0).count() === 0, "Take no items!"); + assert.ok(mx(_arr).take(100).count() === 10, "Take more than count of the collection!"); + }); + + + QUnit.test("takeWhile", function (assert) { + + var _arr = CreateNumberArray(); + + assert.deepEqual(mx(_arr).takeWhile(t => t < 5).toArray(), [0, 1, 2, 3, 4], "Take while elements are less than 5 from the first 10 even numbers!"); + assert.ok(mx(_arr).takeWhile(t => t > 5).count() === 0, "Take while elements are greater than 5 from the first 10 even numbers!"); + }); + + + QUnit.test("toArray", function (assert) { + + var _arr = CreateNumberArray(); + + assert.deepEqual(mx(_arr).where(t => t < 5).toArray(), [0, 1, 2, 3, 4], "Elements less than 5 from the first 10 even numbers!"); + }); + + + QUnit.test("toDictionary", function (assert) { + + var _arr = CreateComplexObjectLiteralArray(); + + assert.ok(mx(_arr).toDictionary(t => t.name).count() === 10, "toDictionary key-selector!"); + assert.ok(mx(_arr).toDictionary(t => t.name, t => t.inner.index).first().value === 0, "toDictionary key-selector & element-selector!"); + assert.ok(mx(_arr).toDictionary(t => t, { + hash: o => mx.hash(o.name), + equals: (a, b) => a.name === b.name + }).first().key.name === "n0", "toDictionary key-selector & comparer!"); + + assert.ok(mx(_arr).toDictionary(t => t, t => t.inner.index, { + hash: o => mx.hash(o.name), + equals: (a, b) => a.name === b.name + }).first().value === 0, "toDictionary key-selector, element-selector & comparer!"); + + assert.throws(() => mx([1, 1, 2]).toDictionary(t => t), "throws an exception with duplicate keys!"); + }); + + + QUnit.test("toList", function (assert) { + + var _arr = CreateNumberArray(); + + assert.ok(mx(_arr).toList().count() === 10, "toList first 10 numbers!"); + assert.ok(mx(_arr).toList()[1] === 1, "toList indexer first 10 numbers!"); + }); + + + QUnit.test("toLookup", function (assert) { + + var _arr1 = CreateNumberArray(), + _arr2 = CreateComplexObjectLiteralArray(); + + assert.ok(mx(_arr1).toLookup(t => t).count() === 10, "toLookup first 10 numbers!"); + assert.ok(mx(_arr1).toLookup(t => t).get(1).count() === 1, "toLookup indexer first 10 numbers!"); + + assert.ok(mx(_arr2).toLookup(t => t, { + hash: o => mx.hash(o.name), + equals: (a, b) => a.name === b.name + }).first().first().name === "n0", "toLookup with key-selector and comparer!"); + + assert.ok(mx(_arr2).toLookup(t => t, t => t.name, { + hash: (o) => mx.hash(o.name), + equals: (a, b) => a.name === b.name + }).first().first() === "n0", "toLookup with key-selector, element-selector and comparer!"); + }); + + + QUnit.test("union", function (assert) { + + var _arr = CreateNumberArray(); + + assert.ok(mx(_arr).union(CreateNumberArray()).count() === 10, "Union first 10 numbers with itself!"); + assert.deepEqual(mx([1, 2]).union(mx([2, 3])).toArray(), [1, 2, 3], "Union two arrays!"); + }); + + + QUnit.test("where", function (assert) { + + var _arr1 = CreateNumberArray(), + _arr2 = CreateComplexObjectLiteralArray(); + + assert.ok(mx(_arr1).where(t => t < 5).count() === 5, "Filter first 10 numbers less than 10!"); + assert.ok(mx(_arr2).where(t => t.inner.index < 5).count() === 5, "Filter complex object by value!"); + assert.deepEqual(mx(_arr1).where(t => t <= 1).toArray(), [0, 1], "Deep equal check!"); + }); + + + QUnit.test("zip", function (assert) { + + assert.ok(mx([1, 2]).zip([3, 4], (t, u) => t + u).first() === 4, "Zip two numeric array!"); + assert.ok(mx([1, 2]).zip([3], (t, u) => t + u).count() === 1, "Zip two inharmonic numeric array!"); + }); + + + + /* Factory methods + ---------------------------------------------------------------------- */ + + function CreateObjectLiteralArray(): Object[] { + return mx.range(0, 10).select(t => ({})).toArray(); + } + + function CreateComplexObjectLiteralArray(): { name: string; inner: { index: number; val: Object } }[] { + return mx.range(0, 10).select(t => ({ + name: "n" + t, + inner: { + index: t, + val: {} + } + })).toArray(); + } + + function CreateSimpleClassArray(): SimpleClass[] { + return mx.range(0, 10).select(t => new SimpleClass()).toArray(); + } + + function CreateSimpleClassWithComparerArray(): SimpleClassWithComparer[] { + return mx.range(0, 10).select(t => new SimpleClassWithComparer(t)).toArray(); + } + + function CreateNumberArray(): number[] { + return mx.range(0, 10).toArray(); + } + + function CreateFloatNumberArray(): number[] { + return mx.range(0, 10).select(t => t + 0.1).toArray(); + } + + function CreateStringArray(): string[] { + return mx.range(0, 10).select(t => t + "_string").toArray(); + } + + function CreateDateArray(): Date[] { + return mx.range(0, 10).select(t => new Date(new Date().getTime() + t)).toArray(); + } + + function CreateBooleanArray(): boolean[] { + return mx.range(0, 10).select(t => t % 2 === 0).toArray(); + } + } + + + module CollectionTests { + + QUnit.module("Collection"); + + + QUnit.test("constructor", function (assert) { + + assert.ok(CreateCollection().count() === 5, "initialize a Collection using specified collection!"); + }); + + + QUnit.test("count", function (assert) { + + var _col = CreateCollection(); + assert.ok(_col.count() === 5, "collection containing count!"); + assert.throws(() => new Collection().count(), "throws an error getting count of an empty collection."); + }); + + + QUnit.test("copyTo", function (assert) { + + var _col = CreateCollection(), + _arr = new Array(_col.count()); + + _col.copyTo(_arr, 0); + + assert.deepEqual(_arr, [1, 2, 3, 4, 5], "Collection copy to an array!"); + assert.throws(() => _col.copyTo([], 0), "throws an error when the number of elements is greater than the number of elements that the destination array can contain!"); + }); + + + QUnit.test("collection enumerable", function (assert) { + + var _col = CreateCollection(); + assert.deepEqual(_col.select(t => t * 2).where(t => t > 5).toArray(), [6, 8, 10], "select-where-toArray over a collection!"); + }); + + + + /* Factory methods + ---------------------------------------------------------------------- */ + + function CreateCollection(): Collection { + return new Collection(mx.range(1, 5)); + } + } + + + module ListTests { + + QUnit.module("List"); + + + QUnit.test("constructor", function (assert) { + assert.ok(new List().count() === 0, "an empty list!"); + assert.ok(new List(10).count() === 10, "an empty list with initial capacity!"); + assert.ok(new List(1, 2, 3, 4, 5).count() === 5, "list initializer!"); + assert.ok(new List(mx.range(0, 10)).count() === 10, "list from an Enumerable!"); + }); + + + QUnit.test("indexer", function (assert) { + + var _list = CreateList(); + + assert.ok(_list[0] === 1, "indexer get!"); + + _list[0] = 0; + assert.ok(_list[0] === 0 && _list.first() === 0, "indexer set!"); + }); + + + QUnit.test("add", function (assert) { + + var _list = new List(); + + _list.add(1); + assert.ok(_list[0] === 1, "add!"); + assert.ok(_list.count() === 1, "add count!"); + }); + + + QUnit.test("addRange", function (assert) { + + var _list = new List(); + + _list.addRange(mx.range(0, 10)); + assert.ok(_list.count() === 10, "add range of numbers!"); + }); + + + QUnit.test("asReadOnly", function (assert) { + + var _rlist = new List(mx.range(0, 10)).asReadOnly(); + + assert.ok(_rlist.count() === 10, "readOnlyCollection count!"); + assert.ok(_rlist[0] === 0, "readOnlyCollection get!"); + }); + + + QUnit.test("binarySearch", function (assert) { + + var _list1 = new List(mx.range(0, 100)), + _list2 = new List<{ index: number }>(mx.range(0, 100).select(t => ({ index: t }))); + + assert.ok(_list1.binarySearch(50) === 50, "binary-search to find an item!"); + assert.ok(_list1.binarySearch(100) < 0, "binary-search item not found!"); + + assert.ok(_list2.binarySearch({ index: 50 }, { compare: (a, b) => a.index - b.index }) === 50, "binary-search find an item with comparer!"); + assert.ok(_list2.binarySearch({ index: 80 }, 50, 40, { compare: (a, b) => a.index - b.index }) === 80, "binary-search find an item with index, count and comparer!"); + }); + + + QUnit.test("clear", function (assert) { + + var _list = CreateList(); + + _list.clear(); + assert.ok(_list.count() === 0, "Clear list!"); + }); + + + QUnit.test("contains", function (assert) { + + var _list = CreateList(); + + assert.ok(_list.contains(3) === true, "list contains!"); + assert.ok(_list.contains(6) === false, "list not containing!"); + }); + + + QUnit.test("copyTo", function (assert) { + + var _list = CreateList(), + _arr = new Array(_list.count()); + + _list.copyTo(_arr, 0); + + assert.deepEqual(_arr, [1, 2, 3, 4, 5], "list copyTo an array!"); + }); + + + QUnit.test("exists", function (assert) { + + var _list = CreateList(); + + assert.ok(_list.exists(t => t % 2 === 0), "an even number exists in a list of the first 5 number!"); + assert.ok(_list.exists(t => t > 5) === false, "6 exists in a list of the first 5 number!"); + }); + + + QUnit.test("find", function (assert) { + + var _list = CreateList(); + + assert.ok(_list.find(t => t % 2 === 0) === 2, "find an even number in a list of the first 5 number!"); + assert.ok(_list.find(t => t > 5) === null, "find a number greater than 5 in a list of the first 5 number!"); + }); + + + QUnit.test("findIndex", function (assert) { + + var _list = CreateList(); + + assert.ok(_list.findIndex(t => t % 2 === 0) === 1, "find index of an even numbers in a list of the first 5 number!"); + assert.ok(_list.findIndex(2, t => t % 2 === 0) === 3, "find index of an even numbers in a list of the first 5 number, starting from 2!"); + assert.ok(_list.findIndex(2, 1, t => t % 2 === 0) === -1, "find index of an even numbers in a list of the first 5 number, starting from 3, for 1 attempt!"); + }); + + + QUnit.test("findLast", function (assert) { + + var _list = CreateList(); + + assert.ok(_list.findLast(t => t % 2 === 0) === 4, "find last even number in a list of the first 5 number!"); + assert.ok(_list.findLast(t => t > 5) === null, "find last number greater than 5 in a list of the first 5 number!"); + }); + + + QUnit.test("findLastIndex", function (assert) { + + var _list = new List(0, 1, 2, 3, 4, 5, 6, 7, 8, 9); + + assert.ok(_list.findLastIndex(t => t % 2 === 0) === 8, "find last index of an even numbers in a list of the first 10 number!"); + assert.ok(_list.findLastIndex(5, t => t % 2 === 0) === 4, "find last index of an even numbers in a list of the first 10 number, starting from 5!"); + assert.ok(_list.findLastIndex(5, 1, t => t % 2 === 0) === -1, "find last index of an even numbers in a list of the first 10 number, starting from 5, for 1 attempt!"); + }); + + + QUnit.test("forEach", function (assert) { + + var _list = CreateList(), + _count = 0; + + _list.forEach(t => _count += t); + + assert.ok(_count === 15, "forEach to get sum of a the items in a list!"); + }); + + + QUnit.test("get", function (assert) { + + var _list = CreateList(); + + assert.ok(_list.get(1) === 2, "get item at index 1 from a list of 5 numbers!"); + assert.throws(() => _list.get(10), "throws an error when the number of elements is greater than the number of elements that the destination array can contain!"); + }); + + + QUnit.test("getRange", function (assert) { + + var _list = CreateList(); + + assert.deepEqual(_list.getRange(0, 3).toArray(), [1, 2, 3], "get range of first 3 items of a list of first 5 numbers!"); + assert.throws(() => _list.getRange(0, 10), "throws an error getting first 10 items from a list of 5 numbers!"); + }); + + + QUnit.test("indexOf", function (assert) { + + var _list = CreateList(); + + assert.ok(_list.indexOf(3) === 2, "get index of 3 in a list of first 5 numbers!"); + assert.ok(_list.indexOf(10) === -1, "get index of 10 in a list of first 5 numbers!"); + assert.ok(_list.indexOf(3, 4) === -1, "get index of 3 in a list of first 5 numbers, starting from index 4!"); + }); + + + QUnit.test("insert", function (assert) { + + var _list = CreateList(); + + _list.insert(3, 0); + + assert.ok(_list.count() === 6, "insert an item in a list of 5 numbers, get count!"); + assert.ok(_list[3] === 0, "insert an item in a list of 5 numbers, get item!"); + assert.throws(() => _list.insert(10, 0), "throws an error inserting in 10th index of a list of 5 numbers!"); + }); + + + QUnit.test("insertRange", function (assert) { + + var _list = CreateList(); + + _list.insertRange(3, mx.range(0, 3)); + + assert.ok(_list.count() === 8, "insert range of items in a list of 5 numbers, get count!"); + assert.ok(_list[3] === 0 && _list[4] === 1 && _list[5] === 2, "insert range of items in a list of 5 numbers, get items!"); + assert.throws(() => _list.insertRange(10, mx.range(0, 3)), "throws an error inserting range of items in 10th index of a list of 5 numbers!"); + }); + + + QUnit.test("lastIndexOf", function (assert) { + + var _list = CreateList(); + + assert.ok(_list.lastIndexOf(3) === 2, "get last index of 3 in a list of first 5 numbers!"); + assert.ok(_list.lastIndexOf(10) === -1, "get last index of 10 in a list of first 5 numbers!"); + assert.ok(_list.lastIndexOf(3, 1) === -1, "get last index of 3 in a list of first 5 numbers, starting from index 1!"); + }); + + + QUnit.test("remove", function (assert) { + + var _list = CreateList(); + + assert.ok(_list.remove(2) === true && _list.count() === 4, "remove an item from a list, get count!"); + assert.ok(_list.remove(10) === false && _list.count() === 4, "remove an item which does not exist in a list, get count!"); + }); + + + QUnit.test("removeAll", function (assert) { + + var _list = CreateList(); + + assert.ok(_list.removeAll(t => t % 2 === 0) === 2 && _list.count() === 3, "remove all even numbers from a list of first 5 numbers, get count!"); + assert.ok(_list.removeAll(t => t % 2 === 0) === 0 && _list.count() === 3, "remove all even numbers from a list of first 3 odd numbers, get count!"); + }); + + + QUnit.test("removeAt", function (assert) { + + var _list = CreateList(); + + _list.removeAt(2); + + assert.ok(_list[2] === 4 && _list.count() === 4, "remove item from 2nd index of a list of first 5 numbers, get count!"); + assert.throws(() => _list.removeAt(10), "throws an error removing item from 10th index of a list of first 5 numbers!"); + }); + + + QUnit.test("removeRange", function (assert) { + + var _list = CreateList(); + + _list.removeRange(1, 3); + + assert.ok(_list[0] === 1 && _list[1] === 5 && _list.count() === 2, "remove range of 3 items, starting from 1st index from a list of first 5 numbers, get count!"); + assert.throws(() => _list.removeRange(10, 10), "throws an error removing a range of items starting from 10th index of a list of first 5 numbers!"); + }); + + + QUnit.test("reverse", function (assert) { + + var _arr = [1, 2, 3, 4, 5], + _list1 = new List(_arr), + _list2 = new List(_arr); + + _list1.reverse(); + _list2.reverse(0, 3); + + assert.deepEqual(_list1.toArray(), [5, 4, 3, 2, 1], "reverse list of 5 first numbers!"); + assert.deepEqual(_list2.toArray(), [3, 2, 1, 4, 5], "reverse first 3 items of a list of 5 first numbers!"); + }); + + + QUnit.test("set", function (assert) { + + var _list = CreateList(); + + _list.set(1, 0); + + assert.ok(_list[1] === 0, "set value at index 1 of a list!"); + assert.throws(() => _list.set(10, 1), "throws an error setting item at index 10 from a list of 5 numbers!"); + }); + + + QUnit.test("sort", function (assert) { + + var _arr = [7, 1, 8, 3, 2, 0, 9, 6, 4, 5], + _list1 = new List(_arr), + _list2 = new List(_arr), + _list3 = new List(_arr), + _list4 = new List(_arr), + _sorter = (a: number, b: number) => a - b; + + _list1.sort(); + _list2.sort(_sorter); + _list3.sort({ compare: _sorter }); + _list4.sort(0, 5, { compare: _sorter }); + + assert.deepEqual(_list1.toArray(), [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], "sort list of first 10 numbers!"); + assert.deepEqual(_list2.toArray(), [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], "sort list of first 10 numbers with a comparison function!"); + assert.deepEqual(_list3.toArray(), [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], "sort list of first 10 numbers with a comparer!"); + assert.deepEqual(_list4.toArray(), [1, 2, 3, 7, 8, 0, 9, 6, 4, 5], "sort 5 first items of list of first 10 numbers with a comparer!"); + }); + + + QUnit.test("toArray", function (assert) { + + var _list = CreateList(); + + assert.deepEqual(_list.toArray(), [1, 2, 3, 4, 5], "converts a list of numbers to an array!"); + }); + + + QUnit.test("trueForAll", function (assert) { + + var _list = CreateList(); + + assert.ok(_list.trueForAll(t => t < 10) === true, "checks whether all items in a list of 5 first numbers are less than 10!"); + assert.ok(_list.trueForAll(t => t < 3) === false, "checks whether all items in a list of 5 first numbers are less than 3!"); + }); + + + QUnit.test("list enumerable", function (assert) { + + var _list = CreateList(); + + assert.deepEqual(_list.select(t => t * 2).where(t => t > 5).toArray(), [6, 8, 10], "select-where-toArray over a list!"); + }); + + + + /* Factory methods + ---------------------------------------------------------------------- */ + + function CreateList(): List { + return new List(1, 2, 3, 4, 5); + } + } + + + module ReadOnlyCollectionTests { + + QUnit.module("ReadOnlyCollection"); + + + QUnit.test("constructor", function (assert) { + assert.ok(CreateReadOnlyCollection().count() === 5, "initialize a ReadOnlyCollection!"); + assert.throws(() => new ReadOnlyCollection(null), "throws an exception creating an ampty ReadOnlyCollection!"); + }); + + + QUnit.test("indexer", function (assert) { + + var _col = CreateReadOnlyCollection(); + + assert.ok(_col[0] === 1, "indexer get!"); + assert.ok(function () { + try { _col[0] = 0; } + catch (e) { } + return _col[0] === 1; + }, "indexer set!"); + + assert.ok(function () { + try { _col[10] = 0; } + catch (e) { } + return _col[10] === undefined; + }, "out of range indexer set!"); + }); + + + QUnit.test("get", function (assert) { + + var _col = CreateReadOnlyCollection(); + + assert.ok(_col.get(1) === 2, "get item at index 1 from a collection of 5 numbers!"); + assert.throws(() => _col.get(10), "throws error getting item at index 10 from a collection of 5 numbers!"); + }); + + + QUnit.test("contains", function (assert) { + + var _col = CreateReadOnlyCollection(); + + assert.ok(_col.contains(3) === true, "collection contains!"); + assert.ok(_col.contains(6) === false, "collection not containing!"); + }); + + + QUnit.test("copyTo", function (assert) { + + var _col = CreateReadOnlyCollection(), + _arr = new Array(_col.count()); + + _col.copyTo(_arr, 0); + assert.deepEqual(_arr, [1, 2, 3, 4, 5], "collection copyTo an array!"); + assert.throws(() => _col.copyTo([], 0), "throws an error when the number of elements is greater than the number of elements that the destination array can contain!"); + }); + + + QUnit.test("indexOf", function (assert) { + + var _col = CreateReadOnlyCollection(); + + assert.ok(_col.indexOf(3) === 2, "get index of 3 in a collection of first 5 numbers!"); + assert.ok(_col.indexOf(10) === -1, "get index of 10 in a collection of first 5 numbers!"); + }); + + + QUnit.test("collection enumerable", function (assert) { + + var _col = CreateReadOnlyCollection(); + + assert.deepEqual(_col.select(t => t * 2).where(t => t > 5).toArray(), [6, 8, 10], "select-where-toArray over a collection!"); + }); + + + + /* Factory methods + ---------------------------------------------------------------------- */ + + function CreateReadOnlyCollection(): ReadOnlyCollection { + return new ReadOnlyCollection(new List(1, 2, 3, 4, 5)); + } + } + + + module SortedListTests { + + QUnit.module("SortedList"); + + + QUnit.test("constructor", function (assert) { + + var _comparer = Comparer.create((a: number, b: number) => a - b), + _dic = CreateDictionary(), + _s1 = new SortedList(), + _s2 = new SortedList(5), + _s3 = new SortedList(_dic), + _s4 = new SortedList(_comparer), + _s5 = new SortedList(5, _comparer), + _s6 = new SortedList(_dic, _comparer); + + + assert.ok(_s1.count() === 0 && _s1.capacity() === 0, "initialize a SortedList!"); + assert.ok(_s2.count() === 0 && _s2.capacity() === 5, "initialize a SortedList using initial capacity!"); + assert.ok(_s3.count() === 5 && _s3.capacity() === 5, "initialize a SortedList using specified dictionary!"); + assert.ok(_s4.count() === 0 && _s4.capacity() === 0, "initialize a SortedList using specified comparer!"); + assert.ok(_s5.count() === 0 && _s5.capacity() === 5, "initialize a SortedList using using initial capacity and comparer!"); + assert.ok(_s6.count() === 5 && _s6.capacity() === 5, "initialize a SortedList using specified dictionary and comparer!"); + }); + + + QUnit.test("add", function (assert) { + + assert.ok(CreateSortedList().count() == 5, "sorted-list add!"); + assert.throws(() => CreateSortedList().add(1, "AA"), "throws an error adding existing key to the list!"); + }); + + + QUnit.test("get", function (assert) { + + var _list = CreateSortedList(); + + assert.ok(_list.get(1) === "A", "sorted-list get!"); + assert.throws(() => _list.get(10), "throws an error getting invalid key!"); + }); + + + QUnit.test("capacity", function (assert) { + + var _list = CreateSortedList(); + + assert.ok(_list.capacity() > 0, "get sorted-list capacity!"); + + _list.capacity(10); + assert.ok(_list.capacity() === 10, "set sorted-list capacity!"); + }); + + + QUnit.test("clear", function (assert) { + + var _list = CreateSortedList(); + + _list.clear(); + assert.ok(_list.count() === 0 && _list.capacity() === 0, "clear sorted-list!"); + }); + + + QUnit.test("comparer", function (assert) { + + var _comparer = CreateSortedList().comparer(); + + assert.ok(_comparer.compare(5, 1) > 0 && _comparer.compare(1, 5) < 0 && _comparer.compare(1, 1) === 0, "sorted-list comparer!"); + }); + + + QUnit.test("containsKey", function (assert) { + + var _list1 = CreateSortedList(), + _list2 = new SortedList<{ id: number; name: string }, number>({ compare: (a, b) => a.name.localeCompare(b.name) }); + + assert.ok(_list1.containsKey(1) === true, "sorted-list contains key!"); + assert.ok(_list1.containsKey(10) === false, "sorted-list does not contain key!"); + + + _list2.add({ id: 2, name: "B" }, 2); + _list2.add({ id: 5, name: "E" }, 5); + _list2.add({ id: 4, name: "D" }, 4); + _list2.add({ id: 3, name: "C" }, 3); + _list2.add({ id: 1, name: "A" }, 1); + + assert.ok(_list2.containsKey({ id: 3, name: "C" }), "sorted-list contains key using specified comparer"); + }); + + + QUnit.test("containsValue", function (assert) { + + var _list = CreateSortedList(); + + assert.ok(_list.containsValue("A") === true, "sorted-list contains value!"); + assert.ok(_list.containsValue("Z") === false, "sorted-list does not contain value!"); + }); + + + QUnit.test("keys", function (assert) { + + var _list = CreateSortedList(); + + assert.deepEqual(_list.keys().toArray(), [1, 2, 3, 4, 5], "sorted-list keys!"); + assert.deepEqual(new SortedList().keys().toArray(), [], "empty sorted-list keys!"); + }); + + + QUnit.test("values", function (assert) { + + var _list = CreateSortedList(); + + assert.deepEqual(_list.values().toArray(), ["A", "B", "C", "D", "E"], "sorted-list values!"); + assert.deepEqual(new SortedList().values().toArray(), [], "empty sorted-list values!"); + }); + + + QUnit.test("indexOfKey", function (assert) { + + var _list = CreateSortedList(); + + assert.ok(_list.indexOfKey(1) === 0, "sorted-list index of key!"); + assert.ok(_list.indexOfKey(10) < 0, "sorted-list index of invalid key!"); + }); + + + QUnit.test("indexOfValue", function (assert) { + + var _list = CreateSortedList(); + + assert.ok(_list.indexOfValue("A") === 0, "sorted-list index of value!"); + assert.ok(_list.indexOfValue("Z") < 0, "sorted-list index of invalid value!"); + }); + + + QUnit.test("remove", function (assert) { + + var _list = CreateSortedList(); + + assert.ok(_list.remove(1) === true && _list.count() === 4 && _list.indexOfKey(1) < 0, "sorted-list remove key!"); + assert.ok(_list.remove(1) === false && _list.count() === 4, "sorted-list remove invalid key!"); + }); + + + QUnit.test("removeAt", function (assert) { + + var _list = CreateSortedList(); + + _list.removeAt(0); + assert.ok(_list.count() === 4 && _list.indexOfKey(1) < 0, "sorted-list remove at index!"); + assert.throws(() => _list.removeAt(10), "throws an error removing item at invalid index"); + }); + + + QUnit.test("set", function (assert) { + + var _list = CreateSortedList(); + + _list.set(1, "AA"); + assert.ok(_list.count() === 5 && _list.get(1) === "AA", "sorted-list set exisiting key's value!"); + + _list.set(6, "F"); + assert.ok(_list.count() === 6 && _list.get(6) === "F", "sorted-list set new key and value!"); + }); + + + QUnit.test("tryGetValue", function (assert) { + + var _list = CreateSortedList(); + + assert.ok(function () { + var value: string; + var res = _list.tryGetValue(1, val => value = val); + + return res && value === "A"; + + }, "sorted-list tryGetValue, exisiting key!"); + + + assert.ok(function () { + var value: string; + var res = _list.tryGetValue(10, val => value = val); + + return res === false; + + }, "sorted-list tryGetValue, invalid key!"); + }); + + + QUnit.test("sorted-list enumerable", function (assert) { + + var _list = CreateSortedList(); + + assert.deepEqual(_list.select(t => t.key * 2).where(t => t > 5).toArray(), [6, 8, 10], "select-where-toArray over a sorted-list!"); + assert.deepEqual(_list.where(t => t.key > 2).select(t => t.value).toArray(), ["C", "D", "E"], "where-select-toArray over a sorted-list!"); + }); + + + QUnit.test("evaluate sorting", function (assert) { + + var _list1 = CreateSortedList(), + _list2 = new SortedList<{ id: number; name: string }, number>({ compare: (a, b) => a.name.localeCompare(b.name) }); + + _list1.remove(5); + _list1.add(6, "F"); + _list1.remove(4); + _list1.add(7, "G"); + _list1.remove(3); + _list1.add(8, "H"); + _list1.remove(2); + _list1.add(9, "I"); + _list1.remove(1); + _list1.add(10, "J"); + + assert.deepEqual(_list1.keys().toArray(), [6, 7, 8, 9, 10], "evaluate sorted keys after multiple add/remove"); + assert.deepEqual(_list1.values().toArray(), ["F", "G", "H", "I", "J"], "evaluate sorted values after multiple add/remove"); + + + + _list2.add({ id: 2, name: "B" }, 2); + _list2.add({ id: 5, name: "E" }, 5); + _list2.add({ id: 4, name: "D" }, 4); + _list2.add({ id: 3, name: "C" }, 3); + _list2.add({ id: 1, name: "A" }, 1); + + assert.deepEqual(_list2.keys().select(t => t.id).toArray(), [1, 2, 3, 4, 5], "evaluate sorted keys after multiple add/remove using specified comparer!"); + }); + + + + /* Factory methods + ---------------------------------------------------------------------- */ + + function CreateDictionary(): Dictionary { + var _dic = new Dictionary(); + _dic.add(1, "A"); + _dic.add(2, "B"); + _dic.add(3, "C"); + _dic.add(4, "D"); + _dic.add(5, "E"); + + return _dic; + } + + function CreateSortedList(): SortedList { + var _list = new SortedList(); + _list.add(5, "E"); + _list.add(3, "C"); + _list.add(2, "B"); + _list.add(4, "D"); + _list.add(1, "A"); + + return _list; + } + } + + + module DictionaryTests { + + QUnit.module("Dictionary"); + + + QUnit.test("constructor", function (assert) { + + var _comparer = EqualityComparer.create(o => mx.hash(o), (a, b) => a === b), + _d1 = new Dictionary(), + _d2 = new Dictionary(CreateDictionary()), + _d3 = new Dictionary(_comparer), + _d4 = new Dictionary(5), + _d5 = new Dictionary(5, _comparer), + _d6 = new Dictionary(CreateDictionary(), _comparer); + + + assert.ok(_d1.count() === 0, "initialize a Dictionary!"); + assert.ok(_d2.count() === 5, "initialize a Dictionary using specified dictionary!"); + assert.ok(_d3.count() === 0, "initialize a Dictionary using specified comparer!"); + assert.ok(_d4.count() === 0, "initialize a Dictionary using initial capacity!"); + assert.ok(_d5.count() === 0, "initialize a Dictionary using using initial capacity and comparer!"); + assert.ok(_d6.count() === 5, "initialize a Dictionary using specified dictionary and comparer!"); + }); + + + QUnit.test("add", function (assert) { + var _dic = new Dictionary(); + _dic.add(1, "A"); + + assert.ok(_dic.count() === 1, "ditionary add"); + assert.throws(() => _dic.add(1, "B"), "throws an error adding duplicate key"); + }); + + + QUnit.test("clear", function (assert) { + var _dic = CreateDictionary(); + _dic.clear(); + + assert.ok(_dic.count() === 0, "ditionary clear!"); + }); + + + QUnit.test("containsKey", function (assert) { + + var _dic = CreateDictionary(); + + assert.ok(_dic.containsKey(1) === true, "dictionary contains key!"); + assert.ok(_dic.containsKey(10) === false, "dictionary does not contain key!"); + }); + + + QUnit.test("containsValue", function (assert) { + + var _dic = CreateDictionary(); + + assert.ok(_dic.containsValue("A") === true, "dictionary contains value!"); + assert.ok(_dic.containsValue("Z") === false, "dictionary does not contain value!"); + }); + + + QUnit.test("copyTo", function (assert) { + + var _dic = CreateDictionary(), + _arr = new Array(_dic.count()); + + _dic.copyTo(_arr, 0); + assert.deepEqual(_arr, [1, 2, 3, 4, 5], "dictionary copy to an array!"); + assert.throws(() => _dic.copyTo([], 0), "throws an error when the number of elements is greater than the number of elements that the destination array can contain!"); + }); + + + QUnit.test("keys", function (assert) { + + var _dic = CreateDictionary(); + + assert.deepEqual(_dic.keys().toArray(), [1, 2, 3, 4, 5], "dictionary keys!"); + assert.deepEqual(new Dictionary().keys().toArray(), [], "empty dictionary keys!"); + }); + + + QUnit.test("values", function (assert) { + + var _dic = CreateDictionary(); + + assert.deepEqual(_dic.values().toArray(), ["A", "B", "C", "D", "E"], "dictionary values!"); + assert.deepEqual(new Dictionary().values().toArray(), [], "empty dictionary values!"); + }); + + + QUnit.test("get", function (assert) { + + var _dic = CreateDictionary(); + + assert.ok(_dic.get(1) === "A", "dictionary get value!"); + assert.throws(() => _dic.get(10), "throws an error getting non existing key!"); + }); + + + QUnit.test("set", function (assert) { + + var _dic = CreateDictionary(); + + _dic.set(1, "AA"); + assert.ok(_dic.get(1) === "AA", "dictionary set value!"); + + _dic.set(6, "F"); + assert.ok(_dic.count() === 6 && _dic.get(6) === "F", "dictionary set new key and value!"); + }); + + + QUnit.test("tryGetValue", function (assert) { + + var _dic = CreateDictionary(); + + assert.ok(function () { + var value: string; + var res = _dic.tryGetValue(1, val => value = val); + + return res && value === "A"; + + }, "dictionary tryGetValue, exisiting key!"); + + + assert.ok(function () { + var value: string; + var res = _dic.tryGetValue(10, val => value = val); + + return res === false; + + }, "dictionary tryGetValue, invalid key!"); + }); + + + QUnit.test("remove", function (assert) { + + var _dic = CreateDictionary(); + + assert.ok(_dic.remove(1) === true && _dic.count() === 4, "dictionary remove key!"); + assert.ok(_dic.remove(10) === false && _dic.count() === 4, "dictionary remove non existing key!"); + }); + + + QUnit.test("key-value pair", function (assert) { + + var _pair1 = new KeyValuePair(1, "A"), + _pair2 = new KeyValuePair(1, "A"); + + assert.ok(_pair1.key === 1 && _pair1.value === "A", "KeyValuePair get key/value!"); + assert.throws(() => _pair1.key = 2, "throws an error trysing to set KeyValuePair key!"); + assert.throws(() => _pair1.value = "B", "throws an error trysing to set KeyValuePair value!"); + assert.ok(mx.hash(_pair1) === mx.hash(_pair2), "KeyValuePair get hash code!"); + assert.ok(mx.equals(_pair1, _pair2), "KeyValuePair equality check!"); + }); + + + QUnit.test("dictionary enumerable", function (assert) { + + var _dic = CreateDictionary(); + + assert.deepEqual(_dic.select(t => t.key).toArray(), [1, 2, 3, 4, 5], "dictionary select keys, to array!"); + assert.deepEqual(_dic.select(t => t.value).toArray(), ["A", "B", "C", "D", "E"], "dictionary select values, to array!"); + assert.ok(_dic.toArray()[0].key === 1 && _dic.toArray()[0].value === "A", "dictionary select key-value items!"); + }); + + + + /* Factory methods + ---------------------------------------------------------------------- */ + + function CreateDictionary(): Dictionary { + var _dic = new Dictionary(); + _dic.add(1, "A"); + _dic.add(2, "B"); + _dic.add(3, "C"); + _dic.add(4, "D"); + _dic.add(5, "E"); + + return _dic; + } + } + + + module HashSetTests { + + QUnit.module("Hashset"); + + + QUnit.test("constructor", function (assert) { + + assert.ok(new HashSet().count() === 0, "initialize an empty HashSet!"); + assert.ok(new HashSet(mx.range(1, 5)).count() === 5, "initialize a HashSet using specified collection!"); + assert.ok(new HashSet(mx.EqualityComparer.defaultComparer).count() === 0, "initialize a HashSet using specified equality comparer!"); + assert.ok(CreateObjectHashSet().count() === 2, "initialize a HashSet using specified collection and equality comparer!"); + }); + + + QUnit.test("add", function (assert) { + + var _hash1 = CreateNumericHashSet(), + _hash2 = CreateObjectHashSet(); + + assert.ok(_hash1.add(6) === true, "add item to a HashSet of numbers!"); + assert.ok(_hash1.add(1) === false, "add existing item to a HashSet of numbers!"); + assert.ok(_hash2.add({ name: "C", value: 5 }) === true, "add item to a HashSet of objects!"); + assert.ok(_hash2.add({ name: "A", value: 5 }) === false, "add an existing item to a HashSet of objects!"); + }); + + + QUnit.test("clear", function (assert) { + + var _hash = CreateNumericHashSet(); + + _hash.clear(); + assert.ok(_hash.count() === 0, "clear a HashSet!"); + }); + + + QUnit.test("contains", function (assert) { + + var _hash1 = CreateNumericHashSet(), + _hash2 = CreateObjectHashSet(); + + assert.ok(_hash1.contains(1) === true, "HashSet of numbers contains an item!"); + assert.ok(_hash1.contains(6) === false, "HashSet of numbers does not contain an item!"); + assert.ok(_hash2.contains({ name: "A", value: 5 }) === true, "HashSet of objects contains an item!"); + assert.ok(_hash2.contains({ name: "C", value: 5 }) === false, "HashSet of objects does not contain an item!"); + }); + + + QUnit.test("copyTo", function (assert) { + + var _hash = CreateNumericHashSet(), + _arr = new Array(_hash.count()); + + _hash.copyTo(_arr, 0); + + assert.deepEqual(_arr, [1, 2, 3, 4, 5], "HashSet copy to an array!"); + assert.throws(() => _hash.copyTo([], 0), "throws an error when the number of elements is greater than the number of elements that the destination array can contain!"); + }); + + + QUnit.test("comparer", function (assert) { + + var _hash1 = CreateNumericHashSet(), + _hash2 = CreateObjectHashSet(); + + assert.ok(_hash1.comparer() === mx.EqualityComparer.defaultComparer, "HashSet default comparer!"); + assert.ok(_hash2.comparer().equals({ name: "A", value: 1 }, { name: "A", value: 2 }), "HashSet custom comparer!"); + }); + + + QUnit.test("remove", function (assert) { + + var _hash1 = CreateNumericHashSet(), + _hash2 = CreateObjectHashSet(); + + assert.ok(_hash1.remove(1) === true, "HashSet of numbers remove an item!"); + assert.ok(_hash1.remove(1) === false, "HashSet of numbers remove non existing item!"); + assert.ok(_hash2.remove({ name: "A", value: 1 }) === true, "HashSet of objects remove an item!"); + assert.ok(_hash2.remove({ name: "A", value: 1 }) === false, "HashSet of objects remove non existing item!"); + }); + + + QUnit.test("removeWhere", function (assert) { + + var _hash1 = CreateNumericHashSet(), + _hash2 = CreateObjectHashSet(); + + assert.ok(_hash1.removeWhere(t => t < 3) === 2, "HashSet of numbers remove with predicate, get number of items removed!"); + assert.ok(_hash1.removeWhere(t => t < 3) === 0, "HashSet of numbers remove with invalid predicate, get number of items removed!"); + assert.ok(_hash1.count() === 3, "HashSet of numbers remove with predicate, get count!"); + + assert.ok(_hash2.removeWhere(t => t.value < 3) === 1, "HashSet of objects remove with predicate, get number of items removed!"); + assert.ok(_hash2.removeWhere(t => t.value < 3) === 0, "HashSet of objects remove with invalid predicate, get number of items removed!"); + assert.ok(_hash2.count() === 1, "HashSet of objects remove with predicate, get count!"); + }); + + + QUnit.test("exceptWith", function (assert) { + + var _hash1 = CreateNumericHashSet(), + _hash2 = CreateObjectHashSet(), + _hash3 = CreateNumericHashSet(); + + _hash1.exceptWith([1, 2, 3]); + _hash2.exceptWith([{ name: "A", value: 0 }]); + _hash3.exceptWith(CreateNumericHashSet()); + + assert.ok(_hash1.count() === 2 && _hash1.contains(1) === false, "HashSet of numbers except a collection, get count!"); + assert.ok(_hash2.count() === 1 && _hash2.contains({ name: "A", value: 0 }) === false, "HashSet of objects except a collection, get count!"); + assert.ok(_hash3.count() === 0, "HashSet of numbers except an equal set, get count!"); + }); + + + QUnit.test("intersectWith", function (assert) { + + var _hash1 = CreateNumericHashSet(), + _hash2 = CreateObjectHashSet(), + _hash3 = CreateNumericHashSet(); + + _hash1.intersectWith([1, 2, 3]); + _hash2.intersectWith([{ name: "A", value: 0 }]); + _hash3.intersectWith(CreateNumericHashSet()); + + assert.ok(_hash1.count() === 3 && _hash1.contains(1) === true, "HashSet of numbers intersect with a collection, get count!"); + assert.ok(_hash2.count() === 1 && _hash2.contains({ name: "A", value: 0 }) === true, "HashSet of objects intersect with a collection, get count!"); + assert.ok(_hash3.count() === 5, "HashSet of numbers intersect with an equal set, get count!"); + }); + + + QUnit.test("isProperSubsetOf", function (assert) { + + var _hash = CreateNumericHashSet(); + + assert.ok(new HashSet().isProperSubsetOf([1, 2, 3]) === true, "an empty set is a proper subset of any other collection!"); + assert.ok(new HashSet().isProperSubsetOf([]) === false, "an empty set is not a proper subset of another empty collection!"); + assert.ok(_hash.isProperSubsetOf([1, 2, 3, 4]) === false, "a hash set is not a proper subset of another collection when count is greater than the number of elements in other!"); + assert.ok(_hash.isProperSubsetOf([1, 2, 3, 4, 5]) === false, "a hash set is not a proper subset of another collection when count is equal to the number of elements in other!"); + assert.ok(_hash.isProperSubsetOf([1, 2, 3, 4, 5, 6]) === true, "hash set proper subset!"); + }); + + + QUnit.test("isProperSupersetOf", function (assert) { + + var _hash = CreateNumericHashSet(); + + assert.ok(new HashSet().isProperSupersetOf([1, 2, 3]) === false, "an empty set is a not superset of any other collection!"); + assert.ok(new HashSet().isProperSupersetOf([]) === false, "an empty set is not a proper superset of another empty collection!"); + assert.ok(_hash.isProperSupersetOf([1, 2, 3, 4, 5, 6]) === false, "a hash set is not a proper superset of another collection when count is less than the number of elements in other!"); + assert.ok(_hash.isProperSupersetOf([1, 2, 3, 4, 5]) === false, "a hash set is not a proper superset of another collection when count is equal to the number of elements in other!"); + assert.ok(_hash.isProperSupersetOf([1, 2, 3]) === true, "hash set proper superset!"); + }); + + + QUnit.test("isSubsetOf", function (assert) { + + var _hash = CreateNumericHashSet(); + + assert.ok(new HashSet().isSubsetOf([1, 2, 3]) === true, "an empty set is a subset of any other collection!"); + assert.ok(new HashSet().isSubsetOf([]) === true, "an empty set is a subset of another empty collection!"); + assert.ok(_hash.isSubsetOf([1, 2, 3, 4]) === false, "a hash set is not a subset of another collection when count is greater than the number of elements in other!"); + assert.ok(_hash.isSubsetOf([1, 2, 3, 4, 5]) === true, "a hash set is a proper subset of another collection when count is equal to the number of elements in other!"); + assert.ok(_hash.isSubsetOf([1, 2, 3, 4, 5, 6]) === true, "hash set subset!"); + }); + + + QUnit.test("isSupersetOf", function (assert) { + + var _hash = CreateNumericHashSet(); + + assert.ok(new HashSet().isSupersetOf([1, 2, 3]) === false, "an empty set is a not superset of any other collection!"); + assert.ok(new HashSet().isSupersetOf([]) === true, "an empty set is superset of another empty collection!"); + assert.ok(_hash.isSupersetOf([1, 2, 3, 4, 5, 6]) === false, "a hash set is not a superset of another collection when count is less than the number of elements in other!"); + assert.ok(_hash.isSupersetOf([1, 2, 3, 4, 5]) === true, "a hash set is a proper superset of another collection when count is equal to the number of elements in other!"); + assert.ok(_hash.isSupersetOf([1, 2, 3]) === true, "hash set superset!"); + }); + + + QUnit.test("overlaps", function (assert) { + + var _hash1 = CreateNumericHashSet(), + _hash2 = CreateObjectHashSet(); + + assert.ok(_hash1.overlaps([1, 2, 3]) === true, "HashSet of numbers overlaps with another collection!"); + assert.ok(_hash2.overlaps([{ name: "A", value: 0 }]) === true, "HashSet of objects overlaps with another collection!"); + assert.ok(new HashSet().overlaps([1, 2, 3]) === false, "an empty HashSet does not overlap with another collection!"); + }); + + + QUnit.test("setEquals", function (assert) { + + var _hash1 = CreateNumericHashSet(), + _hash2 = CreateNumericHashSet(); + + assert.ok(_hash1.setEquals(_hash2) === true, "HashSet of numbers equals with another HashSet!"); + assert.ok(_hash1.setEquals([1, 2, 3, 4, 5]) === true, "HashSet of numbers equals with another collection!"); + assert.ok(new HashSet().setEquals([]) === true, "an empty HashSet equals with an empty collection!"); + assert.ok(new HashSet().setEquals([1, 2, 3]) === false, "an empty HashSet does not equals with another collection!"); + }); + + + QUnit.test("symmetricExceptWith", function (assert) { + + var _hash1 = CreateNumericHashSet(), + _hash2 = CreateObjectHashSet(), + _hash3 = CreateNumericHashSet(); + + _hash1.symmetricExceptWith([2, 3, 4]); + _hash2.symmetricExceptWith([{ name: "A", value: 0 }]); + _hash3.exceptWith(CreateNumericHashSet()); + + assert.ok(_hash1.count() === 2, "HashSet of numbers symmetric except another collection, get count!"); + assert.ok(_hash1.contains(1) === true && _hash1.contains(5) === true, "HashSet of numbers symmetric except another collection, check contains!"); + assert.ok(_hash2.count() === 1, "HashSet of objects symmetric except another collection, get count!"); + assert.ok(_hash2.contains({ name: "A", value: 0 }) === false && _hash2.contains({ name: "B", value: 0 }) === true, "HashSet of objects symmetric except another collection, check contains!"); + assert.ok(_hash3.count() === 0, "HashSet of numbers symmetric except an equal set, get count!"); + }); + + + QUnit.test("unionWith", function (assert) { + + var _hash1 = CreateNumericHashSet(), + _hash2 = CreateObjectHashSet(), + _hash3 = CreateNumericHashSet(); + + _hash1.unionWith([5, 6, 7, 8]); + _hash2.unionWith([{ name: "A", value: 5 }, { name: "B", value: 6 }, { name: "C", value: 7 }, { name: "D", value: 8 }]); + _hash3.unionWith(CreateNumericHashSet()); + + assert.ok(_hash1.count() === 8, "HashSet of numbers union with another collection, get count!"); + assert.ok(_hash1.contains(1) === true && _hash1.contains(8) === true, "HashSet of numbers union with another collection, check contains!"); + assert.ok(_hash2.count() === 4, "HashSet of objects union with another collection, get count!"); + assert.ok(_hash2.contains({ name: "A", value: 0 }) === true && _hash2.contains({ name: "D", value: 0 }) === true, "HashSet of objects union with another collection, check contains!"); + assert.ok(_hash3.count() === 5, "HashSet of numbers union with an equal set, get count!"); + }); + + + QUnit.test("set enumerable", function (assert) { + + var _hash1 = CreateNumericHashSet(), + _hash2 = CreateObjectHashSet(); + + assert.deepEqual(_hash1.select(t => t * 2).where(t => t > 5).toArray(), [6, 8, 10], "select-where-toArray over a HashSet of numbers!"); + assert.deepEqual(_hash2.select(t => t.value * 2).where(t => t > 5).toArray(), [6], "select-where-toArray over a HashSet of objects!"); + }); + + + + /* Factory methods + ---------------------------------------------------------------------- */ + + function CreateNumericHashSet(): HashSet { + return new HashSet(mx.range(1, 5)); + } + + function CreateObjectHashSet(): HashSet { + + var _items: SimpleObject[] = [{ name: "A", value: 1 }, { name: "A", value: 2 }, { name: "B", value: 3 }, { name: "B", value: 4 }], + _comparer = EqualityComparer.create(obj => mx.hash(obj.name), (a, b) => a.name === b.name); + + return new HashSet(_items, _comparer); + } + } + + + module LinkedListTests { + + QUnit.module("LinkedList"); + + + QUnit.test("constructor", function (assert) { + + assert.ok(new LinkedList().count() === 0, "initialize an empty LinkedList!"); + assert.ok(CreateLinkedList().count() === 5, "initialize a LinkedList using specified collection!"); + }); + + + QUnit.test("add", function (assert) { + + var _list = CreateLinkedList(); + + _list.add(6); + assert.ok(_list.count() === 6, "add an item to a LinkedList!"); + }); + + + QUnit.test("clear", function (assert) { + + var _list = CreateLinkedList(); + + _list.clear(); + assert.ok(_list.count() === 0, "clear a LinkedList!"); + }); + + + QUnit.test("contains", function (assert) { + + var _list = CreateLinkedList(); + + assert.ok(_list.contains(1) && _list.contains(5), "LinkedList contains an item!"); + assert.ok(_list.contains(10) === false, "LinkedList does not contains an item!"); + }); + + + QUnit.test("copyTo", function (assert) { + + var _list = CreateLinkedList(), + _arr = new Array(_list.count()); + + _list.copyTo(_arr, 0); + + assert.deepEqual(_arr, [1, 2, 3, 4, 5], "LinkedList copy to an array!"); + assert.throws(() => _list.copyTo([], 0), "throws an error when the number of elements is greater than the number of elements that the destination array can contain!"); + }); + + + QUnit.test("getFirst", function (assert) { + + var _list = CreateLinkedList(); + + assert.ok(_list.getFirst().value() === 1, "LinkedList first item!"); + assert.ok(new LinkedList().getFirst() === null, "empty LinkedList first item!"); + }); + + + QUnit.test("getLast", function (assert) { + + var _list = CreateLinkedList(); + + assert.ok(_list.getLast().value() === 5, "LinkedList last item!"); + assert.ok(new LinkedList().getLast() === null, "empty LinkedList last item!"); + }); + + + QUnit.test("addAfter", function (assert) { + + var _list = CreateLinkedList(), + _first = _list.getFirst(), + _node = new LinkedListNode(6); + + _list.addAfter(_first, _node); + _list.addAfter(_first, 7); + + assert.ok(_list.count() === 7, "LinkedList add after item, get count!"); + assert.ok(_list.contains(6) && _list.contains(7), "LinkedList add after item, check contains!"); + }); + + + QUnit.test("addBefore", function (assert) { + + var _list = CreateLinkedList(), + _last = _list.getLast(), + _node = new LinkedListNode(6); + + _list.addBefore(_last, _node); + _list.addBefore(_last, 7); + + assert.ok(_list.count() === 7, "LinkedList add before item, get count!"); + assert.ok(_list.contains(6) && _list.contains(7), "LinkedList add before item, check contains!"); + }); + + + QUnit.test("addFirst", function (assert) { + + var _list = CreateLinkedList(), + _node = new LinkedListNode(0); + + _list.addFirst(_node); + _list.addFirst(-1); + + assert.ok(_list.count() === 7, "LinkedList add first, get count!"); + assert.ok(_list.contains(0) && _list.contains(-1), "LinkedList add first, check contains!"); + assert.ok(_list.getFirst().value() === -1, "LinkedList add first, get first!"); + }); + + + QUnit.test("addLast", function (assert) { + + var _list = CreateLinkedList(), + _node = new LinkedListNode(6); + + _list.addLast(_node); + _list.addLast(7); + + assert.ok(_list.count() === 7, "LinkedList add last, get count!"); + assert.ok(_list.contains(6) && _list.contains(7), "LinkedList add last, check contains!"); + assert.ok(_list.getLast().value() === 7, "LinkedList add last, get last!"); + }); + + + QUnit.test("find", function (assert) { + + var _list = CreateLinkedList(); + + assert.ok(_list.find(4).value() === 4, "LinkedList find an item!"); + assert.ok(_list.find(10) === null, "LinkedList does not find an item!"); + }); + + + QUnit.test("findLast", function (assert) { + + var _list = CreateLinkedList(), + _node = new LinkedListNode(1); + + _list.addLast(_node); + + assert.ok(_list.findLast(1) === _node, "LinkedList find last!"); + assert.ok(_list.findLast(10) === null, "LinkedList does not find last item!"); + }); + + + QUnit.test("remove", function (assert) { + + var _list = CreateLinkedList(), + _last = _list.getLast(); + + assert.ok(_list.remove(1) === true, "LinkedList remove an item!"); + assert.ok(_list.remove(1) === false, "LinkedList remove non existing item!"); + assert.ok(_list.remove(_last) === true, "LinkedList remove a node!"); + assert.throws(() => _list.remove(_last), "throws an error when removing non existing or invalid node!"); + assert.ok(_list.count() === 3, "LinkedList remove, get count!"); + }); + + + QUnit.test("removeFirst", function (assert) { + + var _list = CreateLinkedList(); + + _list.removeFirst(); + + assert.ok(_list.count() === 4 && _list.contains(1) === false, "LinkedList remove first node!"); + assert.throws(() => new LinkedList().removeFirst(), "throws an error removing from an empty linked list!"); + }); + + + QUnit.test("removeLast", function (assert) { + + var _list = CreateLinkedList(); + + _list.removeLast(); + + assert.ok(_list.count() === 4 && _list.contains(5) === false, "LinkedList remove last node!"); + assert.throws(() => new LinkedList().removeLast(), "throws an error removing from an empty linked list!"); + }); + + + QUnit.test("linked-list enumerable", function (assert) { + + var _list = CreateLinkedList(); + assert.deepEqual(_list.select(t => t * 2).where(t => t > 5).toArray(), [6, 8, 10], "select-where-toArray over a linked-list!"); + }); + + + + + /* Factory methods + ---------------------------------------------------------------------- */ + + function CreateLinkedList(): LinkedList { + return new LinkedList(mx.range(1, 5)); + } + } + + + module QueueTests { + + QUnit.module("Queue"); + + + QUnit.test("constructor", function (assert) { + + assert.ok(new Queue().count() === 0, "initialize an empty Queue!"); + assert.ok(CreateQueue().count() === 5, "initialize a Queue using specified collection!"); + }); + + + QUnit.test("clear", function (assert) { + + var _queue = CreateQueue(); + + _queue.clear(); + assert.ok(_queue.count() === 0, "clears a Queue!"); + }); + + + QUnit.test("contains", function (assert) { + + var _queue = CreateQueue(); + + assert.ok(_queue.contains(1) === true, "queue containing an item!"); + assert.ok(_queue.contains(10) === false, "queue does not contain an item!"); + }); + + + QUnit.test("copyTo", function (assert) { + + var _queue = CreateQueue(), + _arr = new Array(_queue.count()); + + _queue.copyTo(_arr, 0); + assert.deepEqual(_arr, [1, 2, 3, 4, 5], "queue copy to an array!"); + assert.throws(() => _queue.copyTo([], 0), "throws an error when the number of elements is greater than the number of elements that the destination array can contain!"); + }); + + + QUnit.test("dequeue", function (assert) { + + var _queue = CreateQueue(); + + assert.ok(_queue.dequeue() === 1, "queue dequeue an item!"); + + _queue.clear(); + assert.throws(() => _queue.dequeue(), "throws an error dequeue from empty queue!"); + }); + + + QUnit.test("enqueue", function (assert) { + + var _queue = CreateQueue(); + + _queue.enqueue(6); + assert.ok(_queue.count() === 6 && _queue.peek() === 1, "queue dequeue an item!"); + }); + + + QUnit.test("peek", function (assert) { + + var _queue = CreateQueue(); + + assert.ok(_queue.peek() === 1, "queue peek an item!"); + + _queue.clear(); + assert.throws(() => _queue.peek(), "throws an error peek from empty queue!"); + }); + + + QUnit.test("toArray", function (assert) { + + var _queue = CreateQueue(); + + assert.deepEqual(_queue.toArray(), [1, 2, 3, 4, 5], "queue to array!"); + }); + + + QUnit.test("queue enumerable", function (assert) { + + var _queue = CreateQueue(); + + assert.deepEqual(_queue.select(t => t * 2).where(t => t > 5).toArray(), [6, 8, 10], "select-where-toArray over a queue!"); + }); + + + + /* Factory methods + ---------------------------------------------------------------------- */ + + function CreateQueue(): Queue { + return new Queue(mx.range(1, 5)); + } + } + + + module StackTests { + + QUnit.module("Stack"); + + + QUnit.test("constructor", function (assert) { + + assert.ok(new Stack().count() === 0, "initialize an empty Stack!"); + assert.ok(CreateStack().count() === 5, "initialize a Stack using specified collection!"); + }); + + + QUnit.test("clear", function (assert) { + + var _stack = CreateStack(); + + _stack.clear(); + assert.ok(_stack.count() === 0, "clears a Stack!"); + }); + + + QUnit.test("contains", function (assert) { + + var _stack = CreateStack(); + + assert.ok(_stack.contains(1) === true, "stack containing an item!"); + assert.ok(_stack.contains(10) === false, "stack does not contain an item!"); + }); + + + QUnit.test("copyTo", function (assert) { + + var _stack = CreateStack(), + _arr = new Array(_stack.count()); + + _stack.copyTo(_arr, 0); + assert.deepEqual(_arr, [1, 2, 3, 4, 5], "stack copy to an array!"); + assert.throws(() => _stack.copyTo([], 0), "throws an error when the number of elements is greater than the number of elements that the destination array can contain!"); + }); + + + QUnit.test("peek", function (assert) { + + var _stack = CreateStack(); + + assert.ok(_stack.peek() === 5, "stack peek an item!"); + + _stack.clear(); + assert.throws(() => _stack.peek(), "throws an error peek from empty stack!"); + }); + + + QUnit.test("pop", function (assert) { + + var _stack = CreateStack(); + + assert.ok(_stack.pop() === 5, "stack pop an item!"); + + _stack.clear(); + assert.throws(() => _stack.pop(), "throws an error pop from empty stack!"); + }); + + + QUnit.test("push", function (assert) { + + var _stack = CreateStack(); + + _stack.push(6); + assert.ok(_stack.count() === 6 && _stack.peek() === 6, "stack push an item!"); + }); + + + QUnit.test("toArray", function (assert) { + + var _stack = CreateStack(); + + assert.deepEqual(_stack.toArray(), [1, 2, 3, 4, 5], "stack to array!"); + }); + + + QUnit.test("stack enumerable", function (assert) { + + var _stack = CreateStack(); + + assert.deepEqual(_stack.select(t => t * 2).where(t => t > 5).toArray(), [6, 8, 10], "select-where-toArray over a stack!"); + }); + + + + /* Factory methods + ---------------------------------------------------------------------- */ + + function CreateStack(): Stack { + return new Stack(mx.range(1, 5)); + } + } + + + module LookupTests { + + QUnit.module("Lookup"); + + + QUnit.test("contains", function (assert) { + + var _lookup = CreateLookup(); + + assert.ok(_lookup.contains(1) === true, "lookup contains an item!"); + assert.ok(_lookup.contains(10) === false, "lookup does not an item!"); + }); + + + QUnit.test("count", function (assert) { + + var _lookup = CreateLookup(); + + assert.ok(_lookup.count() === 4, "lookup count!"); + }); + + + QUnit.test("get", function (assert) { + + var _lookup = CreateLookup(); + + assert.ok(_lookup.get(1).count() === 2, "lookup get an item!"); + assert.ok(_lookup.get(10).count() === 0, "lookup get non existing item!"); + }); + + + QUnit.test("lookup enumerable", function (assert) { + + var _lookup = CreateLookup(); + + assert.deepEqual(_lookup.select(t => t.key).toArray(), [1, 2, 3, 4], "lookup select keys, to array!"); + assert.deepEqual(_lookup.selectMany(t => t).toArray(), [1, 1, 2, 3, 3, 4, 4, 4], "lookup select all items, to array!"); + assert.deepEqual(_lookup.select(t => t.count()).toArray(), [2, 1, 2, 3], "lookup select items count!"); + }); + + + + /* Factory methods + ---------------------------------------------------------------------- */ + + function CreateLookup(): Lookup { + return mx([1, 1, 2, 3, 3, 4, 4, 4]).toLookup(t => t); + } + } +} \ No newline at end of file diff --git a/multiplexjs/multiplexjs.d.ts b/multiplexjs/multiplexjs.d.ts new file mode 100644 index 000000000..dc39fe6b6 --- /dev/null +++ b/multiplexjs/multiplexjs.d.ts @@ -0,0 +1,2551 @@ +// Type definitions for Multiplex.js 0.9 +// Project: http://github.com/multiplex/multiplex.js +// Definitions by: Kamyar Nazeri +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + + +declare var multiplex: multiplex.MultiplexStatic; + + +// Support AMD require +declare module 'multiplex' { + export = multiplex; +} + + +// Collapse multiplex into mx +import mx = multiplex; + + +// ES6 compatibility +interface Array extends multiplex.Iterable { } +interface String extends multiplex.Iterable { } + + + +declare module multiplex { + + /** + * ES6 Iterable + */ + interface Iterable { + "@@iterator"(): Iterator + } + interface Iterator { + next(): IteratorResult; + return?(value?: any): IteratorResult; + throw?(e?: any): IteratorResult; + } + interface IteratorResult { + done: boolean; + value?: T; + } + + + + /** + * Supports a simple iteration over a collection. + */ + interface Enumerator { + + /** + * Advances the enumerator to the next element of the collection. + */ + next(): boolean; + + /** + * Gets the element in the collection at the current position of the enumerator. + */ + current: T; + } + interface EnumeratorConstructor { + new (generator: (yielder: (value: T) => T) => any): Enumerator; + } + + + + /** + * Exposes the enumerator, which supports a simple iteration over a collection of a specified type. + * Enumerable uses ES6 Iteration protocol. + */ + interface Enumerable extends Iterable { + + /** + * Returns an enumerator that iterates through the collection. + */ + getEnumerator(): Enumerator; + } + interface EnumerableConstructor { + + /** + * Exposes the enumerator, which supports an iteration over the specified Enumerable object. + * @param obj An Iterable object. eg. Enumerable, Array, String, Set, Map, Iterable & Generators + */ + new (obj: Iterable): Enumerable; + + + /** + * Defines an enumerator, which supports an iteration over the specified Generator function. + * @param factory An Enumerator factory function. + */ + new (factory: () => Enumerator): Enumerable; + + /** + * Defines an enumerator, which supports an iteration over the items of the specified Array-like object. + * An Array-like object is an object which has the "length" property and indexed properties access, eg. jQuery + * @param obj An Array-like object. + */ + new (obj: ArrayLike): Enumerable; + + /** + * Defines an enumerator, which supports an iteration over the arguments local variable available within all functions. + * @param obj arguments local variable available within all functions. + */ + new (obj: IArguments): Enumerable; + + /** + * Defines an enumerator, which supports an iteration over the properties of the specified object. + * @param obj A regular Object. + */ + new (obj: Object): Enumerable>; + + + + + /** + * Returns an empty Enumerable. + */ + empty(): Enumerable; + + /** + * Detects if an object is Enumerable. + * @param obj An object to check its Enumerability. + */ + is(obj: any): boolean; + + /** + * Generates a sequence of integral numbers within a specified range. + * @param start The value of the first integer in the sequence. + * @param count The number of sequential integers to generate. + */ + range(start: number, count: number): Enumerable; + + /** + * Generates a sequence that contains one repeated value. + * @param element The value to be repeated. + * @param count The number of times to repeat the value in the generated sequence. + */ + repeat(element: T, count: number): Enumerable; + } + + + + /** + * Defines a method that a type implements to compare two objects. + */ + interface Comparer { + /** + * Compares two objects and returns a value indicating whether one is less than, equal to, or greater than the other. + * returns An integer that indicates the relative values of x and y, as shown in the following table: + * Less than zero x is less than y. + * Zero x equals y. + * Greater than zero x is greater than y.. + * @param x The first object to compare. + * @param y The second object to compare. + */ + compare(x: T, y: T): number; + } + interface ComparerConstructor { + + /** + * Returns a default sort order comparer for the type specified by the generic argument. + */ + defaultComparer: Comparer; + + /** + * Creates a comparer by using the specified comparison. + * @param comparison The comparison to use. + */ + create(comparison: (x: T, y: T) => number): Comparer; + } + + + + /** + * Provides a base class for implementations of the EqualityComparer. + */ + interface EqualityComparer { + + /** + * Determines whether the specified objects are equal. + * @param x The first object of type Object to compare. + * @param y The second object of type Object to compare. + */ + equals(x: T, y: T): boolean; + + + /** + * Returns a hash code for the specified object. + * @param obj The Object for which a hash code is to be returned. + */ + hash(obj: T): number + } + interface EqualityComparerConstructor { + + /** + * Gets a default equality comparer for the type specified by the generic argument. + */ + defaultComparer: EqualityComparer; + + + /** + * Creates an EqualityComparer by using the specified equality and hashCodeProvider. + * @param hashCodeProvider The hashCodeProvider to use for a hash code is to be returned. + * @param equality The equality function. + */ + create(hashCodeProvider: (obj: T) => number, equality: (x: T, y: T) => boolean): EqualityComparer; + } + + + + /** + * Initializes a new instance of the abstract Collection class. + */ + interface Collection extends Enumerable { + + /** + * Gets the number of elements contained in the Collection. + */ + count(): number; + + + /** + * Copies the Collection to an existing one-dimensional Array, starting at the specified array index. + * @param array The one-dimensional Array that is the destination of the elements copied from Dictionary keys. + * @param arrayIndex The zero-based index in array at which copying begins. + */ + copyTo(array: T[], arrayIndex: number): void + } + interface CollectionConstructor { + + /** + * Initializes a new instance of the Collection class that is empty. + */ + new (): Collection + + + /** + * Initializes a new instance of the Collection class that is wrapper around the specified Enumerable. + * @param value The Iterable to wrap. + */ + new (value: Iterable): Collection + } + + + + /** + * Initializes a new instance of the abstract Collection class. + */ + interface ReadOnlyCollection extends Collection { + + /** + * Gets the element at the specified index. + * @param index The zero-based index of the element to get. + */ + [index: number]: T; + + + /** + * Gets the element at the specified index. + * @param index The zero-based index of the element to get. + */ + get(index: number): T + + + /** + * Determines whether the ReadOnlyCollection contains a specific value. + * @param item The object to locate in the ReadOnlyCollection. + */ + contains(item: T): boolean + + + /** + * Searches for the specified object and returns the zero-based index of the first occurrence within the entire ReadOnlyCollection. + * @param item The object to locate in the ReadOnlyCollection. + */ + indexOf(item: T): number + } + interface ReadOnlyCollectionConstructor { + + /** + * Initializes a new instance of the ReadOnlyCollection class that is a read-only wrapper around the specified list. + * @param list The list to wrap. + */ + new (list: List): ReadOnlyCollection + } + + + + /** + * Represents a strongly typed list of objects that can be accessed by index. + */ + interface List extends Collection { + + /** + * Gets the element at the specified index. + * @param index The zero-based index of the element to get. + */ + [index: number]: T; + + + /** + * Adds an object to the end of the List. + * @param item The object to be added to the end of the List. + */ + add(item: T): void + + + /** + * Adds the elements of the specified collection to the end of the List. + * @param collection The collection whose elements should be added to the end of the List. + */ + addRange(collection: Iterable): void + + + /** + * Returns a read-only wrapper for the current list. + */ + asReadOnly(): ReadOnlyCollection + + + /** + * Searches the entire sorted List for an element using the default comparer and returns the zero-based index of the element. + * Returns The zero-based index of item in the sorted List, if item is found; otherwise, a negative number + * that is the bitwise complement of the index of the next element that is larger than item or, if there is no larger element, + * the bitwise complement of List.count(). + * @param item The object to locate. The value can be null for reference types. + */ + binarySearch(item: T): number + + + /** + * Searches the entire sorted List for an element using the specified comparer and returns the zero-based index of the element. + * returns The zero-based index of item in the sorted List, if item is found; otherwise, a negative number + * that is the bitwise complement of the index of the next element that is larger than item or, if there is no larger element, + * the bitwise complement of List.count(). + * @param item The object to locate. The value can be null for reference types. + * @param comparer The Comparer implementation to use when comparing elements. + */ + binarySearch(item: T, comparer: Comparer): number + + + /** + * Searches a range of elements in the sorted List for an element using the specified comparer and returns the zero-based index of the element. + * returns The zero-based index of item in the sorted List, if item is found; otherwise, a negative number + * that is the bitwise complement of the index of the next element that is larger than item or, if there is no larger element, + * the bitwise complement of List.count(). + * @param item The object to locate. The value can be null for reference types. + * @param index The zero-based starting index of the range to search. + * @param count The length of the range to search. + * @param comparer The Comparer implementation to use when comparing elements. + */ + binarySearch(item: T, index: number, count: number, comparer: Comparer): number + + + /** + * Removes all items from the List. + */ + clear(): void + + + /** + * Determines whether the List contains elements that match the conditions defined by the specified predicate. + * @param match The predicate function that defines the conditions of the elements to search for. + */ + exists(match: (item: T) => boolean): boolean + + + /** + * Searches for an element that matches the conditions defined by the specified predicate, and returns the first occurrence within the entire List. + * @param match The predicate function that defines the conditions of the elements to search for. + */ + find(match: (item: T) => boolean): T + + + /** + * Retrieves all the elements that match the conditions defined by the specified predicate. + * @param match The predicate function that defines the conditions of the elements to search for. + */ + findAll(match: (item: T) => boolean): List + + + /** + * Searches for an element that matches the conditions defined by the specified predicate, + * and returns the zero-based index of the first occurrence within the entire List, if found; otherwise, –1. + * @param match The predicate function that defines the conditions of the elements to search for. + */ + findIndex(match: (item: T) => boolean): number + + + /** + * Searches for an element that matches the conditions defined by the specified predicate, + * and returns the zero-based index of the first occurrence within the range of elements + * in the List that extends from the specified index to the last element, if found; otherwise, –1. + * @param startIndex The zero-based starting index of the search. + * @param match The predicate function that defines the conditions of the elements to search for. + */ + findIndex(startIndex: number, match: (item: T) => boolean): number + + + /** + * Searches for an element that matches the conditions defined by the specified predicate, + * and returns the zero-based index of the first occurrence within the range of elements + * in the List that starts at the specified index and contains the specified number of elements, if found; otherwise, –1. + * @param startIndex The zero-based starting index of the search. + * @param count The number of elements in the section to search. + * @param match The predicate function that defines the conditions of the elements to search for. + */ + findIndex(startIndex: number, count: number, match: (item: T) => boolean): number + + + /** + * Searches for an element that matches the conditions defined by the specified predicate, + * and returns the last occurrence within the entire List. + * @param match The predicate function that defines the conditions of the elements to search for. + */ + findLast(match: (item: T) => boolean): T + + + /** + * Searches for an element that matches the conditions defined by the specified predicate, + * and returns the zero-based index of the last occurrence within the entire List, if found; otherwise, –1. + * @param match The predicate function that defines the conditions of the elements to search for. + */ + findLastIndex(match: (item: T) => boolean): number + + + /** + * Searches for an element that matches the conditions defined by the specified predicate, + * and returns the zero-based index of the last occurrence within the range of elements + * in the List that extends from the first element to the specified index, if found; otherwise, –1. + * @param startIndex The zero-based starting index of the search. + * @param match The predicate function that defines the conditions of the elements to search for. + */ + findLastIndex(startIndex: number, match: (item: T) => boolean): number + + + /** + * Searches for an element that matches the conditions defined by the specified predicate, + * and returns the zero-based index of the last occurrence within the range of elements + * in the List that contains the specified number of elements and ends at the specified index, if found; otherwise, –1. + * @param startIndex The zero-based starting index of the search. + * @param count The number of elements in the section to search. + * @param match The predicate function that defines the conditions of the elements to search for. + */ + findLastIndex(startIndex: number, count: number, match: (item: T) => boolean): number + + + /** + * Performs the specified action on each element of the List. + * @param action The action function to perform on each element of the List. + */ + forEach(action: (item: T) => void): void + + + /** + * Gets the element at the specified index. + * @param index The zero-based index of the element to get. + */ + get(index: number): T + + + /** + * Creates a shallow copy of a range of elements in the source List. + * @param index The zero-based List index at which the range starts. + * @param count The number of elements in the range. + */ + getRange(index: number, count: number): List + + + /** + * Searches for the specified object and returns the zero-based index of the first occurrence within the entire List, if found; otherwise, –1. + * @param item The object to locate in the List. + */ + indexOf(item: T): number + + + /** + * Searches for the specified object and returns the zero-based index of the first occurrence within + * the range of elements in the List that extends from the specified index to the last element, if found; otherwise, –1. + * @param item The object to locate in the List. + * @param index The zero-based starting index of the search. 0 (zero) is valid in an empty list. + */ + indexOf(item: T, index: number): number + + + /** + * Inserts an element into the List at the specified index. + * @param index The zero-based index at which item should be inserted. + * @param item The object to insert. The value can be null for reference types. + */ + insert(index: number, item: T): void + + + /** + * Inserts the elements of a collection into the List at the specified index. + * @param index The zero-based index at which item should be inserted. + * @param collection The collection whose elements should be inserted into the List. + */ + insertRange(index: number, collection: Iterable): void + + + /** + * Gets an Array wrapper around the List. + */ + items(): T[] + + + /** + * Searches for the specified object and returns the zero-based index of the last occurrence within the entire List, if found; otherwise, –1. + * @param item The object to locate in the List. + */ + lastIndexOf(item: T): number + + + /** + * Searches for the specified object and returns the zero-based index of the last occurrence + * within the range of elements in the List that extends from the specified index to the last element if found; otherwise, –1. + * @param item The object to locate in the List. + * @param index The zero-based starting index of the search. 0 (zero) is valid in an empty list. + */ + lastIndexOf(item: T, index: number): number + + + /** + * Removes the first occurrence of a specific object from the List. + * @param item The object to remove from the List. + */ + remove(item: T): boolean + + + /** + * Removes all the elements that match the conditions defined by the specified predicate. + * @param match The predicate function that defines the conditions of the elements to remove. + */ + removeAll(match: (item: T) => boolean): number + + + /** + * Removes the element at the specified index of the List. + * @param index The zero-based index of the element to remove. + */ + removeAt(index: number): void + + + /** + * Removes a range of elements from the List. + * @param index The zero-based index of the element to remove. + * @param count The number of elements to remove. + */ + removeRange(index: number, count: number): void + + + /** + * Reverses the order of the elements in the entire List + */ + reverse(): any + + + /** + * Reverses the order of the elements in the entire List + * @param index The zero-based starting index of the range to reverse. + * @param count The number of elements in the range to reverse. + */ + reverse(index: number, count: number): void + + + /** + * Sets the element at the specified index. + * @param index The zero-based index of the element to set. + * @param item The object to be added at the specified index. + */ + set(index: number, value: T): void + + + /** + * Sorts the elements in the entire List using the default comparer. + */ + sort(): void + + + /** + * Sorts the elements in the entire List using the specified Comparison. + * @param comparison The comparison function to use when comparing elements. + */ + sort(comparison: (x: T, y: T) => number): void + + + /** + * Sorts the elements in the entire List using the specified comparer. + * @param comparer The Comparer implementation to use when comparing elements. + */ + sort(comparer: Comparer): void + + + /** + * Sorts the elements in a range of elements in List using the specified comparer. + * @param index The zero-based starting index of the range to sort. + * @param count The length of the range to sort. + * @param comparer The Comparer implementation to use when comparing elements. + */ + sort(index: number, count: number, comparer: Comparer): void + + + /** + * Copies the elements of the List to a new array. + */ + toArray(): T[] + + + /** + * Determines whether every element in the List matches the conditions defined by the specified predicate. + * @param match The Predicate function that defines the conditions to check against the elements. + */ + trueForAll(match: (item: T) => boolean): boolean + } + interface ListConstructor { + + /** + * Initializes a new instance of the List class that is empty. + */ + new (): List + + + /** + * Initializes a new instance of the List class that is empty and has the specified initial capacity. + * @param capacity The number of elements that the new list can initially store. + */ + new (capacity: number): List + + + /** + * Initializes a new instance of the List class that contains elements copied from the specified arguments + * @param args Arbitrary number of arguments to copy to the new list. + */ + new (...args: T[]): List + + + /** + * Initializes a new instance of the List class that contains elements copied from the specified collection + * and has sufficient capacity to accommodate the number of elements copied. + * @param collection The collection whose elements are copied to the new list. + */ + new (collection: Iterable): List + } + + + + /** + * Represents a collection of key/value pairs that are sorted by key based on the associated Comparer implementation. + */ + interface SortedList extends Collection> { + + /** + * Adds an element with the specified key and value into the SortedList. + * @param key The key of the element to add. + * @param value The value of the element to add. The value can be null for reference types. + */ + add(key: TKey, value: TValue): void + + + /** + * Gets the value associated with the specified key. + * @param key The key whose value to get. + */ + get(key: TKey): TValue + + + /** + * Gets or sets the number of elements that the SortedList can contain. + * @param value The number of elements that the SortedList can contain. + */ + capacity(value?: number): number + + + /** + * Removes all elements from the SortedList. + */ + clear(): void + + + /** + * Gets the Comparer for the sorted list. + */ + comparer(): Comparer + + + /** + * Determines whether the SortedList contains a specific key. + * @param key The key to locate in the SortedList. + */ + containsKey(key: TKey): boolean + + + /** + * Determines whether the SortedList contains a specific value. + * @param value The value to locate in the SortedList. + */ + containsValue(value: TValue): boolean + + + /** + * Gets a collection containing the keys in the SortedList, in sorted order. + */ + keys(): Collection + + + /** + * Gets a collection containing the values in the SortedLis. + */ + values(): Collection + + + /** + * Searches for the specified key and returns the zero-based index within the entire SortedList. + * @param key The key to locate in the SortedList. + */ + indexOfKey(key: TKey): number + + + /** + * Searches for the specified value and returns the zero-based index of the first occurrence within the entire SortedList. + * @param value The value to locate in the SortedList. + */ + indexOfValue(value: TValue): number + + + /** + * Removes the element with the specified key from the SortedList. + * Returns true if the element is successfully removed; otherwise, false. This method also returns false if key was not found in the original SortedList. + * @param key The key of the element to remove. + */ + remove(key: TKey): boolean + + + /** + * Removes the element at the specified index of the SortedList. + * @param index The zero-based index of the element to remove. + */ + removeAt(index: number): void + + + /** + * Sets the value associated with the specified key. + * @param key The key whose value to get or set. + * @param value The value associated with the specified key. + */ + set(key: TKey, value: TValue): void + + + /** + * Sets the capacity to the actual number of elements in the SortedList, if that number is less than 90 percent of current capacity. + */ + trimExcess(): void + + + /** + * Gets the value associated with the specified key. + * @param key The key whose value to get. + * @param callback When this method returns, callback method is called with the value + * associated with the specified key, if the key is found; otherwise, null for the type of the value parameter. + */ + tryGetValue(key: TKey, callback: (value: TValue) => void): boolean + } + interface SortedListConstructor { + + /** + * Initializes a new instance of the SortedList class that is empty, + * has the default initial capacity, and uses the default Comparer. + */ + new (): SortedList + + + /** + * Initializes a new instance of the SortedList class that contains elements copied from the specified Dictionary, + * has sufficient capacity to accommodate the number of elements copied, and uses the default Comparer. + * @param dictionary The Dictionary whose elements are copied to the new SortedList. + */ + new (dictionary: Dictionary): SortedList + + + /** + * Initializes a new instance of the SortedList class that is empty, + * has the default initial capacity, and uses the specified Comparer. + * @param comparer The Comparer implementation to use when comparing keys.-or-null to use the default Comparer for the type of the key. + */ + new (comparer: Comparer): SortedList + + + /** + * Initializes a new instance of the SortedList class that is empty, + * has the specified initial capacity, and uses the default Comparer. + * @param capacity The initial number of elements that the SortedList can contain. + */ + new (capacity: number): SortedList + + + /** + * Initializes a new instance of the SortedList class that contains elements copied from the specified Dictionary, + * has sufficient capacity to accommodate the number of elements copied, and uses the specified Comparer. + * @param dictionary The Dictionary whose elements are copied to the new SortedList. + * @param comparer The Comparer implementation to use when comparing keys.-or-null to use the default Comparer for the type of the key. + */ + new (dictionary: Dictionary, comparer: Comparer): SortedList + + + /** + * Initializes a new instance of the SortedList class that is empty, + * has the specified initial capacity, and uses the specified Comparer. + * @param capacity The initial number of elements that the SortedList can contain. + * @param comparer The Comparer implementation to use when comparing keys.-or-null to use the default Comparer for the type of the key. + */ + new (capacity: number, comparer: Comparer): SortedList + } + + + + /** + * Defines a key/value pair that can be set or retrieved. + */ + interface KeyValuePair { + + /** + * Gets the key in the key/value pair. + */ + key: TKey; + + + /** + * Gets the value in the key/value pair. + */ + value: TValue; + } + interface KeyValuePairConstructor { + + /** + * Initializes a new instance of the KeyValuePair with the specified key and value. + * @param key The object defined in each key/value pair. + * @param value The definition associated with key. + */ + new (key: TKey, value: TValue): KeyValuePair + } + + + + /** + * Represents a collection of keys and values. + */ + interface Dictionary extends Collection> { + + /** + * Adds an element with the provided key and value to the Dictionary. + * @param key The object to use as the key of the element to add. + * @param value The object to use as the value of the element to add. + */ + add(key: TKey, value: TValue): void + + + /** + * Removes all keys and values from the Dictionary. + */ + clear(): void + + + /** + * Determines whether the Dictionary contains the specified key. + * @param key The key to locate in the Dictionary. + */ + containsKey(key: TKey): boolean + + + /** + * Determines whether the Dictionary contains a specific value. + * @param value The value to locate in the Dictionary. + */ + containsValue(value: TValue): boolean + + + /** + * Copies the Dictionary keys to an existing one-dimensional Array, starting at the specified array index. + * @param array The one-dimensional Array that is the destination of the elements copied from Dictionary keys. + * @param arrayIndex The zero-based index in array at which copying begins. + */ + copyTo(array: TKey[], arrayIndex: number): void + copyTo(array: KeyValuePair[], arrayIndex: number): void + + + /** + * Gets a Collection containing the keys of the Dictionary. + */ + keys(): Collection + + + /** + * Gets a Collection containing the values in the Dictionary. + */ + values(): Collection + + + /** + * Gets element with the specified key. + * @param key The key of the element to get. + */ + get(key: TKey): TValue + + + /** + * Sets the element with the specified key. + * @param key The key of the element to set. + * @param value The object to use as the value of the element to set. + */ + set(key: TKey, value: TValue): void + + + /** + * Gets the value associated with the specified key. + * @param key The key whose value to get. + * @param callback When this method returns, callback method is called with the value + * associated with the specified key, if the key is found; otherwise, null for the type of the value parameter. + */ + tryGetValue(key: TKey, callback: (value: TValue) => void): boolean + + + /** + * Removes the element with the specified key from the Dictionary. + * @param key The key of the element to remove. + */ + remove(key: TKey): boolean + } + interface DictionaryConstructor { + + /** + * Initializes a new instance of the Dictionary class that is empty, + */ + new (): Dictionary + + + /** + * Initializes a new instance of the Dictionary class that contains elements copied + * from the specified Dictionary and uses the default equality comparer for the key type. + * @param dictionary The Dictionary whose elements are copied to the new Dictionary. + */ + new (dictionary: Dictionary): Dictionary + + + /** + * Initializes a new instance of the Dictionary class that is empty, and uses the specified EqualityComparer. + * @param comparer The EqualityComparer implementation to use when comparing keys. + */ + new (comparer: EqualityComparer): Dictionary + + + /** + * Initializes a new instance of the Dictionary class that is empty, has the specified initial capacity, and uses the default equality comparer for the key type. + * @param capacity The initial number of elements that the Dictionary can contain. + */ + new (capacity: number): Dictionary + + + /** + * Initializes a new instance of the Dictionary that is empty, has the specified initial capacity, and uses the specified EqualityComparer. + * @param capacity The initial number of elements that the Dictionary can contain. + * @param comparer The EqualityComparer implementation to use when comparing keys. + */ + new (capacity: number, comparer: EqualityComparer): Dictionary + + + /** + * Initializes a new instance of the Dictionary class that contains elements copied + * from the specified Dictionary and uses the specified EqualityComparer. + * @param dictionary The Dictionary whose elements are copied to the new Dictionary. + * @param comparer The EqualityComparer implementation to use when comparing keys. + */ + new (dictionary: Dictionary, comparer: EqualityComparer): Dictionary + } + + + + /** + * Represents a set of values. + */ + interface HashSet extends Collection { + + /** + * Adds an element to the current set. + * @param item The element to add to the set. + */ + add(item: T): boolean + + + /** + * Removes all elements from a HashSet object. + */ + clear(): void + + + /** + * Copies the elements of a HashSet object to an array. + * @param array The one-dimensional array that is the destination of the elements copied from the HashSet object. + */ + copyTo(array: T[]): void + + + /** + * Copies the elements of a HashSet object to an array. starting at the specified array index. + * @param array The one-dimensional array that is the destination of the elements copied from the HashSet object. + * @param arrayIndex The zero-based index in array at which copying begins. + */ + copyTo(array: T[], arrayIndex: number): void + + + /** + * Copies the elements of a HashSet object to an array. + * @param array The one-dimensional array that is the destination of the elements copied from the HashSet object. + * @param arrayIndex The zero-based index in array at which copying begins. + * @param count The number of elements to copy to array. + */ + copyTo(array: T[], arrayIndex: number, count: number): void + + + /** + * Gets the EqualityComparer object that is used to determine equality for the values in the set. + */ + comparer(): EqualityComparer + + + /** + * Removes the specified element from a HashSet object. + * @param item The element to remove. + */ + remove(item: T): boolean + + + /** + * Removes all elements that match the conditions defined by the specified predicate from a HashSet collection. + * @param match The predicate function that defines the conditions of the elements to remove. + */ + removeWhere(match: (item: T) => boolean): number + + + /** + * Removes all elements in the specified collection from the current set. + * @param other The collection of items to remove from the set. + */ + exceptWith(other: Iterable): void + + + /** + * Modifies the current set so that it contains only elements that are also in a specified collection. + * @param other The collection to compare to the current set. + */ + intersectWith(other: Iterable): void + + + /** + * Determines whether the current set is a proper (strict) subset of a specified collection. + * @param other The collection to compare to the current set. + */ + isProperSubsetOf(other: Iterable): boolean + + + /** + * Determines whether the current set is a proper (strict) superset of a specified collection. + * @param other The collection to compare to the current set. + */ + isProperSupersetOf(other: Iterable): boolean + + + /** + * Determines whether a set is a subset of a specified collection. + * @param other The collection to compare to the current set. + */ + isSubsetOf(other: Iterable): boolean + + + /** + * Determines whether the current set is a superset of a specified collection. + * @param other The collection to compare to the current set. + */ + isSupersetOf(other: Iterable): boolean + + + /** + * Determines whether the current set overlaps with the specified collection. + * @param other The collection to compare to the current set. + */ + overlaps(other: Iterable): boolean + + + /** + * Determines whether the current set and the specified collection contain the same elements. + * @param other The collection to compare to the current set. + */ + setEquals(other: Iterable): boolean + + + /** + * Modifies the current set so that it contains only elements that are present + * either in the current set or in the specified collection, but not both. + * @param other The collection to compare to the current set. + */ + symmetricExceptWith(other: Iterable): void + + + /** + * Modifies the current set so that it contains all elements that are present + * in either the current set or the specified collection. + * @param other The collection to compare to the current set. + */ + unionWith(other: Iterable): void + + } + interface HashSetConstructor { + + /** + * Initializes a new instance of the HashSet class that is empty and uses the default equality comparer for the set type. + */ + new (): HashSet + + + /** + * Initializes a new instance of the HashSet class that uses the default equality comparer for the set type, + * and contains elements copied from the specified collection. + * @param collection The collection whose elements are copied to the new set. + */ + new (collection: Iterable): HashSet + + + /** + * Initializes a new instance of the HashSet class that is empty and uses the specified equality comparer for the set type. + * @param comparer The EqualityComparer implementation to use when comparing values in the set. + */ + new (comparer: EqualityComparer): HashSet + + + /** + * Initializes a new instance of the HashSet class that uses the specified equality comparer for the set type, + * contains elements copied from the specified collection, and uses the specified equality comparer for the set type. + * @param collection The collection whose elements are copied to the new set. + * @param comparer The EqualityComparer implementation to use when comparing values in the set. + */ + new (collection: Iterable, comparer: EqualityComparer): HashSet + } + + + + /** + * Represents a node in a LinkedList. + */ + interface LinkedListNode { + + /** + * Gets the value contained in the node. + */ + value(): T + + + /** + * Gets the LinkedList that the LinkedListNode belongs to. + */ + list(): LinkedList + + + /** + * Gets the next node in the LinkedList. + */ + next(): LinkedListNode + + + /** + * Gets the previous node in the LinkedList. + */ + previous(): LinkedListNode + } + interface LinkedListNodeConstructor { + + /** + * Initializes a new instance of the LinkedListNode class, containing the specified value. + * @param value The value to contain in the LinkedListNode + */ + new (value: T): LinkedListNode + } + + + + /** + * Represents a doubly linked list. + */ + interface LinkedList extends Collection { + + /** + * Adds an item to the LinkedList. + * @param item The object to add to the LinkedList. + */ + add(item: T): void + + + /** + * Removes all nodes from the LinkedList. + */ + clear(): void + + + /** + * Determines whether a value is in the LinkedList. + * @param value The value to locate in the LinkedList. The value can be null for reference types. + */ + contains(item: T): boolean + + + /** + * Gets the first node of the LinkedList. + */ + getFirst(): LinkedListNode + + + /** + * Gets the last node of the LinkedList. + */ + getLast(): LinkedListNode + + + /** + * Adds the specified new node after the specified existing node in the LinkedList and returns the new LinkedListNode. + * @param node The LinkedListNode after which to insert newNode. + * @param newNode The new LinkedListNode to add to the LinkedList. + */ + addAfter(node: LinkedListNode, newNode: LinkedListNode): LinkedListNode + + + /** + * Adds the specified new node after the specified existing node in the LinkedList. + * returns The new LinkedListNode containing value. + * @param node The LinkedListNode after which to insert newNode. + * @param value The value to add to the LinkedList. + */ + addAfter(node: LinkedListNode, value: T): LinkedListNode + + + /** + * Adds the specified new node before the specified existing node in the LinkedList. + * returns The new LinkedListNode. + * @param node The LinkedListNode before which to insert newNode. + * @param newNode The new LinkedListNode to add to the LinkedList. + */ + addBefore(node: LinkedListNode, newNode: LinkedListNode): LinkedListNode + + + /** + * Adds the specified new node before the specified existing node in the LinkedList. + * returns The new LinkedListNode containing value. + * @param node The LinkedListNode before which to insert newNode. + * @param value The value to add to the LinkedList. + */ + addBefore(node: LinkedListNode, value: T): LinkedListNode + + + /** + * Adds the specified new node at the start of the LinkedList. + * returns The new LinkedListNode. + * @param node The new LinkedListNode to add at the start of the LinkedList. + */ + addFirst(node: LinkedListNode): LinkedListNode + + + /** + * Adds the specified new node at the start of the LinkedList. + * returns The new LinkedListNode containing value. + * @param value The value to add at the start of the LinkedList. + */ + addFirst(value: T): LinkedListNode + + + /** + * Adds the specified new node at the end of the LinkedList. + * returns The new LinkedListNode. + * @param node The new LinkedListNode to add at the end of the LinkedList. + */ + addLast(node: LinkedListNode): LinkedListNode + + + /** + * Adds the specified new node at the end of the LinkedList. + * returns The new LinkedListNode containing value. + * @param value The value to add at the end of the LinkedList. + */ + addLast(value: T): LinkedListNode + + + /** + * Finds the first node that contains the specified value. + * @param value The value to locate in the LinkedList. + */ + find(value: T): LinkedListNode + + + /** + * Finds the last node that contains the specified value. + * @param value The value to locate in the LinkedList. + */ + findLast(value: T): LinkedListNode + + /** + * Removes the node at the start of the LinkedList. + * returns true if the node is successfully removed; otherwise, false. + * This method also returns false if value was not found in the original LinkedList. + * @param node + */ + remove(node: LinkedListNode): boolean + + + /** + * Removes the first occurrence of the specified value from the LinkedList. + * returns true if the element containing value is successfully removed; otherwise, false. + * This method also returns false if value was not found in the original LinkedList. + * @param value The value to remove from the LinkedList. + */ + remove(value: T): boolean + + + /** + * Removes the node at the start of the LinkedList. + */ + removeFirst(): void + + + /** + * Removes the node at the end of the LinkedList. + */ + removeLast(): void + } + interface LinkedListConstructor { + + /** + * Initializes a new instance of the LinkedList class that is empty. + */ + new (): LinkedList + + + /** + * Initializes a new instance of the LinkedList class that contains elements copied from the specified Enumerable. + * @param collection The collection to copy elements from. + */ + new (collection: Iterable): LinkedList + } + + + + /** + * Represents a first-in, first-out collection of objects. + */ + interface Queue extends Collection { + + /** + * Removes all objects from the Queue. + */ + clear(): void + + + /** + * Determines whether an element is in the Queue. + * @param item The object to locate in the Queue. + */ + contains(item: T): boolean + + + /** + * Removes and returns the object at the beginning of the Queue. + */ + dequeue(): T + + /** + * Adds an object to the end of the Queue. + * @param item The object to add to the Queue. + */ + enqueue(item: T): void + + + /** + * Returns the object at the beginning of the Queue without removing it. + */ + peek(): T + + + /** + * Copies the Queue to a new array. + */ + toArray(): T[] + } + interface QueueConstructor { + + /** + * Initializes a new instance of the Queue class that is empty. + */ + new (): Queue + + + /** + * Initializes a new instance of the Queue class that contains elements copied from the specified collection. + * @param collection The collection to copy elements from. + */ + new (collection: Iterable): Queue + } + + + + /** + * Represents a variable size last-in-first-out (LIFO) collection of instances of the same arbitrary type. + */ + interface Stack extends Collection { + + /** + * Removes all objects from the Stack. + */ + clear(): void + + + /** + * Determines whether an element is in the Stack. + * @param item The object to locate in the Stack. + */ + contains(item: T): boolean + + + /** + * Returns the object at the top of the Stack without removing it. + */ + peek(): T + + + /** + * Removes and returns the object at the top of the Stack. + */ + pop(): T + + + /** + * Inserts an object at the top of the Stack. + * @param item The object to push onto the Stack. + */ + push(item: T): void + + + /** + * Copies the Stack to a new array. + */ + toArray(): T[] + } + interface StackConstructor { + + /** + * Initializes a new instance of the Stack class that is empty. + */ + new (): Stack + + + /** + * Initializes a new instance of the Stack class that contains elements copied from the specified collection. + * @param collection The collection to copy elements from. + */ + new (collection: Iterable): Stack + } + + + + /** + * Defines a data structures that map keys to Enumerable sequences of values. + */ + interface Lookup extends Collection> { + + /** + * Determines whether a specified key exists in the Lookup. + * @param key The key to search for in the Lookup. + */ + contains(key: TKey): boolean + contains(item: Grouping): boolean + + + + /** + * Gets the value associated with the specified key. + * @param key The key of the element to add. + */ + get(key: TKey): Enumerable + } + + + + /** + * Represents a collection of objects that have a common key. + */ + interface Grouping extends Collection { + + /** + * Gets the key of the Grouping. + */ + key: TKey + } + + + + /** + * Exposes the enumerator, which supports a simple iteration over a collection of a specified type. + */ + interface OrderedEnumerable extends Enumerable { + + /** + * Performs a subsequent ordering on the elements of an OrderedEnumerable according to a key. + * @param keySelector The selector used to extract the key for each element. + * @param comparer The Comparer used to compare keys for placement in the returned sequence. + * @param descending true to sort the elements in descending order; false to sort the elements in ascending order. + */ + createOrderedEnumerable(keySelector: (item: TElement) => TKey, comparer: Comparer, descending: boolean): OrderedEnumerable + + + /** + * Performs a subsequent ordering of the elements in a sequence in descending order, according to a key. + * Returns an OrderedEnumerable whose elements are sorted in descending order according to a key. + * @param keySelector A function to extract a key from each element. + */ + thenBy(keySelector: (item: TElement) => TKey): OrderedEnumerable + + + /** + * Performs a subsequent ordering of the elements in a sequence in ascending order by using a specified comparer. + * Returns an OrderedEnumerable whose elements are sorted according to a key. + * @param keySelector A function to extract a key from each element. + * @param comparer A Comparer to compare keys. + */ + thenBy(keySelector: (item: TElement) => TKey, comparer: Comparer): OrderedEnumerable + + + /** + * Performs a subsequent ordering of the elements in a sequence in descending order, according to a key. + * Returns an OrderedEnumerable whose elements are sorted in descending order according to a key. + * @param keySelector A function to extract a key from each element. + */ + thenByDescending(keySelector: (item: TElement) => TKey): OrderedEnumerable + + + /** + * Performs a subsequent ordering of the elements in a sequence in descending order, according to a key. + * Returns an OrderedEnumerable whose elements are sorted in descending order according to a key. + * @param keySelector A function to extract a key from each element. + * @param comparer A Comparer to compare keys. + */ + thenByDescending(keySelector: (item: TElement) => TKey, comparer: Comparer): OrderedEnumerable + } + + + + /** + * Defines Enumerable extention methods applied on Enumerable + */ + interface Enumerable { + + + /** + * Applies an accumulator function over a sequence. + * Returns the final accumulator value. + * @param func An accumulator function to be invoked on each element. + */ + aggregate(func: (accumulate: T, item: T) => T): T + + + /** + * Applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value. + * Returns the final accumulator value. + * @param seed The initial accumulator value. + * @param func An accumulator function to be invoked on each element. + */ + aggregate(seed: TAccumulate, func: (accumulate: TAccumulate, item: T) => TAccumulate): TAccumulate + + + /** + * Applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value, + * and the specified function is used to select the result value. + * Returns the final accumulator value. + * @param seed The initial accumulator value. + * @param func An accumulator function to be invoked on each element. + * @param resultSelector A function to transform the final accumulator value into the result value. + */ + aggregate(seed: TAccumulate, func: (accumulate: TAccumulate, item: T) => TAccumulate, resultSelector: (accumulate: TAccumulate) => TResult): TResult; + + + /** + * Determines whether all elements of a sequence satisfy a condition. + * Returns true if every element of the source sequence passes the test in the specified predicate, or if the sequence is empty; otherwise, false. + * @param predicate A function to test each element for a condition. + */ + all(predicate: (item: T) => boolean): boolean + + + /** + * Determines whether a sequence contains any elements. + * Returns true if the source sequence contains any elements; otherwise, false. + */ + any(): boolean + + + /** + * Determines whether any element of a sequence satisfies a condition. + * Returns true if any elements in the source sequence pass the test in the specified predicate; otherwise, false. + * @param predicate A function to test each element for a condition. + */ + any(predicate: (item: T) => boolean): boolean + + + /** + * Returns the input typed as Enumerable. + */ + asEnumerable(): Enumerable + + + /** + * Computes the average of a sequence of numeric values. + */ + average(): number + + + /** + * Computes the average of a sequence of numeric values that are obtained by invoking a transform function on each element of the input sequence. + * @param selector A transform function to apply to each element. + */ + average(selector: (item: number) => number): number + + + /** + * Concatenates two sequences. + * @param second The sequence to concatenate to the first sequence. + */ + concat(second: Iterable): Enumerable + + + /** + * Determines whether a sequence contains a specified element by using the default equality comparer. + * @param value The value to locate in the sequence. + */ + contains(value: T): boolean + + + /** + * Returns the last element of a sequence that satisfies a specified condition. + * @param value The value to locate in the sequence. + * @param comparer An equality comparer to compare values. + */ + contains(value: T, comparer: EqualityComparer): boolean + + + /** + * Returns the number of elements in a sequence. + */ + count(): number + + + /** + * Returns a number that represents how many elements in the specified sequence satisfy a condition. + * @param predicate A function to test each element for a condition. + */ + count(predicate: (item: T) => boolean): number + + + /** + * Returns the elements of the specified sequence or null if the sequence is empty. + */ + defaultIfEmpty(): Enumerable + + + /** + * Returns the elements of the specified sequence or the specified value in a singleton collection if the sequence is empty. + * @param defaultValue The value to return if the sequence is empty. + */ + defaultIfEmpty(defaultValue: T): Enumerable + + + /** + * Returns distinct elements from a sequence by using the default equality comparer to compare values. + */ + distinct(): Enumerable + + + /** + * Produces the set difference of two sequences by using the EqualityComparer to compare values. + * @param comparer An EqualityComparer to compare values. + */ + distinct(comparer: EqualityComparer): Enumerable + + + /** + * Produces the set difference of two sequences by using the default equality comparer to compare values. + * @param second An Iterable whose elements that also occur in the first sequence will cause those elements to be removed from the returned sequence. + */ + except(second: Iterable): Enumerable + + + /** + * Produces the set difference of two sequences by using the specified EqualityComparer to compare values. + * @param second An Iterable whose elements that also occur in the first sequence will cause those elements to be removed from the returned sequence. + * @param comparer An EqualityComparer to compare values. + */ + except(second: Iterable, comparer: EqualityComparer): Enumerable + + + /** + * Returns the element at a specified index in a sequence. Throws an error if the index is less than 0 or greater than or equal to the number of elements in source. + * @param index The zero-based index of the element to retrieve. + */ + elementAt(index: number): T + + + /** + * Returns the first element of a sequence. this method throws an exception if there is no element in the sequence. + */ + first(): T + + + /** + * Returns the first element in a sequence that satisfies a specified condition. this method throws an exception if there is no element in the sequence. + * @param predicate A function to test each source element for a condition; the second parameter of the function represents the index of the source element. + */ + first(predicate: (item: T) => boolean): T + + + /** + * Returns the first element of a sequence, or null if the sequence contains no elements. + */ + firstOrDefault(): T + + + /** + * Returns the first element of the sequence that satisfies a condition or null if no such element is found. + * @param predicate A function to test each source element for a condition; the second parameter of the function represents the index of the source element. + */ + firstOrDefault(predicate: (item: T) => boolean): T + + + /** + * Returns the first element of the sequence that satisfies a condition or a default value if no such element is found. + * @param predicate A function to test each source element for a condition; the second parameter of the function represents the index of the source element. + * @param defaultValue The value to return if no element exists with specified condition. + */ + firstOrDefault(predicate: (item: T) => boolean, defaultValue: T): T + + + /** + * Performs the specified action on each element of an Enumerable. + * @param action The action function to perform on each element of an Enumerable. + */ + forEach(action: (item: T) => void): void + + + /** + * Performs the specified action on each element of an Enumerable. + * @param action The action function to perform on each element of an Enumerable; the second parameter of the function represents the index of the source element. + */ + forEach(action: (item: T, index: number) => void): void + + + /** + * Groups the elements of a sequence according to a specified key selector function. + * @param keySelector A function to extract the key for each element. + */ + groupBy(keySelector: (item: T) => TKey): Enumerable>; + + + /** + * Groups the elements of a sequence according to a specified key selector function. + * @param keySelector A function to extract the key for each element. + * @param comparer An equality comparer to compare values. + */ + groupBy(keySelector: (item: T) => TKey, comparer: EqualityComparer): Enumerable>; + + + /** + * Groups the elements of a sequence according to a specified key selector function and projects the elements for each group by using a specified function. + * @param keySelector A function to extract the key for each element. + * @param elementSelector A function to map each source element to an element in the Grouping. + */ + groupBy(keySelector: (item: T) => TKey, elementSelector: (item: T) => TElement): Enumerable>; + + + /** + * Groups the elements of a sequence according to a key selector function. + * The keys are compared by using a comparer and each group's elements are projected by using a specified function. + * @param keySelector A function to extract the key for each element. + * @param elementSelector A function to map each source element to an element in the Grouping. + * @param comparer An equality comparer to compare values. + */ + groupBy(keySelector: (item: T) => TKey, elementSelector: (item: T) => TElement, comparer: EqualityComparer): Enumerable>; + + + /** + * Groups the elements of a sequence according to a specified key selector function and projects the elements for each group by using a specified function. + * @param keySelector A function to extract the key for each element. + * @param elementSelector A function to map each source element to an element in the Grouping. + * @param resultSelector A function to extract the key for each element. + */ + groupBy(keySelector: (item: T) => TKey, elementSelector: (item: T) => TElement, resultSelector: (key: TKey, elements: Iterable) => TResult): Enumerable; + + + /** + * Groups the elements of a sequence according to a key selector function. + * The keys are compared by using a comparer and each group's elements are projected by using a specified function. + * @param keySelector A function to extract the key for each element. + * @param elementSelector A function to map each source element to an element in the Grouping. + * @param resultSelector A function to extract the key for each element. + * @param comparer An equality comparer to compare values. + */ + groupBy(keySelector: (item: T) => TKey, elementSelector: (item: T) => TElement, resultSelector: (key: TKey, elements: Iterable) => TResult, comparer: EqualityComparer): Enumerable; + + + /** + * Correlates the elements of two sequences based on equality of keys and groups the results. The default equality comparer is used to compare keys. + * @param inner The sequence to join to the current sequence. + * @param outerKeySelector A function to extract the join key from each element of the first sequence. + * @param innerKeySelector A function to extract the join key from each element of the second sequence. + * @param resultSelector A function to create a result element from an element from the first sequence and a collection of matching elements from the second sequence. + */ + groupJoin(inner: Iterable, outerKeySelector: (item: T) => TKey, innerKeySelector: (item: TInner) => TKey, resultSelector: (outer: T, inner: Enumerable) => TResult): Enumerable; + + + /** + * Correlates the elements of two sequences based on key equality and groups the results. A specified EqualityComparer is used to compare keys. + * @param inner The sequence to join to the current sequence. + * @param outerKeySelector A function to extract the join key from each element of the first sequence. + * @param innerKeySelector A function to extract the join key from each element of the second sequence. + * @param resultSelector A function to create a result element from an element from the first sequence and a collection of matching elements from the second sequence. + * @param comparer An equality comparer to compare values. + */ + groupJoin(inner: Iterable, outerKeySelector: (item: T) => TKey, innerKeySelector: (item: TInner) => TKey, resultSelector: (outer: T, inner: Enumerable) => TResult, comparer: EqualityComparer): Enumerable; + + + /** + * Produces the set intersection of two sequences by using the default equality comparer to compare values. + * @param second An Iterable whose distinct elements that also appear in the first sequence will be returned. + */ + intersect(second: Iterable): Enumerable; + + + /** + * Produces the set intersection of two sequences by using the default equality comparer to compare values. + * @param second An Iterable whose distinct elements that also appear in the first sequence will be returned. + * @param comparer An EqualityComparer to compare values. + */ + intersect(second: Iterable, comparer: EqualityComparer): Enumerable; + + + /** + * Correlates the elements of two sequences based on matching keys. The default equality comparer is used to compare keys. + * @param inner The sequence to join to the current sequence. + * @param outerKeySelector A function to extract the join key from each element of the first sequence. + * @param innerKeySelector A function to extract the join key from each element of the second sequence. + * @param resultSelector A function to create a result element from an element from the first sequence and a collection of matching elements from the second sequence. + */ + join(inner: Iterable, outerKeySelector: (item: T) => TKey, innerKeySelector: (item: TInner) => TKey, resultSelector: (outer: T, inner: TInner) => TResult): Enumerable; + + + /** + * Correlates the elements of two sequences based on matching keys. A specified EqualityComparer is used to compare keys. + * @param inner The sequence to join to the current sequence. + * @param outerKeySelector A function to extract the join key from each element of the first sequence. + * @param innerKeySelector A function to extract the join key from each element of the second sequence. + * @param resultSelector A function to create a result element from an element from the first sequence and a collection of matching elements from the second sequence. + * @param comparer An equality comparer to compare values. + */ + join(inner: Iterable, outerKeySelector: (item: T) => TKey, innerKeySelector: (item: TInner) => TKey, resultSelector: (outer: T, inner: TInner) => TResult, comparer: EqualityComparer): Enumerable; + + + /** + * Returns the last element of a sequence. + */ + last(): T + + + /** + * Returns the last element of a sequence that satisfies a specified condition. + * @param predicate A function to test each source element for a condition. + */ + last(predicate: (item: T) => boolean): T + + + /** + * Returns the first element of a sequence, or null if the sequence contains no elements. + */ + lastOrDefault(): T + + + /** + * Returns the last element of a sequence, or null if the sequence contains no elements. + * @param predicate A function to test each source element for a condition. + */ + lastOrDefault(predicate: (item: T) => boolean): T + + + /** + * Returns the last element of a sequence that satisfies a condition or null if no such element is found. + * @param predicate A function to test each source element for a condition. + * @param defaultValue The value to return if no element exists with specified condition. + */ + lastOrDefault(predicate: (item: T) => boolean, defaultValue: T): T + + + /** + * Returns the maximum value in a sequence of values. + */ + max(): T + + + /** + * Invokes a transform function on each element of a sequence and returns the maximum value. + * @param selector A transform function to apply to each element. + */ + max(selector: (item: T) => TResult): TResult + + + /** + * Returns the minimum value in a sequence of values. + */ + min(): T + + + /** + * Invokes a transform function on each element of a sequence and returns the minimum value. + * @param selector A transform function to apply to each element. + */ + min(selector: (item: T) => TResult): TResult + + + /** + * Filters the elements of an Enumerable based on a specified type. + * @param type The type to filter the elements of the sequence on. + */ + ofType(type: { new (...args: any[]): TResult }): Enumerable + + + /** + * Sorts the elements of a sequence in ascending order by using a specified comparer. + * @param keySelector A function to extract a key from each element. + */ + orderBy(keySelector: (item: T) => TKey): OrderedEnumerable + + + /** + * Sorts the elements of a sequence in ascending order by using a specified comparer. + * Returns an OrderedEnumerable whose elements are sorted according to a key. + * @param keySelector A function to extract a key from each element. + * @param comparer A Comparer to compare keys. + */ + orderBy(keySelector: (item: T) => TKey, comparer: EqualityComparer): OrderedEnumerable + + + /** + * Sorts the elements of a sequence in descending order by using a specified comparer. + * Returns an OrderedEnumerable whose elements are sorted according to a key. + * Returns an OrderedEnumerable whose elements are sorted in descending order according to a key. + * @param keySelector A function to extract a key from each element. + */ + orderByDescending(keySelector: (item: T) => TKey): OrderedEnumerable + + + /** + * Sorts the elements of a sequence in descending order by using a specified comparer. + * Returns an OrderedEnumerable whose elements are sorted in descending order according to a key. + * @param keySelector A function to extract a key from each element. + * @param comparer A Comparer to compare keys. + */ + orderByDescending(keySelector: (item: T) => TKey, comparer: EqualityComparer): OrderedEnumerable + + + /** + * Inverts the order of the elements in a sequence. + */ + reverse(): Enumerable + + + /** + * Determines whether two sequences are equal by comparing the elements by using the default equality comparer for their type. + * @param second An Iterable to compare to the first sequence. + */ + sequenceEqual(second: Iterable): boolean + + + /** + * Determines whether two sequences are equal by comparing their elements by using a specified EqualityComparer. + * @param second An Iterable to compare to the first sequence. + * @param comparer The EqualityComparer to compare values. + */ + sequenceEqual(second: Iterable, comparer: EqualityComparer): boolean + + + /** + * Projects each element of a sequence into a new form. + * @param selector A transform function to apply to each source element. + */ + select(selector: (item: T) => TResult): Enumerable + + + /** + * Projects each element of a sequence into a new form by incorporating the element's index. + * @param selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element. + */ + select(selector: (item: T, index: number) => TResult): Enumerable + + + /** + * Projects each element of a sequence to an Enumerable and flattens the resulting sequences into one sequence. + * @param collectionSelector A transform function to apply to each source element. + */ + selectMany(selector: (item: T) => Iterable): Enumerable; + + + /** + * Projects each element of a sequence to an Enumerable and flattens the resulting sequences into one sequence. The index of each source element is used in the projected form of that element. + * @param collectionSelector A transform function to apply to each source element; the second parameter of the function represents the index of the source element. + */ + selectMany(selector: (item: T, index: number) => Iterable): Enumerable; + + + /** + * Projects each element of a sequence to an Enumerable and flattens the resulting sequences into one sequence. + * @param collectionSelector A transform function to apply to each source element; the second parameter of the function represents the index of the source element. + * @param resultSelector A transform function to apply to each element of the intermediate sequence. + */ + selectMany(collectionSelector: (item: T) => Iterable, resultSelector: (item: T, collection: TCollection) => TResult): Enumerable; + + + /** + * Projects each element of a sequence to an Enumerable and flattens the resulting sequences into one sequence. The index of each source element is used in the projected form of that element. + * @param collectionSelector A transform function to apply to each source element; the second parameter of the function represents the index of the source element. + * @param resultSelector A transform function to apply to each element of the intermediate sequence. + */ + selectMany(collectionSelector: (item: T, index: number) => Iterable, resultSelector: (item: T, collection: TCollection) => TResult): Enumerable; + + + /** + * Returns the only element of a sequence, and throws an exception if there is not exactly one element in the sequence. + */ + single(): T + + + /** + * Returns the only element of a sequence that satisfies a specified condition, and throws an exception if more than one such element exists. + * @param predicate A function to test each source element for a condition. + */ + single(predicate: (item: T) => boolean): T + + + /** + * Returns the only element of a sequence, or a null if the sequence is empty; this method throws an exception if there is more than one element in the sequence. + */ + singleOrDefault(): T + + + /** + * Returns the only element of a sequence that satisfies a specified condition or a null if no such element exists; this method throws an exception if more than one element satisfies the condition. + * @param predicate A function to test each source element for a condition. + */ + singleOrDefault(predicate: (item: T) => boolean): T + + + /** + * Returns the only element of a sequence that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition. + * @param predicate A function to test each source element for a condition. + * @param defaultValue The value to return if no element exists with specified condition. + */ + singleOrDefault(predicate: (item: T) => boolean, defaultValue: T): T + + + /** + * Bypasses a specified number of elements in a sequence and then returns the remaining elements. + * @param count The number of elements to skip before returning the remaining elements. + */ + skip(count: number): Enumerable + + + /** + * Bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements. + * @param predicate A function to test each source element for a condition. + */ + skipWhile(predicate: (item: T) => boolean): Enumerable + + + /** + * Bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements. The element's index is used in the logic of the predicate function. + * @param predicate A function to test each source element for a condition; the second parameter of the function represents the index of the source element. + */ + skipWhile(predicate: (item: T, index: number) => boolean): Enumerable + + + /** + * Computes the sum of a sequence of values. + */ + sum(): number + + + /** + * Computes the sum of the sequence of values that are obtained by invoking a transform function on each element of the input sequence. + * @param selector A transform function to apply to each element. + */ + sum(selector: (item: T) => number): number + + + /** + * Returns a specified number of contiguous elements from the start of a sequence. + * @param count The number of elements to return. + */ + take(count: number): Enumerable + + + /** + * Returns elements from a sequence as long as a specified condition is true. + * @param predicate A function to test each source element for a condition. + */ + takeWhile(predicate: (item: T) => boolean): Enumerable + + + /** + * Returns elements from a sequence as long as a specified condition is true. The element's index is used in the logic of the predicate function. + * @param predicate A function to test each source element for a condition; the second parameter of the function represents the index of the source element. + */ + takeWhile(predicate: (item: T, index: number) => boolean): Enumerable + + + /** + * Creates an array from an Enumerable. + */ + toArray(): T[] + + + /** + * Creates a Dictionary from an Enumerable according to a specified key selector function. + * @param keySelector A function to extract a key from each element. + */ + toDictionary(keySelector: (item: T) => TKey): Dictionary; + + + /** + * Creates a Dictionary from an Enumerable according to specified key selector and comparer. + * @param keySelector A function to extract a key from each element. + * @param comparer An equality comparer to compare values. + */ + toDictionary(keySelector: (item: T) => TKey, comparer: EqualityComparer): Dictionary; + + + /** + * Creates a Dictionary from an Enumerable according to specified key selector and element selector functions. + * @param keySelector A function to extract a key from each element. + * @param elementSelector A transform function to produce a result element value from each element. + */ + toDictionary(keySelector: (item: T) => TKey, elementSelector: (item: T) => TElement): Dictionary; + + + /** + * Creates a Dictionary from an Enumerable according to a specified key selector function, a comparer, and an element selector function. + * @param keySelector A function to extract a key from each element. + * @param elementSelector A transform function to produce a result element value from each element. + * @param comparer An equality comparer to compare values. + */ + toDictionary(keySelector: (item: T) => TKey, elementSelector: (item: T) => TElement, comparer: EqualityComparer): Dictionary; + + + /** + * Creates a List from an Enumerable. + */ + toList(): List + + + /** + * Creates a Lookup from an Enumerable according to a specified key selector function. + * @param keySelector A function to extract a key from each element. + */ + toLookup(keySelector: (item: T) => TKey): Lookup; + + + /** + * Creates a Lookup from an Enumerable according to a specified key selector function and comparer. + * @param keySelector A function to extract a key from each element. + * @param comparer An equality comparer to compare values. + */ + toLookup(keySelector: (item: T) => TKey, comparer: EqualityComparer): Lookup; + + + /** + * Creates a Lookup from an Enumerable according to specified key selector and element selector functions. + * @param keySelector A function to extract a key from each element. + * @param elementSelector A transform function to produce a result element value from each element. + */ + toLookup(keySelector: (item: T) => TKey, elementSelector: (item: T) => TElement): Lookup; + + + /** + * Creates a Lookup from an Enumerable according to a specified key selector function, a comparer and an element selector function. + * @param keySelector A function to extract a key from each element. + * @param elementSelector A transform function to produce a result element value from each element. + * @param comparer An equality comparer to compare values. + */ + toLookup(keySelector: (item: T) => TKey, elementSelector: (item: T) => TElement, comparer: EqualityComparer): Lookup; + + + /** + * Produces the set union of two sequences by using the default equality comparer. + * @param second An Iterable whose distinct elements form the second set for the union. + */ + union(second: Iterable): Enumerable + + + /** + * Produces the set union of two sequences by using a specified EqualityComparer. + * @param second An Iterable whose distinct elements form the second set for the union. + * @param comparer The EqualityComparer to compare values. + */ + union(second: Iterable, comparer: EqualityComparer): Enumerable + + + /** + * Filters a sequence of values based on a predicate. + * @param predicate A function to test each source element for a condition. + */ + where(predicate: (item: T) => boolean): Enumerable; + + + /** + * Filters a sequence of values based on a predicate. Each element's index is used in the logic of the predicate function. + * @param predicate A function to test each source element for a condition; the second parameter of the function represents the index of the source element. + */ + where(predicate: (item: T, index: number) => boolean): Enumerable; + + + /** + * Merges two sequences by using the specified predicate function. + * @param second The second sequence to merge. + * @param resultSelector A function that specifies how to merge the elements from the two sequences. + */ + zip(second: Iterable, resultSelector: (first: T, second: TSecond) => TResult): Enumerable; + } + + + + /** + * Represents Array-like objects which has the "length" property and indexed properties access, eg. jQuery + */ + interface ArrayLike { + length: number; + [n: number]: T; + } + + + + /** + * Provides 'hash' and 'equals' functions for a particular type, suitable for use in hashing algorithms and data structures such as a hash table. + */ + interface RuntimeComparer { + + /** + * Serves as a hash function for a particular type. + */ + __hash__(): number; + + /** + * Determines whether the specified Object is equal to the current Object. + */ + __equals__(obj: any): boolean; + } + + + + /** + * Provides a set of static methods that provide support for internal operations. + */ + interface MultiplexRuntime { + + /** + * Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures such as a hash table. + * @param obj An object to retrieve the hash code for. + */ + hash(obj: any): number; + + + /** + * Determines whether the specified object instances are considered equal. + * @param objA The first object to compare. + * @param objB The second object to compare. + */ + equals(objA: any, objB: any): boolean; + + + /** + * Performs a comparison of two objects of the same type and returns a value indicating whether one object is less than, equal to, or greater than the other. + * @param objA The first object to compare. + * @param objB The second object to compare. + */ + compare(objA: T, objB: T): number; + + + /** + * Creates A function expression from the specified string lambda expression + * @param exp String lambda expression. + */ + lambda(exp: string): (obj: T) => TResult; + + + /** + * Creates A function expression from the specified string lambda expression + * @param exp String lambda expression. + */ + lambda(exp: string): (obj1: T1, obj2: T2) => TResult; + + + /** + * Creates A function expression from the specified string lambda expression + * @param exp String lambda expression. + */ + lambda(exp: string): (obj1: T1, obj2: T2, obj3: T3) => TResult; + + + /** + * Creates A function expression from the specified string lambda expression + * @param exp String lambda expression. + */ + lambda(exp: string): (...args: any[]) => TResult; + + + /** + * Defines new or modifies existing properties directly on the specified object, returning the object. + * @param obj The object on which to define or modify properties. + * @param prop The name of the property to be defined or modified. + * @param attributes The descriptor for the property being defined or modified. + */ + define(obj: T, prop: String, attributes: PropertyDescriptor): T; + + + /** + * Extends the given object by implementing supplied members. + * @param obj The object on which to define or modify properties. + * @param properties Represetnts the mixin source object + * @param attributes The descriptor for the property being defined or modified. + */ + mixin(obj: T, properties: Object, attributes?: PropertyDescriptor): T; + } + + + + /** + * Defines MultiplexStatic module members + */ + interface MultiplexStatic { + + + + /* Factory Methods + --------------------------------------------------------------------------*/ + + /** + * Exposes the enumerator, which supports an iteration over the specified Enumerable object. + * @param obj An Iterable object. eg. Enumerable, Array, String, Set, Map, Iterable & Generators + */ + (obj: Iterable): Enumerable + + + /** + * Defines an enumerator, which supports an iteration over the specified Generator function. + * @param factory An Enumerator factory function. + */ + (factory: () => Enumerator): Enumerable + + + /** + * Defines an enumerator, which supports an iteration over the items of the specified Array-like object. + * An Array-like object is an object which has the "length" property and indexed properties access, eg. jQuery + * @param obj An Array-like object. + */ + (obj: ArrayLike): Enumerable + + + /** + * Defines an enumerator, which supports an iteration over the arguments local variable available within all functions. + * @param obj arguments local variable available within all functions. + */ + (obj: IArguments): Enumerable + + + /** + * Defines an enumerator, which supports an iteration over the properties of the specified object. + * @param obj A regular Object. + */ + (obj: Object): Enumerable> + + + + + + + /* Static Methods + --------------------------------------------------------------------------*/ + + /** + * Gets and combines hash code for the given parameters, calls the overridden "hash" method when available. + * @param objs Optional number of objects to combine their hash codes. + */ + hash(...obj: any[]): number; + + + /** + * Determines whether the specified object instances are considered equal. calls the overridden "equals" method when available. + * @param objA The first object to compare. + * @param objB The second object to compare. + */ + equals(objA: any, objB: any): boolean; + + + /** + * Determines whether the specified object instances are considered equal. calls the overridden "equals" method when available. + * @param objA The first object to compare. + * @param objB The second object to compare. + * @param comparer An equality comparer to compare values. + */ + equals(objA: any, objB: any, comparer: EqualityComparer): boolean; + + + /** + * Performs a comparison of two objects of the same type and returns a value indicating whether one object is less than, equal to, or greater than the other. + * @param objA The first object to compare. + * @param objB The second object to compare. + */ + compare(objA: T, objB: T): number; + + + /** + * Extends Enumerable extension methods to the given type + * @param type The type to extend. + */ + enumerableExtend(type: Function): void; + + + /** + * Returns an empty Enumerable. + */ + empty(): Enumerable; + + + /** + * Detects if an object is Enumerable. + * @param obj An object to check its Enumerability. + */ + is(obj: any): boolean; + + + /** + * Generates a sequence of integral numbers within a specified range. + * @param start The value of the first integer in the sequence. + * @param count The number of sequential integers to generate. + */ + range(start: number, count: number): Enumerable; + + + /** + * Generates a sequence that contains one repeated value. + * @param element The value to be repeated. + * @param count The number of times to repeat the value in the generated sequence. + */ + repeat(element: T, count: number): Enumerable; + + + + + + + /* Mutiplex Types + --------------------------------------------------------------------------*/ + + /** + * Provides a set of static methods that provide support for internal operations. + */ + runtime: MultiplexRuntime + + /** + * Supports a simple iteration over a collection. + */ + Enumerator: EnumeratorConstructor + + /** + * Exposes the enumerator, which supports a simple iteration over a collection of a specified type. + */ + Enumerable: EnumerableConstructor + + /** + * Provides a base class for implementations of Comparer generic interface. + */ + Comparer: ComparerConstructor + + /** + * Provides a base class for implementations of the EqualityComparer. + */ + EqualityComparer: EqualityComparerConstructor + + /** + * Initializes a new instance of the abstract Collection class. + */ + Collection: CollectionConstructor + + /** + * Initializes a new instance of the abstract Collection class. + */ + ReadOnlyCollection: ReadOnlyCollectionConstructor + + /** + * Represents a strongly typed list of objects that can be accessed by index. + */ + List: ListConstructor + + /** + * Represents a collection of key/value pairs that are sorted by key based on the associated Comparer implementation. + */ + SortedList: SortedListConstructor + + /** + * Defines a key/value pair that can be set or retrieved. + */ + KeyValuePair: KeyValuePairConstructor + + /** + * Represents a collection of keys and values. + */ + Dictionary: DictionaryConstructor + + /** + * Represents a set of values. + */ + HashSet: HashSetConstructor + + /** + * Represents a node in a LinkedList. + */ + LinkedListNode: LinkedListNodeConstructor + + /** + * Represents a doubly linked list. + */ + LinkedList: LinkedListConstructor + + /** + * Represents a first-in, first-out collection of objects. + */ + Queue: QueueConstructor + + /** + * Represents a variable size last-in-first-out (LIFO) collection of instances of the same arbitrary type. + */ + Stack: StackConstructor + } +} \ No newline at end of file From 4ed4731d6b9f802846b9f8bc1be55d1ffdde43f2 Mon Sep 17 00:00:00 2001 From: Dominic Alie Date: Tue, 26 May 2015 15:44:24 -0400 Subject: [PATCH 152/179] Update angular-file-upload definitions Add abort and xhr methods to the upload promise --- angular-file-upload/angular-file-upload-tests.ts | 4 ++++ angular-file-upload/angular-file-upload.d.ts | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/angular-file-upload/angular-file-upload-tests.ts b/angular-file-upload/angular-file-upload-tests.ts index 8b8fe7490..85dcb7853 100644 --- a/angular-file-upload/angular-file-upload-tests.ts +++ b/angular-file-upload/angular-file-upload-tests.ts @@ -29,6 +29,10 @@ module controllers { }, file: file }) + .abort() + .xhr((evt: any) => { + console.log('xhr'); + }) .progress((evt: angular.angularFileUpload.IFileProgressEvent) => { var percent = parseInt((100.0 * evt.loaded / evt.total).toString(), 10); console.log("upload progress: " + percent + "% for " + evt.config.file.name); diff --git a/angular-file-upload/angular-file-upload.d.ts b/angular-file-upload/angular-file-upload.d.ts index fa7aaa54e..d38c43226 100644 --- a/angular-file-upload/angular-file-upload.d.ts +++ b/angular-file-upload/angular-file-upload.d.ts @@ -14,8 +14,9 @@ declare module angular.angularFileUpload { } interface IUploadPromise extends IHttpPromise { - + abort(): IUploadPromise; progress(callback: IHttpPromiseCallback): IUploadPromise; + xhr(callback: IHttpPromiseCallback): IUploadPromise; } interface IFileUploadConfig extends IRequestConfig { From e96b92628f8ec90da6aebc58f44445f10e2cb655 Mon Sep 17 00:00:00 2001 From: LCHProducciones Date: Tue, 26 May 2015 21:42:24 -0300 Subject: [PATCH 153/179] Initial Commit --- magicsuggest/magicsuggest.d.ts | 463 +++++++++++++++++++++++++++++++++ 1 file changed, 463 insertions(+) create mode 100644 magicsuggest/magicsuggest.d.ts diff --git a/magicsuggest/magicsuggest.d.ts b/magicsuggest/magicsuggest.d.ts new file mode 100644 index 000000000..4d031c39f --- /dev/null +++ b/magicsuggest/magicsuggest.d.ts @@ -0,0 +1,463 @@ +// Type definitions for MagicSuggest 2.1.4 +// Project: http://nicolasbize.com/magicsuggest +// Definitions by: Leonardo Chaia +// Definitions: http://github.com/leonardochaia + +/// +interface JQuery { + magicSuggest: (configurationObject: MagicSuggest.Configuration) => MagicSuggest.Instance; +} + +declare module MagicSuggest { + interface Configuration { + /********** CONFIGURATION PROPERTIES ************/ + /** + * Restricts or allows the user to validate typed entries. + * Defaults to true. + */ + allowFreeEntries?: boolean; + + /** + * Restricts or allows the user to add the same entry more than once + * Defaults to false. + */ + allowDuplicates?: boolean; + + /** + * Additional config object passed to each $.ajax call + */ + ajaxConfig?: JQueryAjaxSettings; + + /** + * If a single suggestion comes out, it is preselected. + */ + autoSelect?: boolean; + + /** + * Auto select the first matching item with multiple items shown + */ + selectFirst?: boolean; + + /** + * Allow customization of query parameter + */ + queryParam?: string; + + /** + * A function triggered just before the ajax request is sent, similar to jQuery + */ + beforeSend?: () => void; + + /** + * A custom CSS class to apply to the field's underlying element. + */ + cls?: string; + + /** + * JSON Data source used to populate the combo box. 3 options are available here: + * No Data Source (default) + * When left null, the combo box will not suggest anything. It can still enable the user to enter + * multiple entries if allowFreeEntries is * set to true (default). + * Static Source + * You can pass an array of JSON objects, an array of strings or even a single CSV string as the + * data source.For ex. data: [* {id:0,name:"Paris"}, {id: 1, name: "New York"}] + * You can also pass any json object with the results property containing the json array. + * Url + * You can pass the url from which the component will fetch its JSON data.Data will be fetched + * using a POST ajax request that will * include the entered text as 'query' parameter. The results + * fetched from the server can be: + * - an array of JSON objects (ex: [{id:...,name:...},{...}]) + * - a string containing an array of JSON objects ready to be parsed (ex: "[{id:...,name:...},{...}]") + * - a JSON object whose data will be contained in the results property + * (ex: {results: [{id:...,name:...},{...}] + * Function + * You can pass a function which returns an array of JSON objects (ex: [{id:...,name:...},{...}]) + * The function can return the JSON data or it can use the first argument as function to handle the data. + * Only one (callback function or return value) is needed for the function to succeed. + * See the following example: + * function (response) { var myjson = [{name: 'test', id: 1}]; response(myjson); return myjson; } + */ + data?: any; + + /** + * Additional parameters to the ajax call + */ + dataUrlParams?: Object; + + /** + * Start the component in a disabled state. + */ + disabled?: boolean; + + /** + * Name of JSON object property that defines the disabled behaviour + */ + disabledField?: string; + + /** + * Name of JSON object property displayed in the combo list + */ + displayField?: string; + + /** + * Set to false if you only want mouse interaction. In that case the combo will + * automatically expand on focus. + */ + editable?: boolean; + + /** + * Set starting state for combo. + */ + expanded?: boolean; + + /** + * Automatically expands combo on focus. + */ + expandOnFocus?: boolean; + + /** + * JSON property by which the list should be grouped + */ + groupBy?: string; + + /** + * Set to true to hide the trigger on the right + */ + hideTrigger?: boolean; + + /** + * Set to true to highlight search input within displayed suggestions + */ + highlight?: boolean; + + /** + * A custom ID for this component + */ + id?: string; + + /** + * A class that is added to the info message appearing on the top-right part of the component + */ + infoMsgCls?: string; + + /** + * Additional parameters passed out to the INPUT tag. Enables usage of AngularJS's custom tags for ex. + */ + inputCfg?: any; + + /** + * The class that is applied to show that the field is invalid + */ + invalidCls?: string; + + /** + * Set to true to filter data results according to case. Useless if the data is fetched remotely + */ + matchCase?: boolean; + + /** + * Once expanded, the combo's height will take as much room as the # of available results. + * In case there are too many results displayed, this will fix the drop down height. + */ + maxDropHeight?: number; + + /** + * Defines how long the user free entry can be. Set to null for no limit. + */ + maxEntryLength?: number; + + /** + * A function that defines the helper text when the max entry length has been surpassed. + */ + maxEntryRenderer?: (v?: number) => void; + + /** + * The maximum number of results displayed in the combo drop down at once. + */ + maxSuggestions?: number; + + /** + * The maximum number of items the user can select if multiple selection is allowed. + * Set to null to remove the limit. + */ + maxSelection?: number; + + /** + * A function that defines the helper text when the max selection amount has been reached. The function has a single + * parameter which is the number of selected elements. + */ + maxSelectionRenderer?: (v: number) => void; + + /** + * The method used by the ajax request. + */ + method?: string; + + /** + * The minimum number of characters the user must type before the combo expands and offers suggestions. + */ + minChars?: number; + + /** + * A function that defines the helper text when not enough letters are set. The function has a single + * parameter which is the difference between the required amount of letters and the current one. + */ + minCharsRenderer?: (v: number) => void; + + /** + * Whether or not sorting / filtering should be done remotely or locally. + * Use either 'local' or 'remote' + */ + mode?: string; + + /** + * The name used as a form element. + */ + name?: string; + + /** + * The text displayed when there are no suggestions. + */ + noSuggestionText?: string; + + /** + * The default placeholder text when nothing has been entered + */ + placeholder?: string; + + /** + * A function used to define how the items will be presented in the combo + */ + renderer?: (item: any) => void; + + /** + * Whether or not this field should be required + */ + required?: boolean; + + /** + * Set to true to render selection as a delimited string + */ + resultAsString?: boolean; + + /** + * Text delimiter to use in a delimited string. + */ + resultAsStringDelimiter?: string; + + /** + * Name of JSON object property that represents the list of suggested objects + */ + resultsField?: string; + + /** + * A custom CSS class to add to a selected item + */ + selectionCls?: string; + + /** + * An optional element replacement in which the selection is rendered + */ + selectionContainer?: JQuery; + + /** + * Where the selected items will be displayed. Only 'right', 'bottom' and 'inner' are valid values + */ + selectionPosition?: string; + + /** + * A function used to define how the items will be presented in the tag list + */ + selectionRenderer?: (item: any) => void; + + /** + * Set to true to stack the selectioned items when positioned on the bottom + * Requires the selectionPosition to be set to 'bottom' + */ + selectionStacked?: boolean; + + /** + * Direction used for sorting. Only 'asc' and 'desc' are valid values + */ + sortDir?: string; + + /** + * name of JSON object property for local result sorting. + * Leave null if you do not wish the results to be ordered or if they are already ordered remotely. + */ + sortOrder?: string; + + /** + * If set to boolean; suggestions will have to start by user input (and not simply contain it as a substring) + */ + strictSuggest?: boolean; + + /** + * Custom style added to the component container. + */ + style?: string; + + /** + * If set to boolean; the combo will expand / collapse when clicked upon + */ + toggleOnClick?: boolean; + + + /** + * Amount (in ms) between keyboard registers. + */ + typeDelay?: number; + + /** + * If set to boolean; tab won't blur the component but will be registered as the ENTER key + */ + useTabKey?: boolean; + + /** + * If set to boolean; using comma will validate the user's choice + */ + useCommaKey?: boolean; + + + /** + * Determines whether or not the results will be displayed with a zebra table style + */ + useZebraStyle?: boolean; + + /** + * initial value for the field + */ + value?: any; + + /** + * name of JSON object property that represents its underlying value + */ + valueField?: string; + + /** + * regular expression to validate the values against + */ + vregex?: any; + + /** + * type to validate against + */ + vtype?: any; + } + + interface Instance { + /** + * Add one or multiple json items to the current selection + * @param items - json object or array of json objects + * @param isSilent - (optional) set to true to suppress 'selectionchange' event from being triggered + */ + addToSelection(objs: Array, isSilent?: boolean): void; + + /** + * Clears the current selection + * @param isSilent - (optional) set to true to suppress 'selectionchange' event from being triggered + */ + clear(isSilent?: boolean): void; + + /** + * Collapse the drop down part of the combo + */ + collapse(): void; + + /** + * Set the component in a disabled state. + */ + disable(): void; + + /** + * Empties out the combo user text + */ + empty(): void; + + /** + * Set the component in a enable state. + */ + enable(): void; + + /** + * Retrieve component enabled status + * @return {boolean} + */ + isDisabled(): boolean; + + /** + * Checks whether the field is valid or not + * @return {boolean} + */ + isValid(): boolean; + + /** + * Gets the data params for current ajax request + */ + getDataUrlParams(): Object; + + /** + * Gets the name given to the form input + */ + getName(): string; + + /** + * Retrieve an array of selected json objects + * @return {Array} + */ + getSelection(): Array; + + /** + * Retrieve the current text entered by the user + */ + getRawValue(): string; + + /** + * Retrieve an array of selected values + */ + getValue(): Array; + + /** + * Remove one or multiples json items from the current selection + * @param items - json object or array of json objects + * @param isSilent - (optional) set to true to suppress 'selectionchange' event from being triggered + */ + removeFromSelection(items: any, isSilent: boolean): void; + + /** + * Set up some combo data after it has been rendered + * @param data + */ + setData(data: any): void; + + /** + * Get current data + */ + getData(): any; + + /** + * Sets the name for the input field so it can be fetched in the form + * @param name + */ + setName(name: string): void; + + /** + * Sets the current selection with the JSON items provided + * @param items + */ + setSelection(items: Array): void; + + /** + * Sets a value for the combo box. Value must be an array of values with data type matching valueField one. + * @param data + */ + setValue(values: Array): void; + + /** + * Sets data params for subsequent ajax requests + * @param params + */ + setDataUrlParams(params: any): void; + + } +} \ No newline at end of file From 2f6e9b996c5c5005f187d1f0991d7a96b6c84d2b Mon Sep 17 00:00:00 2001 From: LCHProducciones Date: Tue, 26 May 2015 21:44:01 -0300 Subject: [PATCH 154/179] Changed definitios url --- magicsuggest/magicsuggest.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/magicsuggest/magicsuggest.d.ts b/magicsuggest/magicsuggest.d.ts index 4d031c39f..9cb09e3e8 100644 --- a/magicsuggest/magicsuggest.d.ts +++ b/magicsuggest/magicsuggest.d.ts @@ -1,7 +1,7 @@ // Type definitions for MagicSuggest 2.1.4 // Project: http://nicolasbize.com/magicsuggest // Definitions by: Leonardo Chaia -// Definitions: http://github.com/leonardochaia +// Definitions: http://github.com/leonardochaia/DefinitelyTyped /// interface JQuery { @@ -460,4 +460,4 @@ declare module MagicSuggest { setDataUrlParams(params: any): void; } -} \ No newline at end of file +} From 7094689c1f419280d40305c6fa9a8474c36ecdba Mon Sep 17 00:00:00 2001 From: Seulgi Kim Date: Wed, 27 May 2015 20:29:52 +0900 Subject: [PATCH 155/179] gulp-istanbul 0.9.0 adds enforceThresholds function. --- gulp-istanbul/gulp-istanbul-0.8.1.d.ts | 51 ++++++++++++++++++++++++++ gulp-istanbul/gulp-istanbul-tests.ts | 13 +++++++ gulp-istanbul/gulp-istanbul.d.ts | 17 ++++++++- 3 files changed, 79 insertions(+), 2 deletions(-) create mode 100644 gulp-istanbul/gulp-istanbul-0.8.1.d.ts diff --git a/gulp-istanbul/gulp-istanbul-0.8.1.d.ts b/gulp-istanbul/gulp-istanbul-0.8.1.d.ts new file mode 100644 index 000000000..3a10dfdba --- /dev/null +++ b/gulp-istanbul/gulp-istanbul-0.8.1.d.ts @@ -0,0 +1,51 @@ +// Type definitions for gulp-istanbul v0.8.1 +// Project: https://github.com/SBoudrias/gulp-istanbul +// Definitions by: Asana +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "gulp-istanbul" { + function GulpIstanbul(opts?: GulpIstanbul.Options): NodeJS.ReadWriteStream; + + module GulpIstanbul { + export function hookRequire(): NodeJS.ReadWriteStream; + export function summarizeCoverage(opts?: {coverageVariable?: string}): Coverage; + export function writeReports(opts?: ReportOptions): NodeJS.ReadWriteStream; + + interface Options { + coverageVariable?: string; + includeUntested?: boolean; + embedSource?: boolean; + preserveComments?: boolean; + noCompact?: boolean; + noAutoWrap?: boolean; + codeGenerationOptions?: Object; + debug?: boolean; + walkDebug?: boolean; + } + + interface Coverage { + lines: CoverageStats; + statements: CoverageStats; + functions: CoverageStats; + branches: CoverageStats; + } + + interface CoverageStats { + total: number; + covered: number; + skipped: number; + pct: number; + } + + interface ReportOptions { + dir?: string; + reporters?: string[]; + reportOpts?: {dir?: string}; + coverageVariable?: string; + } + } + + export = GulpIstanbul; +} diff --git a/gulp-istanbul/gulp-istanbul-tests.ts b/gulp-istanbul/gulp-istanbul-tests.ts index 7f2327d07..0d64b53d0 100644 --- a/gulp-istanbul/gulp-istanbul-tests.ts +++ b/gulp-istanbul/gulp-istanbul-tests.ts @@ -29,4 +29,17 @@ gulp.task('test', function (cb) { .pipe(istanbul.writeReports({reporters: ['text']})) // Creating the reports after tests runned .on('end', cb); }); +}); + +gulp.task('test', function (cb) { + gulp.src(['lib/**/*.js', 'main.js']) + .pipe(istanbul({includeUntested: true})) // Covering files + .pipe(istanbul.hookRequire()) + .on('finish', function () { + gulp.src(['test/*.html']) + .pipe(testFramework()) + .pipe(istanbul.writeReports({reporters: ['text']})) // Creating the reports after tests runned + .pipe(istanbul.enforceThresholds({ thresholds: { global: 90 } })) // + .on('end', cb); + }); }); \ No newline at end of file diff --git a/gulp-istanbul/gulp-istanbul.d.ts b/gulp-istanbul/gulp-istanbul.d.ts index bf7a13bb0..d917d64b1 100644 --- a/gulp-istanbul/gulp-istanbul.d.ts +++ b/gulp-istanbul/gulp-istanbul.d.ts @@ -1,4 +1,4 @@ -// Type definitions for gulp-istanbul +// Type definitions for gulp-istanbul v0.9.0 // Project: https://github.com/SBoudrias/gulp-istanbul // Definitions by: Asana // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -12,6 +12,7 @@ declare module "gulp-istanbul" { export function hookRequire(): NodeJS.ReadWriteStream; export function summarizeCoverage(opts?: {coverageVariable?: string}): Coverage; export function writeReports(opts?: ReportOptions): NodeJS.ReadWriteStream; + export function enforceThresholds(opts?: ThresholdOptions): NodeJS.ReadWriteStream; interface Options { coverageVariable?: string; @@ -45,7 +46,19 @@ declare module "gulp-istanbul" { reportOpts?: {dir?: string}; coverageVariable?: string; } + + interface ThresholdOptions { + coverageVariable?: string; + thresholds?: { global?: Coverage|number; each?: Coverage|number }; + } + + interface CoverageOptions { + lines?: number; + statements?: number; + functions?: number; + branches?: number; + } } export = GulpIstanbul; -} \ No newline at end of file +} From a5efba8589f59949da9d7f0367cd4bfc53a8269c Mon Sep 17 00:00:00 2001 From: Seulgi Kim Date: Wed, 27 May 2015 20:55:26 +0900 Subject: [PATCH 156/179] Fix username --- mpromise/mpromise.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mpromise/mpromise.d.ts b/mpromise/mpromise.d.ts index ba6961362..2a99964c2 100644 --- a/mpromise/mpromise.d.ts +++ b/mpromise/mpromise.d.ts @@ -1,6 +1,6 @@ // Type definitions for mpromise 0.5.4 // Project: https://github.com/aheckmann/mpromise -// Definitions by: Seulgi Kim +// Definitions by: Seulgi Kim // Definitions: https://github.com/borisyankov/DefinitelyTyped declare module "mpromise" { From f2603afffaabe8c70b95d77961745c29036fe858 Mon Sep 17 00:00:00 2001 From: Kevin Wilson Date: Wed, 27 May 2015 15:00:54 +0100 Subject: [PATCH 157/179] Added static method and wrapped in module. Updated to include static Routie methods. Wrapped types up into a module definition. --- routie/routie.d.ts | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/routie/routie.d.ts b/routie/routie.d.ts index 9317904d4..d6e4cd281 100644 --- a/routie/routie.d.ts +++ b/routie/routie.d.ts @@ -3,15 +3,33 @@ // Definitions by: Adilson // Definitions: https://github.com/borisyankov/DefinitelyTyped -interface Route { - constructor(path: string, name: string): Route; - addHandler(fn: Function): void; - removeHandler(fn: Function): void; - run(params: any): void; - match(path: string, params: any): boolean; - toURL(params: any): string; +declare module routie { + interface Route { + constructor(path: string, name: string): Route; + addHandler(fn: Function): void; + removeHandler(fn: Function): void; + run(params: any): void; + match(path: string, params: any): boolean; + toURL(params: any): string; + } + + interface Routie extends RoutieStatic { + (path: string): void; + (path: string, fn: Function): void; + (routes: { [key: string]: Function }): void; + } + + interface RoutieStatic { + lookup(name: string, fn: Function): string; + remove(path: string, fn: Function): void; + removeAll(): void; + navigate(path: string, options: RouteOptions): void; + noConflict(): Routie; + } + + interface RouteOptions { + silent?: boolean; + } } -declare function routie(path: string): void; -declare function routie(path: string, fn: Function): void; -declare function routie(routes: { [key: string]: Function }): void; \ No newline at end of file +declare var routie: routie.Routie; From 34ef6f1dd3ce8c4ead9c1234ca96f2e582f08160 Mon Sep 17 00:00:00 2001 From: Kevin Wilson Date: Wed, 27 May 2015 15:02:08 +0100 Subject: [PATCH 158/179] Added to change log. --- routie/routie.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/routie/routie.d.ts b/routie/routie.d.ts index d6e4cd281..cd3bb09dc 100644 --- a/routie/routie.d.ts +++ b/routie/routie.d.ts @@ -1,6 +1,7 @@ // Type definitions for routie 0.3.2 // Project: https://github.com/jgallen23/routie // Definitions by: Adilson +// Definitions by: kwilson // Definitions: https://github.com/borisyankov/DefinitelyTyped declare module routie { From e2e6bdb50df936afdcfd91e2e1bdcdb28f392a11 Mon Sep 17 00:00:00 2001 From: Kevin Wilson Date: Wed, 27 May 2015 15:13:48 +0100 Subject: [PATCH 159/179] Added tests for static functions. --- routie/routie-tests.ts | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/routie/routie-tests.ts b/routie/routie-tests.ts index 323142c7e..12ee397c4 100644 --- a/routie/routie-tests.ts +++ b/routie/routie-tests.ts @@ -54,4 +54,24 @@ routie("users/12312312"); routie("*", function () { }); -routie("anything"); \ No newline at end of file +routie("anything"); + +// STATIC + +// Lookup +var existing = routie.lookup("users/bob", () => { +}); + +// Remove +routie.remove("users/bob", () => { +}); + +// RemoveAll +routie.removeAll(); + +// Navigate +routie.navigate("users/bob"); +routie.navigate("users/bob", { silent: true }); + +// NoConflict +var myRoutie = routie.noConflict(); From 45d69d19cbc7beae195cfeb5d4d6c085b9073545 Mon Sep 17 00:00:00 2001 From: Kevin Wilson Date: Wed, 27 May 2015 15:14:21 +0100 Subject: [PATCH 160/179] Fixed missing optional flag for navigate options. --- routie/routie.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routie/routie.d.ts b/routie/routie.d.ts index cd3bb09dc..8f32c3d78 100644 --- a/routie/routie.d.ts +++ b/routie/routie.d.ts @@ -24,7 +24,7 @@ declare module routie { lookup(name: string, fn: Function): string; remove(path: string, fn: Function): void; removeAll(): void; - navigate(path: string, options: RouteOptions): void; + navigate(path: string, options?: RouteOptions): void; noConflict(): Routie; } From fa7330d6fe18c795891fc8465445662ba5cd9675 Mon Sep 17 00:00:00 2001 From: Kevin Wilson Date: Wed, 27 May 2015 15:16:53 +0100 Subject: [PATCH 161/179] Fixed heading error. --- routie/routie.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/routie/routie.d.ts b/routie/routie.d.ts index 8f32c3d78..79ab2dc8a 100644 --- a/routie/routie.d.ts +++ b/routie/routie.d.ts @@ -1,7 +1,6 @@ // Type definitions for routie 0.3.2 // Project: https://github.com/jgallen23/routie // Definitions by: Adilson -// Definitions by: kwilson // Definitions: https://github.com/borisyankov/DefinitelyTyped declare module routie { From 79bdd9caf3545c421646c522a49e0c306ddcf00a Mon Sep 17 00:00:00 2001 From: Chris Wrench Date: Wed, 27 May 2015 15:20:33 +0100 Subject: [PATCH 162/179] Add Stripe Checkout definitions Fixes #4366. --- stripe-checkout/stripe-checkout-tests.ts | 38 ++++++++++++++++++++++++ stripe-checkout/stripe-checkout.d.ts | 35 ++++++++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 stripe-checkout/stripe-checkout-tests.ts create mode 100644 stripe-checkout/stripe-checkout.d.ts diff --git a/stripe-checkout/stripe-checkout-tests.ts b/stripe-checkout/stripe-checkout-tests.ts new file mode 100644 index 000000000..c054b2365 --- /dev/null +++ b/stripe-checkout/stripe-checkout-tests.ts @@ -0,0 +1,38 @@ +/// + +// Test the minimum amount of configuration required. +var handler = StripeCheckout.configure({ + key: "my-secret-key", + token: function(token: StripeTokenResponse) { + console.log(token.id); + } +}); + +handler.open(); + +handler.close(); + +// Test all configuration options. +var options = { + key: "my-secret-key", + token: function(token: StripeTokenResponse) { + console.log(token.id); + }, + image: "http://placehold.it/128x128", + name: "Definitely Typed", + description: "A DefinitelyTyped test for Stripe Checkout", + amount: Number.MAX_VALUE, + currency: "USD", + panelLabel: "Pay Definitely Typed {{amount}}", + label: "Pay Definitely Typed", + zipCode: false, + email: "test@example.com", + allowRememberMe: false, + bitcoin: false, + opened: function() {}, + closed: function() {} +} + +handler = StripeCheckout.configure(options); + +handler.open(options); \ No newline at end of file diff --git a/stripe-checkout/stripe-checkout.d.ts b/stripe-checkout/stripe-checkout.d.ts new file mode 100644 index 000000000..f648a1bb3 --- /dev/null +++ b/stripe-checkout/stripe-checkout.d.ts @@ -0,0 +1,35 @@ +// Type definitions for Stripe Checkout +// Project: https://stripe.com/checkout +// Definitions by: Chris Wrench +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +interface StripeCheckoutStatic { + configure(options: StripeCheckoutOptions): StripeCheckoutHandler; +} + +interface StripeCheckoutHandler { + open(options?: StripeCheckoutOptions): void; + close(): void; +} + +interface StripeCheckoutOptions { + key: string; + token: (token: StripeTokenResponse) => void; + image?: string; + name?: string; + description?: string; + amount?: number; + currency?: string; + panelLabel?: string; + zipCode?: boolean; + email?: string; + label?: string; + allowRememberMe?: boolean; + bitcoin?: boolean; + opened?: () => void; + closed?: () => void; +} + +declare var StripeCheckout: StripeCheckoutStatic; \ No newline at end of file From 8f7a306a4875d0fb1124e67a84c7ab3eea3f8d09 Mon Sep 17 00:00:00 2001 From: Reto Rezzonico Date: Wed, 27 May 2015 16:28:51 +0200 Subject: [PATCH 163/179] Add definitions for angular-jwt --- angular-jwt/angular-jwt-tests.ts | 17 +++++++++++++++++ angular-jwt/angular-jwt.d.ts | 30 ++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 angular-jwt/angular-jwt-tests.ts create mode 100644 angular-jwt/angular-jwt.d.ts diff --git a/angular-jwt/angular-jwt-tests.ts b/angular-jwt/angular-jwt-tests.ts new file mode 100644 index 000000000..2e7ccbc08 --- /dev/null +++ b/angular-jwt/angular-jwt-tests.ts @@ -0,0 +1,17 @@ +/// +/// + +var app = angular.module("angular-jwt-tests", ["angular-jwt"]); + +var $jwtHelper: angular.jwt.IJwtHelper; + +var expToken = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL3NhbXBsZXMuYXV0aDAuY29tLyIsInN1YiI6ImZhY2Vib29rfDEwMTU0Mjg3MDI3NTEwMzAyIiwiYXVkIjoiQlVJSlNXOXg2MHNJSEJ3OEtkOUVtQ2JqOGVESUZ4REMiLCJleHAiOjE0MTIyMzQ3MzAsImlhdCI6MTQxMjE5ODczMH0.7M5sAV50fF1-_h9qVbdSgqAnXVF7mz3I6RjS6JiH0H8'; +var tokenPayload = $jwtHelper.decodeToken(expToken); +var date = $jwtHelper.getTokenExpirationDate(expToken); +var bool = $jwtHelper.isTokenExpired(expToken); + +var $jwtInterceptor: angular.jwt.IJwtInterceptor; + +$jwtInterceptor.tokenGetter = () => { + return expToken; +} \ No newline at end of file diff --git a/angular-jwt/angular-jwt.d.ts b/angular-jwt/angular-jwt.d.ts new file mode 100644 index 000000000..ec0e03e16 --- /dev/null +++ b/angular-jwt/angular-jwt.d.ts @@ -0,0 +1,30 @@ +// Type definitions for angular-jwt 0.0.8 +// Project: https://github.com/auth0/angular-jwt +// Definitions by: Reto Rezzonico +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module angular.jwt { + + interface JwtToken { + iss: string; + sub: string; + aud: string; + exp: number; + nbf: number; + iat: number; + jti: string; + unique_name: string; + } + + interface IJwtHelper { + decodeToken(token: string): JwtToken; + getTokenExpirationDate(token: any): Date; + isTokenExpired(token: any, offsetSeconds?: number): boolean; + } + + interface IJwtInterceptor { + tokenGetter(): string; + } +} \ No newline at end of file From 989b586b954819ef65a894634ffb0fa0ca0bb84d Mon Sep 17 00:00:00 2001 From: Reto Rezzonico Date: Wed, 27 May 2015 16:32:52 +0200 Subject: [PATCH 164/179] Linebreaks --- angular-jwt/angular-jwt-tests.ts | 2 +- angular-jwt/angular-jwt.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/angular-jwt/angular-jwt-tests.ts b/angular-jwt/angular-jwt-tests.ts index 2e7ccbc08..7f66f2611 100644 --- a/angular-jwt/angular-jwt-tests.ts +++ b/angular-jwt/angular-jwt-tests.ts @@ -14,4 +14,4 @@ var $jwtInterceptor: angular.jwt.IJwtInterceptor; $jwtInterceptor.tokenGetter = () => { return expToken; -} \ No newline at end of file +} diff --git a/angular-jwt/angular-jwt.d.ts b/angular-jwt/angular-jwt.d.ts index ec0e03e16..55bb3e4f6 100644 --- a/angular-jwt/angular-jwt.d.ts +++ b/angular-jwt/angular-jwt.d.ts @@ -27,4 +27,4 @@ declare module angular.jwt { interface IJwtInterceptor { tokenGetter(): string; } -} \ No newline at end of file +} From 4c024ccc5b6d4258dfec002bc41b8c68de648c01 Mon Sep 17 00:00:00 2001 From: LCHProducciones Date: Wed, 27 May 2015 17:57:12 -0300 Subject: [PATCH 165/179] Added tests file. Bugfixes on definitions --- magicsuggest/magicsuggest-tests.ts | 24 ++++++++++++++++++++++++ magicsuggest/magicsuggest.d.ts | 7 +++++-- 2 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 magicsuggest/magicsuggest-tests.ts diff --git a/magicsuggest/magicsuggest-tests.ts b/magicsuggest/magicsuggest-tests.ts new file mode 100644 index 000000000..993f6cde3 --- /dev/null +++ b/magicsuggest/magicsuggest-tests.ts @@ -0,0 +1,24 @@ + +function basicTest() { + $('#magicSuggest').magicSuggest(); +} + +function testWithConfigurationOptions() { + $('#magicSuggest').magicSuggest({ + data: [ + { id: 1, name: "Buenos Aires" }, + { id: 2, name: "New York" }, + { id: 3, name: "Madrid" }, + ], + maxDropHeight: 500, + maxSelection: 2, + expandOnFocus: true, + }); +} + +function testSomeMethods() { + var ms = $('#magicSuggest').magicSuggest(); + ms.addToSelection([{ id: 1, name: "Mexico" }]); + console.info(ms.getSelection()); + ms.disable() +} \ No newline at end of file diff --git a/magicsuggest/magicsuggest.d.ts b/magicsuggest/magicsuggest.d.ts index 9cb09e3e8..f1ac71a2e 100644 --- a/magicsuggest/magicsuggest.d.ts +++ b/magicsuggest/magicsuggest.d.ts @@ -5,7 +5,10 @@ /// interface JQuery { - magicSuggest: (configurationObject: MagicSuggest.Configuration) => MagicSuggest.Instance; + /** + * Initialize MagicSuggest on this selector + */ + magicSuggest(configurationObject?: MagicSuggest.Configuration): MagicSuggest.Instance; } declare module MagicSuggest { @@ -460,4 +463,4 @@ declare module MagicSuggest { setDataUrlParams(params: any): void; } -} +} \ No newline at end of file From 220ded7238f0cd09b1f456ffb562aa61190335be Mon Sep 17 00:00:00 2001 From: LCHProducciones Date: Wed, 27 May 2015 18:02:55 -0300 Subject: [PATCH 166/179] Forgot to add the reference to typings on test file --- magicsuggest/magicsuggest-tests.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/magicsuggest/magicsuggest-tests.ts b/magicsuggest/magicsuggest-tests.ts index 993f6cde3..b41cf9f71 100644 --- a/magicsuggest/magicsuggest-tests.ts +++ b/magicsuggest/magicsuggest-tests.ts @@ -1,4 +1,6 @@ - +/// +/// + function basicTest() { $('#magicSuggest').magicSuggest(); } From dc9c8d2d5f4822cec81f7c4184f6103e3c340eee Mon Sep 17 00:00:00 2001 From: LCHProducciones Date: Tue, 26 May 2015 21:42:24 -0300 Subject: [PATCH 167/179] Initial Commit --- magicsuggest/magicsuggest.d.ts | 463 +++++++++++++++++++++++++++++++++ 1 file changed, 463 insertions(+) create mode 100644 magicsuggest/magicsuggest.d.ts diff --git a/magicsuggest/magicsuggest.d.ts b/magicsuggest/magicsuggest.d.ts new file mode 100644 index 000000000..4d031c39f --- /dev/null +++ b/magicsuggest/magicsuggest.d.ts @@ -0,0 +1,463 @@ +// Type definitions for MagicSuggest 2.1.4 +// Project: http://nicolasbize.com/magicsuggest +// Definitions by: Leonardo Chaia +// Definitions: http://github.com/leonardochaia + +/// +interface JQuery { + magicSuggest: (configurationObject: MagicSuggest.Configuration) => MagicSuggest.Instance; +} + +declare module MagicSuggest { + interface Configuration { + /********** CONFIGURATION PROPERTIES ************/ + /** + * Restricts or allows the user to validate typed entries. + * Defaults to true. + */ + allowFreeEntries?: boolean; + + /** + * Restricts or allows the user to add the same entry more than once + * Defaults to false. + */ + allowDuplicates?: boolean; + + /** + * Additional config object passed to each $.ajax call + */ + ajaxConfig?: JQueryAjaxSettings; + + /** + * If a single suggestion comes out, it is preselected. + */ + autoSelect?: boolean; + + /** + * Auto select the first matching item with multiple items shown + */ + selectFirst?: boolean; + + /** + * Allow customization of query parameter + */ + queryParam?: string; + + /** + * A function triggered just before the ajax request is sent, similar to jQuery + */ + beforeSend?: () => void; + + /** + * A custom CSS class to apply to the field's underlying element. + */ + cls?: string; + + /** + * JSON Data source used to populate the combo box. 3 options are available here: + * No Data Source (default) + * When left null, the combo box will not suggest anything. It can still enable the user to enter + * multiple entries if allowFreeEntries is * set to true (default). + * Static Source + * You can pass an array of JSON objects, an array of strings or even a single CSV string as the + * data source.For ex. data: [* {id:0,name:"Paris"}, {id: 1, name: "New York"}] + * You can also pass any json object with the results property containing the json array. + * Url + * You can pass the url from which the component will fetch its JSON data.Data will be fetched + * using a POST ajax request that will * include the entered text as 'query' parameter. The results + * fetched from the server can be: + * - an array of JSON objects (ex: [{id:...,name:...},{...}]) + * - a string containing an array of JSON objects ready to be parsed (ex: "[{id:...,name:...},{...}]") + * - a JSON object whose data will be contained in the results property + * (ex: {results: [{id:...,name:...},{...}] + * Function + * You can pass a function which returns an array of JSON objects (ex: [{id:...,name:...},{...}]) + * The function can return the JSON data or it can use the first argument as function to handle the data. + * Only one (callback function or return value) is needed for the function to succeed. + * See the following example: + * function (response) { var myjson = [{name: 'test', id: 1}]; response(myjson); return myjson; } + */ + data?: any; + + /** + * Additional parameters to the ajax call + */ + dataUrlParams?: Object; + + /** + * Start the component in a disabled state. + */ + disabled?: boolean; + + /** + * Name of JSON object property that defines the disabled behaviour + */ + disabledField?: string; + + /** + * Name of JSON object property displayed in the combo list + */ + displayField?: string; + + /** + * Set to false if you only want mouse interaction. In that case the combo will + * automatically expand on focus. + */ + editable?: boolean; + + /** + * Set starting state for combo. + */ + expanded?: boolean; + + /** + * Automatically expands combo on focus. + */ + expandOnFocus?: boolean; + + /** + * JSON property by which the list should be grouped + */ + groupBy?: string; + + /** + * Set to true to hide the trigger on the right + */ + hideTrigger?: boolean; + + /** + * Set to true to highlight search input within displayed suggestions + */ + highlight?: boolean; + + /** + * A custom ID for this component + */ + id?: string; + + /** + * A class that is added to the info message appearing on the top-right part of the component + */ + infoMsgCls?: string; + + /** + * Additional parameters passed out to the INPUT tag. Enables usage of AngularJS's custom tags for ex. + */ + inputCfg?: any; + + /** + * The class that is applied to show that the field is invalid + */ + invalidCls?: string; + + /** + * Set to true to filter data results according to case. Useless if the data is fetched remotely + */ + matchCase?: boolean; + + /** + * Once expanded, the combo's height will take as much room as the # of available results. + * In case there are too many results displayed, this will fix the drop down height. + */ + maxDropHeight?: number; + + /** + * Defines how long the user free entry can be. Set to null for no limit. + */ + maxEntryLength?: number; + + /** + * A function that defines the helper text when the max entry length has been surpassed. + */ + maxEntryRenderer?: (v?: number) => void; + + /** + * The maximum number of results displayed in the combo drop down at once. + */ + maxSuggestions?: number; + + /** + * The maximum number of items the user can select if multiple selection is allowed. + * Set to null to remove the limit. + */ + maxSelection?: number; + + /** + * A function that defines the helper text when the max selection amount has been reached. The function has a single + * parameter which is the number of selected elements. + */ + maxSelectionRenderer?: (v: number) => void; + + /** + * The method used by the ajax request. + */ + method?: string; + + /** + * The minimum number of characters the user must type before the combo expands and offers suggestions. + */ + minChars?: number; + + /** + * A function that defines the helper text when not enough letters are set. The function has a single + * parameter which is the difference between the required amount of letters and the current one. + */ + minCharsRenderer?: (v: number) => void; + + /** + * Whether or not sorting / filtering should be done remotely or locally. + * Use either 'local' or 'remote' + */ + mode?: string; + + /** + * The name used as a form element. + */ + name?: string; + + /** + * The text displayed when there are no suggestions. + */ + noSuggestionText?: string; + + /** + * The default placeholder text when nothing has been entered + */ + placeholder?: string; + + /** + * A function used to define how the items will be presented in the combo + */ + renderer?: (item: any) => void; + + /** + * Whether or not this field should be required + */ + required?: boolean; + + /** + * Set to true to render selection as a delimited string + */ + resultAsString?: boolean; + + /** + * Text delimiter to use in a delimited string. + */ + resultAsStringDelimiter?: string; + + /** + * Name of JSON object property that represents the list of suggested objects + */ + resultsField?: string; + + /** + * A custom CSS class to add to a selected item + */ + selectionCls?: string; + + /** + * An optional element replacement in which the selection is rendered + */ + selectionContainer?: JQuery; + + /** + * Where the selected items will be displayed. Only 'right', 'bottom' and 'inner' are valid values + */ + selectionPosition?: string; + + /** + * A function used to define how the items will be presented in the tag list + */ + selectionRenderer?: (item: any) => void; + + /** + * Set to true to stack the selectioned items when positioned on the bottom + * Requires the selectionPosition to be set to 'bottom' + */ + selectionStacked?: boolean; + + /** + * Direction used for sorting. Only 'asc' and 'desc' are valid values + */ + sortDir?: string; + + /** + * name of JSON object property for local result sorting. + * Leave null if you do not wish the results to be ordered or if they are already ordered remotely. + */ + sortOrder?: string; + + /** + * If set to boolean; suggestions will have to start by user input (and not simply contain it as a substring) + */ + strictSuggest?: boolean; + + /** + * Custom style added to the component container. + */ + style?: string; + + /** + * If set to boolean; the combo will expand / collapse when clicked upon + */ + toggleOnClick?: boolean; + + + /** + * Amount (in ms) between keyboard registers. + */ + typeDelay?: number; + + /** + * If set to boolean; tab won't blur the component but will be registered as the ENTER key + */ + useTabKey?: boolean; + + /** + * If set to boolean; using comma will validate the user's choice + */ + useCommaKey?: boolean; + + + /** + * Determines whether or not the results will be displayed with a zebra table style + */ + useZebraStyle?: boolean; + + /** + * initial value for the field + */ + value?: any; + + /** + * name of JSON object property that represents its underlying value + */ + valueField?: string; + + /** + * regular expression to validate the values against + */ + vregex?: any; + + /** + * type to validate against + */ + vtype?: any; + } + + interface Instance { + /** + * Add one or multiple json items to the current selection + * @param items - json object or array of json objects + * @param isSilent - (optional) set to true to suppress 'selectionchange' event from being triggered + */ + addToSelection(objs: Array, isSilent?: boolean): void; + + /** + * Clears the current selection + * @param isSilent - (optional) set to true to suppress 'selectionchange' event from being triggered + */ + clear(isSilent?: boolean): void; + + /** + * Collapse the drop down part of the combo + */ + collapse(): void; + + /** + * Set the component in a disabled state. + */ + disable(): void; + + /** + * Empties out the combo user text + */ + empty(): void; + + /** + * Set the component in a enable state. + */ + enable(): void; + + /** + * Retrieve component enabled status + * @return {boolean} + */ + isDisabled(): boolean; + + /** + * Checks whether the field is valid or not + * @return {boolean} + */ + isValid(): boolean; + + /** + * Gets the data params for current ajax request + */ + getDataUrlParams(): Object; + + /** + * Gets the name given to the form input + */ + getName(): string; + + /** + * Retrieve an array of selected json objects + * @return {Array} + */ + getSelection(): Array; + + /** + * Retrieve the current text entered by the user + */ + getRawValue(): string; + + /** + * Retrieve an array of selected values + */ + getValue(): Array; + + /** + * Remove one or multiples json items from the current selection + * @param items - json object or array of json objects + * @param isSilent - (optional) set to true to suppress 'selectionchange' event from being triggered + */ + removeFromSelection(items: any, isSilent: boolean): void; + + /** + * Set up some combo data after it has been rendered + * @param data + */ + setData(data: any): void; + + /** + * Get current data + */ + getData(): any; + + /** + * Sets the name for the input field so it can be fetched in the form + * @param name + */ + setName(name: string): void; + + /** + * Sets the current selection with the JSON items provided + * @param items + */ + setSelection(items: Array): void; + + /** + * Sets a value for the combo box. Value must be an array of values with data type matching valueField one. + * @param data + */ + setValue(values: Array): void; + + /** + * Sets data params for subsequent ajax requests + * @param params + */ + setDataUrlParams(params: any): void; + + } +} \ No newline at end of file From 68dd8244f14677b3bf8f17dbb50090721c65175d Mon Sep 17 00:00:00 2001 From: LCHProducciones Date: Tue, 26 May 2015 21:44:01 -0300 Subject: [PATCH 168/179] Changed definitios url --- magicsuggest/magicsuggest.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/magicsuggest/magicsuggest.d.ts b/magicsuggest/magicsuggest.d.ts index 4d031c39f..9cb09e3e8 100644 --- a/magicsuggest/magicsuggest.d.ts +++ b/magicsuggest/magicsuggest.d.ts @@ -1,7 +1,7 @@ // Type definitions for MagicSuggest 2.1.4 // Project: http://nicolasbize.com/magicsuggest // Definitions by: Leonardo Chaia -// Definitions: http://github.com/leonardochaia +// Definitions: http://github.com/leonardochaia/DefinitelyTyped /// interface JQuery { @@ -460,4 +460,4 @@ declare module MagicSuggest { setDataUrlParams(params: any): void; } -} \ No newline at end of file +} From 69750463b614f599f4f95496daed88ce8a489610 Mon Sep 17 00:00:00 2001 From: LCHProducciones Date: Wed, 27 May 2015 17:57:12 -0300 Subject: [PATCH 169/179] Added tests file. Bugfixes on definitions --- magicsuggest/magicsuggest-tests.ts | 24 ++++++++++++++++++++++++ magicsuggest/magicsuggest.d.ts | 7 +++++-- 2 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 magicsuggest/magicsuggest-tests.ts diff --git a/magicsuggest/magicsuggest-tests.ts b/magicsuggest/magicsuggest-tests.ts new file mode 100644 index 000000000..993f6cde3 --- /dev/null +++ b/magicsuggest/magicsuggest-tests.ts @@ -0,0 +1,24 @@ + +function basicTest() { + $('#magicSuggest').magicSuggest(); +} + +function testWithConfigurationOptions() { + $('#magicSuggest').magicSuggest({ + data: [ + { id: 1, name: "Buenos Aires" }, + { id: 2, name: "New York" }, + { id: 3, name: "Madrid" }, + ], + maxDropHeight: 500, + maxSelection: 2, + expandOnFocus: true, + }); +} + +function testSomeMethods() { + var ms = $('#magicSuggest').magicSuggest(); + ms.addToSelection([{ id: 1, name: "Mexico" }]); + console.info(ms.getSelection()); + ms.disable() +} \ No newline at end of file diff --git a/magicsuggest/magicsuggest.d.ts b/magicsuggest/magicsuggest.d.ts index 9cb09e3e8..f1ac71a2e 100644 --- a/magicsuggest/magicsuggest.d.ts +++ b/magicsuggest/magicsuggest.d.ts @@ -5,7 +5,10 @@ /// interface JQuery { - magicSuggest: (configurationObject: MagicSuggest.Configuration) => MagicSuggest.Instance; + /** + * Initialize MagicSuggest on this selector + */ + magicSuggest(configurationObject?: MagicSuggest.Configuration): MagicSuggest.Instance; } declare module MagicSuggest { @@ -460,4 +463,4 @@ declare module MagicSuggest { setDataUrlParams(params: any): void; } -} +} \ No newline at end of file From 99d72aacf41a3b2bc6c48a3da50940989a3c5563 Mon Sep 17 00:00:00 2001 From: LCHProducciones Date: Wed, 27 May 2015 18:02:55 -0300 Subject: [PATCH 170/179] Forgot to add the reference to typings on test file --- magicsuggest/magicsuggest-tests.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/magicsuggest/magicsuggest-tests.ts b/magicsuggest/magicsuggest-tests.ts index 993f6cde3..b41cf9f71 100644 --- a/magicsuggest/magicsuggest-tests.ts +++ b/magicsuggest/magicsuggest-tests.ts @@ -1,4 +1,6 @@ - +/// +/// + function basicTest() { $('#magicSuggest').magicSuggest(); } From 0f894228dfd3ad45b843dbf2fd445e4da04e8e55 Mon Sep 17 00:00:00 2001 From: Dmitry Radkovskiy Date: Thu, 28 May 2015 00:43:38 +0300 Subject: [PATCH 171/179] Moved declarations to moment-node.d.ts --- moment/moment-node.d.ts | 482 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 482 insertions(+) create mode 100644 moment/moment-node.d.ts diff --git a/moment/moment-node.d.ts b/moment/moment-node.d.ts new file mode 100644 index 000000000..13f1b9362 --- /dev/null +++ b/moment/moment-node.d.ts @@ -0,0 +1,482 @@ +// Type definitions for Moment.js 2.8.0 +// Project: https://github.com/timrwood/moment +// Definitions by: Michael Lakerveld , Aaron King , Hiroki Horiuchi , Dick van den Brink , Adi Dahiya +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module moment { + + interface MomentInput { + + years?: number; + y?: number; + + months?: number; + M?: number; + + weeks?: number; + w?: number; + + days?: number; + d?: number; + + hours?: number; + h?: number; + + minutes?: number; + m?: number; + + seconds?: number; + s?: number; + + milliseconds?: number; + ms?: number; + + } + + interface Duration { + + humanize(withSuffix?: boolean): string; + + as(units: string): number; + + milliseconds(): number; + asMilliseconds(): number; + + seconds(): number; + asSeconds(): number; + + minutes(): number; + asMinutes(): number; + + hours(): number; + asHours(): number; + + days(): number; + asDays(): number; + + months(): number; + asMonths(): number; + + years(): number; + asYears(): number; + + add(n: number, p: string): Duration; + add(n: number): Duration; + add(d: Duration): Duration; + + subtract(n: number, p: string): Duration; + subtract(n: number): Duration; + subtract(d: Duration): Duration; + + toISOString(): string; + + } + + interface Moment { + + format(format: string): string; + format(): string; + + fromNow(withoutSuffix?: boolean): string; + + startOf(unitOfTime: string): Moment; + endOf(unitOfTime: string): Moment; + + /** + * Mutates the original moment by adding time. (deprecated in 2.8.0) + * + * @param unitOfTime the unit of time you want to add (eg "years" / "hours" etc) + * @param amount the amount you want to add + */ + add(unitOfTime: string, amount: number): Moment; + /** + * Mutates the original moment by adding time. + * + * @param amount the amount you want to add + * @param unitOfTime the unit of time you want to add (eg "years" / "hours" etc) + */ + add(amount: number, unitOfTime: string): Moment; + /** + * Mutates the original moment by adding time. Note that the order of arguments can be flipped. + * + * @param amount the amount you want to add + * @param unitOfTime the unit of time you want to add (eg "years" / "hours" etc) + */ + add(amount: string, unitOfTime: string): Moment; + /** + * Mutates the original moment by adding time. + * + * @param objectLiteral an object literal that describes multiple time units {days:7,months:1} + */ + add(objectLiteral: MomentInput): Moment; + /** + * Mutates the original moment by adding time. + * + * @param duration a length of time + */ + add(duration: Duration): Moment; + + /** + * Mutates the original moment by subtracting time. (deprecated in 2.8.0) + * + * @param unitOfTime the unit of time you want to subtract (eg "years" / "hours" etc) + * @param amount the amount you want to subtract + */ + subtract(unitOfTime: string, amount: number): Moment; + /** + * Mutates the original moment by subtracting time. + * + * @param unitOfTime the unit of time you want to subtract (eg "years" / "hours" etc) + * @param amount the amount you want to subtract + */ + subtract(amount: number, unitOfTime: string): Moment; + /** + * Mutates the original moment by subtracting time. Note that the order of arguments can be flipped. + * + * @param amount the amount you want to add + * @param unitOfTime the unit of time you want to subtract (eg "years" / "hours" etc) + */ + subtract(amount: string, unitOfTime: string): Moment; + /** + * Mutates the original moment by subtracting time. + * + * @param objectLiteral an object literal that describes multiple time units {days:7,months:1} + */ + subtract(objectLiteral: MomentInput): Moment; + /** + * Mutates the original moment by subtracting time. + * + * @param duration a length of time + */ + subtract(duration: Duration): Moment; + + calendar(): string; + calendar(start: Moment): string; + + clone(): Moment; + + /** + * @return Unix timestamp, or milliseconds since the epoch. + */ + valueOf(): number; + + local(): Moment; // current date/time in local mode + + utc(): Moment; // current date/time in UTC mode + + isValid(): boolean; + + year(y: number): Moment; + year(): number; + quarter(): number; + quarter(q: number): Moment; + month(M: number): Moment; + month(M: string): Moment; + month(): number; + day(d: number): Moment; + day(d: string): Moment; + day(): number; + date(d: number): Moment; + date(): number; + hour(h: number): Moment; + hour(): number; + hours(h: number): Moment; + hours(): number; + minute(m: number): Moment; + minute(): number; + minutes(m: number): Moment; + minutes(): number; + second(s: number): Moment; + second(): number; + seconds(s: number): Moment; + seconds(): number; + millisecond(ms: number): Moment; + millisecond(): number; + milliseconds(ms: number): Moment; + milliseconds(): number; + weekday(): number; + weekday(d: number): Moment; + isoWeekday(): number; + isoWeekday(d: number): Moment; + weekYear(): number; + weekYear(d: number): Moment; + isoWeekYear(): number; + isoWeekYear(d: number): Moment; + week(): number; + week(d: number): Moment; + weeks(): number; + weeks(d: number): Moment; + isoWeek(): number; + isoWeek(d: number): Moment; + isoWeeks(): number; + isoWeeks(d: number): Moment; + weeksInYear(): number; + isoWeeksInYear(): number; + 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; + + diff(b: Moment): number; + diff(b: Moment, unitOfTime: string): number; + diff(b: Moment, unitOfTime: string, round: boolean): number; + + toArray(): number[]; + toDate(): Date; + toISOString(): string; + toJSON(): string; + unix(): number; + + isLeapYear(): boolean; + zone(): number; + zone(b: number): Moment; + zone(b: string): Moment; + utcOffset(): number; + utcOffset(b: number): Moment; + utcOffset(b: string): Moment; + daysInMonth(): number; + 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; + + 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; + + 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; + + // Deprecated as of 2.8.0. + lang(language: string): Moment; + lang(reset: boolean): Moment; + lang(): MomentLanguage; + + locale(language: string): Moment; + locale(reset: boolean): Moment; + locale(): string; + + localeData(language: string): Moment; + localeData(reset: boolean): 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: 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: string, format: string): Moment; + min(clone: Moment): Moment; + + get(unit: string): number; + set(unit: string, value: number): Moment; + + } + + interface MomentCalendar { + + lastDay: any; + sameDay: any; + nextDay: any; + lastWeek: any; + nextWeek: any; + sameElse: any; + + } + + interface BaseMomentLanguage { + months ?: any; + monthsShort ?: any; + weekdays ?: any; + weekdaysShort ?: any; + weekdaysMin ?: any; + relativeTime ?: MomentRelativeTime; + meridiem ?: (hour: number, minute: number, isLowercase: boolean) => string; + calendar ?: MomentCalendar; + ordinal ?: (num: number) => string; + } + + interface MomentLanguage extends BaseMomentLanguage { + longDateFormat?: MomentLongDateFormat; + } + + interface MomentLanguageData extends BaseMomentLanguage { + /** + * @param formatType should be L, LL, LLL, LLLL. + */ + longDateFormat(formatType: string): string; + } + + interface MomentLongDateFormat { + + L: string; + LL: string; + LLL: string; + LLLL: string; + LT: string; + l?: string; + ll?: string; + lll?: string; + llll?: string; + lt?: string; + + } + + interface MomentRelativeTime { + + future: any; + past: any; + s: any; + m: any; + mm: any; + h: any; + hh: any; + d: any; + dd: any; + M: any; + MM: any; + y: any; + yy: any; + + } + + interface MomentStatic { + + version: string; + + (): Moment; + (date: number): Moment; + (date: number[]): Moment; + (date: string, format?: string, strict?: boolean): Moment; + (date: string, format?: string, language?: string, strict?: boolean): Moment; + (date: string, formats: string[], strict?: boolean): Moment; + (date: string, formats: string[], language?: string, strict?: boolean): Moment; + (date: string, specialFormat: () => void, strict?: boolean): Moment; + (date: string, specialFormat: () => void, language?: string, strict?: boolean): Moment; + (date: string, formatsIncludingSpecial: any[], strict?: boolean): Moment; + (date: string, formatsIncludingSpecial: any[], language?: string, strict?: boolean): Moment; + (date: Date): Moment; + (date: Moment): Moment; + (date: Object): Moment; + + utc(): Moment; + utc(date: number): Moment; + utc(date: number[]): Moment; + utc(date: string, format?: string, strict?: boolean): Moment; + utc(date: string, format?: string, language?: string, strict?: boolean): Moment; + utc(date: string, formats: string[], strict?: boolean): Moment; + utc(date: string, formats: string[], language?: string, strict?: boolean): Moment; + utc(date: Date): Moment; + utc(date: Moment): Moment; + utc(date: Object): Moment; + + unix(timestamp: number): Moment; + + invalid(parsingFlags?: Object): Moment; + isMoment(): boolean; + isMoment(m: any): boolean; + isDuration(): boolean; + isDuration(d: any): boolean; + + // Deprecated in 2.8.0. + lang(language?: string): string; + lang(language?: string, definition?: MomentLanguage): string; + + locale(language?: string): string; + locale(language?: string[]): string; + locale(language?: string, definition?: MomentLanguage): string; + + localeData(language?: string): MomentLanguageData; + + longDateFormat: any; + relativeTime: any; + meridiem: (hour: number, minute: number, isLowercase: boolean) => string; + calendar: any; + ordinal: (num: number) => string; + + duration(milliseconds: Number): Duration; + duration(num: Number, unitOfTime: string): Duration; + duration(input: MomentInput): Duration; + duration(object: any): Duration; + duration(): Duration; + + parseZone(date: string): Moment; + + months(): string[]; + months(index: number): string; + months(format: string): string[]; + months(format: string, index: number): string; + monthsShort(): string[]; + monthsShort(index: number): string; + monthsShort(format: string): string[]; + monthsShort(format: string, index: number): string; + + weekdays(): string[]; + weekdays(index: number): string; + weekdays(format: string): string[]; + weekdays(format: string, index: number): string; + weekdaysShort(): string[]; + weekdaysShort(index: number): string; + weekdaysShort(format: string): string[]; + weekdaysShort(format: string, index: number): string; + weekdaysMin(): string[]; + weekdaysMin(index: number): string; + weekdaysMin(format: string): string[]; + weekdaysMin(format: string, index: number): string; + + min(moments: Moment[]): Moment; + max(moments: Moment[]): Moment; + + normalizeUnits(unit: string): string; + relativeTimeThreshold(threshold: string, limit: number): void; + + /** + * Constant used to enable explicit ISO_8601 format parsing. + */ + ISO_8601(): void; + + } + +} + +declare module 'moment' { + var moment: moment.MomentStatic; + export = moment; +} From a1575b96ec38e916750629839d2110cb96210f89 Mon Sep 17 00:00:00 2001 From: Dmitry Radkovskiy Date: Thu, 28 May 2015 00:46:21 +0300 Subject: [PATCH 172/179] Modified moment.d.ts to use moment-node.d.ts --- moment/moment.d.ts | 477 +-------------------------------------------- 1 file changed, 1 insertion(+), 476 deletions(-) diff --git a/moment/moment.d.ts b/moment/moment.d.ts index e09aab1d5..736956e5d 100644 --- a/moment/moment.d.ts +++ b/moment/moment.d.ts @@ -3,481 +3,6 @@ // Definitions by: Michael Lakerveld , Aaron King , Hiroki Horiuchi , Dick van den Brink , Adi Dahiya // Definitions: https://github.com/borisyankov/DefinitelyTyped -declare module moment { - - interface MomentInput { - - years?: number; - y?: number; - - months?: number; - M?: number; - - weeks?: number; - w?: number; - - days?: number; - d?: number; - - hours?: number; - h?: number; - - minutes?: number; - m?: number; - - seconds?: number; - s?: number; - - milliseconds?: number; - ms?: number; - - } - - interface Duration { - - humanize(withSuffix?: boolean): string; - - as(units: string): number; - - milliseconds(): number; - asMilliseconds(): number; - - seconds(): number; - asSeconds(): number; - - minutes(): number; - asMinutes(): number; - - hours(): number; - asHours(): number; - - days(): number; - asDays(): number; - - months(): number; - asMonths(): number; - - years(): number; - asYears(): number; - - add(n: number, p: string): Duration; - add(n: number): Duration; - add(d: Duration): Duration; - - subtract(n: number, p: string): Duration; - subtract(n: number): Duration; - subtract(d: Duration): Duration; - - toISOString(): string; - - } - - interface Moment { - - format(format: string): string; - format(): string; - - fromNow(withoutSuffix?: boolean): string; - - startOf(unitOfTime: string): Moment; - endOf(unitOfTime: string): Moment; - - /** - * Mutates the original moment by adding time. (deprecated in 2.8.0) - * - * @param unitOfTime the unit of time you want to add (eg "years" / "hours" etc) - * @param amount the amount you want to add - */ - add(unitOfTime: string, amount: number): Moment; - /** - * Mutates the original moment by adding time. - * - * @param amount the amount you want to add - * @param unitOfTime the unit of time you want to add (eg "years" / "hours" etc) - */ - add(amount: number, unitOfTime: string): Moment; - /** - * Mutates the original moment by adding time. Note that the order of arguments can be flipped. - * - * @param amount the amount you want to add - * @param unitOfTime the unit of time you want to add (eg "years" / "hours" etc) - */ - add(amount: string, unitOfTime: string): Moment; - /** - * Mutates the original moment by adding time. - * - * @param objectLiteral an object literal that describes multiple time units {days:7,months:1} - */ - add(objectLiteral: MomentInput): Moment; - /** - * Mutates the original moment by adding time. - * - * @param duration a length of time - */ - add(duration: Duration): Moment; - - /** - * Mutates the original moment by subtracting time. (deprecated in 2.8.0) - * - * @param unitOfTime the unit of time you want to subtract (eg "years" / "hours" etc) - * @param amount the amount you want to subtract - */ - subtract(unitOfTime: string, amount: number): Moment; - /** - * Mutates the original moment by subtracting time. - * - * @param unitOfTime the unit of time you want to subtract (eg "years" / "hours" etc) - * @param amount the amount you want to subtract - */ - subtract(amount: number, unitOfTime: string): Moment; - /** - * Mutates the original moment by subtracting time. Note that the order of arguments can be flipped. - * - * @param amount the amount you want to add - * @param unitOfTime the unit of time you want to subtract (eg "years" / "hours" etc) - */ - subtract(amount: string, unitOfTime: string): Moment; - /** - * Mutates the original moment by subtracting time. - * - * @param objectLiteral an object literal that describes multiple time units {days:7,months:1} - */ - subtract(objectLiteral: MomentInput): Moment; - /** - * Mutates the original moment by subtracting time. - * - * @param duration a length of time - */ - subtract(duration: Duration): Moment; - - calendar(): string; - calendar(start: Moment): string; - - clone(): Moment; - - /** - * @return Unix timestamp, or milliseconds since the epoch. - */ - valueOf(): number; - - local(): Moment; // current date/time in local mode - - utc(): Moment; // current date/time in UTC mode - - isValid(): boolean; - - year(y: number): Moment; - year(): number; - quarter(): number; - quarter(q: number): Moment; - month(M: number): Moment; - month(M: string): Moment; - month(): number; - day(d: number): Moment; - day(d: string): Moment; - day(): number; - date(d: number): Moment; - date(): number; - hour(h: number): Moment; - hour(): number; - hours(h: number): Moment; - hours(): number; - minute(m: number): Moment; - minute(): number; - minutes(m: number): Moment; - minutes(): number; - second(s: number): Moment; - second(): number; - seconds(s: number): Moment; - seconds(): number; - millisecond(ms: number): Moment; - millisecond(): number; - milliseconds(ms: number): Moment; - milliseconds(): number; - weekday(): number; - weekday(d: number): Moment; - isoWeekday(): number; - isoWeekday(d: number): Moment; - weekYear(): number; - weekYear(d: number): Moment; - isoWeekYear(): number; - isoWeekYear(d: number): Moment; - week(): number; - week(d: number): Moment; - weeks(): number; - weeks(d: number): Moment; - isoWeek(): number; - isoWeek(d: number): Moment; - isoWeeks(): number; - isoWeeks(d: number): Moment; - weeksInYear(): number; - isoWeeksInYear(): number; - 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; - - diff(b: Moment): number; - diff(b: Moment, unitOfTime: string): number; - diff(b: Moment, unitOfTime: string, round: boolean): number; - - toArray(): number[]; - toDate(): Date; - toISOString(): string; - toJSON(): string; - unix(): number; - - isLeapYear(): boolean; - zone(): number; - zone(b: number): Moment; - zone(b: string): Moment; - utcOffset(): number; - utcOffset(b: number): Moment; - utcOffset(b: string): Moment; - daysInMonth(): number; - 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; - - 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; - - 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; - - // Deprecated as of 2.8.0. - lang(language: string): Moment; - lang(reset: boolean): Moment; - lang(): MomentLanguage; - - locale(language: string): Moment; - locale(reset: boolean): Moment; - locale(): string; - - localeData(language: string): Moment; - localeData(reset: boolean): 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: 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: string, format: string): Moment; - min(clone: Moment): Moment; - - get(unit: string): number; - set(unit: string, value: number): Moment; - - } - - interface MomentCalendar { - - lastDay: any; - sameDay: any; - nextDay: any; - lastWeek: any; - nextWeek: any; - sameElse: any; - - } - - interface BaseMomentLanguage { - months ?: any; - monthsShort ?: any; - weekdays ?: any; - weekdaysShort ?: any; - weekdaysMin ?: any; - relativeTime ?: MomentRelativeTime; - meridiem ?: (hour: number, minute: number, isLowercase: boolean) => string; - calendar ?: MomentCalendar; - ordinal ?: (num: number) => string; - } - - interface MomentLanguage extends BaseMomentLanguage { - longDateFormat?: MomentLongDateFormat; - } - - interface MomentLanguageData extends BaseMomentLanguage { - /** - * @param formatType should be L, LL, LLL, LLLL. - */ - longDateFormat(formatType: string): string; - } - - interface MomentLongDateFormat { - - L: string; - LL: string; - LLL: string; - LLLL: string; - LT: string; - l?: string; - ll?: string; - lll?: string; - llll?: string; - lt?: string; - - } - - interface MomentRelativeTime { - - future: any; - past: any; - s: any; - m: any; - mm: any; - h: any; - hh: any; - d: any; - dd: any; - M: any; - MM: any; - y: any; - yy: any; - - } - - interface MomentStatic { - - version: string; - - (): Moment; - (date: number): Moment; - (date: number[]): Moment; - (date: string, format?: string, strict?: boolean): Moment; - (date: string, format?: string, language?: string, strict?: boolean): Moment; - (date: string, formats: string[], strict?: boolean): Moment; - (date: string, formats: string[], language?: string, strict?: boolean): Moment; - (date: string, specialFormat: () => void, strict?: boolean): Moment; - (date: string, specialFormat: () => void, language?: string, strict?: boolean): Moment; - (date: string, formatsIncludingSpecial: any[], strict?: boolean): Moment; - (date: string, formatsIncludingSpecial: any[], language?: string, strict?: boolean): Moment; - (date: Date): Moment; - (date: Moment): Moment; - (date: Object): Moment; - - utc(): Moment; - utc(date: number): Moment; - utc(date: number[]): Moment; - utc(date: string, format?: string, strict?: boolean): Moment; - utc(date: string, format?: string, language?: string, strict?: boolean): Moment; - utc(date: string, formats: string[], strict?: boolean): Moment; - utc(date: string, formats: string[], language?: string, strict?: boolean): Moment; - utc(date: Date): Moment; - utc(date: Moment): Moment; - utc(date: Object): Moment; - - unix(timestamp: number): Moment; - - invalid(parsingFlags?: Object): Moment; - isMoment(): boolean; - isMoment(m: any): boolean; - isDuration(): boolean; - isDuration(d: any): boolean; - - // Deprecated in 2.8.0. - lang(language?: string): string; - lang(language?: string, definition?: MomentLanguage): string; - - locale(language?: string): string; - locale(language?: string[]): string; - locale(language?: string, definition?: MomentLanguage): string; - - localeData(language?: string): MomentLanguageData; - - longDateFormat: any; - relativeTime: any; - meridiem: (hour: number, minute: number, isLowercase: boolean) => string; - calendar: any; - ordinal: (num: number) => string; - - duration(milliseconds: Number): Duration; - duration(num: Number, unitOfTime: string): Duration; - duration(input: MomentInput): Duration; - duration(object: any): Duration; - duration(): Duration; - - parseZone(date: string): Moment; - - months(): string[]; - months(index: number): string; - months(format: string): string[]; - months(format: string, index: number): string; - monthsShort(): string[]; - monthsShort(index: number): string; - monthsShort(format: string): string[]; - monthsShort(format: string, index: number): string; - - weekdays(): string[]; - weekdays(index: number): string; - weekdays(format: string): string[]; - weekdays(format: string, index: number): string; - weekdaysShort(): string[]; - weekdaysShort(index: number): string; - weekdaysShort(format: string): string[]; - weekdaysShort(format: string, index: number): string; - weekdaysMin(): string[]; - weekdaysMin(index: number): string; - weekdaysMin(format: string): string[]; - weekdaysMin(format: string, index: number): string; - - min(moments: Moment[]): Moment; - max(moments: Moment[]): Moment; - - normalizeUnits(unit: string): string; - relativeTimeThreshold(threshold: string, limit: number): void; - - /** - * Constant used to enable explicit ISO_8601 format parsing. - */ - ISO_8601(): void; - - } - -} +/// declare var moment: moment.MomentStatic; - -declare module 'moment' { - export = moment; -} From 4e99d96891661b1d8885e2748b812b7d1ea19dbb Mon Sep 17 00:00:00 2001 From: LCHProducciones Date: Wed, 27 May 2015 19:43:27 -0300 Subject: [PATCH 173/179] Bugfixes on definitions --- magicsuggest/magicsuggest.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/magicsuggest/magicsuggest.d.ts b/magicsuggest/magicsuggest.d.ts index f1ac71a2e..660a58c5c 100644 --- a/magicsuggest/magicsuggest.d.ts +++ b/magicsuggest/magicsuggest.d.ts @@ -447,8 +447,9 @@ declare module MagicSuggest { /** * Sets the current selection with the JSON items provided * @param items + * @param isSilent - (optional) */ - setSelection(items: Array): void; + setSelection(items: Array, isSilet?: boolean): void; /** * Sets a value for the combo box. Value must be an array of values with data type matching valueField one. From 23b92b854f13406ad47da99ecdcc4855f7e2cc28 Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Thu, 28 May 2015 15:36:30 +0200 Subject: [PATCH 174/179] Type definitions for urlsafe-base64 v1.0.0 --- urlsafe-base64/urlsafe-base64-tests.ts | 9 +++++ urlsafe-base64/urlsafe-base64.d.ts | 50 ++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 urlsafe-base64/urlsafe-base64-tests.ts create mode 100644 urlsafe-base64/urlsafe-base64.d.ts diff --git a/urlsafe-base64/urlsafe-base64-tests.ts b/urlsafe-base64/urlsafe-base64-tests.ts new file mode 100644 index 000000000..2c7d4722f --- /dev/null +++ b/urlsafe-base64/urlsafe-base64-tests.ts @@ -0,0 +1,9 @@ +/// + +import URLSafeBase64 = require('urlsafe-base64'); + +var base64 = URLSafeBase64.encode(new Buffer('3Rpbmd1aXNoZWQ', 'base64')); + +var buf = URLSafeBase64.decode('3Rpbmd1aXNoZWQ'); + +var isValid = URLSafeBase64.validate('3Rpbmd1aXNoZWQ'); diff --git a/urlsafe-base64/urlsafe-base64.d.ts b/urlsafe-base64/urlsafe-base64.d.ts new file mode 100644 index 000000000..c9c6ed0b9 --- /dev/null +++ b/urlsafe-base64/urlsafe-base64.d.ts @@ -0,0 +1,50 @@ +// Type definitions for urlsafe-base64 v1.0.0 +// Project: https://github.com/RGBboy/urlsafe-base64 +// Definitions by: Tanguy Krotoff +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module 'urlsafe-base64' { + /** + * Library version. + */ + export var version: string; + + /** + * .encode + * + * return an encoded Buffer as URL Safe Base64 + * + * Note: This function encodes to the RFC 4648 Spec where '+' is encoded + * as '-' and '/' is encoded as '_'. The padding character '=' is + * removed. + * + * @param {Buffer} buffer + * @return {String} + * @api public + */ + export function encode(buffer: Buffer): string; + + /** + * .decode + * + * return an decoded URL Safe Base64 as Buffer + * + * @param {String} + * @return {Buffer} + * @api public + */ + export function decode(base64: string): Buffer; + + /** + * .validate + * + * Validates a string if it is URL Safe Base64 encoded. + * + * @param {String} + * @return {Boolean} + * @api public + */ + export function validate(base64: string): boolean; +} From 9920fd383c8a426d91eaae34ed33ab23046d8ae5 Mon Sep 17 00:00:00 2001 From: LeandroDG Date: Thu, 28 May 2015 13:25:04 -0300 Subject: [PATCH 175/179] Adding basic authentication support Added property "auth" to options class and method "request.auth" to provide basic authentication --- request/request.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/request/request.d.ts b/request/request.d.ts index eff35ada6..e94a04ad1 100644 --- a/request/request.d.ts +++ b/request/request.d.ts @@ -62,6 +62,7 @@ declare module 'request' { callback?: (error: any, response: any, body: any) => void; jar?: any; // CookieJar form?: any; // Object or string + auth?: AuthOptions; oauth?: OAuthOptions; aws?: AWSOptions; hawk ?: HawkOptions; @@ -107,6 +108,7 @@ declare module 'request' { multipart(multipart: RequestPart[]): Request; json(val: any): Request; aws(opts: AWSOptions, now?: boolean): Request; + auth(username: string, password: string, sendInmediately?: boolean, bearer?: string): Request; oauth(oauth: OAuthOptions): Request; jar(jar: CookieJar): Request; From 292104d982d25965eefa0411ce0e1118323b4dc7 Mon Sep 17 00:00:00 2001 From: LeandroDG Date: Thu, 28 May 2015 18:13:44 -0300 Subject: [PATCH 176/179] Changed response type to http.IncomingMessage --- request/request.d.ts | 50 ++++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/request/request.d.ts b/request/request.d.ts index e94a04ad1..e16eafadb 100644 --- a/request/request.d.ts +++ b/request/request.d.ts @@ -15,40 +15,40 @@ declare module 'request' { export = RequestAPI; - function RequestAPI(uri: string, options?: RequestAPI.Options, callback?: (error: any, response: any, body: any) => void): RequestAPI.Request; - function RequestAPI(uri: string, callback?: (error: any, response: any, body: any) => void): RequestAPI.Request; - function RequestAPI(options: RequestAPI.Options, callback?: (error: any, response: any, body: any) => void): RequestAPI.Request; + function RequestAPI(uri: string, options?: RequestAPI.Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): RequestAPI.Request; + function RequestAPI(uri: string, callback?: (error: any, response: http.IncomingMessage, body: any) => void): RequestAPI.Request; + function RequestAPI(options: RequestAPI.Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): RequestAPI.Request; module RequestAPI { export function defaults(options: Options): typeof RequestAPI; - export function request(uri: string, options?: Options, callback?: (error: any, response: any, body: any) => void): Request; - export function request(uri: string, callback?: (error: any, response: any, body: any) => void): Request; - export function request(options?: Options, callback?: (error: any, response: any, body: any) => void): Request; + export function request(uri: string, options?: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request; + export function request(uri: string, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request; + export function request(options?: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request; - export function get(uri: string, options?: Options, callback?: (error: any, response: any, body: any) => void): Request; - export function get(uri: string, callback?: (error: any, response: any, body: any) => void): Request; - export function get(options: Options, callback?: (error: any, response: any, body: any) => void): Request; + export function get(uri: string, options?: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request; + export function get(uri: string, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request; + export function get(options: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request; - export function post(uri: string, options?: Options, callback?: (error: any, response: any, body: any) => void): Request; - export function post(uri: string, callback?: (error: any, response: any, body: any) => void): Request; - export function post(options: Options, callback?: (error: any, response: any, body: any) => void): Request; + export function post(uri: string, options?: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request; + export function post(uri: string, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request; + export function post(options: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request; - export function put(uri: string, options?: Options, callback?: (error: any, response: any, body: any) => void): Request; - export function put(uri: string, callback?: (error: any, response: any, body: any) => void): Request; - export function put(options: Options, callback?: (error: any, response: any, body: any) => void): Request; + export function put(uri: string, options?: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request; + export function put(uri: string, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request; + export function put(options: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request; - export function head(uri: string, options?: Options, callback?: (error: any, response: any, body: any) => void): Request; - export function head(uri: string, callback?: (error: any, response: any, body: any) => void): Request; - export function head(options: Options, callback?: (error: any, response: any, body: any) => void): Request; + export function head(uri: string, options?: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request; + export function head(uri: string, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request; + export function head(options: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request; - export function patch(uri: string, options?: Options, callback?: (error: any, response: any, body: any) => void): Request; - export function patch(uri: string, callback?: (error: any, response: any, body: any) => void): Request; - export function patch(options: Options, callback?: (error: any, response: any, body: any) => void): Request; + export function patch(uri: string, options?: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request; + export function patch(uri: string, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request; + export function patch(options: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request; - export function del(uri: string, options?: Options, callback?: (error: any, response: any, body: any) => void): Request; - export function del(uri: string, callback?: (error: any, response: any, body: any) => void): Request; - export function del(options: Options, callback?: (error: any, response: any, body: any) => void): Request; + export function del(uri: string, options?: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request; + export function del(uri: string, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request; + export function del(options: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request; export function forever(agentOptions: any, optionsArg: any): Request; export function jar(): CookieJar; @@ -59,7 +59,7 @@ declare module 'request' { export interface Options { url?: string; uri?: string; - callback?: (error: any, response: any, body: any) => void; + callback?: (error: any, response: http.IncomingMessage, body: any) => void; jar?: any; // CookieJar form?: any; // Object or string auth?: AuthOptions; From 3afd16a3691da4a9be175374f127730fbf87dc7a Mon Sep 17 00:00:00 2001 From: Fabian Raetz Date: Fri, 29 May 2015 00:33:31 +0200 Subject: [PATCH 177/179] add test case for fulfilled --- chai-as-promised/chai-as-promised-tests.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/chai-as-promised/chai-as-promised-tests.ts b/chai-as-promised/chai-as-promised-tests.ts index a2dcb72ed..95a433517 100644 --- a/chai-as-promised/chai-as-promised-tests.ts +++ b/chai-as-promised/chai-as-promised-tests.ts @@ -9,6 +9,7 @@ chai.use(chaiAsPromised); var promise: any; chai.expect(promise).to.eventually.equal(3); chai.expect(promise).to.become(3); +chai.expect(promise).to.be.fulfilled; chai.expect(promise).to.be.rejected; chai.expect(promise).to.be.rejectedWith(Error); chai.expect(promise).to.notify(() => console.log('done')); From 5b0830b61e0cd5ba8dfe37bca50e47af2d3d1575 Mon Sep 17 00:00:00 2001 From: Fabian Raetz Date: Fri, 29 May 2015 00:34:31 +0200 Subject: [PATCH 178/179] add fulfilled to Assertion --- chai-as-promised/chai-as-promised.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/chai-as-promised/chai-as-promised.d.ts b/chai-as-promised/chai-as-promised.d.ts index 6ff150eb4..106bbf41e 100644 --- a/chai-as-promised/chai-as-promised.d.ts +++ b/chai-as-promised/chai-as-promised.d.ts @@ -14,6 +14,7 @@ declare module Chai { interface Assertion { become(expected: any): Assertion; + fulfilled: Assertion; rejected: Assertion; rejectedWith(expected: any): Assertion; notify(fn: Function): Assertion; From dfc08933163f1e36ba0bad0390bcc2a1a4636bd3 Mon Sep 17 00:00:00 2001 From: John Reilly Date: Fri, 29 May 2015 13:24:40 +0100 Subject: [PATCH 179/179] Update angular.d.ts - JSDoc-ed $filter --- angularjs/angular.d.ts | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index 92784af38..1b12c2026 100755 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -736,17 +736,37 @@ declare module angular { eventFn(element: Node, doneFn: () => void): Function; } - /////////////////////////////////////////////////////////////////////////// - // FilterService - // see http://docs.angularjs.org/api/ng.$filter - // see http://docs.angularjs.org/api/ng.$filterProvider - /////////////////////////////////////////////////////////////////////////// + /** + * $filter - $filterProvider - service in module ng + * + * Filters are used for formatting data displayed to the user. + * + * see https://docs.angularjs.org/api/ng/service/$filter + */ interface IFilterService { + /** + * Usage: + * $filter(name); + * + * @param name Name of the filter function to retrieve + */ (name: string): Function; } + /** + * $filterProvider - $filter - provider in module ng + * + * Filters are just functions which transform input to an output. However filters need to be Dependency Injected. To achieve this a filter definition consists of a factory function which is annotated with dependencies and is responsible for creating a filter function. + * + * see https://docs.angularjs.org/api/ng/provider/$filterProvider + */ interface IFilterProvider extends IServiceProvider { - register(name: string, filterFactory: Function): IServiceProvider; + /** + * register(name); + * + * @param name Name of the filter function, or an object map of filters where the keys are the filter names and the values are the filter factories. Note: Filter names must be valid angular Expressions identifiers, such as uppercase or orderBy. Names with special characters, such as hyphens and dots, are not allowed. If you wish to namespace your filters, then you can use capitalization (myappSubsectionFilterx) or underscores (myapp_subsection_filterx). + */ + register(name: string | {}): IServiceProvider; } ///////////////////////////////////////////////////////////////////////////