Merge remote-tracking branch 'upstream/master'

This commit is contained in:
pr1st0n
2017-10-25 17:21:26 +03:00
754 changed files with 41078 additions and 50614 deletions
+1 -1
View File
@@ -2725,7 +2725,7 @@
/types/pug/ @TonyPythoneer @19majkel94
/types/pulltorefreshjs/ @DanielRosenwasser
/types/pump/ @tlaziuk
/types/puppeteer/ @marvinhagemeister
/types/puppeteer/ @marvinhagemeister @cdeutsch
/types/pure-render-decorator/ @seansfkelley
/types/purl/ @danfma
/types/pusher-js/ @tkqubo
+4
View File
@@ -1,5 +1,9 @@
If you know how to fix the issue, make a pull request instead.
- [ ] I tried using the `@types/xxxx` package and had problems.
- [ ] I tried using the latest stable version of tsc. https://www.npmjs.com/package/typescript
- [ ] I have a question that is inappropriate for [StackOverflow](https://stackoverflow.com/). (Please ask any appropriate questions there).
- [ ] [Mention](https://github.com/blog/821-mention-somebody-they-re-notified) the authors (see `Definitions by:` in `index.d.ts`) so they can respond.
- Authors: @....
If you do not mention the authors the issue will be ignored.
+1 -1
View File
@@ -12,7 +12,7 @@ If adding a new definition:
- [ ] The package does not provide its own types, and you can not add them.
- [ ] If this is for an NPM package, match the name. If not, do not conflict with the name of an NPM package.
- [ ] Create it with `dts-gen --dt`, not by basing it on an existing project.
- [ ] `tslint.json` should be present, and `tsconfig.json` should have `noImplicitAny`, `noImplicitThis`, and `strictNullChecks` set to `true`.
- [ ] `tslint.json` should be present, and `tsconfig.json` should have `noImplicitAny`, `noImplicitThis`, `strictNullChecks`, and `strictFunctionTypes` set to `true`.
If changing an existing definition:
- [ ] Provide a URL to documentation or source code which provides context for the suggested changes: <<url here>>
+6
View File
@@ -54,6 +54,12 @@
"sourceRepoURL": "https://github.com/ranisalt/node-argon2",
"asOfVersion": "0.15.0"
},
{
"libraryName": "askmethat-rating",
"typingsPackageName": "askmethat-rating",
"sourceRepoURL": "https://github.com/AlexTeixeira/Askmethat-Rating",
"asOfVersion": "0.4.0"
},
{
"libraryName": "aws-sdk",
"typingsPackageName": "aws-sdk",
+2
View File
@@ -3,6 +3,8 @@
"rules": {
"interface-name": [false],
"ban-types": false,
"no-redundant-jsdoc": false,
"no-redundant-jsdoc-2": false,
"no-unnecessary-qualifier": false
}
}
+6 -8
View File
@@ -455,7 +455,6 @@ declare namespace adone {
* Writes a 32bit le float
*
* @param offset Offset to write to
* @returns {this}
*/
writeFloatLE(value: number, offset?: number): this;
@@ -802,8 +801,7 @@ declare namespace adone {
* Resizes this ByteArray to be backed by a buffer of at least the given capacity.
* Will do nothing if already that large or larger.
*
* @param {number} capacity Capacity required
* @returns {this}
* @param capacity Capacity required
*/
resize(capacity: number): this;
@@ -1679,8 +1677,8 @@ declare namespace adone {
* Returns a new BufferList object containing the bytes within the range specified.
* No copies will be performed. All buffers in the result share memory with the original list.
*
* @param {number} start slice from
* @param {number} end slice to
* @param start slice from
* @param end slice to
*/
shallowSlice(start?: number, end?: number): BufferList;
@@ -1705,11 +1703,11 @@ declare namespace adone {
destroy(): void;
then<T1 = Buffer, T2 = never>(
onfulfilled?: ((value: Buffer) => T1 | PromiseLike<T1>) | undefined | null,
onrejected?: ((reason: any) => T2 | PromiseLike<T2>) | undefined | null
onfulfilled?: ((value: Buffer) => T1 | PromiseLike<T1>) | null,
onrejected?: ((reason: any) => T2 | PromiseLike<T2>) | null
): PromiseLike<T1 | T2>;
catch<T>(onrejected?: ((reason: any) => T | PromiseLike<T>) | undefined | null): PromiseLike<T | Buffer>;
catch<T>(onrejected?: ((reason: any) => T | PromiseLike<T>) | null): PromiseLike<T | Buffer>;
}
/**
+343 -361
View File
File diff suppressed because it is too large Load Diff
-205
View File
@@ -53,41 +53,27 @@ declare namespace adone.math {
/**
* Returns a new instance with the lane values swizzled.
* @param a
* @param l1
* @param l2
* @param l3
* @param l4
*/
swizzle(a: Float32x4, l1: number, l2: number, l3: number, l4: number): Float32x4;
/**
* Returns a new instance with the lane values shuffled.
* @param a
* @param b
* @param l1
* @param l2
* @param l3
* @param l4
*/
shuffle(a: Float32x4, b: Float32x4, l1: number, l2: number, l3: number, l4: number): Float32x4;
/**
* Returns a new instance if the parameter is a valid SIMD data type and the same as Float32x4. Throws a TypeError otherwise.
* @param a
*/
check(a: Float32x4): Float32x4;
/**
* Creates a new SIMD.Float32x4 data type with all lanes set to a given value.
* @param n
*/
splat(n: number): Float32x4;
/**
* Returns a new instance with the given lane value replaced.
* @param simd An instance of a corresponding SIMD type.
* @param lane
* @param value A new value to be used for the lane.
* @return A new SIMD data type with the given lane value replaced.
*/
@@ -121,16 +107,8 @@ declare namespace adone.math {
div(a: Float32x4, b: Float32x4): Float32x4;
/**
*
* @param a
*/
neg(a: Float32x4): Float32x4;
/**
*
* @param a
*/
abs(a: Float32x4): Float32x4;
min(a: Float32x4, b: Float32x4): Float32x4;
@@ -143,16 +121,8 @@ declare namespace adone.math {
reciprocalApproximation(a: Float32x4, b: Float32x4): Float32x4;
/**
*
* @param a
*/
reciprocalSqrtApproximation(a: Float32x4): Float32x4;
/**
*
* @param a
*/
sqrt(a: Float32x4): Float32x4;
/**
@@ -310,41 +280,27 @@ declare namespace adone.math {
/**
* Returns a new instance with the lane values swizzled.
* @param a
* @param l1
* @param l2
* @param l3
* @param l4
*/
swizzle(a: Int32x4, l1: number, l2: number, l3: number, l4: number): Int32x4;
/**
* Returns a new instance with the lane values shuffled.
* @param a
* @param b
* @param l1
* @param l2
* @param l3
* @param l4
*/
shuffle(a: Int32x4, b: Int32x4, l1: number, l2: number, l3: number, l4: number): Int32x4;
/**
* Returns a new instance if the parameter is a valid SIMD data type and the same as Int32x4. Throws a TypeError otherwise.
* @param a
*/
check(a: Int32x4): Int32x4;
/**
* Creates a new SIMD.Int32x4 data type with all lanes set to a given value.
* @param n
*/
splat(n: number): Int32x4;
/**
* Returns a new instance with the given lane value replaced.
* @param simd An instance of a corresponding SIMD type.
* @param lane
* @param value A new value to be used for the lane.
* @return A new SIMD data type with the given lane value replaced.
*/
@@ -384,10 +340,6 @@ declare namespace adone.math {
mul(a: Int32x4, b: Int32x4): Int32x4;
/**
*
* @param a
*/
neg(a: Int32x4): Int32x4;
/**
@@ -565,49 +517,27 @@ declare namespace adone.math {
/**
* Returns a new instance with the lane values swizzled.
* @param a
* @param l1
* @param l2
* @param l3
* @param l4
* @param l5
* @param l6
* @param l7
* @param l8
*/
swizzle(a: Int16x8, l1: number, l2: number, l3: number, l4: number, l5: number, l6: number, l7: number, l8: number): Int16x8;
/**
* Returns a new instance with the lane values shuffled.
* @param a
* @param b
* @param l1
* @param l2
* @param l3
* @param l4
* @param l5
* @param l6
* @param l7
* @param l8
*/
shuffle(a: Int16x8, b: Int16x8, l1: number, l2: number, l3: number, l4: number, l5: number, l6: number, l7: number, l8: number): Int16x8;
/**
* Returns a new instance if the parameter is a valid SIMD data type and the same as Int16x8. Throws a TypeError otherwise.
* @param a
*/
check(a: Int16x8): Int16x8;
/**
* Creates a new SIMD.Int16x8 data type with all lanes set to a given value.
* @param n
*/
splat(n: number): Int16x8;
/**
* Returns a new instance with the given lane value replaced.
* @param simd An instance of a corresponding SIMD type.
* @param lane
* @param value A new value to be used for the lane.
* @return A new SIMD data type with the given lane value replaced.
*/
@@ -647,10 +577,6 @@ declare namespace adone.math {
mul(a: Int16x8, b: Int16x8): Int16x8;
/**
*
* @param a
*/
neg(a: Int16x8): Int16x8;
/**
@@ -803,23 +729,6 @@ declare namespace adone.math {
/**
* Returns a new instance with the lane values swizzled.
* @param a
* @param l1
* @param l2
* @param l3
* @param l4
* @param l5
* @param l6
* @param l7
* @param l8
* @param l9
* @param l10
* @param l11
* @param l12
* @param l13
* @param l14
* @param l15
* @param l16
*/
swizzle(
a: Int8x16,
@@ -843,24 +752,6 @@ declare namespace adone.math {
/**
* Returns a new instance with the lane values shuffled.
* @param a
* @param b
* @param l1
* @param l2
* @param l3
* @param l4
* @param l5
* @param l6
* @param l7
* @param l8
* @param l9
* @param l10
* @param l11
* @param l12
* @param l13
* @param l14
* @param l15
* @param l16
*/
shuffle(
a: Int8x16,
@@ -885,20 +776,17 @@ declare namespace adone.math {
/**
* Returns a new instance if the parameter is a valid SIMD data type and the same as Int8x16. Throws a TypeError otherwise.
* @param a
*/
check(a: Int8x16): Int8x16;
/**
* Creates a new SIMD.Int8x16 data type with all lanes set to a given value.
* @param n
*/
splat(n: number): Int8x16;
/**
* Returns a new instance with the given lane value replaced.
* @param simd An instance of a corresponding SIMD type.
* @param lane
* @param value A new value to be used for the lane.
* @return A new SIMD data type with the given lane value replaced.
*/
@@ -938,10 +826,6 @@ declare namespace adone.math {
mul(a: Int8x16, b: Int8x16): Int8x16;
/**
*
* @param a
*/
neg(a: Int8x16): Int8x16;
/**
@@ -1065,41 +949,27 @@ declare namespace adone.math {
/**
* Returns a new instance with the lane values swizzled.
* @param a
* @param l1
* @param l2
* @param l3
* @param l4
*/
swizzle(a: Uint32x4, l1: number, l2: number, l3: number, l4: number): Uint32x4;
/**
* Returns a new instance with the lane values shuffled.
* @param a
* @param b
* @param l1
* @param l2
* @param l3
* @param l4
*/
shuffle(a: Uint32x4, b: Uint32x4, l1: number, l2: number, l3: number, l4: number): Uint32x4;
/**
* Returns a new instance if the parameter is a valid SIMD data type and the same as Uint32x4. Throws a TypeError otherwise.
* @param a
*/
check(a: Uint32x4): Uint32x4;
/**
* Creates a new SIMD.Uint32x4 data type with all lanes set to a given value.
* @param n
*/
splat(n: number): Uint32x4;
/**
* Returns a new instance with the given lane value replaced.
* @param simd An instance of a corresponding SIMD type.
* @param lane
* @param value A new value to be used for the lane.
* @return A new SIMD data type with the given lane value replaced.
*/
@@ -1314,49 +1184,27 @@ declare namespace adone.math {
/**
* Returns a new instance with the lane values swizzled.
* @param a
* @param l1
* @param l2
* @param l3
* @param l4
* @param l5
* @param l6
* @param l7
* @param l8
*/
swizzle(a: Uint16x8, l1: number, l2: number, l3: number, l4: number, l5: number, l6: number, l7: number, l8: number): Uint16x8;
/**
* Returns a new instance with the lane values shuffled.
* @param a
* @param b
* @param l1
* @param l2
* @param l3
* @param l4
* @param l5
* @param l6
* @param l7
* @param l8
*/
shuffle(a: Uint16x8, b: Uint16x8, l1: number, l2: number, l3: number, l4: number, l5: number, l6: number, l7: number, l8: number): Uint16x8;
/**
* Returns a new instance if the parameter is a valid SIMD data type and the same as Uint16x8. Throws a TypeError otherwise.
* @param a
*/
check(a: Uint16x8): Uint16x8;
/**
* Creates a new SIMD.Uint16x8 data type with all lanes set to a given value.
* @param n
*/
splat(n: number): Uint16x8;
/**
* Returns a new instance with the given lane value replaced.
* @param simd An instance of a corresponding SIMD type.
* @param lane
* @param value A new value to be used for the lane.
* @return A new SIMD data type with the given lane value replaced.
*/
@@ -1546,23 +1394,6 @@ declare namespace adone.math {
/**
* Returns a new instance with the lane values swizzled.
* @param a
* @param l1
* @param l2
* @param l3
* @param l4
* @param l5
* @param l6
* @param l7
* @param l8
* @param l9
* @param l10
* @param l11
* @param l12
* @param l13
* @param l14
* @param l15
* @param l16
*/
swizzle(
a: Uint8x16,
@@ -1586,24 +1417,6 @@ declare namespace adone.math {
/**
* Returns a new instance with the lane values shuffled.
* @param a
* @param b
* @param l1
* @param l2
* @param l3
* @param l4
* @param l5
* @param l6
* @param l7
* @param l8
* @param l9
* @param l10
* @param l11
* @param l12
* @param l13
* @param l14
* @param l15
* @param l16
*/
shuffle(
a: Uint8x16,
@@ -1628,20 +1441,17 @@ declare namespace adone.math {
/**
* Returns a new instance if the parameter is a valid SIMD data type and the same as Uint8x16. Throws a TypeError otherwise.
* @param a
*/
check(a: Uint8x16): Uint8x16;
/**
* Creates a new SIMD.Uint8x16 data type with all lanes set to a given value.
* @param n
*/
splat(n: number): Uint8x16;
/**
* Returns a new instance with the given lane value replaced.
* @param simd An instance of a corresponding SIMD type.
* @param lane
* @param value A new value to be used for the lane.
* @return A new SIMD data type with the given lane value replaced.
*/
@@ -1802,20 +1612,17 @@ declare namespace adone.math {
/**
* Returns a new instance if the parameter is a valid SIMD data type and the same as Bool32x4. Throws a TypeError otherwise.
* @param a
*/
check(a: Bool32x4): Bool32x4;
/**
* Creates a new SIMD.Bool32x4 data type with all lanes set to a given value.
* @param n
*/
splat(n: boolean): Bool32x4;
/**
* Returns a new instance with the given lane value replaced.
* @param simd An instance of a corresponding SIMD type.
* @param lane
* @param value A new value to be used for the lane.
* @return A new SIMD data type with the given lane value replaced.
*/
@@ -1823,13 +1630,11 @@ declare namespace adone.math {
/**
* If all lane values are `true`, return `true`.
* @param a
*/
allTrue(a: Bool32x4): boolean;
/**
* If any lane values are `true`, return `true`.
* @param a
*/
anyTrue(a: Bool32x4): boolean;
@@ -1888,20 +1693,17 @@ declare namespace adone.math {
/**
* Returns a new instance if the parameter is a valid SIMD data type and the same as Bool16x8. Throws a TypeError otherwise.
* @param a
*/
check(a: Bool16x8): Bool16x8;
/**
* Creates a new SIMD.Bool16x8 data type with all lanes set to a given value.
* @param n
*/
splat(n: boolean): Bool16x8;
/**
* Returns a new instance with the given lane value replaced.
* @param simd An instance of a corresponding SIMD type.
* @param lane
* @param value A new value to be used for the lane.
* @return A new SIMD data type with the given lane value replaced.
*/
@@ -1909,13 +1711,11 @@ declare namespace adone.math {
/**
* If all lane values are `true`, return `true`.
* @param a
*/
allTrue(a: Bool16x8): boolean;
/**
* If any lane values are `true`, return `true`.
* @param a
*/
anyTrue(a: Bool16x8): boolean;
@@ -1998,20 +1798,17 @@ declare namespace adone.math {
/**
* Returns a new instance if the parameter is a valid SIMD data type and the same as Bool8x16. Throws a TypeError otherwise.
* @param a
*/
check(a: Bool8x16): Bool8x16;
/**
* Creates a new SIMD.Bool8x16 data type with all lanes set to a given value.
* @param n
*/
splat(n: boolean): Bool8x16;
/**
* Returns a new instance with the given lane value replaced.
* @param simd An instance of a corresponding SIMD type.
* @param lane
* @param value A new value to be used for the lane.
* @return A new SIMD data type with the given lane value replaced.
*/
@@ -2019,13 +1816,11 @@ declare namespace adone.math {
/**
* If all lane values are `true`, return `true`.
* @param a
*/
allTrue(a: Bool8x16): boolean;
/**
* If any lane values are `true`, return `true`.
* @param a
*/
anyTrue(a: Bool8x16): boolean;
+2 -2
View File
@@ -47,8 +47,8 @@ declare namespace adone {
/**
* Converts a function that returns promises to a node.js style callback function
*
* @param {Function} fn Function
* @returns {Promise} the original promise
* @param fn Function
* @returns the original promise
*/
export function callbackify<R>(fn: () => Promise<R>): (callback: (err?: any, result?: R) => void) => Promise<R>;
export function callbackify<T, R>(fn: (a: T) => Promise<R>): (a: T, callback: (err?: any, result?: R) => void) => Promise<R>;
+128 -119
View File
@@ -1,144 +1,153 @@
import * as algoliasearch from "algoliasearch";
import { ClientOptions, SynonymOption, AlgoliaUserKeyOptions, SearchSynonymOptions, AlgoliaResponse,
AlgoliaSecuredApiOptions, AlgoliaIndexSettings, AlgoliaQueryParameters, AlgoliaIndex } from "algoliasearch";
import * as algoliasearch from 'algoliasearch';
import {
ClientOptions,
SynonymOption,
AlgoliaApiKeyOptions,
SearchSynonymOptions,
AlgoliaResponse,
AlgoliaSecuredApiOptions,
AlgoliaIndexSettings,
AlgoliaQueryParameters,
AlgoliaIndex,
} from 'algoliasearch';
let _algoliaResponse: AlgoliaResponse = {
hits: [{}, {}],
page: 0,
nbHits: 12,
nbPages: 6,
hitsPerPage: 2,
processingTimeMS: 32,
query: "",
params: "",
hits: [{}, {}],
page: 0,
nbHits: 12,
nbPages: 6,
hitsPerPage: 2,
processingTimeMS: 32,
query: '',
params: '',
};
let _clientOptions: ClientOptions = {
timeout: 12,
protocol: "",
httpAgent: "",
timeout: 12,
protocol: '',
httpAgent: '',
};
let _synonymOption: SynonymOption = {
forwardToSlaves: false,
replaceExistingSynonyms: false,
forwardToReplicas: false,
replaceExistingSynonyms: false,
};
let _algoliaUserKeyOptions: AlgoliaUserKeyOptions = {
validity: 0,
maxQueriesPerIPPerHour: 0,
indexes: [""],
queryParameters: { attributesToRetrieve: ["algolia"] },
description: "",
let _algoliaApiKeyOptions: AlgoliaApiKeyOptions = {
validity: 0,
maxQueriesPerIPPerHour: 0,
indexes: [''],
queryParameters: { attributesToRetrieve: ['algolia'] },
description: '',
};
let _searchSynonymOptions: SearchSynonymOptions = {
query: "",
page: 0,
type: "",
hitsPerPage: 0,
query: '',
page: 0,
type: '',
hitsPerPage: 0,
};
let _algoliaSecuredApiOptions: AlgoliaSecuredApiOptions = {
filters: "",
validUntil: 0,
restrictIndices: "",
userToken: "",
filters: '',
validUntil: 0,
restrictIndices: '',
userToken: '',
};
let _algoliaIndexSettings: AlgoliaIndexSettings = {
attributesToIndex: [""],
attributesForFaceting: [""],
unretrievableAttributes: [""],
attributesToRetrieve: [""],
ranking: [""],
customRanking: [""],
slaves: [""],
maxValuesPerFacet: "",
attributesToHighlight: [""],
attributesToSnippet: [""],
highlightPreTag: "",
highlightPostTag: "",
snippetEllipsisText: "",
restrictHighlightAndSnippetArrays: false,
hitsPerPage: 0,
minWordSizefor1Typo: 0,
minWordSizefor2Typos: 0,
typoTolerance: false,
allowTyposOnNumericTokens: false,
ignorePlurals: false,
disableTypoToleranceOnAttributes: "",
separatorsToIndex: "",
queryType: "",
removeWordsIfNoResults: "",
advancedSyntax: false,
optionalWords: [""],
removeStopWords: [""],
disablePrefixOnAttributes: [""],
disableExactOnAttributes: [""],
exactOnSingleWordQuery: "",
alternativesAsExact: false,
attributeForDistinct: "",
distinct: false,
numericAttributesToIndex: [""],
allowCompressionOfIntegerArray: false,
altCorrections: [{}],
minProximity: 0,
placeholders: "",
attributesToIndex: [''],
attributesForFaceting: [''],
unretrievableAttributes: [''],
attributesToRetrieve: [''],
ranking: [''],
customRanking: [''],
replicas: [''],
maxValuesPerFacet: '',
attributesToHighlight: [''],
attributesToSnippet: [''],
highlightPreTag: '',
highlightPostTag: '',
snippetEllipsisText: '',
restrictHighlightAndSnippetArrays: false,
hitsPerPage: 0,
minWordSizefor1Typo: 0,
minWordSizefor2Typos: 0,
typoTolerance: false,
allowTyposOnNumericTokens: false,
ignorePlurals: false,
disableTypoToleranceOnAttributes: '',
separatorsToIndex: '',
queryType: '',
removeWordsIfNoResults: '',
advancedSyntax: false,
optionalWords: [''],
removeStopWords: [''],
disablePrefixOnAttributes: [''],
disableExactOnAttributes: [''],
exactOnSingleWordQuery: '',
alternativesAsExact: false,
attributeForDistinct: '',
distinct: false,
numericAttributesToIndex: [''],
allowCompressionOfIntegerArray: false,
altCorrections: [{}],
minProximity: 0,
placeholders: '',
};
let _algoliaQueryParameters: AlgoliaQueryParameters = {
query: "",
filters: "",
attributesToRetrieve: [""],
restrictSearchableAttributes: [""],
facets: "",
maxValuesPerFacet: "",
attributesToHighlight: [""],
attributesToSnippet: [""],
highlightPreTag: "",
highlightPostTag: "",
snippetEllipsisText: "",
restrictHighlightAndSnippetArrays: false,
hitsPerPage: 0,
page: 0,
offset: 0,
length: 0,
minWordSizefor1Typo: 0,
minWordSizefor2Typos: 0,
typoTolerance: false,
allowTyposOnNumericTokens: false,
ignorePlurals: false,
disableTypoToleranceOnAttributes: "",
aroundLatLng: "",
aroundLatLngViaIP: "",
aroundRadius: "",
aroundPrecision: 0,
minimumAroundRadius: 0,
insideBoundingBox: "",
queryType: "",
insidePolygon: "",
removeWordsIfNoResults: "",
advancedSyntax: false,
optionalWords: [""],
removeStopWords: [""],
disableExactOnAttributes: [""],
exactOnSingleWordQuery: "",
alternativesAsExact: true,
distinct: 0,
getRankingInfo: false,
numericAttributesToIndex: [""],
numericFilters: [""],
tagFilters: "",
facetFilters: "",
analytics: false,
analyticsTags: [""],
synonyms: true,
replaceSynonymsInHighlight: false,
minProximity: 0,
query: '',
filters: '',
attributesToRetrieve: [''],
restrictSearchableAttributes: [''],
facets: '',
maxValuesPerFacet: '',
attributesToHighlight: [''],
attributesToSnippet: [''],
highlightPreTag: '',
highlightPostTag: '',
snippetEllipsisText: '',
restrictHighlightAndSnippetArrays: false,
hitsPerPage: 0,
page: 0,
offset: 0,
length: 0,
minWordSizefor1Typo: 0,
minWordSizefor2Typos: 0,
typoTolerance: false,
allowTyposOnNumericTokens: false,
ignorePlurals: false,
disableTypoToleranceOnAttributes: '',
aroundLatLng: '',
aroundLatLngViaIP: '',
aroundRadius: '',
aroundPrecision: 0,
minimumAroundRadius: 0,
insideBoundingBox: '',
queryType: '',
insidePolygon: '',
removeWordsIfNoResults: '',
advancedSyntax: false,
optionalWords: [''],
removeStopWords: [''],
disableExactOnAttributes: [''],
exactOnSingleWordQuery: '',
alternativesAsExact: true,
distinct: 0,
getRankingInfo: false,
numericAttributesToIndex: [''],
numericFilters: [''],
tagFilters: '',
facetFilters: '',
analytics: false,
analyticsTags: [''],
synonyms: true,
replaceSynonymsInHighlight: false,
minProximity: 0,
};
let index: AlgoliaIndex = algoliasearch("", "").initIndex("");
let index: AlgoliaIndex = algoliasearch('', '').initIndex('');
let search = index.search({query: ""});
index.search({query: ""}, (err, res) => {});
let search = index.search({ query: '' });
index.search({ query: '' }, (err, res) => {});
+1666 -1504
View File
File diff suppressed because it is too large Load Diff
+5 -1
View File
@@ -2323,7 +2323,11 @@ If you do not set properties such as dashLength, lineAlpha, lineColor, etc - val
negativeLineColor: string;
/** Example: {precision:-1, decimalSeparator:'.', thousandsSeparator:','}. The graph uses this object's values to format the numbers. Uses chart's numberFormatter if not defined. */
numberFormatter: Object;
/** Name of the open field (used by floating columns, candlesticks and ohlc) in your dataProvider. */
/** If you set it to true, column chart will begin new stack. This allows having Clustered and Stacked column/bar chart. */
newStack: boolean;
/** Name of the open field (used by floating columns, candlesticks and ohlc) in your dataProvider.
@default 50
*/
openField: string;
/**Precision of values. Will use chart's precision if not set any.*/
precision: number;
+3 -3
View File
@@ -67,7 +67,7 @@ declare module 'angular' {
* If the filter function returns a string it will be passed as the message
* argument to the start method of the service.
*
* @param {angular.IRequestConfig} config - the Angular request config object.
* @param config the Angular request config object.
*
*/
requestFilter?(config: IRequestConfig): (string | boolean);
@@ -123,7 +123,7 @@ declare module 'angular' {
*
* This behaviour can be modified in the configuration.
*
* @param {string|IBlockUIConfig} messageOrOptions -
* @param messageOrOptions
* Either supply the message (string) to be show in the
* overlay or specify an IBlockUIConfig object that will be
* merged/extended into the block ui instance state.
@@ -156,7 +156,7 @@ declare module 'angular' {
* Allows the message shown in the overlay to be updated
* while to block is active.
*
* @param {string} message - The message to show in the overlay.
* @param message The message to show in the overlay.
*/
message(message: string): void;
@@ -264,6 +264,48 @@ myApp.controller('ToastController', ($scope: TestScope, $mdToast: ng.material.IT
};
});
myApp.controller('ThemeController', ($element: JQuery, $scope: TestScope, $mdTheming: ng.material.IThemingService) => {
$mdTheming($element);
const PALETTES: ng.material.IConfiguredColorPalette = $mdTheming.PALETTES;
const redPalette: ng.material.IPalette = PALETTES.red;
const myPalette: ng.material.IPalette = PALETTES.myPalette;
const THEMES: ng.material.IConfiguredThemes = $mdTheming.THEMES;
const defaultTheme: ng.material.ITheme = THEMES.default;
const myTheme: ng.material.ITheme = THEMES.myTheme;
$scope['registered'] = () => {
let registered: boolean = $mdTheming.registered('default');
registered = $mdTheming.registered('myTheme');
};
$scope['defaultTheme'] = () => {
const themeName: string = $mdTheming.defaultTheme();
};
$scope['generateTheme'] = () => {
$mdTheming.generateTheme('myTheme');
};
$scope['setBrowserColors'] = () => {
const browserColors: ng.material.IBrowserColors = {
theme: 'default',
palette: 'neonRed',
hue: '500'
};
const remove: () => void = $mdTheming.setBrowserColor(browserColors);
};
$scope['defineTheme'] = () => {
const newTheme: ng.material.IDefineThemeOptions = {
primary: 'blue',
accent: 'orange',
dark: true
};
$mdTheming.defineTheme('newTheme', newTheme);
};
});
myApp.controller('PanelController', ($scope: TestScope, $mdPanel: ng.material.IPanelService, $q: ng.IQService) => {
$scope['createPanel'] = () => {
const config: ng.material.IPanelConfig = {
+31
View File
@@ -290,6 +290,25 @@ declare module 'angular' {
configuration(): IThemeConfig;
}
interface IDefineThemeOptions {
primary?: string;
accent?: string;
warn?: string;
background?: string;
dark?: boolean;
}
interface IThemingService {
PALETTES: IConfiguredColorPalette; // get only
THEMES: IConfiguredThemes; // get only
(element: JQuery): void;
registered(themeName: string): boolean;
defaultTheme(): string;
generateTheme(name: string): void;
setBrowserColor(options: IBrowserColors): () => void;
defineTheme(name: string, options: IDefineThemeOptions): IPromise<string>;
}
interface IDateLocaleProvider {
months: string[];
shortMonths: string[];
@@ -330,6 +349,18 @@ declare module 'angular' {
'blue-grey': IPalette;
}
interface IConfiguredColorPalette extends IColorPalette {
[name: string]: IPalette;
}
interface IThemes {
default: ITheme;
}
interface IConfiguredThemes extends IThemes {
[name: string]: ITheme;
}
interface IPanelConfig {
id?: string;
template?: string;
+3 -5
View File
@@ -178,7 +178,7 @@ mod.controller('name', class {
// $onChanges(x: number) { }
});
mod.controller({
MyCtrl: class{},
MyCtrl: class {},
MyCtrl2() {},
MyCtrl3: ['$fooService', ($fooService: any) => { }]
});
@@ -229,7 +229,7 @@ mod.provider(My.Namespace);
mod.service('name', ($scope: ng.IScope) => {});
mod.service('name', ['$scope', ($scope: ng.IScope) => {}]);
mod.service({
MyCtrl: class{},
MyCtrl: class {},
MyCtrl2: () => {}, // tslint:disable-line:object-literal-shorthand
MyCtrl3: ['$fooService', ($fooService: any) => {}]
});
@@ -491,9 +491,7 @@ namespace TestInjector {
// $injector.instantiate
{
class Foobar {
constructor($q) {}
}
class Foobar {}
const result: Foobar = $injector.instantiate(Foobar);
}
+7 -9
View File
@@ -1089,7 +1089,7 @@ declare namespace angular {
* Retrieves or overrides whether to generate an error when a rejected promise is not handled.
* This feature is enabled by default.
*
* @returns {boolean} Current value
* @returns Current value
*/
errorOnUnhandledRejections(): boolean;
@@ -1097,8 +1097,8 @@ declare namespace angular {
* Retrieves or overrides whether to generate an error when a rejected promise is not handled.
* This feature is enabled by default.
*
* @param {boolean} value Whether to generate an error when a rejected promise is not handled.
* @returns {ng.IQProvider} Self for chaining otherwise.
* @param value Whether to generate an error when a rejected promise is not handled.
* @returns Self for chaining otherwise.
*/
errorOnUnhandledRejections(value: boolean): IQProvider;
}
@@ -1109,8 +1109,8 @@ declare namespace angular {
* The successCallBack may return IPromise<never> for when a $q.reject() needs to be returned
* This method returns a new promise which is resolved or rejected via the return value of the successCallback, errorCallback. It also notifies via the return value of the notifyCallback method. The promise can not be resolved or rejected from the notifyCallback method.
*/
then<TResult>(successCallback: (promiseValue: T) => IPromise<TResult>|TResult, errorCallback?: null | undefined, notifyCallback?: (state: any) => any): IPromise<TResult>;
then<TResult1, TResult2>(successCallback: (promiseValue: T) => IPromise<TResult1>|TResult2, errorCallback?: null | undefined, notifyCallback?: (state: any) => any): IPromise<TResult1 | TResult2>;
then<TResult>(successCallback: (promiseValue: T) => IPromise<TResult>|TResult, errorCallback?: null, notifyCallback?: (state: any) => any): IPromise<TResult>;
then<TResult1, TResult2>(successCallback: (promiseValue: T) => IPromise<TResult1>|TResult2, errorCallback?: null, notifyCallback?: (state: any) => any): IPromise<TResult1 | TResult2>;
then<TResult, TCatch>(successCallback: (promiseValue: T) => IPromise<TResult>|TResult, errorCallback: (reason: any) => IPromise<TCatch>|TCatch, notifyCallback?: (state: any) => any): IPromise<TResult | TCatch>;
then<TResult1, TResult2, TCatch1, TCatch2>(successCallback: (promiseValue: T) => IPromise<TResult1>|TResult2, errorCallback: (reason: any) => IPromise<TCatch1>|TCatch2, notifyCallback?: (state: any) => any): IPromise<TResult1 | TResult2 | TCatch1 | TCatch2>;
@@ -1639,9 +1639,8 @@ declare namespace angular {
useApplyAsync(value: boolean): IHttpProvider;
/**
*
* @param {boolean=} value If true, `$http` will return a normal promise without the `success` and `error` methods.
* @returns {boolean|Object} If a value is specified, returns the $httpProvider for chaining.
* @param value If true, `$http` will return a normal promise without the `success` and `error` methods.
* @returns If a value is specified, returns the $httpProvider for chaining.
* otherwise, returns the current configured value.
*/
useLegacyPromiseExtensions(value: boolean): boolean | IHttpProvider;
@@ -1762,7 +1761,6 @@ declare namespace angular {
(tpl: string, ignoreRequestError?: boolean): IPromise<string>;
/**
* total amount of pending template requests being downloaded.
* @type {number}
*/
totalPendingRequests: number;
}
+1 -43
View File
@@ -6,39 +6,23 @@
/**
* Options for function `start`
*
* @export
* @interface StartOptions
*/
export interface StartOptions {
/**
* Should annyang restart itself if it is closed indirectly, because of silence or window conflicts?
*
* @type {boolean}
*/
autoRestart?: boolean;
/**
* Allow forcing continuous mode on or off. Annyang is pretty smart about this, so only set this if you know what you're doing.
*
* @type {boolean}
*/
continuous?: boolean;
}
/**
* A command option that supports custom regular expressions
*
* @export
* @interface CommandOptionRegex
*/
export interface CommandOptionRegex {
/**
* @type {RegExp}
*/
regexp: RegExp;
/**
* @type {() => any}
*/
callback(): void;
}
@@ -50,8 +34,6 @@ export interface CommandOptionRegex {
* {'hello :name': helloFunction, 'howdy': helloFunction};
* {'hi': helloFunction};
* ````
* @export
* @interface CommandOption
*/
export interface CommandOption {
[command: string]: CommandOptionRegex | (() => void);
@@ -92,8 +74,6 @@ export interface Annyang {
/**
* Start listening.
* It's a good idea to call this after adding some commands first, but not mandatory.
*
* @param {StartOptions} options
*/
start(options?: StartOptions): void;
@@ -119,15 +99,13 @@ export interface Annyang {
/**
* Turn on output of debug messages to the console. Ugly, but super-handy!
*
* @export
* @param {boolean} [newState=true] Turn on/off debug messages
* @param [newState=true] Turn on/off debug messages
*/
debug(newState?: boolean): void;
/**
* Set the language the user will speak in. If this method is not called, defaults to 'en-US'.
*
* @param {string} lang
* @see [Languages](https://github.com/TalAter/annyang/blob/master/docs/FAQ.md#what-languages-are-supported)
*/
setLanguage(lang: string): void;
@@ -144,8 +122,6 @@ export interface Annyang {
* annyang.addCommands(commands2);
* // annyang will now listen to all three commands
* ````
*
* @param {CommandOption} commands
*/
addCommands(commands: CommandOption): void;
@@ -161,7 +137,6 @@ export interface Annyang {
* // Remove all existing commands
* annyang.removeCommands();
* ````
* @param {string} command
*/
removeCommands(command?: string): void;
@@ -175,37 +150,22 @@ export interface Annyang {
* // Don't respond to howdy or hi
* annyang.removeCommands(['howdy', 'hi']);
* ````
*
* @param {string[]} command
*/
removeCommands(command: string[]): void;
/**
* @param {Events} event
* @param {(userSaid : string, commandText : string, results : string[]) => void} callback
* @param {*} [context]
*/
addCallback(event: Events, callback: (userSaid?: string, commandText?: string, results?: string[]) => void, context?: any): void;
/**
* @param {Events} [event]
* @param {Function} [callback]
*/
removeCallback(event?: Events, callback?: (userSaid: string, commandText: string, results: string[]) => void): void;
/**
* Returns true if speech recognition is currently on.
* Returns false if speech recognition is off or annyang is paused.
*
* @returns {boolean}
*/
isListening(): boolean;
/**
* Returns the instance of the browser's SpeechRecognition object used by annyang.
* Useful in case you want direct access to the browser's Speech Recognition engine.
*
* @returns {*}
*/
getSpeechRecognizer(): any;
@@ -223,8 +183,6 @@ export interface Annyang {
* ['Time for some thrilling heroics', 'Time for some thrilling aerobics']
* );
* ````
*
* @param {string} command
*/
trigger(command: string | string[]): void;
}
+3
View File
@@ -6,7 +6,10 @@
"no-declare-current-package": false,
"no-internal-module": false,
"no-mergeable-namespace": false,
"no-redundant-jsdoc": false,
"no-redundant-jsdoc-2": false,
"no-single-declare-module": false,
"no-unnecessary-class": false,
"no-unnecessary-qualifier": false
}
}
@@ -0,0 +1,20 @@
import { argon2 } from 'argon2-browser';
const mandatoryOptions = {
pass: 'Qwerty12?',
salt: 'Salty'
};
(async () => {
(await argon2.hash(mandatoryOptions)).encoded; // string
(await argon2.hash(mandatoryOptions)).hash; // Uint8Array
(await argon2.hash(mandatoryOptions)).hashHex; // string
(await argon2.hash({ ...mandatoryOptions, distPath: 'path' })).encoded; // string
(await argon2.hash({ ...mandatoryOptions, hashLen: 24 })).encoded; // string
(await argon2.hash({ ...mandatoryOptions, mem: 1024 })).encoded; // string
(await argon2.hash({ ...mandatoryOptions, parallelism: 1 })).encoded; // string
(await argon2.hash({ ...mandatoryOptions, time: 1 })).encoded; // string
(await argon2.hash({ ...mandatoryOptions, type: argon2.ArgonType.Argon2d })).encoded; // string
(await argon2.hash({ ...mandatoryOptions, type: argon2.ArgonType.Argon2i })).encoded; // string
})();
+31
View File
@@ -0,0 +1,31 @@
// Type definitions for argon2-browser 1.1
// Project: https://github.com/antelle/argon2-browser#readme
// Definitions by: Ivan Gabriele <https://github.com/ivangabriele>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
export namespace argon2 {
function hash(options: Argon2BrowserHashOptions): Promise<Argon2BrowserHashResult>;
interface Argon2BrowserHashOptions {
distPath?: string;
hashLen?: number;
mem?: number;
parallelism?: number;
pass: string;
salt: string;
time?: number;
type?: ArgonType;
}
interface Argon2BrowserHashResult {
encoded: string;
hash: Uint8Array;
hashHex: string;
}
enum ArgonType {
Argon2d = 0,
Argon2i = 1
}
}
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"argon2-browser-tests.ts"
]
}
-1
View File
@@ -12,7 +12,6 @@
* arrify(1) // returns [1]
* @example
* arrify([2, 3]) // returns [2, 3]
* @param val
*/
declare function arrify<T>(val: undefined | null | T | T[]): T[];
export = arrify;
+13
View File
@@ -0,0 +1,13 @@
import { ScenarioContext, Next } from 'artillery';
const scenarioContext: ScenarioContext = {vars: {}};
scenarioContext.vars = {};
scenarioContext.vars.testing = "value";
scenarioContext.vars.testing2 = 1;
const next: Next = (error?: Error) => {
// do nothing.
};
next();
next(new Error());
+13
View File
@@ -0,0 +1,13 @@
// Type definitions for artillery 1.6
// Project: https://github.com/shoreditch-ops/artillery#readme
// Definitions by: Kira McCoan <https://github.com/kmccoan-allocadia>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
import * as request from 'request';
import * as events from 'events';
export interface ScenarioContext { vars: {[key: string]: any}; }
export type Next = (err?: Error) => void;
export type ResponseRequest = request.ResponseRequest;
export type RequestResponse = request.RequestResponse;
export type EventEmitter = events.EventEmitter;
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"artillery-tests.ts"
]
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}
+10 -48
View File
@@ -249,14 +249,12 @@ declare namespace Artyom {
/**
* Artyom can return inmediately the voices available in your browser.
* @see http://ourcodeworld.com/projects/projects-documentation/14/read-doc/artyom-getvoices/artyom-js
* @returns {Array}
*/
getVoices(): SpeechSynthesisVoice[];
/**
* Returns an array with all the available commands for artyom.
* @see http://ourcodeworld.com/projects/projects-documentation/10/read-doc/artyom-getavailablecommands/artyom-js
* @returns {Array}
*/
getAvailableCommands(): ArtyomCommand[];
@@ -264,38 +262,30 @@ declare namespace Artyom {
* Set up artyom for the application. This function will set the default language used by artyom
* or notice the user if artyom is not supported in the actual browser.
* @see http://ourcodeworld.com/projects/projects-documentation/15/read-doc/artyom-initialize/artyom-js
* @param {ArtyomConfigProperties} config
* @returns {Boolean}
*/
initialize(config: ArtyomConfigProperties): boolean;
/**
* Force artyom to stop listen even if is in continuos mode.
* @see http://ourcodeworld.com/projects/projects-documentation/9/read-doc/artyom-fatality/artyom-js
* @returns {Boolean}
*/
fatality(): boolean;
/**
* Add dinamically commands to artyom using. You can even add commands while artyom is active.
* @see http://ourcodeworld.com/projects/projects-documentation/4/read-doc/artyom-addcommands/artyom-js
* @param {ArtyomCommand | Array[ArtyomCommand]} newCommand
* @returns {Boolean}
*/
addCommands(newCommand: ArtyomCommand | ArtyomCommand[]): boolean;
/**
* Remove the commands of artyom with indexes that matches with the given text.
* @see http://ourcodeworld.com/projects/projects-documentation/19/read-doc/artyom-removecommands/artyom-js
* @param {string} identifier
* @returns {Array}
*/
removeCommands(identifier: string): number[];
/**
* Removes all the added commands of artyom.
* @see http://ourcodeworld.com/projects/projects-documentation/7/read-doc/artyom-emptycommands/artyom-js
* @returns {Array}
*/
emptyCommands(): ArtyomCommand[];
@@ -308,7 +298,6 @@ declare namespace Artyom {
/**
* Returns an object with the actual properties of artyom.
* @see http://ourcodeworld.com/projects/projects-documentation/12/read-doc/artyom-getproperties/artyom-js
* @returns {ArtyomConfigProperties}
*/
getProperties(): ArtyomConfigProperties;
@@ -321,37 +310,34 @@ declare namespace Artyom {
/**
* Returns the code language of artyom according to initialize function.
* @see http://ourcodeworld.com/projects/projects-documentation/11/read-doc/artyom-getlanguage/artyom-js
* @returns {String} Language
* @returns Language
*/
getLanguage(): string;
/**
* Talks a text according to the given parameters (private function).
* @param {String} text Text to be spoken
* @param {Int} actualChunk Number of chunk of the
* @param {Int} totalChunks
* @param {any} callbacks
* @param text Text to be spoken
* @param actualChunk Number of chunk of the
*/
artyomTalk(text: any, actualChunk: any, totalChunks: any, callbacks: any): any;
/**
* Splits a string into an array of strings with a limited size (chunk_length).
* @param {String} input text to split into chunks
* @param {Integer} chunk_length limit of characters in every chunk
* @param input text to split into chunks
* @param chunk_length limit of characters in every chunk
*/
splitStringByChunks(input: any, chunk_length: any): string[];
/**
* Process the given text into chunks and execute the private function artyom_talk.
* @param {String} message Text to be spoken
* @param {Object} callbacks { onStart, onEnd }
* @param message Text to be spoken
* @see http://ourcodeworld.com/projects/projects-documentation/20/read-doc/artyom-say/artyom-js
*/
say(message: any, callbacks: any): void;
/**
* Repeats the last sentence that artyom said. Useful in noisy environments.
* @param {Boolean} returnObject If set to true, an object with the text and the timestamp when was executed will be returned.
* @param returnObject If set to true, an object with the text and the timestamp when was executed will be returned.
* @see http://ourcodeworld.com/projects/projects-documentation/25/read-doc/artyom-repeatlastsay/artyom-js
*/
repeatLastSay(returnObject: any): void;
@@ -359,50 +345,42 @@ declare namespace Artyom {
/**
* Verify if the browser supports speechSynthesis.
* @see http://ourcodeworld.com/projects/projects-documentation/40/read-doc/artyom-speechsupported/artyom-js
* @returns {Boolean}
*/
speechSupported(): boolean;
/**
* Verify if the browser supports webkitSpeechRecognition.
* @see http://ourcodeworld.com/projects/projects-documentation/39/read-doc/artyom-recognizingsupported/artyom-js
* @returns {Boolean}
*/
recognizingSupported(): boolean;
/**
* Simulate a voice command via JS.
* @see http://ourcodeworld.com/projects/projects-documentation/22/read-doc/artyom-simulateinstruction/artyom-js
* @param {string} sentence
* @returns {Boolean}
*/
simulateInstruction(sentence: string): boolean;
/**
* Returns an object with data of the matched element.
* @param {string} voiceCommand
* @returns {Object | Function}. There is a result field when the function should return a boolean value.
* @returns . There is a result field when the function should return a boolean value.
*/
artyomExecute(voiceCommand: string): any;
/**
* Displays a message in the console if the artyom propery DEBUG is set to true.
* @param {string} error The error to be debugged
* @param {string} traceLevel Error level: { error | warn | info }
* @param error The error to be debugged
* @param traceLevel Error level: { error | warn | info }
* @see http://ourcodeworld.com/projects/projects-documentation/38/read-doc/artyom-debug/artyom-js
*/
debug(stringEvent: string, traceLevel: string): void;
/**
* Allows to retrieve the recognized spoken text of artyom and do something with it everytime something is recognized.
* @param {Function} action
* @returns {Boolean}
*/
redirectRecognizedTextOutput(action: () => void): boolean;
/**
* Says a random quote and returns it's object.
* @param data
*/
sayRandom(data: any): any;
@@ -431,7 +409,6 @@ declare namespace Artyom {
* This function returns a boolean according to the SpeechRecognition status if artyom is listening, will return true.
* Note: This is not a feature of SpeechRecognition, therefore this value hangs on the fiability of the onStart and onEnd
* events of the SpeechRecognition
* @returns {Boolean}
*/
isRecognizing(): boolean;
@@ -439,14 +416,12 @@ declare namespace Artyom {
* This function returns a boolean according to the speechSynthesis status if artyom is speaking, will return true.
* Note: This is not a feature of speechSynthesis, therefore this value hangs on the fiability of the onStart and onEnd
* events of the speechSynthesis.
* @returns {Boolean}
*/
isSpeaking(): boolean;
/**
* The SpeechSynthesisUtterance objects are stored in the artyom_garbage_collector variable to prevent the wrong behaviour
* of artyom.say. Use this method to clear all spoken SpeechSynthesisUtterance unused objects.
* @returns {Boolean}
*/
clearGarbageCollection(): any;
@@ -457,31 +432,26 @@ declare namespace Artyom {
/**
* Pause the processing of commands. Artyom still listening in the background and it can be resumed after a couple of seconds.
* @returns {Boolean}
*/
dontObey(): any;
/**
* Allow artyom to obey commands again.
* @returns {Boolean}
*/
obey(): any;
/**
* A boolean to check if artyom is obeying commands or not.
* @returns {Boolean}
*/
isObeying(): boolean;
/**
* Process the recognized text if artyom is active in remote mode.
* @returns {Boolean}
*/
remoteProcessorService(action: any): any;
/**
* Returns a string with the actual version of Artyom script.
* @returns {String}
*/
getVersion(): string;
@@ -490,22 +460,14 @@ declare namespace Artyom {
* tasks then probably you don't like to write a lot to achieve it.
* Use the artisan syntax to write less, but with the same accuracy.
* @disclaimer Not a promise-based implementation, just syntax.
* @returns {Object}
*/
on(indexes: any, smart: any): any;
}
/**
* ArtyomBuilder bla, bla...
*/
class ArtyomBuilder {
/**
* Method to bla, bla, bla...
*/
static getInstance(): ArtyomJS;
}
}
// tslint:disable-next-line:export-just-namespace
export = Artyom;
export as namespace Artyom;
+8 -1
View File
@@ -1 +1,8 @@
{ "extends": "dtslint/dt.json" }
{
"extends": "dtslint/dt.json",
"rules": {
// TODOs
"export-just-namespace": false,
"no-unnecessary-class": false
}
}
+1 -1
View File
@@ -28,7 +28,7 @@ interface ascii2mathml {
/**
* Converts ASCIIMath expression to MathML markup.
* @param asciimath {string} ASCIIMath expression
* @param asciimath ASCIIMath expression
* @param options Options
*/
(asciimath: string, options?: Options): string;
@@ -1,18 +0,0 @@
import { AskmethatRating, AskmethatRatingSteps } from "askmethat-rating";
const options = {
backgroundColor: "#e5e500",
hoverColor: "#ffff66",
fontClass: "fa fa-star",
minRating: 1,
maxRating: 5,
readonly: false,
step: AskmethatRatingSteps["OnePerOneStep"],
inputName: "AskmethatRating"
};
const div = document.createElement("div");
const amcRating = new AskmethatRating(div, 2 , options);
options.readonly = true;
amcRating.defaultOptions = options;
-142
View File
@@ -1,142 +0,0 @@
// Type definitions for askmethat-rating 0.3
// Project: https://alexteixeira.github.io/Askmethat-Rating/
// Definitions by: Alexandre Teixeira <https://github.com/AlexTeixeira>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
export enum AskmethatRatingSteps {
/**
* Step 0.1 per 0.1
*/
DecimalStep = 0,
/**
* Step 0.5 per 0.5
*/
HalfStep = 1,
/**
* Step 1 per 1
*/
OnePerOneStep = 2,
}
export interface AskmethatRatingOptions {
hoverColor?: string;
/**
* Color when the rating is not hovered
*/
backgroundColor?: string;
/**
* Mininmum rating that the user can set
*/
minRating?: number;
/**
* Maximum rating that the plugin display
*/
maxRating?: number;
/**
* Class to display as rating (FontAwesome or Rating for exemple)
*/
fontClass: string;
/**
* Set the rating to readonly
*/
readonly: boolean;
/**
* The stepping for the rating
*/
step: AskmethatRatingSteps;
/**
* Input name (Default is AskmethatRating)
*/
inputName: string;
}
export class AskmethatRating {
private parentElement;
private pValue;
private styleSheet;
private changeEvent;
private ratingClick;
private mouseMove;
/**
* @function get the current value for the rating
*/
/**
* @function set a new value for the rating
*
* @param _value this is the new value you want to set to the rating
* @returns the current number
*/
value: number;
/**
* Default option base on @type IAskmethatRatingOptions
*/
private _defaultOptions;
/**
* @function get the default option for the rating
*
* @return options based on @type AskmethatRatingOptions
*/
/**
* @function set the default option for the rating
*
* @return options based on @type AskmethatRatingOptions
*/
defaultOptions: AskmethatRatingOptions;
/**
* constructor with div element, default rating value & default options
*
* @param element This is the html container for the rating elements
* @param defaultValue Default value set when the plugin render the rating
* @param options Default option base on AskmethatRatingOptions type
*/
constructor(element: HTMLDivElement, defaultValue?: number, options?: any);
/**
* render a new rating, by default value is the minRating
*
* @param value this is the default value set when the plugin is rendered, by default IAskmethatRatingOptions.minRating
*/
render(value?: number): void;
/**
* @function when a rating is clicked
* @param {type} event : Event {event object}
*/
private onRatingClick(event?);
/**
* @function Calculate the value according to the step provided in options
* @param {Number} value:number the current value
* @return {Number} the new value according to step
*/
protected getValueAccordingToStep(value: number): number;
/**
* @function mouse event enter in rating
* @param {type} event?: Event {event}
*/
private onMouseMove(event?);
/**
* @function mouse out event in rating
* @param {type} event?: Event {event}
*/
private onMouseLeave(event?);
/**
* @function set or unset the active class and color
* @param {HTMLSpanElement} current : current span element
* @param {number} current : value needed for the if
*/
protected setOrUnsetActive(value: number): void;
/**
* Check if disabled attribute is added or removed from the input
* Update readonly status if needed for the rating
*/
private mutationEvent();
/**
* This is fired by mutation observer when an attribute changed in the hidden input
* Is protected to have some unit tests
* @param {MutationRecord[]} mutations list of mutations record
*/
protected mutationDisableEvent(mutations: MutationRecord[]): void;
/**
* @function static method to retrieve with identifier the value
* @param {string} identifier: string container identifier
* @return {number} current rating
*/
static value(identifier: string): number;
}
+1
View File
@@ -16,6 +16,7 @@
"no-void-expression": false,
"object-literal-key-quotes": false,
"object-literal-shorthand": false,
"one-line": false,
"one-variable-per-declaration": false,
"only-arrow-functions": false,
"prefer-const": false,
+16
View File
@@ -19,3 +19,19 @@ Many of the types used by Atom Keymap can be referenced from the AtomKeymap name
```ts
function example(keybind: AtomKeymap.KeyBinding) {}
```
### Exposing Private Methods and Properties
[Declaration Merging](https://www.typescriptlang.org/docs/handbook/declaration-merging.html) can be used to augment any of the types used within Atom Keymap. As an example, if we wanted to reveal the private ```partialMatchTimeout``` property within the KeymapManager class, then we would create a file with the following contents:
```ts
// <<filename>>.d.ts
declare namespace AtomKeymap {
interface KeymapManager {
partialMatchTimeout: number;
}
}
```
Once this file is either referenced or included within your project, then this new property would be freely usable on instances of the KeymapManager class without TypeScript reporting errors.
+15 -15
View File
@@ -11,17 +11,17 @@ keymaps.defaultTarget = document.body;
// Pass all the window's keydown events to the KeymapManager
document.addEventListener("keydown", (event): void => {
keymaps.handleKeyboardEvent(event);
keymaps.handleKeyboardEvent(event);
});
// Add some keymaps. It can also be a directory of json / cson files.
keymaps.loadKeymap("/path/to/keymap-file.json");
// OR
keymaps.add("/key/for/these/keymaps", {
body: {
up: "core:move-up",
down: "core:move-down",
},
body: {
up: "core:move-up",
down: "core:move-down",
},
});
// When a keybinding is triggered, it will dispatch it on the node that was focused
@@ -31,17 +31,17 @@ window.addEventListener("core:move-down", (event) => console.log("down", event))
// General Usage ==============================================================
const manager = new KeymapManager();
manager.add("some/unique/path", {
".workspace": {
"ctrl-x": "package:do-something",
"ctrl-y": "package:do-something-else",
},
".test": {
enter: "core:confirm",
},
".workspace": {
"ctrl-x": "package:do-something",
"ctrl-y": "package:do-something-else",
},
".test": {
enter: "core:confirm",
},
});
manager.onDidMatchBinding((event): void => {
console.log(event.binding.command);
console.log(event.binding.command);
});
manager.destroy();
@@ -84,8 +84,8 @@ manager.handleKeyboardEvent(event);
manager.keystrokeForKeyboardEvent(event);
sub = manager.addKeystrokeResolver((event): string => {
event.layoutName;
return "Test";
event.layoutName;
return "Test";
});
const num: number = manager.getPartialMatchTimeout();
+179 -181
View File
@@ -7,230 +7,228 @@
/// <reference types="event-kit" />
declare global {
namespace AtomKeymap {
/** Objects that appear as parameters to callbacks. */
namespace Events {
interface FullKeybindingMatch {
/** The string of keystrokes that matched the binding. */
keystrokes: string;
namespace AtomKeymap {
/** The event objects that are passed into the callbacks which the user provides to
* specific API calls.
*/
namespace Events {
/** This custom subclass of CustomEvent exists to provide the ::abortKeyBinding
* method, as well as versions of the ::stopPropagation methods that record the
* intent to stop propagation so event bubbling can be properly simulated for
* detached elements.
*/
interface CommandEvent extends CustomEvent {
keyBindingAborted: boolean;
propagationStopped: boolean;
/** The KeyBinding that the keystrokes matched. */
binding: KeyBinding;
abortKeyBinding(): void;
stopPropagation(): CustomEvent;
stopImmediatePropagation(): CustomEvent;
}
/** The DOM element that was the target of the most recent keyboard event. */
keyboardEventTarget: Element;
}
interface FullKeybindingMatch {
/** The string of keystrokes that matched the binding. */
keystrokes: string;
interface PartialKeybindingMatch {
/** The string of keystrokes that matched the binding. */
keystrokes: string;
/** The KeyBinding that the keystrokes matched. */
binding: KeyBinding;
/** The KeyBindings that the keystrokes partially matched. */
partiallyMatchedBindings: KeyBinding[];
/** The DOM element that was the target of the most recent keyboard event. */
keyboardEventTarget: Element;
}
/** DOM element that was the target of the most recent keyboard event. */
keyboardEventTarget: Element;
}
interface PartialKeybindingMatch {
/** The string of keystrokes that matched the binding. */
keystrokes: string;
interface FailedKeybindingMatch {
/** The string of keystrokes that failed to match the binding. */
keystrokes: string;
/** The KeyBindings that the keystrokes partially matched. */
partiallyMatchedBindings: KeyBinding[];
/** The DOM element that was the target of the most recent keyboard event. */
keyboardEventTarget: Element;
}
/** DOM element that was the target of the most recent keyboard event. */
keyboardEventTarget: Element;
}
interface FailedKeymapFileRead {
/** The error message. */
message: string;
interface FailedKeybindingMatch {
/** The string of keystrokes that failed to match the binding. */
keystrokes: string;
/** The error stack trace. */
stack: string;
}
/** The DOM element that was the target of the most recent keyboard event. */
keyboardEventTarget: Element;
}
interface KeymapLoaded {
/** The path of the keymap file. */
path: string;
}
interface FailedKeymapFileRead {
/** The error message. */
message: string;
interface AddedKeystrokeResolver {
/** The currently resolved keystroke string. If your function returns a falsy
* value, this is how Atom will resolve your keystroke.
*/
keystroke: string;
/** The error stack trace. */
stack: string;
}
/** The raw DOM 3 `KeyboardEvent` being resolved. See the DOM API documentation
* for more details.
*/
event: KeyboardEvent;
interface KeymapLoaded {
/** The path of the keymap file. */
path: string;
}
/** The OS-specific name of the current keyboard layout. */
layoutName: string;
interface AddedKeystrokeResolver {
/** The currently resolved keystroke string. If your function returns a falsy
* value, this is how Atom will resolve your keystroke.
*/
keystroke: string;
/** An object mapping DOM 3 `KeyboardEvent.code` values to objects with the
* typed character for that key in each modifier state, based on the current
* operating system layout.
*/
keymap: object;
}
}
/** The raw DOM 3 `KeyboardEvent` being resolved. See the DOM API documentation
* for more details.
*/
event: KeyboardEvent;
/** Objects that appear as parameters to functions. */
namespace Options {
interface BuildKeyEvent {
ctrl?: boolean;
alt?: boolean;
shift?: boolean;
cmd?: boolean;
which?: number;
target?: Element;
}
}
/** The OS-specific name of the current keyboard layout. */
layoutName: string;
/** The static side to each exported class. Should generally only be used internally. */
namespace Statics {
/* tslint:disable:no-unnecessary-qualifier */
/** The static side to the KeymapManager class. */
interface KeymapManager {
/** Create a keydown DOM event. */
buildKeydownEvent(key: string, options?: AtomKeymap.Options.BuildKeyEvent): void;
/** An object mapping DOM 3 `KeyboardEvent.code` values to objects with the
* typed character for that key in each modifier state, based on the current
* operating system layout.
*/
keymap: object;
}
}
/** Create a keyup DOM event. */
buildKeyupEvent(key: string, options?: AtomKeymap.Options.BuildKeyEvent): void;
/** The option objects that the user is expected to fill out and provide to
* specific API calls.
*/
namespace Options {
interface BuildKeyEvent {
ctrl?: boolean;
alt?: boolean;
shift?: boolean;
cmd?: boolean;
which?: number;
target?: Element;
}
}
/** Create a new KeymapManager. */
new (options?: { defaultTarget?: HTMLElement }): AtomKeymap.KeymapManager;
}
/* tslint:enable:no-unnecessary-qualifier */
}
interface KeyBinding {
// Properties
enabled: boolean;
source: string;
command: string;
keystrokes: string;
keystrokeArray: string[];
keystrokeCount: number;
selector: string;
specificity: number;
/** This custom subclass of CustomEvent exists to provide the ::abortKeyBinding
* method, as well as versions of the ::stopPropagation methods that record the
* intent to stop propagation so event bubbling can be properly simulated for
* detached elements.
*/
interface CommandEvent extends CustomEvent {
keyBindingAborted: boolean;
propagationStopped: boolean;
// Comparison
/** Determines whether the given keystroke matches any contained within this binding. */
matches(keystroke: string): boolean;
abortKeyBinding(): void;
stopPropagation(): CustomEvent;
stopImmediatePropagation(): CustomEvent;
}
/** Compare another KeyBinding to this instance.
* Returns <= -1 if the argument is considered lesser or of lower priority.
* Returns 0 if this binding is equivalent to the argument.
* Returns >= 1 if the argument is considered greater or of higher priority.
*/
compare(other: KeyBinding): number;
}
interface KeyBinding {
// Properties
enabled: boolean;
source: string;
command: string;
keystrokes: string;
keystrokeArray: string[];
keystrokeCount: number;
selector: string;
specificity: number;
/** Allows commands to be associated with keystrokes in a context-sensitive way.
* In Atom, you can access a global instance of this object via `atom.keymaps`.
*/
interface KeymapManager {
defaultTarget: HTMLElement;
// Comparison
/** Determines whether the given keystroke matches any contained within this binding. */
matches(keystroke: string): boolean;
partialMatchTimeout: number;
/** Compare another KeyBinding to this instance.
* Returns <= -1 if the argument is considered lesser or of lower priority.
* Returns 0 if this binding is equivalent to the argument.
* Returns >= 1 if the argument is considered greater or of higher priority.
*/
compare(other: KeyBinding): number;
}
/** Clear all registered key bindings and enqueued keystrokes. For use in tests. */
clear(): void;
/** Allows commands to be associated with keystrokes in a context-sensitive way.
* In Atom, you can access a global instance of this object via `atom.keymaps`.
*/
/** Instance side of KeymapManager class. */
interface KeymapManager {
defaultTarget: HTMLElement;
/** Unwatch all watched paths. */
destroy(): void;
partialMatchTimeout: number;
// Event Subscription
/** Invoke the given callback when one or more keystrokes completely match a key binding. */
onDidMatchBinding(callback: (event: Events.FullKeybindingMatch) => void):
EventKit.Disposable;
/** Clear all registered key bindings and enqueued keystrokes. For use in tests. */
clear(): void;
/** Invoke the given callback when one or more keystrokes partially match a binding. */
onDidPartiallyMatchBindings(callback: (event: Events.PartialKeybindingMatch) =>
void): EventKit.Disposable;
/** Unwatch all watched paths. */
destroy(): void;
/** Invoke the given callback when one or more keystrokes fail to match any bindings. */
onDidFailToMatchBinding(callback: (event: Events.FailedKeybindingMatch) =>
void): EventKit.Disposable;
// Event Subscription
/** Invoke the given callback when one or more keystrokes completely match a key binding. */
onDidMatchBinding(callback: (event: Events.FullKeybindingMatch) => void):
EventKit.Disposable;
/** Invoke the given callback when a keymap file is reloaded. */
onDidReloadKeymap(callback: (event: Events.KeymapLoaded) => void):
EventKit.Disposable;
/** Invoke the given callback when one or more keystrokes partially match a binding. */
onDidPartiallyMatchBindings(callback: (event: Events.PartialKeybindingMatch) =>
void): EventKit.Disposable;
/** Invoke the given callback when a keymap file is unloaded. */
onDidUnloadKeymap(callback: (event: Events.KeymapLoaded) => void):
EventKit.Disposable;
/** Invoke the given callback when one or more keystrokes fail to match any bindings. */
onDidFailToMatchBinding(callback: (event: Events.FailedKeybindingMatch) =>
void): EventKit.Disposable;
/** Invoke the given callback when a keymap file not able to be loaded. */
onDidFailToReadFile(callback: (error: Events.FailedKeymapFileRead) => void):
EventKit.Disposable;
/** Invoke the given callback when a keymap file is reloaded. */
onDidReloadKeymap(callback: (event: Events.KeymapLoaded) => void):
EventKit.Disposable;
// Adding and Removing Bindings
/** Construct KeyBindings from an object grouping them by CSS selector. */
build(source: string, bindings: { [key: string]: { [key: string]: string }},
priority?: number): KeyBinding[];
/** Invoke the given callback when a keymap file is unloaded. */
onDidUnloadKeymap(callback: (event: Events.KeymapLoaded) => void):
EventKit.Disposable;
/** Add sets of key bindings grouped by CSS selector. */
add(source: string, bindings: { [key: string]: { [key: string]: string }},
priority?: number): EventKit.Disposable;
/** Invoke the given callback when a keymap file not able to be loaded. */
onDidFailToReadFile(callback: (error: Events.FailedKeymapFileRead) => void):
EventKit.Disposable;
// Accessing Bindings
/** Get all current key bindings. */
getKeyBindings(): KeyBinding[];
// Adding and Removing Bindings
/** Construct KeyBindings from an object grouping them by CSS selector. */
build(source: string, bindings: { [key: string]: { [key: string]: string }},
priority?: number): KeyBinding[];
/** Get the key bindings for a given command and optional target. */
findKeyBindings(params?: {
keystrokes?: string, // e.g. 'ctrl-x ctrl-s'
command?: string, // e.g. 'editor:backspace'
target?: Element,
}): KeyBinding[];
/** Add sets of key bindings grouped by CSS selector. */
add(source: string, bindings: { [key: string]: { [key: string]: string }},
priority?: number): EventKit.Disposable;
// Managing Keymap Files
/** Load the key bindings from the given path. */
loadKeymap(bindingsPath: string, options?: { watch?: boolean, priority?: number }):
void;
// Accessing Bindings
/** Get all current key bindings. */
getKeyBindings(): KeyBinding[];
/** Cause the keymap to reload the key bindings file at the given path whenever
* it changes.
*/
watchKeymap(filePath: string, options?: { priority: number }): void;
/** Get the key bindings for a given command and optional target. */
findKeyBindings(params?: {
keystrokes?: string, // e.g. 'ctrl-x ctrl-s'
command?: string, // e.g. 'editor:backspace'
target?: Element,
}): KeyBinding[];
// Managing Keyboard Events
/** Dispatch a custom event associated with the matching key binding for the
* given `KeyboardEvent` if one can be found.
*/
handleKeyboardEvent(event: KeyboardEvent): void;
// Managing Keymap Files
/** Load the key bindings from the given path. */
loadKeymap(bindingsPath: string, options?: { watch?: boolean, priority?: number }):
void;
/** Translates a keydown event to a keystroke string. */
keystrokeForKeyboardEvent(event: KeyboardEvent): string;
/** Cause the keymap to reload the key bindings file at the given path whenever
* it changes.
*/
watchKeymap(filePath: string, options?: { priority: number }): void;
/** Customize translation of raw keyboard events to keystroke strings. */
addKeystrokeResolver(resolver: (event: Events.AddedKeystrokeResolver) => string):
EventKit.Disposable;
// Managing Keyboard Events
/** Dispatch a custom event associated with the matching key binding for the
* given `KeyboardEvent` if one can be found.
*/
handleKeyboardEvent(event: KeyboardEvent): void;
/** Get the number of milliseconds allowed before pending states caused by
* partial matches of multi-keystroke bindings are terminated.
*/
getPartialMatchTimeout(): number;
}
/** Translates a keydown event to a keystroke string. */
keystrokeForKeyboardEvent(event: KeyboardEvent): string;
/** The static side to the KeymapManager class. */
interface KeymapManagerStatic {
/** Create a keydown DOM event. */
buildKeydownEvent(key: string, options?: Options.BuildKeyEvent): void;
/** Customize translation of raw keyboard events to keystroke strings. */
addKeystrokeResolver(resolver: (event: Events.AddedKeystrokeResolver) => string):
EventKit.Disposable;
/** Create a keyup DOM event. */
buildKeyupEvent(key: string, options?: Options.BuildKeyEvent): void;
/** Get the number of milliseconds allowed before pending states caused by
* partial matches of multi-keystroke bindings are terminated.
*/
getPartialMatchTimeout(): number;
}
}
/** Create a new KeymapManager. */
new (options?: { defaultTarget?: HTMLElement }): KeymapManager;
}
}
}
declare const KeymapManager: AtomKeymap.Statics.KeymapManager;
declare const KeymapManager: AtomKeymap.KeymapManagerStatic;
export = KeymapManager;
+2 -3
View File
@@ -1,11 +1,10 @@
{
"extends": "dtslint/dt.json",
"rules": {
// Custom rules.
"class-name": true,
"indent": [true, "tabs"],
"indent": [true, "spaces", 4],
"jsdoc-format": true,
"max-line-length": [true, 100],
"max-line-length": [true, 110],
"quotemark": [true, "double", "avoid-escape"],
"trailing-comma": [true, {
"multiline": { "objects": "always", "arrays": "always", "functions": "never" },
@@ -2,37 +2,37 @@ import { createRunner } from "atom-mocha-test-runner";
import defaultMochaRunner = require("atom-mocha-test-runner");
const extraOptions = {
testSuffixes: ["-spec.js", "-spec.coffee"],
testSuffixes: ["-spec.js", "-spec.coffee"],
};
function mochaSetup(mocha: Mocha) {
mocha.addFile("test.file");
mocha.addFile("test.file");
}
let testRunner = createRunner();
testRunner = createRunner(extraOptions);
testRunner = createRunner(extraOptions, mochaSetup);
testRunner = createRunner({
colors: true,
globalAtom: true,
htmlTitle: "Test Title",
reporter: "dot",
testSuffixes: ["test.file"],
colors: true,
globalAtom: true,
htmlTitle: "Test Title",
reporter: "dot",
testSuffixes: ["test.file"],
});
declare const atom: Atom.AtomEnvironment;
declare const atom: AtomCore.AtomEnvironment;
declare const blob: object;
declare let num: number;
async function runTests(): Promise<number> {
const runnerArgs: Atom.Structures.TestRunnerArgs = {
testPaths: ["/var/test"],
logFile: "/var/log",
headless: false,
buildDefaultApplicationDelegate: () => blob,
buildAtomEnvironment: () => atom,
};
const runnerArgs: AtomCore.Structures.TestRunnerArgs = {
testPaths: ["/var/test"],
logFile: "/var/log",
headless: false,
buildDefaultApplicationDelegate: () => blob,
buildAtomEnvironment: () => atom,
};
num = await defaultMochaRunner(runnerArgs);
return await testRunner(runnerArgs);
num = await defaultMochaRunner(runnerArgs);
return testRunner(runnerArgs);
}
+13 -13
View File
@@ -4,24 +4,24 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="atom" />
/// <reference types="mocha" />
/// <reference types="atom" />
interface AtomMochaOptions {
/** Which reporter to use on the terminal. */
reporter?: string;
/** Which reporter to use on the terminal. */
reporter?: string;
/** Whether or not to assign the created Atom environment to `global.atom`. */
globalAtom?: boolean;
/** Whether or not to assign the created Atom environment to `global.atom`. */
globalAtom?: boolean;
/** File extensions that indicate that the file contains tests. */
testSuffixes?: string[];
/** File extensions that indicate that the file contains tests. */
testSuffixes?: string[];
/** Whether or not to colorize output on the terminal. */
colors?: boolean;
/** Whether or not to colorize output on the terminal. */
colors?: boolean;
/** The string to use for the window title in the HTML reporter. */
htmlTitle?: string;
/** The string to use for the window title in the HTML reporter. */
htmlTitle?: string;
}
// The test runner function is augmented on export by:
@@ -31,8 +31,8 @@ interface AtomMochaOptions {
// module.exports.createRunner = createRunner
// Which is what we're trying to model here.
interface TestRunnerExport extends AtomCore.TestRunner {
createRunner(options?: AtomMochaOptions, mochaConfigFunction?:
(mocha: Mocha) => void): AtomCore.TestRunner;
createRunner(options?: AtomMochaOptions, mochaConfigFunction?:
(mocha: Mocha) => void): AtomCore.TestRunner;
}
declare const runner: TestRunnerExport;
+1 -2
View File
@@ -1,9 +1,8 @@
{
"extends": "dtslint/dt.json",
"rules": {
// Custom rules.
"class-name": true,
"indent": [true, "tabs"],
"indent": [true, "spaces", 4],
"jsdoc-format": true,
"max-line-length": [true, 100],
"quotemark": [true, "double", "avoid-escape"],
+23 -5
View File
@@ -30,13 +30,31 @@ function example(cursor: AtomCore.Cursor) {}
### Service Type Definitions
There are many services provided by other Atom packages that you may want to use within your own Atom package. We bundle type definitions for several of these services with these type definitions.
There are many services provided by other Atom packages that you may want to use within your own Atom package. We bundle type definitions for several of these services with these type definitions. All type definitions for services are available only through ES6 imports.
```ts
/// <reference types="atom/services" />
let completionProvider: Atom.Services.Autocomplete.Provider;
import { AutocompleteProvider } from "atom/autocomplete-plus";
let completionProvider: AutocompleteProvider;
```
The currently supported services are:
- [Autocomplete](https://github.com/atom/autocomplete-plus)
- [Status Bar](https://github.com/atom/status-bar)
- [Autocomplete](https://github.com/atom/autocomplete-plus) (atom/autocomplete-plus)
- [Linter](https://github.com/atom/linter) (atom/linter)
- [Status Bar](https://github.com/atom/status-bar) (atom/status-bar)
### Exposing Private Methods and Properties
[Declaration Merging](https://www.typescriptlang.org/docs/handbook/declaration-merging.html) can be used to augment any of the types used within Atom. As an example, if we wanted to reveal the private ```triggerActivationHook``` method within the PackageManager class, then we would create a file with the following contents:
```ts
// <<filename>>.d.ts
declare namespace AtomCore {
interface PackageManager {
triggerActivationHook(name: string): void;
triggerDeferredActivationHooks(): void;
}
}
```
Once this file is either referenced or included within your project, then this new member function would be freely usable on instances of the PackageManager class without TypeScript reporting errors.
+3059 -2014
View File
File diff suppressed because it is too large Load Diff
+137
View File
@@ -0,0 +1,137 @@
// Autocomplete Plus 2.x
// https://atom.io/packages/autocomplete-plus
/** The parameters passed into getSuggestions by Autocomplete+. */
export interface SuggestionsRequestedEvent {
/** The current TextEditor. */
editor: AtomCore.TextEditor;
/** The position of the cursor. */
bufferPosition: TextBuffer.Point;
/** The scope descriptor for the current cursor position. */
scopeDescriptor: AtomCore.ScopeDescriptor;
/** The prefix for the word immediately preceding the current cursor position. */
prefix: string;
/** Whether the autocomplete request was initiated by the user. */
activatedManually: boolean;
}
/** The parameters passed into onDidInsertSuggestion by Autocomplete+. */
export interface SuggestionInsertedEvent {
editor: AtomCore.TextEditor;
triggerPosition: TextBuffer.Point;
suggestion: TextSuggestion|SnippetSuggestion;
}
/** An autocompletion suggestion for the user.
* Primary data type for the Atom Autocomplete+ service.
*/
export interface Suggestion<T extends { text: string }|{ snippet: string }> {
/** A string that will show in the UI for this suggestion.
* When not set, snippet || text is displayed.
*/
displayText?: string;
/** The text immediately preceding the cursor, which will be replaced by the text.
* If not provided, the prefix passed into getSuggestions will be used.
*/
replacementPrefix?: string;
/** The suggestion type. It will be converted into an icon shown against the
* suggestion.
*/
type?: string;
/** This is shown before the suggestion. Useful for return values. */
leftLabel?: string;
/** Use this instead of leftLabel if you want to use html for the left label. */
leftLabelHTML?: string;
/** An indicator (e.g. function, variable) denoting the "kind" of suggestion this
* represents.
*/
rightLabel?: string;
/** Use this instead of rightLabel if you want to use html for the right label. */
rightLabelHTML?: string;
/** Class name for the suggestion in the suggestion list. Allows you to style your
* suggestion via CSS, if desired.
*/
className?: string;
/** If you want complete control over the icon shown against the suggestion.
* e.g. iconHTML: <i class="icon-move-right"></i>
*/
iconHTML?: string;
/** A doc-string summary or short description of the suggestion. When specified, it
* will be displayed at the bottom of the suggestions list.
*/
description?: string;
/** A url to the documentation or more information about this suggestion.
* When specified, a More.. link will be displayed in the description area.
*/
descriptionMoreURL?: string;
}
export interface TextSuggestion extends Suggestion<TextSuggestion> {
/** The text which will be inserted into the editor, in place of the prefix. */
text: string;
}
export interface SnippetSuggestion extends Suggestion<SnippetSuggestion> {
/** A snippet string. This will allow users to tab through function arguments
* or other options.
*/
snippet: string;
}
export type Suggestions = Array<TextSuggestion|SnippetSuggestion>;
/** The interface that all Autocomplete+ providers must implement. */
export interface AutocompleteProvider {
/** Defines the scope selector(s) (can be comma-separated) for which your provider
* should receive suggestion requests.
*/
selector: string;
/** Is called when a suggestion request has been dispatched by autocomplete+ to
* your provider. Return an array of suggestions (if any) in the order you would
* like them displayed to the user. Returning a Promise of an array of suggestions
* is also supported.
*/
getSuggestions(params: SuggestionsRequestedEvent): Suggestions|Promise<Suggestions>;
/** Defines the scope selector(s) (can be comma-separated) for which your provider
* should not be used.
*/
disableForSelector?: string;
/** A number to indicate its priority to be included in a suggestions request.
* The default provider has an inclusion priority of 0. Higher priority providers
* can suppress lower priority providers with excludeLowerPriority.
*/
inclusionPriority?: number;
/** Will not use lower priority providers when this provider is used. */
excludeLowerPriority?: boolean;
/** A number to determine the sort order of suggestions. The default provider has
* an suggestion priority of 1.
*/
suggestionPriority?: number;
/** Function that is called when a suggestion from your provider was inserted
* into the buffer.
*/
onDidInsertSuggestion?(params: SuggestionInsertedEvent): void;
/** Will be called if your provider is being destroyed by autocomplete+ */
dispose?(): void;
}
+3836 -3992
View File
File diff suppressed because it is too large Load Diff
+77
View File
@@ -0,0 +1,77 @@
// Linter 2.x
// https://atom.io/packages/linter
export interface ReplacementSolution {
title?: string;
position: TextBuffer.Range;
priority?: number;
currentText?: string;
replaceWith: string;
}
export interface CallbackSolution {
title?: string;
position: TextBuffer.Range;
priority?: number;
// tslint:disable-next-line:no-any
apply(): any;
}
export interface Message {
/** The location of the issue (aka where to highlight). */
location: {
/** The path to the file to which the message applies. */
file: string;
/** The range of the message in the editor. */
position: TextBuffer.Range;
};
/** A reference to a different location in the editor. */
reference?: {
/** The path to the file being referenced. */
file: string;
/** The point being referenced in that file. */
position?: TextBuffer.Point;
};
/** An HTTP link to a resource explaining the issue. Default is a google search. */
url?: string;
/** The name of the octicon to show in the gutter. */
icon?: string;
/** The text for the message. */
excerpt: string;
/** The severity level for the message. */
severity: "error"|"warning"|"info";
/** Possible solutions (which the user can invoke at will). */
solutions?: Array<ReplacementSolution|CallbackSolution>;
/** Markdown long description of the error. Accepts a callback so that you can
* do things like HTTP requests.
*/
description?: string|(() => Promise<string>|string);
}
export interface IndieDelegate {
name: string;
getMessages(): Message[];
clearMessages(): void;
setMessages(filePath: string, messages: Message[]): void;
setAllMessages(messages: Message[]): void;
onDidUpdate(callback: () => void): EventKit.Disposable;
onDidDestroy(callback: () => void): EventKit.Disposable;
dispose(): void;
}
export interface LinterProvider {
name: string;
scope: "file"|"project";
lintsOnChange: boolean;
grammarScopes: string[];
lint(textEditor: AtomCore.TextEditor): Message[]|void|Promise<Message[]|undefined>;
}
-190
View File
@@ -1,190 +0,0 @@
/* tslint:disable:no-unnecessary-qualifier */
declare namespace Atom {
namespace Services {
/** Type definitions for autocomplete+ 2 */
namespace Autocomplete {
/** Objects that appear as parameters to callbacks. */
namespace Events {
/** The parameters passed into getSuggestions by Autocomplete+. */
interface SuggestionsRequested {
/** The current TextEditor. */
editor: Atom.TextEditor;
/** The position of the cursor. */
bufferPosition: Atom.Point;
/** The scope descriptor for the current cursor position. */
scopeDescriptor: Atom.ScopeDescriptor;
/** The prefix for the word immediately preceding the current cursor position. */
prefix: string;
/** Whether the autocomplete request was initiated by the user. */
activatedManually: boolean;
}
/** The parameters passed into onDidInsertSuggestion by Autocomplete+. */
interface SuggestionInserted {
editor: Atom.TextEditor;
triggerPosition: Atom.Point;
suggestion: TextSuggestion|SnippetSuggestion;
}
}
/** An autocompletion suggestion for the user.
* Primary data type for the Atom Autocomplete+ service.
*/
interface Suggestion {
/** A string that will show in the UI for this suggestion.
* When not set, snippet || text is displayed.
*/
displayText?: string;
/** The text immediately preceding the cursor, which will be replaced by the text.
* If not provided, the prefix passed into getSuggestions will be used.
*/
replacementPrefix?: string;
/** The suggestion type. It will be converted into an icon shown against the suggestion. */
type?: string;
/** This is shown before the suggestion. Useful for return values. */
leftLabel?: string;
/** Use this instead of leftLabel if you want to use html for the left label. */
leftLabelHTML?: string;
/** An indicator (e.g. function, variable) denoting the "kind" of suggestion this represents. */
rightLabel?: string;
/** Use this instead of rightLabel if you want to use html for the right label. */
rightLabelHTML?: string;
/** Class name for the suggestion in the suggestion list. Allows you to style your suggestion
* via CSS, if desired.
*/
className?: string;
/** If you want complete control over the icon shown against the suggestion. e.g. iconHTML:
* <i class="icon-move-right"></i>
*/
iconHTML?: string;
/** A doc-string summary or short description of the suggestion. When specified, it will be
* displayed at the bottom of the suggestions list.
*/
description?: string;
/** A url to the documentation or more information about this suggestion. When specified,
* a More.. link will be displayed in the description area.
*/
descriptionMoreURL?: string;
}
interface TextSuggestion extends Suggestion {
/** The text which will be inserted into the editor, in place of the prefix. */
text: string;
}
interface SnippetSuggestion extends Suggestion {
/** A snippet string. This will allow users to tab through function arguments or other
* options.
*/
snippet: string;
}
type Suggestions = Array<TextSuggestion|SnippetSuggestion>;
interface Provider {
/** Defines the scope selector(s) (can be comma-separated) for which your provider
* should receive suggestion requests.
*/
selector: string;
/** Is called when a suggestion request has been dispatched by autocomplete+ to your
* provider. Return an array of suggestions (if any) in the order you would like them
* displayed to the user. Returning a Promise of an array of suggestions is also
* supported.
*/
getSuggestions(params: Events.SuggestionsRequested): Suggestions|Promise<Suggestions>;
/** Defines the scope selector(s) (can be comma-separated) for which your provider
* should not be used.
*/
disableForSelector?: string;
/** A number to indicate its priority to be included in a suggestions request.
* The default provider has an inclusion priority of 0. Higher priority providers
* can suppress lower priority providers with excludeLowerPriority.
*/
inclusionPriority?: number;
/** Will not use lower priority providers when this provider is used. */
excludeLowerPriority?: boolean;
/** A number to determine the sort order of suggestions. The default provider has
* an suggestion priority of 1.
*/
suggestionPriority?: number;
/** Function that is called when a suggestion from your provider was inserted
* into the buffer.
*/
onDidInsertSuggestion?(params: Events.SuggestionInserted): void;
/** Will be called if your provider is being destroyed by autocomplete+ */
dispose?(): void;
}
}
/** Type definitions for status-bar 1.8 */
namespace StatusBar {
/** Objects that appear as parameters to functions. */
namespace Options {
interface AddTile {
/** A DOM element, a jQuery object, or a model object for which a view provider
* has been registered in the the view registry.
*/
item: object;
/** Determines the placement of the tile within the status bar. Lower priority
* will result in closer placement to the anchor.
*/
priority: number;
}
}
interface Tile {
/** Retrieve the priority that was assigned to the Tile when it was created. */
getPriority(): number;
/** Retrieve the Tile's item. */
getItem(): object;
/** Remove the Tile from the status bar. */
destroy(): void;
}
interface StatusBar {
/** Add a tile to the left side of the status bar. Lower priority tiles are placed
* further to the left.
*/
addLeftTile(options: Options.AddTile): Tile;
/** Add a tile to the right side of the status bar. Lower priority tiles are placed
* further to the right.
*/
addRightTile(options: Options.AddTile): Tile;
/** Retrieve all of the tiles on the left side of the status bar. */
getLeftTiles(): Tile[];
/** Retrieve all of the tiles on the right side of the status bar. */
getRightTiles(): Tile[];
}
type Consumer = (statusBar: StatusBar) => void;
}
}
}
/* tslint:enable:no-unnecessary-qualifier */
+43
View File
@@ -0,0 +1,43 @@
// Status Bar 1.x
// https://atom.io/packages/status-bar
export interface AddTileOptions {
/** A DOM element, a jQuery object, or a model object for which a view provider
* has been registered in the the view registry.
*/
item: object;
/** Determines the placement of the tile within the status bar. Lower priority
* will result in closer placement to the anchor.
*/
priority: number;
}
export interface Tile {
/** Retrieve the priority that was assigned to the Tile when it was created. */
getPriority(): number;
/** Retrieve the Tile's item. */
getItem(): object;
/** Remove the Tile from the status bar. */
destroy(): void;
}
export interface StatusBar {
/** Add a tile to the left side of the status bar. Lower priority tiles are placed
* further to the left.
*/
addLeftTile(options: AddTileOptions): Tile;
/** Add a tile to the right side of the status bar. Lower priority tiles are placed
* further to the right.
*/
addRightTile(options: AddTileOptions): Tile;
/** Retrieve all of the tiles on the left side of the status bar. */
getLeftTiles(): Tile[];
/** Retrieve all of the tiles on the right side of the status bar. */
getRightTiles(): Tile[];
}
+4 -2
View File
@@ -20,6 +20,8 @@
"files": [
"index.d.ts",
"atom-tests.ts",
"services/index.d.ts"
"autocomplete-plus.d.ts",
"linter.d.ts",
"status-bar.d.ts"
]
}
}
+2 -3
View File
@@ -1,12 +1,11 @@
{
"extends": "dtslint/dt.json",
"rules": {
// Custom rules.
"await-promise": [true, "CancellablePromise"],
"class-name": true,
"indent": [true, "tabs"],
"indent": [true, "spaces", 4],
"jsdoc-format": true,
"max-line-length": [true, 100],
"max-line-length": [true, 110],
"quotemark": [true, "double", "avoid-escape"],
"trailing-comma": [true, {
"multiline": { "objects": "always", "arrays": "always", "functions": "never" },
+3 -3
View File
@@ -151,7 +151,7 @@ webAuth.client.login({
webAuth.popup.buildPopupHandler();
webAuth.popup.preload({});
webAuth.popup.authorize({}, (err, data) => {
webAuth.popup.authorize({ domain: "", redirectUri: "", responseType: "code" }, (err, data) => {
if (err) /* handle error */ return;
// do something with data
});
@@ -159,11 +159,11 @@ webAuth.popup.loginWithCredentials({}, (err, data) => {
if (err) /* handle error */ return;
// do something with data
});
webAuth.popup.passwordlessVerify({}, (err, data) => {
webAuth.popup.passwordlessVerify({ type: "sms", phoneNumber: "", connection: "", verificationCode: "" }, (err, data) => {
if (err) /* handle error */ return;
// do something with data
});
webAuth.popup.signupAndLogin({}, (err, data) => {
webAuth.popup.signupAndLogin({ email: "", password: "", connection: "" }, (err, data) => {
if (err) /* handle error */ return;
// do something with data
});
+139 -137
View File
@@ -15,82 +15,68 @@ export class Authentication {
/**
* Builds and returns the `/authorize` url in order to initialize a new authN/authZ transaction
*
* @param {Object} options: https://auth0.com/docs/api/authentication#!#get--authorize_db
* @param options: https://auth0.com/docs/api/authentication#!#get--authorize_db
*/
buildAuthorizeUrl(options: any): string;
/**
* Builds and returns the Logout url in order to initialize a new authN/authZ transaction
*
* @param {Object} options: https://auth0.com/docs/api/authentication#!#get--v2-logout
* @param options: https://auth0.com/docs/api/authentication#!#get--v2-logout
*/
buildLogoutUrl(options?: LogoutOptions): string;
/**
* Makes a call to the `oauth/token` endpoint with `password` grant type
*
* @param {DefaultDirectoryLoginOptions} options: https://auth0.com/docs/api-auth/grant/password
* @param {Function} callback
* @param options: https://auth0.com/docs/api-auth/grant/password
*/
loginWithDefaultDirectory(options: DefaultDirectoryLoginOptions, callback: Auth0Callback<any>): void;
/**
* Makes a call to the `/ro` endpoint
* @param {ResourceOwnerLoginOptions} options
* @param {Function} callback
* @deprecated `loginWithResourceOwner` will be soon deprecated, user `login` instead.
*/
loginWithResourceOwner(options: ResourceOwnerLoginOptions, callback: Auth0Callback<any>): void;
/**
* Makes a call to the `oauth/token` endpoint with `password-realm` grant type
* @param {DefaultLoginOptions} options
* @param {Function} callback
*/
login(options: DefaultLoginOptions, callback: Auth0Callback<any>): void;
/**
* Makes a call to the `oauth/token` endpoint
* @param {any} options
* @param {Function} callback
*/
oauthToken(options: any, callback: Auth0Callback<any>): void;
/**
* Makes a call to the `/ssodata` endpoint
*
* @param {Function} callback
*/
getSSOData(callback?: Auth0Callback<any>): void;
/**
* Makes a call to the `/ssodata` endpoint
*
* @param {Boolean} withActiveDirectories
* @param {Function} callback
*/
getSSOData(withActiveDirectories: boolean, callback?: Auth0Callback<any>): void;
/**
* Makes a call to the `/userinfo` endpoint and returns the user profile
*
* @param {String} accessToken
* @param {Function} callback
*/
userInfo(accessToken: string, callback: Auth0Callback<Auth0UserProfile>): void;
/**
* Makes a call to the `/delegation` endpoint
*
* @param {DelegationOptions} options: https://auth0.com/docs/api/authentication#!#post--delegation
* @param {Function} callback
* @param options: https://auth0.com/docs/api/authentication#!#post--delegation
*/
delegation(options: DelegationOptions, callback: Auth0Callback<Auth0DelegationToken>): any;
/**
* Fetches the user country based on the ip.
*
* @param {Function} callback
*/
getUserCountry(callback: Auth0Callback<{ countryCode: string }>): void;
}
@@ -101,24 +87,19 @@ export class PasswordlessAuthentication {
/**
* Builds and returns the passwordless TOTP verify url in order to initialize a new authN/authZ transaction
*
* @param {PasswordlessVerifyOptions} options
* @param {Function} callback
*/
buildVerifyUrl(options: PasswordlessVerifyOptions): string;
/**
* Initializes a new passwordless authN/authZ transaction
*
* @param {Object} options: https://auth0.com/docs/api/authentication#passwordless
* @param {Function} callback
* @param options: https://auth0.com/docs/api/authentication#passwordless
*/
start(options: PasswordlessStartOptions, callback: Auth0Callback<any>): void;
/**
* Verifies the passwordless TOTP and returns an error if any.
*
* @param {PasswordlessVerifyOptions} options
* @param {Function} callback
*/
verify(options: PasswordlessVerifyOptions, callback: Auth0Callback<any>): void;
}
@@ -129,16 +110,14 @@ export class DBConnection {
/**
* Signup a new user
*
* @param {DbSignUpOptions} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup
* @param {Function} calback
* @param options: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup
*/
signup(options: DbSignUpOptions, callback: Auth0Callback<any>): void;
/**
* Initializes the change password flow
*
* @param {ChangePasswordOptions} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-change_password
* @param {Function} callback
* @param options: https://auth0.com/docs/api/authentication#!#post--dbconnections-change_password
*/
changePassword(options: ChangePasswordOptions, callback: Auth0Callback<any>): void;
}
@@ -146,15 +125,12 @@ export class DBConnection {
export class Management {
/**
* Initialize your client class, by using a Non Interactive Client to fetch an access_token via the Client Credentials Grant.
* @param {ManagementOptions} options
*/
constructor(options: ManagementOptions);
/**
* Returns the user profile. https://auth0.com/docs/api/management/v2#!/Users/get_users_by_id
*
* @param {String} userId
* @param {Function} callback
*/
getUser(userId: string, callback: Auth0Callback<Auth0UserProfile>): void;
@@ -162,18 +138,12 @@ export class Management {
* Updates the user metdata. It will patch the user metdata with the attributes sent.
* https://auth0.com/docs/api/management/v2#!/Users/patch_users_by_id
*
* @param {String} userId
* @param {Object} userMetadata
* @param {Function} callback
*/
patchUserMetadata(userId: string, userMetadata: any, callback: Auth0Callback<Auth0UserProfile>): void;
/**
* Link two users. https://auth0.com/docs/api/management/v2#!/Users/post_identities
*
* @param {String} userId
* @param {String} secondaryUserToken
* @param {Function} callback
*/
linkUser(userId: string, secondaryUserToken: string, callback: Auth0Callback<any>): void;
}
@@ -188,7 +158,7 @@ export class WebAuth {
/**
* Redirects to the hosted login page (`/authorize`) in order to initialize a new authN/authZ transaction
*
* @param {AuthorizeOptions} options: https://auth0.com/docs/api/authentication#!#get--authorize_db
* @param options: https://auth0.com/docs/api/authentication#!#get--authorize_db
*/
authorize(options?: AuthorizeOptions): void;
@@ -199,8 +169,7 @@ export class WebAuth {
* by the `/.well-known/jwks.json` endpoint. Id tokens signed with other algorithms will not be
* accepted.
*
* @param {ParseHashOptions} options
* @param {Function} callback: any(err, token_payload)
* @param callback: any(err, token_payload)
*/
parseHash(callback: Auth0Callback<Auth0DecodedHash>): void;
@@ -211,17 +180,14 @@ export class WebAuth {
* by the `/.well-known/jwks.json` endpoint. Id tokens signed with other algorithms will not be
* accepted.
*
* @param {ParseHashOptions} options
* @param {Function} callback: any(err, token_payload)
* @param callback: any(err, token_payload)
*/
parseHash(options: ParseHashOptions, callback: Auth0Callback<Auth0DecodedHash>): void;
/**
* Decodes the id_token and verifies the nonce.
*
* @param {String} token
* @param {String} nonce
* @param {Function} callback: function(err, {payload, transaction})
* @param callback: function(err, {payload, transaction})
*/
validateToken(token: string, nonce: string, callback: Auth0Callback<any>): void;
@@ -231,24 +197,21 @@ export class WebAuth {
* Watch out! If you're not using the hosted login page to do social logins, you have to use your own [social connection keys](https://manage.auth0.com/#/connections/social).
* If you use Auth0's dev keys, you'll always get `login_required` as an error when calling this method.
*
* @param {RenewAuthOptions} options: any valid oauth2 parameter to be sent to the `/authorize` endpoint
* @param {Function} callback
* @param options: any valid oauth2 parameter to be sent to the `/authorize` endpoint
*/
renewAuth(options: RenewAuthOptions, callback: Auth0Callback<any>): void;
/**
* Initialices a change password transaction
*
* @param {ChangePasswordOptions} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-change_password
* @param {Function} callback
* @param options: https://auth0.com/docs/api/authentication#!#post--dbconnections-change_password
*/
changePassword(options: ChangePasswordOptions, callback: Auth0Callback<any>): void;
/**
* Signs up a new user
*
* @param {DbSignUpOptions} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup
* @param {Function} callback
* @param options: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup
*/
signup(options: DbSignUpOptions, callback: Auth0Callback<any>): void;
@@ -256,8 +219,7 @@ export class WebAuth {
* Signs up a new user, automatically logs the user in after the signup and returns the user token.
* The login will be done using /oauth/token with password-realm grant type.
*
* @param {DbSignUpOptions} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup
* @param {Function} callback
* @param options: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup
*/
signupAndAuthorize(options: DbSignUpOptions, callback: Auth0Callback<any>): void;
@@ -268,8 +230,8 @@ export class WebAuth {
* This only works when 3rd party cookies are enabled in the browser.
* After the /co/authenticate call, you'll have to use the {@link parseHash} function at the `redirectUri` specified in the constructor.
*
* @param {CrossOriginLoginOptions} options options used in the {@link authorize} call after the login_ticket is acquired
* @param {crossOriginLoginCallback} cb Callback function called only when an authentication error, like invalid username or password, occurs.
* @param options options used in the {@link authorize} call after the login_ticket is acquired
* @param cb Callback function called only when an authentication error, like invalid username or password, occurs.
* For other types of errors, there will be a redirect to the `redirectUri`.
*/
login(options: CrossOriginLoginOptions, callback: Auth0Callback<any>): void;
@@ -288,7 +250,6 @@ export class WebAuth {
* - If the client_id parameter is included, the returnTo URL must be listed in the Allowed Logout URLs set at the client level (see Setting Allowed Logout URLs at the App Level).
* - If the client_id parameter is NOT included, the returnTo URL must be listed in the Allowed Logout URLs set at the account level (see Setting Allowed Logout URLs at the Account Level).
*
* @param {LogoutOptions} options
* @see {@link https://auth0.com/docs/api/authentication#logout}
*/
logout(options: LogoutOptions): void;
@@ -296,17 +257,14 @@ export class WebAuth {
/**
* Initialices a passwordless authentication transaction
*
* @param {PasswordlessStartOptions} options: https://auth0.com/docs/api/authentication#passwordless
* @param {Function} callback
* @param options: https://auth0.com/docs/api/authentication#passwordless
*/
passwordlessStart(options: PasswordlessStartOptions, callback: Auth0Callback<any>): void;
/**
* Verifies the passwordless TOTP and redirects to finish the passwordless transaction
*
* @method passwordlessVerify
* @param {PasswordlessVerifyOptions} options:
* @param {Function} callback
* @param options:
*/
passwordlessVerify(options: PasswordlessVerifyOptions, callback: Auth0Callback<any>): void;
}
@@ -319,28 +277,35 @@ export class Redirect {
*
* This method is not compatible with API Auth so if you need to fetch API tokens with audience
* you should use {@link authorize} or {@link login}.
*
* @method loginWithCredentials
* @param {Object} options
* @param {String} [options.redirectUri] url that the Auth0 will redirect after Auth with the Authorization Response
* @param {String} [options.responseType] type of the response used. It can be any of the values `code` and `token`
* @param {String} [options.responseMode] how the AuthN response is encoded and redirected back to the client. Supported values are `query` and `fragment`
* @param {String} [options.scope] scopes to be requested during AuthN. e.g. `openid email`
* @param {credentialsCallback} cb
*/
loginWithCredentials(options: any, callback: Auth0Callback<any>): void;
loginWithCredentials(
options: {
/** url that the Auth0 will redirect after Auth with the Authorization Response */
redirectUri?: string,
/** type of the response used. It can be any of the values `code` and `token` */
responseType?: string,
/** how the AuthN response is encoded and redirected back to the client. */
responseMode?: "query" | "fragment",
/** scopes to be requested during AuthN. e.g. `openid email` */
scope: string,
},
callback: Auth0Callback<any>,
): void;
/**
* Signs up a new user and automatically logs the user in after the signup.
*
* @method signupAndLogin
* @param {Object} options
* @param {String} options.email user email address
* @param {String} options.password user password
* @param {String} options.connection name of the connection where the user will be created
* @param {credentialsCallback} cb
*/
signupAndLogin(options: any, callback: Auth0Callback<any>): void;
signupAndLogin(
options: {
/** user email address */
email: string,
/** user password */
password: string,
/** name of the connection where the user will be created */
connection: string,
},
callback: Auth0Callback<any>,
): void;
}
export class Popup {
@@ -349,98 +314,135 @@ export class Popup {
/**
* Returns a new instance of the popup handler
*
* @method buildPopupHandler
*/
buildPopupHandler(): any;
/**
* Initializes the popup window and returns the instance to be used later in order to avoid being blocked by the browser.
*
* @method preload
* @param {Object} options: receives the window height and width and any other window feature to be sent to window.open
* @param options: receives the window height and width and any other window feature to be sent to window.open
*/
preload(options: any): any;
/**
* Handles the popup logic for the callback page.
*
* @method callback
* @param {Object} options
* @param {String} options.hash the url hash. If not provided it will extract from window.location.hash
* @param {String} [options.state] value originally sent in `state` parameter to {@link authorize} to mitigate XSRF
* @param {String} [options.nonce] value originally sent in `nonce` parameter to {@link authorize} to prevent replay attacks
* @param {String} [options._idTokenVerification] makes parseHash perform or skip `id_token` verification.
* We **strongly** recommend validating the `id_token` yourself if you disable the verification.
* @see {@link parseHash}
* @see {@link parseHash}
*/
callback(options: any): void;
callback(options: {
/**
* the url hash.
* @default window.location.hash
*/
hash: string,
/** value originally sent in `state` parameter to {@link authorize} to mitigate XSRF */
state?: string,
/** value originally sent in `nonce` parameter to {@link authorize} to prevent replay attacks */
nonce?: string,
/**
* makes parseHash perform or skip `id_token` verification.
* We **strongly** recommend validating the `id_token` yourself if you disable the verification.
*/
_idTokenVerification?: string,
}): void;
/**
* Shows inside a new window the hosted login page (`/authorize`) in order to start a new authN/authZ transaction and post its result using `postMessage`.
*
* @method authorize
* @param {Object} options
* @param {String} [options.domain] your Auth0 domain
* @param {String} [options.clientID] your Auth0 client identifier obtained when creating the client in the Auth0 Dashboard
* @param {String} options.redirectUri url that the Auth0 will redirect after Auth with the Authorization Response
* @param {String} options.responseType type of the response used by OAuth 2.0 flow.
* It can be any space separated list of the values `code`, `token`, `id_token`. {@link https://openid.net/specs/oauth-v2-multiple-response-types-1_0}
* @param {String} [options.responseMode] how the Auth response is encoded and redirected back to the client.
* Supported values are `query`, `fragment` and `form_post`. {@link https://openid.net/specs/oauth-v2-multiple-response-types-1_0.html#ResponseModes}
* @param {String} [options.state] value used to mitigate XSRF attacks. {@link https://auth0.com/docs/protocols/oauth2/oauth-state}
* @param {String} [options.nonce] value used to mitigate replay attacks when using Implicit Grant. {@link https://auth0.com/docs/api-auth/tutorials/nonce}
* @param {String} [options.scope] scopes to be requested during Auth. e.g. `openid email`
* @param {String} [options.audience] identifier of the resource server who will consume the access token issued after Auth
* @param {Boolean} [options.owp] determines if Auth0 should render the relay page or not and the caller is responsible of handling the response.
* @param {authorizeCallback} cb
* @see {@link https://auth0.com/docs/api/authentication#authorize-client}
*/
authorize(options: any, callback: Auth0Callback<any>): void;
authorize(
options: {
/** your Auth0 domain */
domain: string,
/** your Auth0 client identifier obtained when creating the client in the Auth0 Dashboard */
clientId?: string,
/** url that the Auth0 will redirect after Auth with the Authorization Response */
redirectUri: string,
/**
* type of the response used by OAuth 2.0 flow.
* It can be any space separated list of the values `code`, `token`, `id_token`.
* {@link https://openid.net/specs/oauth-v2-multiple-response-types-1_0}
*/
responseType: string,
/**
* how the Auth response is encoded and redirected back to the client.
* {@link https://openid.net/specs/oauth-v2-multiple-response-types-1_0.html#ResponseModes}
*/
responseMode?: "query" | "fragment" | "form_post",
/**
* value used to mitigate XSRF attacks.
* {@link https://auth0.com/docs/protocols/oauth2/oauth-state}
*/
state?: string,
/**
* value used to mitigate replay attacks when using Implicit Grant.
* {@link https://auth0.com/docs/api-auth/tutorials/nonce}
*/
nonce?: string,
/** scopes to be requested during Auth. e.g. `openid email` */
scope?: string,
/** identifier of the resource server who will consume the access token issued after Auth */
audience?: string,
/** determines if Auth0 should render the relay page or not and the caller is responsible of handling the response. */
owp?: boolean,
},
callback: Auth0Callback<any>,
): void;
/**
* Performs authentication with username/email and password with a database connection inside a new window
*
* This method is not compatible with API Auth so if you need to fetch API tokens with audience
* you should use {@link authorize} or {@link login}.
*
* @method loginWithCredentials
* @param {Object} options
* @param {String} [options.redirectUri] url that the Auth0 will redirect after Auth with the Authorization Response
* @param {String} [options.responseType] type of the response used. It can be any of the values `code` and `token`
* @param {String} [options.responseMode] how the AuthN response is encoded and redirected back to the client. Supported values are `query` and `fragment`
* @param {String} [options.scope] scopes to be requested during AuthN. e.g. `openid email`
* @param {credentialsCallback} cb
*/
loginWithCredentials(options: any, callback: Auth0Callback<any>): void;
loginWithCredentials(
options: {
/** url that the Auth0 will redirect after Auth with the Authorization Response */
redirectUri?: string,
/** type of the response used. */
responseType?: "code" | "token",
/** how the AuthN response is encoded and redirected back to the client. */
responseMode?: "query" | "fragment",
/** scopes to be requested during AuthN. e.g. `openid email` */
scope?: string,
},
callback: Auth0Callback<any>,
): void;
/**
* Verifies the passwordless TOTP and returns the requested token
*
* @method passwordlessVerify
* @param {Object} options:
* @param {Object} options.type: `sms` or `email`
* @param {Object} options.phoneNumber: only if type = sms
* @param {Object} options.email: only if type = email
* @param {Object} options.connection: the connection name
* @param {Object} options.verificationCode: the TOTP code
* @param {Function} callback
*/
passwordlessVerify(options: any, callback: Auth0Callback<any>): void;
passwordlessVerify(
options: {
type: "sms" | "email",
/** only if type = sms */
phoneNumber?: string,
/** only if type = email */
email?: string,
/** the connection name */
connection: string,
/** the TOTP code */
verificationCode: string,
},
callback: Auth0Callback<any>,
): void;
/**
* Signs up a new user and automatically logs the user in after the signup.
*
* This method is not compatible with API Auth so if you need to fetch API tokens with audience
* you should use {@link authorize} or {@link signupAndAuthorize}.
*
* @method signupAndLogin
* @param {Object} options
* @param {String} options.email user email address
* @param {String} options.password user password
* @param {String} options.connection name of the connection where the user will be created
* @param {credentialsCallback} cb
*/
signupAndLogin(options: any, callback: Auth0Callback<any>): void;
signupAndLogin(
options: {
/** user email address */
email: string,
/** user password */
password: string,
/** name of the connection where the user will be created */
connection: string,
},
callback: Auth0Callback<any>,
): void;
}
export class CrossOriginAuthentication {
@@ -452,8 +454,8 @@ export class CrossOriginAuthentication {
* This only works when 3rd party cookies are enabled in the browser.
* After the /co/authenticate call, you'll have to use the {@link parseHash} function at the `redirectUri` specified in the constructor.
*
* @param {CrossOriginLoginOptions} options options used in the {@link authorize} call after the login_ticket is acquired
* @param {crossOriginLoginCallback} cb Callback function called only when an authentication error, like invalid username or password, occurs.
* @param options options used in the {@link authorize} call after the login_ticket is acquired
* @param cb Callback function called only when an authentication error, like invalid username or password, occurs.
* For other types of errors, there will be a redirect to the `redirectUri`.
*/
login(options: CrossOriginLoginOptions, callback: Auth0Callback<any>): void;
+39 -12
View File
@@ -1,4 +1,4 @@
// Type definitions for auth0 2.3
// Type definitions for auth0 2.4
// Project: https://github.com/auth0/node-auth0
// Definitions by: Wilson Hobbs <https://github.com/wbhob>, Seth Westphal <https://github.com/westy92>, Amiram Korach <https://github.com/amiram>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -60,6 +60,33 @@ export interface GetUsersData {
search_engine?: string;
}
export interface Rule {
/**
* The name of the rule.
*/
name?: string;
/**
* The rule's identifier.
*/
id?: string;
/**
* The code to be executed when the rule runs.
*/
script?: string;
/**
* The rule's execution stage.
*/
stage?: string;
/**
* `true` if the connection is enabled, `false` otherwise.
*/
enabled?: boolean;
/**
* The rule's order in relation to other rules. A rule with a lower order than another rule executes first.
*/
order?: number;
}
export interface User {
email?: string;
email_verified?: boolean;
@@ -352,20 +379,20 @@ export class ManagementClient {
// Rules
getRules(): Promise<User>;
getRules(cb: (err: Error, data: any) => void): void;
getRules(): Promise<Rule[]>;
getRules(cb: (err: Error, rules: Rule[]) => void): void;
getRule(params: ClientParams): Promise<User>;
getRule(params: ClientParams, cb: (err: Error, data: any) => void): void;
getRule(params: ClientParams): Promise<Rule>;
getRule(params: ClientParams, cb: (err: Error, rule: Rule) => void): void;
createRules(data: Data): Promise<User>;
createRules(data: Data, cb: (err: Error, data: any) => void): void;
createRule(data: Data): Promise<Rule>;
createRule(data: Data, cb: (err: Error, rule: Rule) => void): void;
updateRule(params: ObjectWithId, data: Data): Promise<User>;
updateRule(params: ObjectWithId, data: Data, cb: (err: Error, data: any) => void): void;
updateRule(params: ObjectWithId, data: Data): Promise<Rule>;
updateRule(params: ObjectWithId, data: Data, cb: (err: Error, rule: Rule) => void): void;
deleteRule(params: ObjectWithId): Promise<User>;
deleteRule(params: ObjectWithId, cb: (err: Error, data: any) => void): void;
deleteRule(params: ObjectWithId): Promise<void>;
deleteRule(params: ObjectWithId, cb: (err: Error) => void): void;
// Users
@@ -377,7 +404,7 @@ export class ManagementClient {
getUser(params: ObjectWithId, cb?: (err: Error, user: User) => void): void;
createUser(data: CreateUserData): Promise<User>;
createUser(data: CreateUserData, cb: (err: Error, data: User) => void): void;
createUser(data: CreateUserData, cb: (err: Error, user: User) => void): void;
updateUser(params: ObjectWithId, data: UpdateUserData): Promise<User>;
updateUser(params: ObjectWithId, data: UpdateUserData, cb: (err: Error, data: User) => void): void;
-9
View File
@@ -8,17 +8,14 @@
/**
* Attach autosize to NodeList
* @param elements
*/
declare function autosize(elements: NodeList): NodeList;
/**
* Attach autosize to Element
* @param element
*/
declare function autosize(element: Element): Element;
/**
* Attach autosize to JQuery collection
* @param collection
*/
declare function autosize(collection: JQuery): JQuery;
@@ -27,37 +24,31 @@ declare namespace autosize {
* Triggers the height adjustment for an assigned textarea element.
* Autosize will automatically adjust the textarea height on keyboard and window resize events.
* There is no efficient way for Autosize to monitor for when another script has changed the textarea value or for changes in layout that impact the textarea element.
* @param elements
*/
function update(elements: NodeList): NodeList;
/**
* Triggers the height adjustment for an assigned textarea element.
* Autosize will automatically adjust the textarea height on keyboard and window resize events.
* There is no efficient way for Autosize to monitor for when another script has changed the textarea value or for changes in layout that impact the textarea element.
* @param element
*/
function update(element: Element): Element;
/**
* Triggers the height adjustment for an assigned textarea element.
* Autosize will automatically adjust the textarea height on keyboard and window resize events.
* There is no efficient way for Autosize to monitor for when another script has changed the textarea value or for changes in layout that impact the textarea element.
* @param collection
*/
function update(collection: JQuery): JQuery;
/**
* Removes Autosize and reverts any changes it made to the textarea element.
* @param elements
*/
function destroy(elements: NodeList): NodeList;
/**
* Removes Autosize and reverts any changes it made to the textarea element.
* @param element
*/
function destroy(element: Element): Element;
/**
* Removes Autosize and reverts any changes it made to the textarea element.
* @param collection
*/
function destroy(collection: JQuery): JQuery;
}
+3 -2
View File
@@ -162,8 +162,9 @@ export interface TransformOptions {
/** Indicate the mode the code should be parsed in. Can be either “script” or “module”. Default: "module" */
sourceType?: "script" | "module";
/** An optional callback that can be used to wrap visitor methods.
* NOTE: This is useful for things like introspection, and not really needed for implementing anything.
/**
* An optional callback that can be used to wrap visitor methods.
* NOTE: This is useful for things like introspection, and not really needed for implementing anything.
*/
wrapPluginVisitorMethod?(pluginAlias: string, visitorType: 'enter' | 'exit', callback: (path: NodePath, state: any) => void): (path: NodePath, state: any) => void ;
}
+5 -5
View File
@@ -691,7 +691,7 @@ export class Region extends Object implements DomMixin {
* Render a template with data by passing in the template selector and the
* data to render. This is the default renderer that is used by Marionette.
*/
export class Renderer {
export namespace Renderer {
/**
* This method returns a string containing the result of applying the
* template using the data object as the context.
@@ -703,7 +703,7 @@ export class Renderer {
* that returns valid HTML as a string from the data parameter passed to
* the function.
*/
static render(template: any, data: any): string;
function render(template: any, data: any): string;
}
export interface ViewOptions<TModel extends Backbone.Model> extends Backbone.ViewOptions<TModel>, ViewMixinOptions {
@@ -1614,11 +1614,11 @@ export class Behavior extends Object {
/**
* DEPRECATED
*/
export class Behaviors {
export namespace Behaviors {
/**
* This method defines where your behavior classes are stored. Override this to provide another lookup.
*/
static behaviorsLookup(): any;
function behaviorsLookup(): any;
/**
* This method has a default implementation that is simple to override. It
@@ -1626,5 +1626,5 @@ export class Behaviors {
* Behaviors.behaviorsLookup or elsewhere. Note that it should return the type of the
* class to instantiate, not an instance of that class.
*/
static getBehaviorClass(options: any, key: string): any;
function getBehaviorClass(options: any, key: string): any;
}
+2
View File
@@ -115,6 +115,8 @@ class Employee extends Backbone.Model {
super(options);
this.reports = new EmployeeCollection();
this.reports.url = '../api/employees/' + this.id + '/reports';
// Test that collection url property can be set as a function returning a string.
this.reports.url = () => { return ""; };
}
more() {
+15 -1
View File
@@ -100,7 +100,6 @@ declare namespace Backbone {
}
class ModelBase extends Events {
url: any;
parse(response: any, options?: any): any;
toJSON(options?: any): any;
sync(...arg: any[]): JQueryXHR;
@@ -133,6 +132,13 @@ declare namespace Backbone {
id: any;
idAttribute: string;
validationError: any;
/**
* Returns the relative URL where the model's resource would be located on the server.
* @memberof Model
*/
url: () => string;
urlRoot: any;
constructor(attributes?: any, options?: any);
@@ -314,6 +320,14 @@ declare namespace Backbone {
take(): TModel;
take(n: number): TModel[];
toArray(): TModel[];
/**
* Sets the url property (or function) on a collection to reference its location on the server.
*
* @memberof Collection
*/
url: string | (() => string);
without(...values: TModel[]): TModel[];
}
+3 -2
View File
@@ -4,7 +4,8 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export interface FittingContext {
/** The input defined in the fitting definition
/**
* The input defined in the fitting definition
* (string, number, object, array)
*/
input: any;
@@ -56,7 +57,7 @@ export type Fitting = (
* Executed during parsing
* @see {@link https://github.com/apigee-127/bagpipes#fittings|Docs}
*
* @param {Object} fittingDef Fitting Definition
* @param fittingDef Fitting Definition
*/
export type FittingFactory = (fittingDef: FittingDef, bagpipes: any) => Fitting;
+3 -9
View File
@@ -1,10 +1,4 @@
import BezierEasing = require("bezier-easing");
function get_easing() {
let easing: Easing = BezierEasing(0, 0, 1, 0.5);
}
function use_easing() {
let easing: Easing = BezierEasing(0, 0, 1, 0.5);
let eased: number = easing(1);
}
const easing: BezierEasing.Easing = BezierEasing(0, 0, 1, 0.5);
const eased: number = easing(1);
+6 -4
View File
@@ -1,10 +1,12 @@
// Type definitions for bezier-easing
// Type definitions for bezier-easing 2.0
// Project: https://github.com/gre/bezier-easing
// Definitions by: brian ridley <https://github.com/ptlis>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare interface Easing {
(x: number): number;
declare namespace BezierEasing {
type Easing = (x: number) => number;
}
declare function BezierEasing(mX1: number, mY1: number, mX2: number, mY2: number): Easing;
declare function BezierEasing(mX1: number, mY1: number, mX2: number, mY2: number): BezierEasing.Easing;
export = BezierEasing;
export as namespace BezierEasing;
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+3 -1
View File
@@ -62,10 +62,12 @@ export class Block {
}
export class ECPair {
constructor(d: BigInteger, Q?: null | undefined, options?: { compressed?: boolean, network?: Network });
constructor(d: BigInteger, Q?: null, options?: { compressed?: boolean, network?: Network });
constructor(d: null | undefined, Q: any, options?: { compressed?: boolean, network?: Network }); // Q should be ECPoint, but not sure how to define such type
d: BigInteger;
getAddress(): string;
getNetwork(): Network;
-22
View File
@@ -14,59 +14,43 @@ export function createBlob(parts: any[], options?: { type: string }): Blob;
/**
* Shim for URL.createObjectURL() to support browsers that only have the prefixed webkitURL (e.g. Android <4.4).
*
* @param blob
*/
export function createObjectURL(blob: Blob): string;
/**
* Shim for URL.revokeObjectURL() to support browsers that only have the prefixed webkitURL (e.g. Android <4.4).
*
* @param url
*/
export function revokeObjectURL(url: string): void;
/**
* Convert a Blob to a binary string.
*
* @param blob
*/
export function blobToBinaryString(blob: Blob): Promise<string>;
/**
* Convert a binary string to a Blob.
*
* @param binary
* @param type the content type
*/
export function binaryStringToBlob(binary: string, type?: string): Promise<Blob>;
/**
* Convert a Blob to a base-64 string.
*
* @param blob
*/
export function blobToBase64String(blob: Blob): Promise<string>;
/**
* Convert a base-64 string to a Blob.
*
* @param base64
* @param type the content type
*/
export function base64StringToBlob(base64: string, type?: string): Promise<Blob>;
/**
* Convert a data URL string (e.g. `'data:image/png;base64,iVBORw0KG...'`) to a Blob.
*
* @param dataURL
*/
export function dataURLToBlob(dataURL: string): Promise<Blob>;
/**
* Convert a Blob to a data URL string (e.g. `'data:image/png;base64,iVBORw0KG...'`).
*
* @param blob
*/
export function blobToDataURL(blob: Blob): Promise<string>;
@@ -75,7 +59,6 @@ export function blobToDataURL(blob: Blob): Promise<string>;
*
* Note: this will coerce the image to the desired content type, and it will only paint the first frame of an animated GIF.
*
* @param src
* @param type the content type (optional, defaults to 'image/png')
* @param crossOrigin for CORS-enabled images, set this to 'Anonymous' to avoid "tainted canvas" errors
* @param quality a number between 0 and 1 indicating image quality if the requested type is 'image/jpeg' or 'image/webp'
@@ -85,7 +68,6 @@ export function imgSrcToDataURL(src: string, type?: string, crossOrigin?: string
/**
* Convert a canvas to a Blob.
*
* @param src
* @param type the content type (optional, defaults to 'image/png')
* @param quality a number between 0 and 1 indicating image quality if the requested type is 'image/jpeg' or 'image/webp'
*/
@@ -96,7 +78,6 @@ export function canvasToBlob(canvas: HTMLCanvasElement, type?: string, quality?:
*
* Note: this will coerce the image to the desired content type, and it will only paint the first frame of an animated GIF.
*
* @param src
* @param type the content type (optional, defaults to 'image/png')
* @param crossOrigin for CORS-enabled images, set this to 'Anonymous' to avoid "tainted canvas" errors
* @param quality a number between 0 and 1 indicating image quality if the requested type is 'image/jpeg' or 'image/webp'
@@ -106,14 +87,11 @@ export function imgSrcToBlob(src: string, type?: string, crossOrigin?: string, q
/**
* Convert an ArrayBuffer to a Blob.
*
* @param arrayBuff
* @param type the content type
*/
export function arrayBufferToBlob(arrayBuff: ArrayBuffer, type?: string): Promise<Blob>;
/**
* Convert a Blob to an ArrayBuffer.
*
* @param blob
*/
export function blobToArrayBuffer(blob: Blob): Promise<ArrayBuffer>;
+1
View File
@@ -6,6 +6,7 @@
"array-type": false,
"unified-signatures": false,
"ban-types": false,
"no-redundant-undefined": false,
"no-unnecessary-generics": false
}
}
+1
View File
@@ -3,6 +3,7 @@
"rules": {
"adjacent-overload-signatures": false,
"max-line-length": [true, 490],
"no-redundant-undefined": false,
"no-unnecessary-callback-wrapper": false,
"no-unnecessary-generics": false,
"no-void-expression": false,
+1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/expressjs/body-parser
// Definitions by: Santi Albo <https://github.com/santialbo>, Vilic Vane <https://github.com/vilic>, Jonathan Häberle <https://github.com/dreampulse>, Gevik Babakhani <https://github.com/blendsdk>, Tomasz Łaziuk <https://github.com/tlaziuk>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="node" />
@@ -90,6 +90,56 @@ $(() => {
$('#ex16a').slider({ min: 0, max: 10, value: 0, focus: true });
$('#ex16b').slider({ min: 0, max: 10, value: [0, 10], focus: true });
$("#ex17a").slider({
min: 0,
max: 10,
value: 0,
tooltip_position: 'bottom'
});
$("#ex17b").slider({
min: 0,
max: 10,
value: 0,
orientation: 'vertical',
tooltip_position: 'left'
});
$("#ex18a").slider({
min: 0,
max: 10,
value: 5,
labelledby: 'ex18-label-1'
});
$("#ex18b").slider({
min: 0,
max: 10,
value: [3, 6],
labelledby: ['ex18-label-2a', 'ex18-label-2b']
});
$('#ex22').slider({
id: 'slider22',
min: 0,
max: 20,
step: 1,
value: 14,
rangeHighlights: [{ start: 2, end: 5, class: "category1" },
{ start: 7, end: 8, class: "category2" },
{ start: 17, end: 19 },
{ start: 17, end: 24 },
{ start: -3, end: 19 }]});
$("#ex23").slider({
ticks: [0, 1, 2, 3, 4],
ticks_positions: [0, 30, 60, 70, 90, 100],
ticks_snap_bounds: 200,
formatter(value) {
return 'Current value: ' + value;
},
ticks_tooltip: true,
step: 0.01
});
// examples from https://github.com/seiyria/bootstrap-slider/blob/master/README.md
{
+61 -9
View File
@@ -1,4 +1,4 @@
// Type definitions for bootstrap-slider.js 9.8
// Type definitions for bootstrap-slider.js 9.9
// Project: https://github.com/seiyria/bootstrap-slider
// Definitions by: Daniel Beckwith <https://github.com/dbeckwith>
// Leonard Thieu <https://github.com/leonard-thieu>
@@ -7,6 +7,19 @@
/// <reference types="jquery" />
interface RangeHighlight {
class?: string;
start?: number;
end?: number;
}
type SliderEventType = 'slide' |
'slideStart' |
'slideStop' |
'change' |
'slideEnabled' |
'slideDisabled';
interface SliderOptions {
/**
* Default: ''
@@ -63,6 +76,14 @@ interface SliderOptions {
* if false show one tootip if true show two tooltips one for each handler
*/
tooltip_split?: boolean;
/**
* Default: null
* Position of tooltip, relative to slider. Accepts 'top'/'bottom' for
* horizontal sliders and 'left'/'right' for vertically orientated sliders.
* Default positions are 'top' for horizontal and 'right' for vertical
* slider.
*/
tooltip_position?: 'top' | 'bottom' | 'left' | 'right';
/**
* Default: 'round'
* handle shape. Accepts: 'round', 'square', 'triangle' or 'custom'
@@ -73,6 +94,10 @@ interface SliderOptions {
* whether or not the slider should be reversed
*/
reversed?: boolean;
/**
* Default: 'auto'
*/
rtl?: boolean | 'auto';
/**
* Default: true
* whether or not the slider is initially enabled
@@ -111,16 +136,34 @@ interface SliderOptions {
* Used to define the snap bounds of a tick. Snaps to the tick if value is within these bounds.
*/
ticks_snap_bounds?: number;
/**
* Default: false
* Used to allow for a user to hover over a given tick to see it's value.
* Useful if custom formatter passed in
*/
ticks_tooltip?: boolean;
/**
* Default: 'linear'
* Set to 'logarithmic' to use a logarithmic scale.
*/
scale?: string;
scale?: 'linear' | 'logarithmic';
/**
* Default: false
* Focus the appropriate slider handle after a value change.
*/
focus?: boolean;
/**
* Default: null
* ARIA labels for the slider handle's, Use array for multiple values in a
* range slider.
*/
labelledby?: string | string[];
/**
* Default: []
* Defines a range array that you want to highlight, for example:
* [{'start':val1, 'end': val2, 'class': 'optionalAdditionalClassName'}].
*/
rangeHighlights?: RangeHighlight[];
}
interface JQuery {
@@ -134,7 +177,6 @@ interface SliderPlugin<TJQuery> {
(methodName: string, ...args: any[]): TJQuery;
/**
* Creates a slider from the current element.
* @param options
*/
(options?: SliderOptions): TJQuery;
}
@@ -163,11 +205,12 @@ declare class Slider {
/**
* 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): this;
/**
* Get the div slider element
*/
getElement(): HTMLDivElement;
/**
* Properly clean up and remove the slider instance
*/
@@ -180,25 +223,34 @@ declare class Slider {
* Enables the slider
*/
enable(): this;
/**
* Toggles the slider between enabled and disabled
*/
toggle(): this;
/**
* Returns true if enabled, false if disabled
*/
isEnabled(): boolean;
/**
* Updates the slider's attributes
* @param attribute
* @param value
*/
setAttribute(attribute: string, value: any): this;
/**
* Get the slider's attributes
* @param attribute
*/
getAttribute(attribute: string): any;
/**
* Refreshes the current slider
*/
refresh(): this;
/**
* When the slider event eventType is triggered, the callback function will be invoked
*/
on(eventType: SliderEventType, callback: (val: number | undefined) => void): this;
/**
* Removes the callback function from the slider event eventType
*/
off(eventType: SliderEventType, callback: (val: number | undefined) => void): void;
/**
* Renders the tooltip again, after initialization. Useful in situations when the slider and tooltip are initially hidden.
*/
+112 -57
View File
@@ -24,7 +24,8 @@ export interface Datetimepicker {
clear(): void;
/** Returns the component's model current date, a moment object or null if not set. */
date(): moment.Moment;
/** Takes string, Date, moment, null parameter and sets the components model current moment to it.
/**
* Takes string, Date, moment, null parameter and sets the components model current moment to it.
* Passing a null value unsets the components model current moment.
* Parsing of the newDate parameter is made using moment library with the options.format and options.useStrict components configuration.
* Throws:
@@ -36,14 +37,16 @@ export interface Datetimepicker {
date(date: moment.Moment | Date | string | null): void;
/** Destroys the widget and removes all attached event listeners */
destroy(): void;
/** Disables the input element, the component is attached to, by adding a disabled="true" attribute to it. If the widget was visible before that call it is hidden.
/**
* Disables the input element, the component is attached to, by adding a disabled="true" attribute to it. If the widget was visible before that call it is hidden.
* Emits:
* - dp.hide - if the widget was visible before that call
*/
disable(): void;
/** Enables the input element, the component is attached to, by removing disabled attribute from it. */
enable(): void;
/** Hides the widget
/**
* Hides the widget
* Emits:
* - dp.hide - if the widget was visible before that call
*/
@@ -55,13 +58,15 @@ export interface Datetimepicker {
options(): DatetimepickerOptions;
/** Takes an object variable with option key:value properties and configures the component. Use this to update multiple options on the component. */
options(options: DatetimepickerOptions): void;
/** Shows the widget
/**
* Shows the widget
* Emits:
* - dp.show - if the widget was hidden before that call
* - dp.change - if the widget is opened for the first time and the useCurrent is set to true or to a granularity value and the input element the component is attached to has an empty value
*/
show(): void;
/** Shows or hides the widget
/**
* Shows or hides the widget
* Emits:
* - dp.hide - if the widget is hidden after the toggle call
* - dp.show - if the widget is show after the toggle call
@@ -90,7 +95,8 @@ export interface Datetimepicker {
* IMPORTANT! Throws exception if not set explicitly https://github.com/Eonasdan/bootstrap-datetimepicker/issues/1459
*/
daysOfWeekDisabled(): number[];
/** Takes an [ Number:0 to 6 ] and disallow the user to select weekdays that exist in this array.
/**
* Takes an [ Number:0 to 6 ] and disallow the user to select weekdays that exist in this array.
* This has lower priority over the options.minDate, options.maxDate, options.disabledDates and options.enabledDates configuration settings.
* Emits:
* - dp.change - if the currently selected moment falls in the values passed on the daysOfWeek parameter.
@@ -133,13 +139,15 @@ export interface Datetimepicker {
* Like en/disabledDates, the en/disabledHours options are mutually exclusive and will reset one of the options back to false.
*/
disabledHours(value: boolean | number[]): void;
/** Returns the options.disabledTimeIntervals option, or... not exactly
/**
* Returns the options.disabledTimeIntervals option, or... not exactly
* IMPORTANT! Creates an object from the options.disabledTimeIntervals with the keys being numbers, the values being the moment arrays.
* eg { "0": [<moment.Moment1>, <moment.Moment2>], "1": [...] }
* https://github.com/Eonasdan/bootstrap-datetimepicker/issues/1498
*/
disabledTimeIntervals(): boolean | moment.Moment[][];
/** Disables time selection between the given moments
/**
* Disables time selection between the given moments
* eg: [[moment({ h: 0 }), moment({ h: 8 })], [moment({ h: 18 }), moment({ h: 24 })]]
*/
disabledTimeIntervals(value: boolean | moment.Moment[][]): void;
@@ -148,7 +156,8 @@ export interface Datetimepicker {
* NOTES: probably should be: enabledDates(): boolean | Array<moment.Moment>; see: DatetimepickerOptions
*/
enabledDates(): boolean | any;
/** Takes an array of values and allows the user to select only from those days.
/**
* Takes an array of values and allows the user to select only from those days.
* Setting this takes precedence over options.minDate, options.maxDate configuration.
* Also calling this function removes the configuration of options.disabledDates if such exist.
* Note: These values are matched with Day granularity.
@@ -174,7 +183,8 @@ export interface Datetimepicker {
focusOnShow(value: boolean): void;
/** Returns the component's options.format string */
format(): boolean | string | moment.MomentBuiltinFormat;
/** Takes a moment.js format string and sets the components options.format.
/**
* Takes a moment.js format string and sets the components options.format.
* This is used for displaying and also for parsing input strings either from the input element the component is attached to or the date() function.
* The parameter can also be a boolean:false in which case the format is set to the locale's L LT.
* Note: this is also used to determine if the TimePicker sub component will display the hours in 12 or 24 format. (if "a" or "h" exists in the passed string then a 12 hour mode is set)
@@ -184,7 +194,8 @@ export interface Datetimepicker {
format(format: boolean | string | moment.MomentBuiltinFormat): void;
/** Returns options.icons */
icons(): Icons;
/** Takes an Object of strings.
/**
* Takes an Object of strings.
* Throws:
* - TypeError - if icons parameter is not an Object
*/
@@ -209,14 +220,16 @@ export interface Datetimepicker {
keyBinds(value: any): void;
/** Returns the currently set locale of the options.locale */
locale(): string;
/** Takes a string of any valid moment locale e.g. de for German.
/**
* Takes a string of any valid moment locale e.g. de for German.
* Throws:
* - TypeError - if the locale is not loaded via a separate script or moment-with-locale
*/
locale(newLocale: string): void;
/** Returns the currently set moment of the options.maxDate or false if not set */
maxDate(): moment.Moment | boolean;
/** Takes a parameter and disallows the user to select a moment that is after that moment.
/**
* Takes a parameter and disallows the user to select a moment that is after that moment.
* If a boolean:false value is passed options.maxDate is cleared and there is no restriction to the maximum moment the user can select.
* Note: If the parameter is before the currently selected moment the currently selected moment changes to maxDate
* Throws:
@@ -230,7 +243,8 @@ export interface Datetimepicker {
maxDate(date: moment.Moment | Date | string | boolean): void;
/** Returns the currently set moment of the options.minDate or false if not set */
minDate(): moment.Moment | boolean;
/** Takes a parameter and disallows the user to select a moment that is before that moment.
/**
* Takes a parameter and disallows the user to select a moment that is before that moment.
* If a boolean:false value is passed the options.minDate parameter is cleared and there is no restriction to the miminum moment the user can select.
* Note: If the parameter is after the currently selected moment the currently selected moment changes to minDate parameter
* Throws:
@@ -244,7 +258,8 @@ export interface Datetimepicker {
minDate(date: moment.Moment | Date | string | boolean): void;
/** Returns the options.parseInputDate option */
parseInputDate(): InputParser | undefined;
/** Allows custom input formatting For example: the user can enter "yesterday"" or "30 days ago".
/**
* Allows custom input formatting For example: the user can enter "yesterday"" or "30 days ago".
* {@link http://eonasdan.github.io/bootstrap-datetimepicker/Functions/#parseinputdate}
*/
parseInputDate(value: InputParser): void;
@@ -270,14 +285,16 @@ export interface Datetimepicker {
stepping(step: number): void;
/** Returns a string of options.timeZone */
timeZone(): string | null;
/** Takes a null or a string of a valid timezone.
/**
* Takes a null or a string of a valid timezone.
* Throws:
* - TypeError - if tooltips parameter is not a string or null
*/
timeZone(timeZone: string | null): void;
/** Returns the options.toolbarplacement option. */
toolbarPlacement(): string;
/** Changes the placement of the toolbar where the today, clear, component switch icon are located.
/**
* Changes the placement of the toolbar where the today, clear, component switch icon are located.
* See valid values at DatetimepickerOptions.toolbarplacement
* Throws:
* - TypeError - if the parameter is not a valid value
@@ -285,14 +302,16 @@ export interface Datetimepicker {
toolbarPlacement(value: string): void;
/** Returns the options.tooltips option */
tooltips(): Tooltips;
/** Sets the tooltips for icons.
/**
* Sets the tooltips for icons.
* Throws:
* - TypeError - if tooltips parameter is not an Object
*/
tooltips(value: Tooltips): void;
/** Returns the options.useCurrent option configuration */
useCurrent(): boolean | string;
/** Takes a boolean or string.
/**
* Takes a boolean or string.
* If a boolean true is passed and the components model moment is not set (either through setDate or through a valid value on the input element the component is attached to)
* then the first time the user opens the datetimepicker widget the value is initialized to the current moment of the action.
* If a false boolean is passed then no initialization happens on the input element.
@@ -312,7 +331,8 @@ export interface Datetimepicker {
viewDate(value: string | Date | moment.Moment | boolean): void;
/** Returns the options.viewMode. */
viewMode(): string;
/** Takes a string. See valid values at DatetimepickerOptions.viewMode
/**
* Takes a string. See valid values at DatetimepickerOptions.viewMode
* Throws:
* - TypeError - if the parameter is not a string or not a valid value
*/
@@ -323,7 +343,8 @@ export interface Datetimepicker {
widgetParent(widgetParent: string | JQuery | null): void;
/** Returns the options.widgetPositioning object */
widgetPositioning(): WidgetPositioningOptions;
/** WidgetPositioning defines where the dropdown with the widget will appear relative to the input element the component is attached to.
/**
* WidgetPositioning defines where the dropdown with the widget will appear relative to the input element the component is attached to.
* "auto" is the default value for both horizontal and vertical keys and it tries to automatically place the dropdown in a position that is visible to the user.
* Usually you should not override those options unless you have a special need in your layout.
*/
@@ -331,7 +352,6 @@ export interface Datetimepicker {
/**
* JQuery plugin function.
* @param {DatetimepickerOptions} options
*/
(options?: DatetimepickerOptions): JQuery;
@@ -343,91 +363,109 @@ export interface Datetimepicker {
}
export interface DatetimepickerOptions {
/** If true, the picker will show on textbox focus and icon click when used in a button group
/**
* If true, the picker will show on textbox focus and icon click when used in a button group
* @default: false
*/
allowInputToggle?: boolean;
/** Shows the week of the year to the left of first day of the week.
/**
* Shows the week of the year to the left of first day of the week.
* @default: false
*/
calendarWeeks?: boolean;
/** Using a Bootstraps collapse to switch between date/time pickers.
/**
* Using a Bootstraps collapse to switch between date/time pickers.
* @default: true
*/
collapse?: boolean;
/** Disables the section of days of the week, e.g. weekends.
/**
* Disables the section of days of the week, e.g. weekends.
* Accepts: array of numbers from 0-6
* @default: false
*/
daysOfWeekDisabled?: number[] | boolean;
/** Changes the heading of the datepicker when in "days" view.
/**
* Changes the heading of the datepicker when in "days" view.
* @default: "MMMM YYYY"
*/
dayViewHeaderFormat?: string;
/** Will cause the date picker to stay open after a blur event.
/**
* Will cause the date picker to stay open after a blur event.
* @default: false
*/
debug?: boolean;
/** Sets the picker default date/time. Overrides useCurrent
/**
* Sets the picker default date/time. Overrides useCurrent
* @default: false
*/
defaultDate?: boolean | moment.Moment | Date | string;
/** Disables selection of dates in the array, e.g. holidays
/**
* Disables selection of dates in the array, e.g. holidays
* @default: false
* IMPORTANT! The getter returns an Object NOT an Array, with keys being the dates, values being true.
* eg disabledDates = ["2010-10-10"]; -> disabledDated will be { "2010-01-01": true }
* https://github.com/Eonasdan/bootstrap-datetimepicker/issues/1499
*/
disabledDates?: boolean | Array<moment.Moment | Date | string> | any;
/** Will allow or disallow hour selections (much like disabledTimeIntervals) but will affect all days
/**
* Will allow or disallow hour selections (much like disabledTimeIntervals) but will affect all days
* @default: false
* IMPORTANT! The getter returns an Object NOT an Array, with keys being the hours, values being true.
* eg disabledHours = [0, 1]; -> disabledHours will be { "0": true, "1": true }
* https://github.com/Eonasdan/bootstrap-datetimepicker/issues/1499
*/
disabledHours?: boolean | number[] | any;
/** Disables time selection between the given moments
/**
* Disables time selection between the given moments
* eg: [[moment({ h: 0 }), moment({ h: 8 })], [moment({ h: 18 }), moment({ h: 24 })]]
* @default: false
*/
disabledTimeIntervals?: boolean | moment.Moment[][];
/** Disables selection of dates NOT in the array, e.g. holidays
/**
* Disables selection of dates NOT in the array, e.g. holidays
* @default: false
* IMPORTANT! The getter returns an Object NOT an Array, with keys being the dates, values being true.
* eg enabledDates = ["2010-10-10"]; -> enabledDated will be { "2010-01-01": true }
* https://github.com/Eonasdan/bootstrap-datetimepicker/issues/1499
*/
enabledDates?: boolean | Array<moment.Moment | Date | string> | any;
/** Will allow or disallow hour selections (much like disabledTimeIntervals) but will affect all days
/**
* Will allow or disallow hour selections (much like disabledTimeIntervals) but will affect all days
* @default: false
* IMPORTANT! The getter returns an Object NOT an Array, with keys being the hours, values being true.
* eg enabledHours = [0, 1]; -> enabledHours will be { "0": true, "1": true }
* https://github.com/Eonasdan/bootstrap-datetimepicker/issues/1499
*/
enabledHours?: boolean | number[];
/** Allows for several input formats to be valid. See: https://github.com/Eonasdan/bootstrap-datetimepicker/pull/666
/**
* Allows for several input formats to be valid. See: https://github.com/Eonasdan/bootstrap-datetimepicker/pull/666
* @default: false
*/
extraFormats?: boolean | Array<string | moment.MomentBuiltinFormat>;
/** If false, the textbox will not be given focus when the picker is shown
/**
* If false, the textbox will not be given focus when the picker is shown
* @default: true
*/
focusOnShow?: boolean;
/** See momentjs' docs for valid formats. Format also dictates what components are shown, e.g. MM/dd/YYYY will not display the time picker.
/**
* See momentjs' docs for valid formats. Format also dictates what components are shown, e.g. MM/dd/YYYY will not display the time picker.
* @default: false
*/
format?: boolean | string | moment.MomentBuiltinFormat;
/** Change the default icons for the pickers functions. */
icons?: Icons;
/** Allow date picker show event to fire even when the associated input element has the readonly="readonly"property.
/**
* Allow date picker show event to fire even when the associated input element has the readonly="readonly"property.
* @default: false
*/
ignoreReadonly?: boolean;
/** Will display the picker inline without the need of a input field. This will also hide borders and shadows.
/**
* Will display the picker inline without the need of a input field. This will also hide borders and shadows.
* @default: false
*/
inline?: boolean;
/** Allows for custom events to fire on keyboard press.
/**
* Allows for custom events to fire on keyboard press.
* eg: keybinds: {
* up: (widget) => console.log(widget),
* "control up": (widget) => console.log(widget)
@@ -435,52 +473,63 @@ export interface DatetimepickerOptions {
* The widget parameter is false, if the datepicker is closed.
*/
keyBinds?: { [key: string]: (widget: boolean | JQuery) => void };
/** Will cause the date picker to not revert or overwrite invalid dates.
/**
* Will cause the date picker to not revert or overwrite invalid dates.
* @default: false
*/
keepInvalid?: boolean;
/** Will cause the date picker to stay open after selecting a date if no time components are being used.
/**
* Will cause the date picker to stay open after selecting a date if no time components are being used.
* @default: false
*/
keepOpen?: boolean;
/** See momentjs for valid locales. You must include moment-with-locales.js or a local js file.
/**
* See momentjs for valid locales. You must include moment-with-locales.js or a local js file.
* @default: moment.locale()
*/
locale?: string;
/** Prevents date/time selections after this date.
/**
* Prevents date/time selections after this date.
* maxDate will override defaultDate and useCurrent if either of these settings are the same day since both options are invalid according to the rules you've selected.
* @default: false
*/
maxDate?: boolean | moment.Moment | Date | string;
/** Prevents date/time selections before this date.
/**
* Prevents date/time selections before this date.
* minDate will override defaultDate and useCurrent if either of these settings are the same day since both options are invalid according to the rules you've selected.
* @default: false
*/
minDate?: boolean | moment.Moment | Date | string;
/** Allows custom input formatting For example: the user can enter "yesterday"" or "30 days ago".
/**
* Allows custom input formatting For example: the user can enter "yesterday"" or "30 days ago".
* {@link http://eonasdan.github.io/bootstrap-datetimepicker/Functions/#parseinputdate}
*/
parseInputDate?: InputParser;
/** Show the "Clear" button in the icon toolbar.
/**
* Show the "Clear" button in the icon toolbar.
* Clicking the "Clear" button will set the calendar to null.
* @default: false
*/
showClear?: boolean;
/** Show the "Close" button in the icon toolbar.
/**
* Show the "Close" button in the icon toolbar.
* Clicking the "Close" button will call hide()
* @default: false
*/
showClose?: boolean;
/** Show the "Today" button in the icon toolbar.
/**
* Show the "Today" button in the icon toolbar.
* Clicking the "Today" button will set the calendar view and set the date to now.
* @default: false
*/
showTodayButton?: boolean;
/** Shows the picker side by side when using the time and date together.
/**
* Shows the picker side by side when using the time and date together.
* @default: false
*/
sideBySide?: boolean;
/** Number of minutes the up/down arrow's will move the minutes value in the time picker
/**
* Number of minutes the up/down arrow's will move the minutes value in the time picker
* @default: 1
*/
stepping?: number;
@@ -489,30 +538,36 @@ export interface DatetimepickerOptions {
* @default: ""
*/
timeZone?: string | null;
/** Changes the placement of the icon toolbar.
/**
* Changes the placement of the icon toolbar.
* @default: "default"
*/
toolbarPlacement?: "default" | "top" | "bottom";
/** This will change the tooltips over each icon to a custom string */
tooltips?: Tooltips;
/** On show, will set the picker to the current date/time
/**
* On show, will set the picker to the current date/time
* @default: true
*/
useCurrent?: boolean;
/** Defines if moment should use strict date parsing when considering a date to be valid
/**
* Defines if moment should use strict date parsing when considering a date to be valid
* @default: false
*/
useStrict?: boolean;
/** This will change the viewDate without changing or setting the selected date.
/**
* This will change the viewDate without changing or setting the selected date.
* @default: false
*/
viewDate?: boolean | moment.Moment | Date | string;
/** The default view to display when the picker is shown.
/**
* The default view to display when the picker is shown.
* Note: To limit the picker to selecting, for instance the year and month, use format: MM/YYYY
* @default: "days"
*/
viewMode?: "decades" | "years" | "months" | "days";
/** On picker show, places the widget at the identifier (string) or jQuery object if the element has css position: "relative"
/**
* On picker show, places the widget at the identifier (string) or jQuery object if the element has css position: "relative"
* @default: null
*/
widgetParent?: string | JQuery | null;
+2 -2
View File
@@ -88,13 +88,13 @@ declare namespace Bull {
/**
* Removes a job from the queue and from any lists it may be included in.
* @returns {Promise} A promise that resolves when the job is removed.
* @returns A promise that resolves when the job is removed.
*/
remove(): Promise<void>;
/**
* Re-run a job that has failed.
* @returns {Promise} A promise that resolves when the job is scheduled for retry.
* @returns A promise that resolves when the job is scheduled for retry.
*/
retry(): Promise<void>;
+8 -11
View File
@@ -17,8 +17,8 @@ declare namespace bunnymq {
/**
* Handle messages from a named queue.
*
* @param {string} queue A named queue.
* @param {ConsumerCallback} callback A callback.
* @param queue A named queue.
* @param callback A callback.
*/
consume<T>(queue: string, callback: ConsumerCallback<T>): void;
}
@@ -31,16 +31,15 @@ declare namespace bunnymq {
/**
* Subscriber to handle messages from a named queue.
*
* @param {string} queue A named queue.
* @param {ConsumerCallback} callback A callback.
* @param queue A named queue.
* @param callback A callback.
*/
subscribe<T>(queueName: string, callback: ConsumerCallback<T>): void;
/**
* Publisher to send messages to a named queue.
*
* @type {Producer}
* @return {Promise} The consumer response.
* @return The consumer response.
*/
publish<T>(queueName: string, message: any, options?: ProducerOptions): Promise<T>;
}
@@ -61,14 +60,12 @@ declare namespace bunnymq {
/**
* Number of fetched messages at once on the channel.
*
* @type {number}
*/
prefetch?: number;
/**
* Requeue put back message into the broker if consumer crashes/trigger exception.
*
* @type {boolean}
*/
requeue?: boolean;
rpcTimeout?: number;
@@ -80,9 +77,9 @@ declare namespace bunnymq {
/**
* Send messages to a named queue.
*
* @param {string} queue A named queue.
* @param {any} message A message.
* @return {Promise} The consumer response.
* @param queue A named queue.
* @param message A message.
* @return The consumer response.
*/
produce<T>(queue: string, message: any, options?: ProducerOptions): Promise<T>;
}
+2 -2
View File
@@ -7,8 +7,8 @@ import * as Logger from "bunyan";
/**
* Constructor.
* @param {string} [name] name of the blackhole Logger
* @return {Logger} A bunyan logger .
* @param name name of the blackhole Logger
* @return A bunyan logger .
*/
declare function bunyanBlackHole(name: string): Logger;
export = bunyanBlackHole;
+1 -1
View File
@@ -366,7 +366,7 @@ declare namespace c3 {
* and it will recieve the data as argument.
* Available Values: desc, asc, function (data1, data2) { ... }, null
*/
order?: string | ((...data: string[]) => void);
order?: string | ((...data: string[]) => void) | null;
/**
* Define regions for each data.
* The values must be an array for each data and it should include an object that has start, end, style. If start is not set, the start will be the first data point. If end is not set, the
+107 -66
View File
@@ -1,17 +1,17 @@
// Type definitions for CasperJS v1.0.29
// Type definitions for CasperJS 1.1
// Project: http://casperjs.org/
// Definitions by: Jed Mao <https://github.com/jedmao>
// Uriel Chemouni <https://github.com/urielch>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
/// <reference types="phantomjs" />
export function create(options?: CasperOptions): Casper;
export function selectXPath(expression: string): Object;
export function selectXPath(expression: string): object;
export class Casper {
constructor(options: CasperOptions);
test: Tester;
@@ -23,23 +23,23 @@ export class Casper {
// Methods
back(): Casper;
base64encode(url: string, method?: string, data?: any): string;
bypass(nb: number): any;
click(selector: string): boolean;
bypass(nb: number): Casper;
click(selector: string, X?: number | string, Y?: number | string): boolean;
clickLabel(label: string, tag?: string): boolean;
capture(targetFilePath: string, clipRect: ClipRect): Casper;
captureBase64(format: string): string;
captureBase64(format: string, area: string): string;
captureBase64(format: string, area: ClipRect): string;
captureBase64(format: string, area: any): string;
captureSelector(targetFile: string, selector: string): Casper;
capture(targetFilePath: string, clipRect?: ClipRect, imgOptions?: ImgOptions): Casper;
captureBase64(format: string, area?: string | ClipRect | CasperSelector): string;
captureSelector(targetFile: string, selector: string, imgOptions?: ImgOptions): Casper;
clear(): Casper;
clearCache(): Casper;
clearMemoryCache(): Casper;
debugHTML(selector?: string, outer?: boolean): Casper;
debugPage(): Casper;
die(message: string, status?: number): Casper;
download(url: string, target?: string, method?: string, data?: any): Casper;
download(url: string, target: string, method?: string, data?: any): Casper;
each<T>(array: T[], fn: (this: Casper, item: T, index: number) => void): Casper;
eachThen(array: any[], then?: FunctionThen): Casper;
echo(message: string, style?: string): Casper;
evaluate<T>(fn: (...args: any[]) => T, ...args: any[]): T
evaluate<T>(fn: (...args: any[]) => T, ...args: any[]): T;
evaluateOrDie(fn: () => any, message?: string, status?: number): Casper;
exit(status?: number): Casper;
exists(selector: string): boolean;
@@ -52,7 +52,7 @@ export class Casper {
getCurrentUrl(): string;
getElementAttribute(selector: string, attribute: string): string;
getElementsAttribute(selector: string, attribute: string): string;
getElementBounds(selector: string): ElementBounds;
getElementBounds(selector: string, page?: boolean): ElementBounds | null;
getElementsBounds(selector: string): ElementBounds[];
getElementInfo(selector: string): ElementInfo;
getElementsInfo(selector: string): ElementInfo;
@@ -61,83 +61,125 @@ export class Casper {
getHTML(selector?: string, outer?: boolean): string;
getPageContent(): string;
getTitle(): string;
mouseEvent(type: string, selector: string): boolean;
mouseEvent(type: string, selector: string, X?: number|string, Y?: number|string): boolean;
newPage(): any;
open(location: string, settings: OpenSettings): Casper;
reload(then?: (response: HttpResponse) => void): Casper;
repeat(times: number, then: Function): Casper;
resourceExists(test: Function): boolean;
resourceExists(test: string): boolean;
run(onComplete: Function, time?: number): Casper;
reload(then?: FunctionThen): Casper;
repeat(times: number, then: FunctionThen): Casper;
resourceExists(test: string | Function | RegExp): boolean;
run(onComplete?: Function, time?: number): Casper;
scrollTo(x: number, y: number): Casper;
scrollToBottom(): Casper;
sendKeys(selector: string, keys: string, options?: any): Casper;
sendKeys(selector: string, keys: string, options?: KeyOptions): Casper;
setHttpAuth(username: string, password: string): Casper;
start(url?: string, then?: (response: HttpResponse) => void): Casper;
status(asString: boolean): any;
setMaxListeners(maxListeners: number): Casper;
start(url?: string, then?: FunctionThen): Casper;
status(asString?: false): number;
status(asString: true): string;
switchToFrame(frameInfo: string | number): Casper;
switchToMainFrame(): Casper;
switchToParentFrame(): Casper;
then(fn: (this: Casper) => void): Casper;
thenBypass(nb: number): Casper;
thenBypassIf(condition: any, nb: number): Casper;
thenBypassUnless(condition: any, nb: number): Casper;
thenClick(selector: string): Casper;
thenClick(selector: string, then?: FunctionThen): Casper;
thenEvaluate(fn: () => any, ...args: any[]): Casper;
thenOpen(location: string, then?: (response: HttpResponse) => void): Casper;
thenOpen(location: string, options?: OpenSettings, then?: (response: HttpResponse) => void): Casper;
thenOpenAndEvaluate(location: string, then?: Function, ...args: any[]): Casper;
thenOpenAndEvaluate(location: string, then?: FunctionThen, ...args: any[]): Casper;
toString(): string;
unwait(): Casper;
userAgent(agent: string): string;
viewport(width: number, height: number): Casper;
// 2017-10-19 Doc said returning String but code return Casper object.
userAgent(agent: string): Casper;
viewport(width: number, height: number, then?: FunctionThen): Casper;
visible(selector: string): boolean;
wait(timeout: number, then?: Function): Casper;
waitFor(testFx: Function, then?: Function, onTimeout?: Function, timeout?: number): Casper;
waitForAlert(then: Function, onTimeout?: Function, timeout?: number): Casper;
waitForPopup(urlPattern: string, then?: Function, onTimeout?: Function, timeout?: number): Casper;
waitForPopup(urlPattern: RegExp, then?: Function, onTimeout?: Function, timeout?: number): Casper;
waitForUrl(url: string, then?: Function, onTimeout?: Function, timeout?: number): Casper;
waitForUrl(url: RegExp, then?: Function, onTimeout?: Function, timeout?: number): Casper;
waitForSelector(selector: string, then?: Function, onTimeout?: Function, timeout?: number): Casper;
waitWhileSelector(selector: string, then?: Function, onTimeout?: Function, timeout?: number): Casper;
waitForResource(testFx: Function, then?: Function, onTimeout?: Function, timeout?: number): Casper;
waitForText(pattern: string, then?: Function, onTimeout?: Function, timeout?: number): Casper;
waitForText(pattern: RegExp, then?: Function, onTimeout?: Function, timeout?: number): Casper;
waitUntilVisible(selector: string, then?: Function, onTimeout?: Function, timeout?: number): Casper;
waitWhileVisible(selector: string, then?: Function, onTimeout?: Function, timeout?: number): Casper;
wait(timeout: number, then?: FunctionThen): Casper;
waitFor(testFx: Function, then?: FunctionThen, onTimeout?: FunctionOnTimeout, timeout?: number, details?: any): Casper;
waitForAlert(then: FunctionThen, onTimeout?: FunctionOnTimeout, timeout?: number): Casper;
waitForExec(command: string | null, parameter: string[], then?: FunctionThen, onTimeout?: FunctionOnTimeout, timeout?: number): Casper;
waitForPopup(urlPattern: RegExp | string | number | FindByUrlNameTitle, then?: FunctionThen, onTimeout?: Function, timeout?: number): Casper;
waitForResource(testFx: RegExp | string | ((resource: {url: string}) => boolean), then?: FunctionThen, onTimeout?: Function, timeout?: number): Casper;
waitForUrl(url: RegExp | string, then?: FunctionThen, onTimeout?: FunctionOnTimeout, timeout?: number): Casper;
waitForSelector(selector: string, then?: FunctionThen, onTimeout?: FunctionOnTimeout, timeout?: number): Casper;
waitWhileSelector(selector: string, then?: FunctionThen, onTimeout?: FunctionOnTimeout, timeout?: number): Casper;
waitForSelectorTextChange(selectors: string, then?: FunctionThen, onTimeout?: FunctionOnTimeout, timeout?: number): Casper;
waitForText(pattern: RegExp | string, then?: FunctionThen, onTimeout?: FunctionOnTimeout, timeout?: number): Casper;
waitUntilVisible(selector: string, then?: FunctionThen, onTimeout?: FunctionOnTimeout, timeout?: number): Casper;
waitWhileVisible(selector: string, then?: FunctionThen, onTimeout?: FunctionOnTimeout, timeout?: number): Casper;
warn(message: string): Casper;
withFrame(frameInfo: string, then: Function): Casper;
withFrame(frameInfo: number, then: Function): Casper;
withPopup(popupInfo: string, step: Function): Casper;
withPopup(popupInfo: RegExp, step: Function): Casper;
withFrame(frameInfo: string | number, then: FunctionThen): Casper;
withPopup(popupInfo: RegExp | string | number | FindByUrlNameTitle, step: FunctionThen): Casper;
withSelectorScope(selector: string, then: FunctionThen): Casper;
zoom(factor: number): Casper;
removeAllFilters(filter: string): Casper;
setFilter(filter: string, cb: Function): boolean;
// do not exists anymore
// removeAllFilters(filter: string): Casper;
// do not exists anymore
// setFilter(filter: string, cb: Function): boolean;
}
interface HttpResponse {
export type FunctionThen = (this: Casper, response: HttpResponse) => void;
export type FunctionOnTimeout = (this: Casper, timeout: number, details: any) => void;
// not visible in doc
// interface QtRuntimeObject {id?: any; url?: string;}
// see modules/pagestack.js in casperjs
export interface ImgOptions {
// format to set the image format manually, avoiding relying on the filename
format?: string;
// quality to set the image quality, from 1 to 100
quality?: number;
}
export interface FindByUrlNameTitle {
url?: string;
title?: string;
windowName?: string;
}
export interface Header {
name: string;
value: string;
}
export interface CasperSelector {
type?: 'xpath' | 'css';
path: string;
}
export interface KeyOptions {
reset?: boolean;
keepFocus?: boolean;
modifiers?: string; // combinaison of 'ctrl+alt+shift+meta+keypad'
}
export interface HttpResponse {
contentType: string;
headers: any[];
headers: Header[];
id: number;
redirectURL: string;
redirectURL: string | null;
stage: string;
status: number;
statusText: string;
time: string;
url: string;
data: any;
}
interface OpenSettings {
export interface OpenSettings {
method: string;
data: any;
headers: any;
}
interface ElementBounds {
export interface ElementBounds {
top: number;
left: number;
width: number;
height: number;
}
interface ElementInfo {
export interface ElementInfo {
nodeName: string;
attributes: any;
tag: string;
@@ -150,7 +192,7 @@ interface ElementInfo {
visible: boolean;
}
interface CasperOptions {
export interface CasperOptions {
clientScripts?: any[];
exitOnError?: boolean;
httpStatusHandlers?: any;
@@ -179,7 +221,7 @@ interface CasperOptions {
waitTimeout?: number;
}
interface ClientUtils {
export interface ClientUtils {
echo(message: string): void;
encode(contents: string): void;
exists(selector: string): void;
@@ -200,12 +242,12 @@ interface ClientUtils {
visible(selector: string): void;
}
interface Colorizer {
export interface Colorizer {
colorize(text: string, styleName: string): void;
format(text: string, style: any): void;
}
interface Tester {
export interface Tester {
assert(condition: boolean, message?: string): any;
assertDoesntExist(selector: string, message?: string): any;
assertElementCount(selctor: string, expected: number, message?: string): any;
@@ -235,15 +277,14 @@ interface Tester {
assertTruthy(subject: any, message?: string): any;
assertType(input: any, type: string, message?: string): any;
assertInstanceOf(input: any, ctor: Function, message?: string): any;
assertUrlMatch(pattern: string, message?: string): any;
assertUrlMatch(pattern: RegExp, message?: string): any;
assertUrlMatch(pattern: RegExp | string, message?: string): any;
assertVisible(selector: string, message?: string): any;
/* since 1.1 */
begin(description: string, planned: number, suite: Function): any;
begin(description: string, suite: Function): any;
begin(description: string, planned: number, config: Object): any;
begin(description: string, config: Object): any;
begin(description: string, planned: number, config: object): any;
begin(description: string, config: object): any;
colorize(message: string, style: string): any;
comment(message: string): any;
@@ -262,12 +303,12 @@ interface Tester {
tearDown(fn: Function): any;
}
interface Cases {
export interface Cases {
length: number;
cases: Case[];
}
interface Case {
export interface Case {
success: boolean;
type: string;
standard: string;
@@ -275,12 +316,12 @@ interface Case {
values: CaseValues;
}
interface CaseValues {
export interface CaseValues {
subject: boolean;
expected: boolean;
}
interface Utils {
export interface Utils {
betterTypeOf(input: any): any;
dump(value: any): any;
fileExt(file: string): any;
+12
View File
@@ -0,0 +1,12 @@
{
"extends": "dtslint/dt.json",
"rules": {
// need to fix some Function type
"ban-types": false,
// can not merge
// begin(description: string, planned: number, suite: Function): any;
// and
// begin(description: string, planned: number, config: object): any;
"unified-signatures": false
}
}
+6 -27
View File
@@ -9,12 +9,7 @@
declare global {
namespace Chai {
interface Assertion {
/**
* Assert that the object matches the snapshot
* @param snapshotFilename
* @param snapshotName
* @param update
*/
/** Assert that the object matches the snapshot */
matchSnapshot(snapshotFilename?: string, snapshotName?: string, update?: boolean): Assertion;
matchSnapshot(update: boolean): Assertion;
}
@@ -22,40 +17,24 @@ declare global {
}
interface ChaiJestSnapshot {
/**
* Chai bootstrapper
* @param chai
* @param utils
*/
/** Chai bootstrapper */
(chai: any, utils: any): void;
/**
* Set snapshot file name
* @param filename
*/
/** Set snapshot file name */
setFileName(filename: string): void;
/**
* Set snapshot test name
* @param testname
*/
setTestName(testname: string): void;
/**
* Configure snapshot name using mocha context
* @param context
*/
/** Configure snapshot name using mocha context */
configureUsingMochaContext(context: Mocha.IBeforeAndAfterContext): void;
/**
* Reset snapshot registry
*/
/** Reset snapshot registry */
resetSnapshotRegistry(): void;
/**
* Add a serializer plugin
* @param serializer
*/
/** Add a serializer plugin */
addSerializer(serializer: any): void;
}
+7 -1
View File
@@ -36,7 +36,13 @@ const chart: Chart = new Chart(new CanvasRenderingContext2D(), {
ticks: {
callback: Math.floor
},
gridLines: { display: false }
gridLines: {
display: false,
borderDash: [5, 15],
borderDashOffset: 2,
zeroLineBorderDash: [5, 15],
zeroLineBorderDashOffset: 2
}
}]
}
}
+18
View File
@@ -6,6 +6,7 @@
// Larry Bahr <https://github.com/larrybahr>
// Daniel Luz <https://github.com/mernen>
// Joseph Page <https://github.com/josefpaij>
// Dan Manastireanu <https://github.com/danmana>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -160,6 +161,7 @@ declare namespace Chart {
hover?: ChartHoverOptions;
animation?: ChartAnimationOptions;
elements?: ChartElementsOptions;
layout?: ChartLayoutOptions;
scales?: ChartScales;
showLines?: boolean;
spanGaps?: boolean;
@@ -312,9 +314,23 @@ declare namespace Chart {
borderColor?: ChartColor;
borderSkipped?: string;
}
interface ChartLayoutOptions {
padding?: ChartLayoutPaddingObject | number;
}
interface ChartLayoutPaddingObject {
top?: number;
right?: number;
bottom?: number;
left?: number;
}
interface GridLineOptions {
display?: boolean;
color?: ChartColor;
borderDash?: number[];
borderDashOffset?: number;
lineWidth?: number;
drawBorder?: boolean;
drawOnChartArea?: boolean;
@@ -322,6 +338,8 @@ declare namespace Chart {
tickMarkLength?: number;
zeroLineWidth?: number;
zeroLineColor?: ChartColor;
zeroLineBorderDash?: number[];
zeroLineBorderDashOffset?: number;
offsetGridLines?: boolean;
}
-3
View File
@@ -34,9 +34,6 @@ declare namespace chroma {
/**
* Create a color in the specified color space using a, b and c as values.
*
* @param a
* @param b
* @param c
* @param colorSpace The color space to use. Defaults to "rgb".
* @return the color object.
*/
+3 -7
View File
@@ -1,14 +1,10 @@
import CircularJSON = require('circular-json');
var replacer = (key: any, val: any) => {
const replacer = (key: any, val: any) => {
return val;
}
};
var replacerArray = ['a', 'x'];
// implements JSON interface
var json_obj: JSON = CircularJSON;
const replacerArray = ['a', 'x'];
CircularJSON.parse('{"a":"b"}');
+3 -10
View File
@@ -1,14 +1,7 @@
// Type definitions for circular-json v0.1.6
// Type definitions for circular-json 0.4
// Project: https://github.com/WebReflection/circular-json
// Definitions by: Jonathan Pevarnek <https://github.com/jpevarnek>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
interface ICircularJSON extends JSON {
parse(text: string, reviver?: (key: any, value: any) => any): any;
stringify(value: any, replacer?: ((key: string, value: any) => any) | any[], space?: any, placeholder?: boolean): string;
}
declare var CircularJSON: ICircularJSON;
export = CircularJSON;
export function parse(text: string, reviver?: (key: any, value: any) => any): any;
export function stringify(value: any, replacer?: ((key: string, value: any) => any) | Array<number | string> | null, space?: any, placeholder?: boolean): string;
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}
+7 -8
View File
@@ -8,7 +8,7 @@ declare class Clipboard {
/**
* Subscribes to events that indicate the result of a copy/cut operation.
* @param type {"success" | "error"} Event type ('success' or 'error').
* @param type Event type ('success' or 'error').
* @param handler Callback function.
*/
on(type: "success" | "error", handler: (e: Clipboard.Event) => void): this;
@@ -29,22 +29,21 @@ declare namespace Clipboard {
interface Options {
/**
* Overwrites default command ('cut' or 'copy').
* @param {Element} elem Current element
* @returns {String} Only 'cut' or 'copy'.
* @param elem Current element
*/
action?(elem: Element): string;
action?(elem: Element): "cut" | "copy";
/**
* Overwrites default target input element.
* @param {Element} elem Current element
* @returns {Element} <input> element to use.
* @param elem Current element
* @returns <input> element to use.
*/
target?(elem: Element): Element;
/**
* Returns the explicit text to copy.
* @param {Element} elem Current element
* @returns {String} Text to be copied.
* @param elem Current element
* @returns Text to be copied.
*/
text?(elem: Element): string;
}
+11 -7
View File
@@ -3,13 +3,15 @@
// Definitions by: TeamworkGuy2 <https://github.com/TeamworkGuy2>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/** Add source maps of multiple files, offset them and then combine them into one source map.
/**
* Add source maps of multiple files, offset them and then combine them into one source map.
* (documentation based on project's README file)
*/
declare class Combiner {
constructor(file?: string, sourceRoot?: string);
/** Adds map to underlying source map.
/**
* Adds map to underlying source map.
* If source contains a source map comment that has the source of the original file inlined it will offset these
* mappings and include them.
* If no source map comment is found or it has no source inlined, mappings for the file will be generated and included
@@ -18,12 +20,14 @@ declare class Combiner {
*/
addFile(opts: { sourceFile: string; source: string }, offset?: Combiner.Offset): Combiner;
/** output the combined source map in base64 format
/**
* output the combined source map in base64 format
* @return base64 encoded combined source map
*/
base64(): string;
/** generate a base64 encoded sourceMappingURL comment
/**
* generate a base64 encoded sourceMappingURL comment
* @return base64 encoded sourceMappingUrl comment of the combined source map
*/
comment(): string;
@@ -40,15 +44,15 @@ declare namespace Combiner {
column?: number;
}
/** Create a source map combiner that accepts multiple files, offsets them and then combines them into one source map.
/**
* Create a source map combiner that accepts multiple files, offsets them and then combines them into one source map.
* @param file optional name of the generated file
* @param sourceRoot optional sourceRoot of the map to be generated
* @return Combiner instance to which source maps can be added and later combined
*/
function create(file?: string, sourceRoot?: string): Combiner;
/** removeComments
* @param src
/**
* @return src with all sourceMappingUrl comments removed
*/
function removeComments(src: string): string;
+12 -6
View File
@@ -3,7 +3,8 @@
// Definitions by: Andrew Gaspar <https://github.com/AndrewGaspar>, Melvin Groenhoff <https://github.com/mgroenhoff>, TeamworkGuy2 <https://github.com/TeamworkGuy2>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/** Converts a source-map from/to different formats and allows adding/changing properties.
/**
* Converts a source-map from/to different formats and allows adding/changing properties.
* (documentation based on project's README file)
*/
export interface SourceMapConverter {
@@ -19,7 +20,8 @@ export interface SourceMapConverter {
/** Converts source map to base64 encoded json string */
toBase64(): string;
/** Converts source map to an inline comment that can be appended to the source-file.
/**
* Converts source map to an inline comment that can be appended to the source-file.
* By default, the comment is formatted like: //# sourceMappingURL=..., which you would normally see in a JS source file.
* When options.multiline == true, the comment is formatted like: /*# sourceMappingURL=... *\/, which you would find in a CSS source file
*/
@@ -47,16 +49,19 @@ export function fromBase64(base64: string): SourceMapConverter;
/** Returns source map converter from given base64 encoded json string prefixed with //# sourceMappingURL=... */
export function fromComment(comment: string): SourceMapConverter;
/** Returns source map converter from given filename by parsing //# sourceMappingURL=filename.
/**
* Returns source map converter from given filename by parsing //# sourceMappingURL=filename.
* filename must point to a file that is found inside the mapFileDir. Most tools store this file right next to the generated file, i.e. the one containing the source map.
*/
export function fromMapFileComment(comment: string, commentFileDir: string): SourceMapConverter;
/** Finds last sourcemap comment in file and returns source map converter or returns null if no source map comment was found.
/**
* Finds last sourcemap comment in file and returns source map converter or returns null if no source map comment was found.
*/
export function fromSource(content: string): SourceMapConverter | null;
/** Finds last sourcemap comment in file and returns source map converter or returns null if no source map comment was found.
/**
* Finds last sourcemap comment in file and returns source map converter or returns null if no source map comment was found.
* The sourcemap will be read from the map file found by parsing # sourceMappingURL=file comment. For more info see fromMapFileComment.
*/
export function fromMapFileSource(content: string, commentFileDir: string): SourceMapConverter | null;
@@ -73,7 +78,8 @@ export const commentRegex: RegExp;
/** Returns a new regex used to find source map comments pointing to map files */
export const mapFileCommentRegex: RegExp;
/** Returns a comment that links to an external source map via file.
/**
* Returns a comment that links to an external source map via file.
* By default, the comment is formatted like: //# sourceMappingURL=..., which you would normally see in a JS source file.
* When options.multiline == true, the comment is formatted like: /*# sourceMappingURL=... *\/, which you would find in a CSS source file.
*/
+31 -33
View File
@@ -27,27 +27,33 @@ declare namespace convict {
coerce?(val: any): any;
}
interface SchemaObj {
default: any;
doc?: string;
/**
* From the implementation:
*
* format can be a:
* - predefined type, as seen below
* - an array of enumerated values, e.g. ["production", "development", "testing"]
* - built-in JavaScript type, i.e. Object, Array, String, Number, Boolean
* - function that performs validation and throws an Error on failure
*
* If omitted, format will be set to the value of Object.prototype.toString.call
* for the default value
*/
format?: string | any[] | ((val: any) => void);
env?: string;
arg?: string;
sensitive?: boolean;
}
interface Schema {
[name: string]: Schema | {
default: any;
doc?: string;
/**
* From the implementation:
*
* format can be a:
* - predefined type, as seen below
* - an array of enumerated values, e.g. ["production", "development", "testing"]
* - built-in JavaScript type, i.e. Object, Array, String, Number, Boolean
* - function that performs validation and throws an Error on failure
*
* If omitted, format will be set to the value of Object.prototype.toString.call
* for the default value
*/
format?: string | any[] | ((val: any) => void);
env?: string;
arg?: string;
sensitive?: boolean;
};
[name: string]: Schema | SchemaObj;
}
interface InternalSchema {
properties: Schema;
}
interface Config {
@@ -69,48 +75,40 @@ declare namespace convict {
* Sets the value of name to value. name can use dot notation to reference
* nested values, e.g. "database.port". If objects in the chain don't yet
* exist, they will be initialized to empty objects
*
* @return {Config} instance
*/
set(name: string, value: any): Config;
/**
* Loads and merges a JavaScript object into config
*
* @return {Config} instance
*/
load(conf: Object): Config;
/**
* Loads and merges JSON configuration file(s) into config
*
* @return {Config} instance
*/
loadFile(files: string | string[]): Config;
/**
* Validates config against the schema used to initialize it
*
* @param options
*/
validate(options?: ValidateOptions): Config;
/**
* Exports all the properties (that is the keys and their current values) as a {JSON} {Object}
* @returns {Object} A {JSON} compliant {Object}
* @returns A {JSON} compliant {Object}
*/
getProperties(): Object;
/**
* Exports the schema as a {JSON} {Object}
* @returns {Object} A {JSON} compliant {Object}
* @returns A {JSON} compliant {Object}
*/
getSchema(): Object;
getSchema(): InternalSchema;
/**
* Exports all the properties (that is the keys and their current values) as a JSON string.
* @returns {String} a string representing this object
* @returns A string representing this object
*/
toString(): string;
/**
* Exports the schema as a JSON string.
* @returns {String} a string representing the schema of this {Config}
* @returns A string representing the schema of this {Config}
*/
getSchemaString(): string;
}
+1 -9
View File
@@ -3,19 +3,11 @@
// Definitions by: François Nguyen <https://github.com/lith-light-g>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/**
* Sign the given `val` with `secret`.
* @param {string} val
* @param {string} secret
* @return {string}
*/
/** Sign the given `val` with `secret`. */
export function sign(value: string, secret: string): string;
/**
* Unsign and decode the given `val` with `secret`,
* returning `false` if the signature is invalid.
* @param {string} val
* @param {string} secret
* @return {string|boolean}
*/
export function unsign(value: string, secret: string): string | boolean;
-18
View File
@@ -6,7 +6,6 @@ interface NativeKeyboard {
/**
* Show the messenger, the bare minimum which has to be passed to the function is
* the onSubmit callback
* @param options
*/
showMessenger(
options: NativeKeyboardShowOptions
@@ -16,10 +15,6 @@ interface NativeKeyboard {
* It's likely your app only has 1 one page where you want to show the messenger,
* so you want to hide it when the user navigates away. You can choose to do this
* either animated (a quick slide down animation) or not.
*
* @param options
* @param onSuccess
* @param onError
*/
hideMessenger(
options?: NativeKeyboardHideOptions,
@@ -29,9 +24,6 @@ interface NativeKeyboard {
/**
* Show a previously hidden keyboard
*
* @param onSuccess
* @param onError
*/
showMessengerKeyboard(
onSuccess?: () => void,
@@ -40,9 +32,6 @@ interface NativeKeyboard {
/**
* Hide the keyboard, but not the messenger bar
*
* @param onSuccess
* @param onError
*/
hideMessengerKeyboard(
onSuccess?: () => void,
@@ -53,10 +42,6 @@ interface NativeKeyboard {
* Manipulate the messenger while it's open. For instance if you want to
* update the text programmatically based on what the user typed (by responding to
* onTextChanged events).
*
* @param options
* @param onSuccess
* @param onError
*/
updateMessenger(
options: NativeKeyboardUpdateOptions,
@@ -92,7 +77,6 @@ interface NativeKeyboardHideOptions {
interface NativeKeyboardShowOptions {
/**
* Callback function, which is being called as soon as the user submits
* @param text
*/
onSubmit(text: string): void;
@@ -119,8 +103,6 @@ interface NativeKeyboardShowOptions {
/**
* Callback function which is being executed as soon as the entered text changes. Will
* return the new text
*
* @param text
*/
onTextChanged?(text: string): void;
+21
View File
@@ -0,0 +1,21 @@
import * as cpx from "cpx";
const SRC = "**/.js";
const DEST = ".tmp/";
const callback = (error: Error | null) => { };
const ASYNC_OPTIONS: cpx.AsyncOptions = { includeEmptyDirs: true };
const SYNC_OPTIONS: cpx.SyncOptions = { preserve: true };
const WATCH_OPTIONS: cpx.WatchOptions = { initialCopy: true };
cpx.copy(SRC, DEST);
cpx.copy(SRC, DEST, callback);
cpx.copy(SRC, DEST, ASYNC_OPTIONS);
cpx.copy(SRC, DEST, ASYNC_OPTIONS, callback);
cpx.copySync(SRC, DEST, SYNC_OPTIONS);
cpx.copySync(SRC, DEST);
const watch = cpx.watch(SRC, DEST, WATCH_OPTIONS);
watch.close();
watch.open();
watch.on("copy", (x) => x);
+44
View File
@@ -0,0 +1,44 @@
// Type definitions for cpx 1.5
// Project: https://github.com/mysticatea/cpx
// Definitions by: Alan Agius <https://github.com/alan-agius4>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
import * as stream from "stream";
export interface SyncOptions {
/** remove files that copied on past before copy. */
clean?: boolean;
/** Follow symbolic links when copying from them. */
dereference?: boolean;
/** Copy empty directories which is matched with the glob. */
includeEmptyDirs?: boolean;
/** Preserve UID, GID, ATIME, and MTIME of files. */
preserve?: boolean;
/** Do not overwrite files on destination if the source file is older. */
update?: boolean;
}
export interface AsyncOptions extends SyncOptions {
/** Function that creates a `stream.Transform` object to transform each copying file. */
transform?(filepath: string): stream.Transform[];
}
export interface WatchOptions extends AsyncOptions, SyncOptions {
/** Flag to not copy at the initial time of watch. */
initialCopy?: boolean;
}
export class Watcher extends NodeJS.EventEmitter {
constructor(options: WatchOptions);
open(): void;
close(): void;
}
export function copy(source: string, dest: string, options?: AsyncOptions, callback?: (error: Error | null) => void): void;
export function copy(source: string, dest: string, callback?: (error: Error | null) => void): void;
export function copySync(source: string, dest: string, options?: SyncOptions): void;
export function watch(source: string, dest: string, options?: WatchOptions): Watcher;
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"cpx-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+3 -3
View File
@@ -1,9 +1,9 @@
import * as Cropper from 'cropperjs';
var image = <HTMLImageElement>document.getElementById('image');
var cropper = new Cropper(image, {
const image = <HTMLImageElement> document.getElementById('image');
const cropper = new Cropper(image, {
aspectRatio: 16 / 9,
crop: function(e) {
crop(e) {
console.log(e.detail.x);
console.log(e.detail.y);
console.log(e.detail.width);
+273 -269
View File
@@ -1,259 +1,260 @@
// Type definitions for cropperjs
// Type definitions for cropperjs 1.1
// Project: https://github.com/fengyuanchen/cropperjs
// Definitions by: Stepan Mikhaylyuk <https://github.com/stepancar>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
declare namespace cropperjs {
export enum CropperViewMods {
enum CropperViewMods {
CropBoxIsJustWithInTheContainer = 0,
CropBoxShouldBeWithInTheCanvas = 1,
CanvasShouldNotBeWithInTheContainer = 2,
ContainerSshouldBeWithInTheCanvas = 3
}
export interface CropperReadyEvent extends CustomEvent { }
export interface CropperCropEvent extends CustomEvent {
type CropperReadyEvent = CustomEvent;
interface CropperCropEvent extends CustomEvent {
detail: Data;
}
export interface CropperCropStepEvent extends CustomEvent {
interface CropperCropStepEvent extends CustomEvent {
detail: CropStepData;
}
export interface CropperZoomEvent extends CustomEvent {
interface CropperZoomEvent extends CustomEvent {
detail: ZoomData;
}
export interface CropperOptions {
interface CropperOptions {
/**
* Function called when crop box is ready
*/
ready?: (event: CropperReadyEvent) => void;
* Function called when crop box is ready
*/
ready?(event: CropperReadyEvent): void;
/**
* Function called when crop box is moved or resized
*/
crop?: (event: CropperCropEvent) => void;
* Function called when crop box is moved or resized
*/
crop?(event: CropperCropEvent): void;
/**
* Function called at start of crop box being moved or resized
*/
cropstart?: (event: CropperCropStepEvent) => void;
* Function called at start of crop box being moved or resized
*/
cropstart?(event: CropperCropStepEvent): void;
/**
* Function called when crop box is moved
*/
cropmove?: (event: CropperCropStepEvent) => void;
* Function called when crop box is moved
*/
cropmove?(event: CropperCropStepEvent): void;
/**
* Function called when crop box is finished being moved or resized
*/
cropend?: (event: CropperCropStepEvent) => void;
* Function called when crop box is finished being moved or resized
*/
cropend?(event: CropperCropStepEvent): void;
/**
* Function called when a cropper instance starts to zoom in or zoom out its canvas (image wrapper).
*/
zoom?: (event: CropperZoomEvent) => void;
zoom?(event: CropperZoomEvent): void;
/**
* Define the view mode of the cropper.
* @default 0
*/
* Define the view mode of the cropper.
* @default 0
*/
viewMode?: CropperViewMods;
/**
* Define the dragging mode of the cropper.
* 'crop': create a new crop box
* 'move': move the canvas
* 'none': do nothing
*/
* Define the dragging mode of the cropper.
* 'crop': create a new crop box
* 'move': move the canvas
* 'none': do nothing
*/
dragMode?: string;
/**
* Set the aspect ratio of the crop box. By default, the crop box is free ratio.
* @default Nan
*/
* Set the aspect ratio of the crop box. By default, the crop box is free ratio.
* @default Nan
*/
aspectRatio?: number;
/**
* The previous cropped data if you had stored, will be passed to setData method automatically.
* @default null
*/
data?: Object;
* The previous cropped data if you had stored, will be passed to setData method automatically.
* @default null
*/
data?: object;
/**
* Add extra elements (containers) for previewing.
* Valid selector for Document.querySelectorAll
* @default ''
*/
* Add extra elements (containers) for previewing.
* Valid selector for Document.querySelectorAll
* @default ''
*/
preview?: string;
/**
* Rebuild the cropper when resize the window.
* @default true
*/
* Rebuild the cropper when resize the window.
* @default true
*/
responsive?: boolean;
/**
* By default, the plugin will check the image origin, and if it is a cross-origin image,
* a crossOrigin attribute will be added to the image element and a timestamp will be added to the image url to reload the image for "getCroppedCanvas".
* By adding crossOrigin attribute to image will stop adding timestamp to image url, and stop reload of image.
* @default true
*/
* By default, the plugin will check the image origin, and if it is a cross-origin image,
* a crossOrigin attribute will be added to the image element and a timestamp will be added to the image url to reload the image for "getCroppedCanvas".
* By adding crossOrigin attribute to image will stop adding timestamp to image url, and stop reload of image.
* @default true
*/
checkCrossOrigin?: boolean;
/**
* Check the current image's Exif Orientation information.
* More exactly, read the Orientation value for rotating or flipping the image, and then override the Orientation
* value with 1 (the default value) to avoid some issues (1, 2) on iOS devices.
* Requires to set both the rotatable and scalable options to true at the same time.
* Note: Don't trust this all the time as some JPG images have incorrect (not standard) Orientation values.
* @default true
*/
* Check the current image's Exif Orientation information.
* More exactly, read the Orientation value for rotating or flipping the image, and then override the Orientation
* value with 1 (the default value) to avoid some issues (1, 2) on iOS devices.
* Requires to set both the rotatable and scalable options to true at the same time.
* Note: Don't trust this all the time as some JPG images have incorrect (not standard) Orientation values.
* @default true
*/
checkOrientation?: boolean;
/**
* Show the black modal above the image and under the crop box.
* @default true
*/
* Show the black modal above the image and under the crop box.
* @default true
*/
modal?: boolean;
/**
* Show the dashed lines above the crop box.
* @default true
*/
* Show the dashed lines above the crop box.
* @default true
*/
guides?: boolean;
/**
* Show the center indicator above the crop box.
* @default true
*/
* Show the center indicator above the crop box.
* @default true
*/
center?: boolean;
/**
* Show the white modal above the crop box (highlight the crop box).
* @default true
*/
* Show the white modal above the crop box (highlight the crop box).
* @default true
*/
highlight?: boolean;
/**
* Show the grid background of the container.
* @default true
*/
* Show the grid background of the container.
* @default true
*/
background?: boolean;
/**
* Enable to crop the image automatically when initialize.
* @default true
*/
* Enable to crop the image automatically when initialize.
* @default true
*/
autoCrop?: boolean;
/**
* A number between 0 and 1. Define the automatic cropping area size (percentage).
* @default 0.8 (80% of the image)
*/
* A number between 0 and 1. Define the automatic cropping area size (percentage).
* @default 0.8 (80% of the image)
*/
autoCropArea?: number;
/**
* Enable to move the image.
* @default true
*/
* Enable to move the image.
* @default true
*/
movable?: boolean;
/**
* Enable to rotate the image.
* @default true
*/
* Enable to rotate the image.
* @default true
*/
rotatable?: boolean;
/**
* Enable to restore the cropped area after resizing the window.
* @default true
*/
* Enable to restore the cropped area after resizing the window.
* @default true
*/
restore?: boolean;
/**
* Enable to scale the image.
* @default true
*/
* Enable to scale the image.
* @default true
*/
scalable?: boolean;
/**
* Enable to zoom the image.
* @default true
*/
* Enable to zoom the image.
* @default true
*/
zoomable?: boolean;
/**
* Enable to zoom the image by dragging touch.
* @default true
*/
* Enable to zoom the image by dragging touch.
* @default true
*/
zoomOnTouch?: boolean;
/**
* Enable to zoom the image by wheeling mouse.
* @default true
*/
* Enable to zoom the image by wheeling mouse.
* @default true
*/
zoomOnWheel?: boolean;
/**
* Define zoom ratio when zoom the image by wheeling mouse.
* @default 0.1
*/
* Define zoom ratio when zoom the image by wheeling mouse.
* @default 0.1
*/
wheelZoomRatio?: number;
/**
* Enable to move the crop box.
* @default true
*/
* Enable to move the crop box.
* @default true
*/
cropBoxMovable?: boolean;
/**
* Enable to resize the crop box.
* @default true
*/
* Enable to resize the crop box.
* @default true
*/
cropBoxResizable?: boolean;
/**
* Enable to toggle drag mode between "crop" and "move" when click twice on the cropper.
* @default true
*/
* Enable to toggle drag mode between "crop" and "move" when click twice on the cropper.
* @default true
*/
toggleDragModeOnDblclick?: boolean;
/**
* The minimum width of the container
* @default 200
*/
* The minimum width of the container
* @default 200
*/
minContainerWidth?: number;
/**
* The minimum height of the container.
* @default 100
*/
* The minimum height of the container.
* @default 100
*/
minContainerHeight?: number;
/**
* The minimum width of the canvas (image wrapper).
* @default 0
*/
* The minimum width of the canvas (image wrapper).
* @default 0
*/
minCanvasWidth?: number;
/**
* The minimum height of the canvas (image wrapper).
* @default 0
*/
* The minimum height of the canvas (image wrapper).
* @default 0
*/
minCanvasHeight?: number;
/**
* The minimum width of the crop box.
* @default 0
*/
* The minimum width of the crop box.
* @default 0
*/
minCropBoxWidth?: number;
/**
* The minimum height of the crop box.
* @default 0
*/
* The minimum height of the crop box.
* @default 0
*/
minCropBoxHeight?: number;
/**
* This function will be called when a cropper instance starts to load an image.
* Return false to prevent to build
* @default null
*/
build?: () => boolean;
* This function will be called when a cropper instance starts to load an image.
* Return false to prevent to build
* @default null
*/
build?(): boolean;
/**
* This function will be called when a cropper instance has built completely.
* @default null
*/
built?: () => void;
* This function will be called when a cropper instance has built completely.
* @default null
*/
built?(): void;
}
interface Data {
/**
* the offset left of the cropped area
*/
* the offset left of the cropped area
*/
x: number;
/**
* the offset top of the cropped area
*/
* the offset top of the cropped area
*/
y: number;
/**
* the width of the cropped area
*/
* the width of the cropped area
*/
width: number;
/**
* the height of the cropped area
*/
* the height of the cropped area
*/
height: number;
/**
* the rotated degrees of the image
*/
* the rotated degrees of the image
*/
rotate: number;
/**
* the scaling factor to apply on the abscissa of the image
*/
* the scaling factor to apply on the abscissa of the image
*/
scaleX: number;
/**
* the scaling factor to apply on the ordinate of the image
*/
* the scaling factor to apply on the ordinate of the image
*/
scaleY: number;
}
interface CropStepData {
@@ -284,7 +285,7 @@ declare namespace cropperjs {
}
interface ZoomData {
/**
* The original event that was triggered
* The original event that was triggered
* Options: wheel, touchmove
*/
originalEvent: Event;
@@ -299,104 +300,108 @@ declare namespace cropperjs {
}
interface ContainerData {
/**
* The current width of the container
*/
* The current width of the container
*/
width: number;
/**
* The current height of the container
*/
* The current height of the container
*/
height: number;
}
interface CropBoxData {
/**
* the offset left of the crop box
*/
left: number;
* the offset left of the crop box
*/
left?: number;
/**
* the offset top of the crop box
*/
top: number;
* the offset top of the crop box
*/
top?: number;
/**
* the width of the crop box
*/
width: number;
* the width of the crop box
*/
width?: number;
/**
* the height of the crop box
*/
height: number;
* the height of the crop box
*/
height?: number;
}
interface CanvasData {
/**
* offset left of the canvas
*/
* offset left of the canvas
*/
left: number;
/**
* new offset top of the canvas
*/
* new offset top of the canvas
*/
top: number;
/**
* new width of the canvas
*/
* new width of the canvas
*/
width: number;
/**
* new height of the canvas
*/
* new height of the canvas
*/
height: number;
}
interface ImageData {
/**
* the offset left of the image
*/
* the offset left of the image
*/
left: number;
/**
* the offset top of the image
*/
* the offset top of the image
*/
top: number;
/**
* the width of the image
*/
* the width of the image
*/
width: number;
/**
* the height of the image
*/
* the height of the image
*/
height: number;
/**
* the natural width of the image
*/
* the natural width of the image
*/
naturalWidth: number;
/**
* the natural height of the image
*/
* the natural height of the image
*/
naturalHeight: number;
/**
* the aspect ratio of the image
*/
* the aspect ratio of the image
*/
aspectRatio: number;
/**
* the rotated degrees of the image if rotated
*/
* the rotated degrees of the image if rotated
*/
rotate: number;
/**
* the scaling factor to apply on the abscissa of the image if scaled
*/
* the scaling factor to apply on the abscissa of the image if scaled
*/
scaleX: number;
/**
* the scaling factor to apply on the ordinate of the image if scaled
*/
* the scaling factor to apply on the ordinate of the image if scaled
*/
scaleY: number;
}
interface CroppedCanvasOptions {
/**
* the destination width of the output canvas
*/
* the destination width of the output canvas
*/
width?: number;
minWidth?: number;
maxWidth?: number;
/**
* the destination height of the output canvas
*/
* the destination height of the output canvas
*/
height?: number;
minHeight?: number;
maxHeight?: number;
/**
* a color to fill any alpha values in the output canvas
*/
* a color to fill any alpha values in the output canvas
*/
fillColor?: string;
}
}
@@ -409,144 +414,143 @@ declare class cropperjs {
crop(): void;
/**
* Clear the crop box.
*/
* Clear the crop box.
*/
reset(): void;
/**
* Replace the image's src and rebuild the cropper.
* @param url A new image url
*/
* Replace the image's src and rebuild the cropper.
* @param url A new image url
*/
replace(url: string): void;
/**
* Enable (unfreeze) the cropper.
*/
* Enable (unfreeze) the cropper.
*/
enable(): void;
/**
* Disable (freeze) the cropper
*/
* Disable (freeze) the cropper
*/
disable(): void;
/**
* Destroy the cropper and remove the instance from the image.
*/
* Destroy the cropper and remove the instance from the image.
*/
destroy(): void;
/**
* Move the canvas (image wrapper) with relative offsets.
* @param offsetX Moving size (px) in the horizontal direction.
* @param offsetY Moving size (px) in the vertical direction.
* If not present, its default value is offsetX.
*/
* Move the canvas (image wrapper) with relative offsets.
* @param offsetX Moving size (px) in the horizontal direction.
* @param offsetY Moving size (px) in the vertical direction.
* If not present, its default value is offsetX.
*/
move(offsetX: number, offsetY?: number): void;
/**
* Move the canvas (image wrapper) to an absolute point.
* @param x The left value of the canvas
* @param y The top value of the canvas
* If not present, its default value is x.
*/
* Move the canvas (image wrapper) to an absolute point.
* @param x The left value of the canvas
* @param y The top value of the canvas
* If not present, its default value is x.
*/
moveTo(x: number, y?: number): void;
/**
* Zoom the canvas (image wrapper) with a relative ratio.
* Zoom in: requires a positive number (ratio > 0)
* Zoom out: requires a negative number (ratio < 0)
*/
* Zoom the canvas (image wrapper) with a relative ratio.
* Zoom in: requires a positive number (ratio > 0)
* Zoom out: requires a negative number (ratio < 0)
*/
zoom(ratio: number): void;
/**
* Zoom the canvas (image wrapper) to an absolute ratio.
* Zoom in: requires a positive number (ratio > 0)
* Zoom out: requires a negative number (ratio < 0)
*/
* Zoom the canvas (image wrapper) to an absolute ratio.
* Zoom in: requires a positive number (ratio > 0)
* Zoom out: requires a negative number (ratio < 0)
*/
zoomTo(ratio: number): void;
/**
* Rotate the canvas (image wrapper) with a relative degree.
* Rotate right: requires a positive number (degree > 0)
* Rotate left: requires a negative number (degree < 0)
*/
* Rotate the canvas (image wrapper) with a relative degree.
* Rotate right: requires a positive number (degree > 0)
* Rotate left: requires a negative number (degree < 0)
*/
rotate(degree: number): void;
/**
* Rotate the canvas (image wrapper) to an absolute degree.
* Rotate right: requires a positive number (degree > 0)
* Rotate left: requires a negative number (degree < 0)
*/
* Rotate the canvas (image wrapper) to an absolute degree.
* Rotate right: requires a positive number (degree > 0)
* Rotate left: requires a negative number (degree < 0)
*/
rotateTo(degree: number): void;
/**
* Clear the crop box.
*/
* Clear the crop box.
*/
clear(): void;
/**
* Output the cropped area position and size data (base on the original image).
*/
* Output the cropped area position and size data (base on the original image).
*/
getData(rounded?: boolean): cropperjs.Data;
/**
* Change the cropped area position and size with new data (base on the original image).
*/
* Change the cropped area position and size with new data (base on the original image).
*/
setData(data: cropperjs.Data): void;
/**
* Output the container size data.
*/
* Output the container size data.
*/
getContainerData(): cropperjs.ContainerData;
/**
* Output the image position, size and other related data.
*/
* Output the image position, size and other related data.
*/
getImageData(): cropperjs.ImageData;
/**
* Output the canvas (image wrapper) position and size data.
*/
* Output the canvas (image wrapper) position and size data.
*/
getCanvasData(): cropperjs.CanvasData & {
/**
* the natural width of the canvas (read only)
*/
* the natural width of the canvas (read only)
*/
naturalWidth: number;
/**
* the natural height of the canvas (read only)
*/
* the natural height of the canvas (read only)
*/
naturalHeight: number;
};
/**
* Change the canvas (image wrapper) position and size with new data.
*/
* Change the canvas (image wrapper) position and size with new data.
*/
setCanvasData(data: cropperjs.CanvasData): void;
/**
* Output the crop box position and size data.
*/
* Output the crop box position and size data.
*/
getCropBoxData(): cropperjs.CropBoxData;
/**
* Change the crop box position and size with new data.
*/
* Change the crop box position and size with new data.
*/
setCropBoxData(data: cropperjs.CropBoxData): void;
/**
* Get a canvas drawn the cropped image.
*/
* Get a canvas drawn the cropped image.
*/
getCroppedCanvas(options?: cropperjs.CroppedCanvasOptions): HTMLCanvasElement;
/**
* Change the aspect ratio of the crop box.
*/
* Change the aspect ratio of the crop box.
*/
setAspectRatio(aspectRatio: number): void;
/**
* Change the drag mode.
*/
* Change the drag mode.
*/
setDragMode(mode?: 'none' | 'crop' | 'move'): void;
}
export = cropperjs;
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+3 -20
View File
@@ -17,44 +17,27 @@ interface TokensOptions {
}
declare class Tokens {
/**
* Token generation/verification class.
*
* @param {object} [options]
* @param {number} [options.saltLength=8] The string length of the salt
* @param {number} [options.secretLength=18] The byte length of the secret key
* @public
*/
/** Token generation/verification class. */
constructor(options?: TokensOptions)
/**
* Create a new CSRF token.
*
* @param {string} secret The secret for the token.
* @public
* @param secret The secret for the token.
*/
create(secret: string): string;
/**
* Create a new secret key.
*
* @param {function} [callback]
* @public
*/
/** Create a new secret key. */
secret(callback?: SecretCallback): Promise<string>;
/**
* Create a new secret key synchronously.
* @public
*/
secretSync(): string;
/**
* Verify if a given token is valid for a given secret.
*
* @param {string} secret
* @param {string} token
* @public
*/
verify(secret: string, token: string): boolean;
}
+26 -26
View File
@@ -179,50 +179,50 @@ declare namespace csvtojson {
class Converter extends stream.Transform {
/**
* Initializes a new instance of a Converter
* @param {ConverterOptions} options converter options
* @param {StreamOptions} streamOptions stream options
* @param options converter options
* @param streamOptions stream options
*/
constructor(options?: ConverterOptions, streamOptions?: StreamOptions);
/**
* Reads in a CSV from a string.
* @param {string} str the string to convert
* @return {Converter} returns this object for chaining
* @param str the string to convert
* @return returns this object for chaining
*/
fromString(str: string): this;
/**
* Reads in a CSV from a string.
* @param {string} str the string to convert
* @param {ParseResultHandler} callback callback function to handle result or error
* @param str the string to convert
* @param callback callback function to handle result or error
*/
fromString(str: string, callback: ParseResultHandler): void;
/**
* Reads in a CSV from a file.
* @param {string} filePath the path to the CSV file
* @return {Converter} returns this object for chaining
* @param filePath the path to the CSV file
* @return returns this object for chaining
*/
fromFile(filePath: string): this;
/**
* Reads in a CSV from a file.
* @param {string} filePath the path to the CSV file
* @param {ParseResultHandler} callback callback function to handle result or error
* @param filePath the path to the CSV file
* @param callback callback function to handle result or error
*/
fromFile(filePath: string, callback: ParseResultHandler): void;
/**
* Reads in a CSV from a stream.
* @param {Stream} stream the stream
* @return {Converter} returns this object for chaining
* @param stream the stream
* @return returns this object for chaining
*/
fromStream(stream: NodeJS.ReadableStream): this;
/**
* Reads in a CSV from a stream.
* @param {Stream} stream the stream
* @param {ParseResultHandler} callback callback function to handle result or error
* @param stream the stream
* @param callback callback function to handle result or error
*/
fromStream(stream: stream.Stream, callback: ParseResultHandler): void;
@@ -237,9 +237,9 @@ declare namespace csvtojson {
* - end
* - end_parsed
* - done
* @param {Event} event name of event
* @param {Function} listener listener function
* @return {this} returns this object for chaining
* @param event name of event
* @param listener listener function
* @return returns this object for chaining
*/
// tslint:disable-next-line ban-types
on(event: string, listener: Function | JsonEventHandler | CsvEventHandler | DataEventHandler | ErrorEventHandler
@@ -247,22 +247,22 @@ declare namespace csvtojson {
/**
* Transform objects after CSV parsing but before result being emitted or pushed downstream.
* @param {Function} callback transform function
* @return {this} returns this object for chaining
* @param callback transform function
* @return returns this object for chaining
*/
transf(callback: (jsonObj: any, csvRow: string[], rowNumber: number) => void): this;
/**
* The function in preRawData will be called directly with the string from upper stream.
* @param {Function} callback callback function
* @return {this} returns this object for chaining
* @param callback callback function
* @return returns this object for chaining
*/
preRawData(callback: (csvRawData: string, cb: (newData: any) => void) => void): this;
/**
* The function is called each time a file line being found in csv stream.
* @param {Function} callback callback function
* @return {this} returns this object for chaining
* @param callback callback function
* @return returns this object for chaining
*/
preFileLine(callback: (line: string, rowNumber: number) => string): this;
}
@@ -270,9 +270,9 @@ declare namespace csvtojson {
/**
* Factory function which creates an instance of a Converter object.
* @param {ConverterOptions} options converter options
* @param {StreamOptions} streamOptions stream options
* @return {csvtojson.Converter} Converter object
* @param options converter options
* @param streamOptions stream options
* @return Converter object
*/
declare function csvtojson(options?: csvtojson.ConverterOptions, streamOptions?: csvtojson.StreamOptions): csvtojson.Converter;
+18 -9
View File
@@ -2711,7 +2711,8 @@ declare namespace cytoscape {
* http://js.cytoscape.org/#eles.degreeCentrality
*/
interface SearchDegreeCentralityOptions {
/** The root node (selector or collection) for which the
/**
* The root node (selector or collection) for which the
* centrality calculation is made.
*/
root: NodeSingular | Selector;
@@ -2725,7 +2726,8 @@ declare namespace cytoscape {
* in the centrality calculation.
*/
alpha?: number;
/** A boolean indicating whether the directed indegree and outdegree centrality is calculated (true) or
/**
* Whether the directed indegree and outdegree centrality is calculated (true) or
* whether the undirected centrality is calculated (false, default).
*/
directed?: boolean;
@@ -2757,7 +2759,8 @@ declare namespace cytoscape {
* in the centrality calculation.
*/
alpha?: number;
/** A boolean indicating whether the directed indegree and outdegree centrality is calculated (true) or
/**
* A boolean indicating whether the directed indegree and outdegree centrality is calculated (true) or
* whether the undirected centrality is calculated (false, default).
*/
directed?: boolean;
@@ -2780,14 +2783,16 @@ declare namespace cytoscape {
* http://js.cytoscape.org/#eles.closenessCentrality
*/
interface SearchClosenessCentralityOptions {
/** The root node (selector or collection) for which the
/**
* The root node (selector or collection) for which the
* centrality calculation is made.
*/
root: NodeSingular | Selector;
/** A function that returns the weight for the edge. */
weight?(edge: EdgeSingular): number;
/** A boolean indicating whether the directed indegree and outdegree centrality is calculated (true) or
/**
* A boolean indicating whether the directed indegree and outdegree centrality is calculated (true) or
* whether the undirected centrality is calculated (false, default).
*/
directed?: boolean;
@@ -2829,7 +2834,8 @@ declare namespace cytoscape {
/** A function that returns the weight for the edge. */
weight?(edge: EdgeSingular): number;
/** A boolean indicating whether the directed indegree and outdegree centrality is calculated (true) or
/**
* A boolean indicating whether the directed indegree and outdegree centrality is calculated (true) or
* whether the undirected centrality is calculated (false, default).
*/
directed?: boolean;
@@ -3976,7 +3982,8 @@ declare namespace cytoscape {
originalEvent: EventObject;
}
interface LayoutEventObject extends AbstractEventObject {
/** layout : indicates the corresponding layout that triggered the event
/**
* layout : indicates the corresponding layout that triggered the event
* (useful if running multiple layouts simultaneously)
*/
layout: any;
@@ -4357,12 +4364,14 @@ declare namespace cytoscape {
* A new, developer accessible layout can be made via cy.makeLayout().
*/
interface LayoutManipulation {
/** Start running the layout
/**
* Start running the layout
* http://js.cytoscape.org/#layout.run
*/
run(): void;
start(): void;
/** Stop running the (asynchronous/discrete) layout
/**
* Stop running the (asynchronous/discrete) layout
* http://js.cytoscape.org/#layout.stop
*/
stop(): void;
+2 -1
View File
@@ -26,8 +26,9 @@ const n = 256;
const m = 256;
const values: number[] = new Array(n * m);
for (let j = 0.5, k = 0; j < m; ++j) {
for (let i = 0.5; i < n; ++i, ++k) {
for (let i = 0.5; i < n; i++) {
values[k] = goldsteinPrice(i / n * 4 - 2, 1 - j / m * 3);
k++;
}
}

Some files were not shown because too many files have changed in this diff Show More