mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-11 20:50:02 +00:00
Merge branch 'master' into react-request
This commit is contained in:
596
.github/CODEOWNERS
vendored
596
.github/CODEOWNERS
vendored
File diff suppressed because it is too large
Load Diff
@@ -2,7 +2,9 @@ language: node_js
|
||||
node_js:
|
||||
- 8
|
||||
|
||||
sudo: false
|
||||
|
||||
notifications:
|
||||
email: false
|
||||
|
||||
script:
|
||||
- npm run test
|
||||
- if [[ $TRAVIS_EVENT_TYPE == "cron" ]]; then npm run update-codeowners || travis_terminate 1; fi
|
||||
51
README.md
51
README.md
@@ -57,7 +57,7 @@ You may need to add manual [references](http://www.typescriptlang.org/docs/handb
|
||||
|
||||
## How can I contribute?
|
||||
|
||||
DefinitelyTyped only works because of contributions by users like you!
|
||||
Definitely Typed only works because of contributions by users like you!
|
||||
|
||||
### Test
|
||||
|
||||
@@ -89,7 +89,7 @@ then follow the instructions to [edit an existing package](#edit-an-existing-pac
|
||||
|
||||
### Make a pull request
|
||||
|
||||
Once you've tested your package, you can share it on DefinitelyTyped.
|
||||
Once you've tested your package, you can share it on Definitely Typed.
|
||||
|
||||
First, [fork](https://guides.github.com/activities/forking/) this repository, install [node](https://nodejs.org/), and run `npm install`.
|
||||
|
||||
@@ -117,7 +117,7 @@ If it doesn't, you can do so yourself in the comment associated with the PR.
|
||||
|
||||
#### Create a new package
|
||||
|
||||
If you are the library author and your package is written in TypeScript, [bundle the autogenerated declaration files](http://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html) in your package instead of publishing to DefinitelyTyped.
|
||||
If you are the library author and your package is written in TypeScript, [bundle the autogenerated declaration files](http://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html) in your package instead of publishing to Definitely Typed.
|
||||
|
||||
If you are adding typings for an NPM package, create a directory with the same name.
|
||||
If the package you are adding typings for is not on NPM, make sure the name you choose for it does not conflict with the name of a package on NPM.
|
||||
@@ -137,7 +137,7 @@ See all options at [dts-gen](https://github.com/Microsoft/dts-gen).
|
||||
|
||||
You may edit the `tsconfig.json` to add new files, to add `"target": "es6"` (needed for async functions), to add to `"lib"`, or to add the `"jsx"` compiler option.
|
||||
|
||||
DefinitelyTyped members routinely monitor for new PRs, though keep in mind that the number of other PRs may slow things down.
|
||||
Definitely Typed members routinely monitor for new PRs, though keep in mind that the number of other PRs may slow things down.
|
||||
|
||||
For a good example package, see [base64-js](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/base64-js).
|
||||
|
||||
@@ -165,18 +165,31 @@ For a good example package, see [base64-js](https://github.com/DefinitelyTyped/D
|
||||
|
||||
#### Removing a package
|
||||
|
||||
When a package [bundles](http://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html) its own types, types should be removed from DefinitelyTyped to avoid confusion.
|
||||
When a package [bundles](http://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html) its own types, types should be removed from Definitely Typed to avoid confusion.
|
||||
|
||||
You can remove it by running `npm run not-needed -- typingsPackageName asOfVersion sourceRepoURL [libraryName]`.
|
||||
- `typingsPackageName`: This is the name of the directory to delete.
|
||||
- `asOfVersion`: A stub will be published to `@types/foo` with this version. Should be higher than any currently published version.
|
||||
- `sourceRepoURL`: This should point to the repository that contains the typings.
|
||||
- `libraryName`: Descriptive name of the library, e.g. "Angular 2" instead of "angular2". (If ommitted, will be identical to "typingsPackageName".)
|
||||
- `libraryName`: Name of npm package that replaces the Definitely Typed types. Usually this is identical to "typingsPackageName", in which case you can omit it.
|
||||
|
||||
Any other packages in DefinitelyTyped that referenced the deleted package should be updated to reference the bundled types. To do this, add a `package.json` with `"dependencies": { "foo": "x.y.z" }`.
|
||||
Any other packages in Definitely Typed that referenced the deleted package should be updated to reference the bundled types.
|
||||
You can get this list by looking at the errors from `npm run test`.
|
||||
To fix the errors, add a `package.json` with `"dependencies": { "foo": "x.y.z" }`.
|
||||
For example:
|
||||
|
||||
If a package was never on DefinitelyTyped, it does not need to be added to `notNeededPackages.json`.
|
||||
```json
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"foo": "^2.6.0"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
When you add a `package.json` to dependents of `foo`, you will also need to open a PR to add `foo` [to dependenciesWhitelist.txt in types-publisher](https://github.com/Microsoft/types-publisher/blob/master/dependenciesWhitelist.txt).
|
||||
|
||||
If a package was never on Definitely Typed, it does not need to be added to `notNeededPackages.json`.
|
||||
|
||||
#### Lint
|
||||
|
||||
@@ -225,11 +238,11 @@ The `master` branch is automatically published to the `@types` scope on NPM than
|
||||
|
||||
#### I've submitted a pull request. How long until it is merged?
|
||||
|
||||
It depends, but most pull requests will be merged within a week. PRs that have been approved by an author listed in the definition's header are usually merged more quickly; PRs for new definitions will take more time as they require more review from maintainers. Each PR is reviewed by a TypeScript or DefinitelyTyped team member before being merged, so please be patient as human factors may cause delays. Check the [PR Burndown Board](https://github.com/DefinitelyTyped/DefinitelyTyped/projects/3?card_filter_query=is%3Aopen) to see progress as maintainers work through the open PRs.
|
||||
It depends, but most pull requests will be merged within a week. PRs that have been approved by an author listed in the definition's header are usually merged more quickly; PRs for new definitions will take more time as they require more review from maintainers. Each PR is reviewed by a TypeScript or Definitely Typed team member before being merged, so please be patient as human factors may cause delays. Check the [PR Burndown Board](https://github.com/DefinitelyTyped/DefinitelyTyped/projects/3?card_filter_query=is%3Aopen) to see progress as maintainers work through the open PRs.
|
||||
|
||||
#### My PR is merged; when will the `@types` NPM package be updated?
|
||||
|
||||
NPM packages should update within a few minutes. If it's been more than an hour, mention the PR number on [the DefinitelyTyped Gitter channel](https://gitter.im/DefinitelyTyped/DefinitelyTyped) and the current maintainer will get the correct team member to investigate.
|
||||
NPM packages should update within a few minutes. If it's been more than an hour, mention the PR number on [the Definitely Typed Gitter channel](https://gitter.im/DefinitelyTyped/DefinitelyTyped) and the current maintainer will get the correct team member to investigate.
|
||||
|
||||
#### I'm writing a definition that depends on another definition. Should I use `<reference types="" />` or an import?
|
||||
|
||||
@@ -325,13 +338,13 @@ You can look [here](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/mast
|
||||
This may belong in [TSJS-Lib-Generator](https://github.com/Microsoft/TSJS-lib-generator#readme). See the guidelines there.
|
||||
If the standard is still a draft, it belongs here.
|
||||
Use a name beginning with `dom-` and include a link to the standard as the "Project" link in the header.
|
||||
When it graduates draft mode, we may remove it from DefinitelyTyped and deprecate the associated `@types` package.
|
||||
When it graduates draft mode, we may remove it from Definitely Typed and deprecate the associated `@types` package.
|
||||
|
||||
#### How do DefinitelyTyped package versions relate to versions of the corresponding library?
|
||||
#### How do Definitely Typed package versions relate to versions of the corresponding library?
|
||||
|
||||
_NOTE: The discussion in this section assumes familiarity with [Semantic versioning](https://semver.org/)_
|
||||
|
||||
Each DefinitelyTyped package is versioned when published to NPM.
|
||||
Each Definitely Typed package is versioned when published to NPM.
|
||||
The [types-publisher](https://github.com/Microsoft/types-publisher) (the tool that publishes `@types` packages to npm) will set the declaration package's version by using the `major.minor` version number listed in the first line of its `index.d.ts` file.
|
||||
For example, here are the first few lines of [Node's type declarations](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/1253faabf5e0d2c5470db6ea87795d7f96fef7e2/types/node/index.d.ts) for version `10.12.x` at the time of writing:
|
||||
|
||||
@@ -339,24 +352,24 @@ For example, here are the first few lines of [Node's type declarations](https://
|
||||
// Type definitions for Node.js 10.12
|
||||
// Project: http://nodejs.org/
|
||||
// Definitions by: Microsoft TypeScript <https://github.com/Microsoft>
|
||||
// DefinitelyTyped <https://github.com/DefinitelyTyped>
|
||||
// Definitely Typed <https://github.com/DefinitelyTyped>
|
||||
// Alberto Schiabel <https://github.com/jkomyno>
|
||||
```
|
||||
|
||||
Because `10.12` is at the end the first line, the npm version of the `@types/node` package will also be `10.12.x`.
|
||||
Note that the first-line comment in the `index.d.ts` file should only contain the `major.minor` version (e.g. `10.12`) and should not contain a patch version (e.g. `10.12.4`).
|
||||
This is because only the major and minor release numbers are aligned between library packages and type declaration packages.
|
||||
The patch release number of the type declaration package (e.g. `.0` in `10.12.0`) is initialized to zero by DefinitelyTyped and is incremented each time a new `@types/node` package is published to NPM for the same major/minor version of the corresponding library.
|
||||
The patch release number of the type declaration package (e.g. `.0` in `10.12.0`) is initialized to zero by Definitely Typed and is incremented each time a new `@types/node` package is published to NPM for the same major/minor version of the corresponding library.
|
||||
|
||||
Sometimes type declaration package versions and library package versions can get out of sync.
|
||||
Below are a few common reasons why, in order of how much they inconvenience users of a library.
|
||||
Only the last case is typically problematic.
|
||||
|
||||
* As noted above, the patch version of the type declaration package is unrelated to the library patch version.
|
||||
This allows DefinitelyTyped to safely update type declarations for the same major/minor version of a library.
|
||||
This allows Definitely Typed to safely update type declarations for the same major/minor version of a library.
|
||||
* If updating a package for new functionality, don't forget to update the version number to line up with that version of the library.
|
||||
If users make sure versions correspond between JavaScript packages and their respective `@types` packages, then `npm update` should typically just work.
|
||||
* It's common for type declaration package updates to lag behind library updates because it's often library users, not maintainers, who update DefinitelyTyped when new library features are released.
|
||||
* It's common for type declaration package updates to lag behind library updates because it's often library users, not maintainers, who update Definitely Typed when new library features are released.
|
||||
So there may be a lag of days, weeks, or even months before a helpful community member sends a PR to update the type declaration package for a new library release.
|
||||
If you're impacted by this, you can be the change you want to see in the world and you can be that helpful community member!
|
||||
|
||||
@@ -366,7 +379,7 @@ Only the last case is typically problematic.
|
||||
|
||||
[Semantic versioning](https://semver.org/) requires that versions with breaking changes must increment the major version number.
|
||||
For example, a library that removes a publicly exported function after its `3.5.8` release must bump its version to `4.0.0` in its next release.
|
||||
Furthermore, when the library's `4.0.0` release is out, its DefinitelyTyped type declaration package should also be updated to `4.0.0`, including any breaking changes to the library's API.
|
||||
Furthermore, when the library's `4.0.0` release is out, its Definitely Typed type declaration package should also be updated to `4.0.0`, including any breaking changes to the library's API.
|
||||
|
||||
Many libraries have a large installed base of developers (including maintainers of other packages using that library as a dependency) who won't move right away to a new version that has breaking changes, because it might be months until a maintainer has time to rewrite code to adapt to the new version.
|
||||
In the meantime, users of old library versions still may want to update type declarations for older versions.
|
||||
@@ -398,7 +411,7 @@ At the time of writing, the [history v2 `tsconfig.json`](https://github.com/Defi
|
||||
}
|
||||
```
|
||||
|
||||
If there are other packages in DefinitelyTyped that are incompatible with the new version, you will need to add path mappings to the old version.
|
||||
If there are other packages in Definitely Typed that are incompatible with the new version, you will need to add path mappings to the old version.
|
||||
You will also need to do this recursively for packages depending on packages depending on the old version.
|
||||
|
||||
For example, `react-router` depends on `history@2`, so [react-router `tsconfig.json`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react-router/v2/tsconfig.json) has a path mapping to `"history": [ "history/v2" ]`.
|
||||
|
||||
@@ -18,6 +18,12 @@
|
||||
"sourceRepoURL": "https://github.com/ceolter/ag-grid",
|
||||
"asOfVersion": "3.2.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "aggregate-error",
|
||||
"typingsPackageName": "aggregate-error",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/aggregate-error",
|
||||
"asOfVersion": "2.2.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "ajv",
|
||||
"typingsPackageName": "ajv",
|
||||
@@ -198,6 +204,12 @@
|
||||
"sourceRepoURL": "https://github.com/ded/bowser",
|
||||
"asOfVersion": "1.1.1"
|
||||
},
|
||||
{
|
||||
"libraryName": "boxen",
|
||||
"typingsPackageName": "boxen",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/boxen",
|
||||
"asOfVersion": "3.0.1"
|
||||
},
|
||||
{
|
||||
"libraryName": "Bugsnag Browser",
|
||||
"typingsPackageName": "bugsnag-js",
|
||||
@@ -216,12 +228,24 @@
|
||||
"sourceRepoURL": "https://github.com/blakeembrey/camel-case",
|
||||
"asOfVersion": "1.2.1"
|
||||
},
|
||||
{
|
||||
"libraryName": "camelcase",
|
||||
"typingsPackageName": "camelcase",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/camelcase",
|
||||
"asOfVersion": "5.2.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "catalog",
|
||||
"typingsPackageName": "catalog",
|
||||
"sourceRepoURL": "https://github.com/interactivethings/catalog",
|
||||
"asOfVersion": "3.5.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "chai-http",
|
||||
"typingsPackageName": "chai-http",
|
||||
"sourceRepoURL": "https://github.com/chaijs/chai-http",
|
||||
"asOfVersion": "4.2.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "chalk",
|
||||
"typingsPackageName": "chalk",
|
||||
@@ -240,12 +264,24 @@
|
||||
"sourceRepoURL": "https://github.com/mapbox/cheap-ruler",
|
||||
"asOfVersion": "2.5.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "chokidar",
|
||||
"typingsPackageName": "chokidar",
|
||||
"sourceRepoURL": "https://github.com/paulmillr/chokidar",
|
||||
"asOfVersion": "2.1.3"
|
||||
},
|
||||
{
|
||||
"libraryName": "chunked-dc",
|
||||
"typingsPackageName": "chunked-dc",
|
||||
"sourceRepoURL": "https://github.com/saltyrtc/chunked-dc-js",
|
||||
"asOfVersion": "0.2.2"
|
||||
},
|
||||
{
|
||||
"libraryName": "clean-webpack-plugin",
|
||||
"typingsPackageName": "clean-webpack-plugin",
|
||||
"sourceRepoURL": "https://github.com/johnagan/clean-webpack-plugin",
|
||||
"asOfVersion": "2.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "colors.js (colors)",
|
||||
"typingsPackageName": "colors",
|
||||
@@ -258,6 +294,12 @@
|
||||
"sourceRepoURL": "https://github.com/tj/commander.js",
|
||||
"asOfVersion": "2.12.2"
|
||||
},
|
||||
{
|
||||
"libraryName": "conf",
|
||||
"typingsPackageName": "conf",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/conf",
|
||||
"asOfVersion": "3.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "confirmdialog",
|
||||
"typingsPackageName": "confirmdialog",
|
||||
@@ -270,6 +312,12 @@
|
||||
"sourceRepoURL": "https://github.com/blakeembrey/constant-case",
|
||||
"asOfVersion": "1.1.2"
|
||||
},
|
||||
{
|
||||
"libraryName": "copy-text-to-clipboard",
|
||||
"typingsPackageName": "copy-text-to-clipboard",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/copy-text-to-clipboard",
|
||||
"asOfVersion": "2.0.1"
|
||||
},
|
||||
{
|
||||
"libraryName": "cordova-plugin-battery-status",
|
||||
"typingsPackageName": "cordova-plugin-battery-status",
|
||||
@@ -384,6 +432,18 @@
|
||||
"sourceRepoURL": "https://github.com/jayphelps/core-decorators.js",
|
||||
"asOfVersion": "0.20.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "cp-file",
|
||||
"typingsPackageName": "cp-file",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/cp-file",
|
||||
"asOfVersion": "6.1.1"
|
||||
},
|
||||
{
|
||||
"libraryName": "cpy",
|
||||
"typingsPackageName": "cpy",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/cpy",
|
||||
"asOfVersion": "7.1.1"
|
||||
},
|
||||
{
|
||||
"libraryName": "cypress",
|
||||
"typingsPackageName": "cypress",
|
||||
@@ -402,18 +462,36 @@
|
||||
"sourceRepoURL": "https://github.com/DataDog/dd-trace-js",
|
||||
"asOfVersion": "0.9.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "decamelize",
|
||||
"typingsPackageName": "decamelize",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/decamelize",
|
||||
"asOfVersion": "3.0.1"
|
||||
},
|
||||
{
|
||||
"libraryName": "decimal.js",
|
||||
"typingsPackageName": "decimal.js",
|
||||
"sourceRepoURL": "https://github.com/MikeMcl/decimal.js",
|
||||
"asOfVersion": "7.4.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "decompress-response",
|
||||
"typingsPackageName": "decompress-response",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/decompress-response",
|
||||
"asOfVersion": "4.1.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "deepmerge",
|
||||
"typingsPackageName": "deepmerge",
|
||||
"sourceRepoURL": "git@github.com:KyleAMathews/deepmerge.git",
|
||||
"asOfVersion": "2.2.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "del",
|
||||
"typingsPackageName": "del",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/del",
|
||||
"asOfVersion": "4.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "delay",
|
||||
"typingsPackageName": "delay",
|
||||
@@ -444,6 +522,12 @@
|
||||
"sourceRepoURL": "https://github.com/joyent/docker-file-parser",
|
||||
"asOfVersion": "1.0.3"
|
||||
},
|
||||
{
|
||||
"libraryName": "dom-loaded",
|
||||
"typingsPackageName": "dom-loaded",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/dom-loaded",
|
||||
"asOfVersion": "1.1.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "dot-case",
|
||||
"typingsPackageName": "dot-case",
|
||||
@@ -498,6 +582,12 @@
|
||||
"sourceRepoURL": "https://github.com/loopline-systems/electron-builder",
|
||||
"asOfVersion": "2.8.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "element-ready",
|
||||
"typingsPackageName": "element-ready",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/element-ready",
|
||||
"asOfVersion": "3.1.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "email-addresses",
|
||||
"typingsPackageName": "email-addresses",
|
||||
@@ -510,6 +600,12 @@
|
||||
"sourceRepoURL": "https://github.com/Sembiance/email-validator",
|
||||
"asOfVersion": "1.0.6"
|
||||
},
|
||||
{
|
||||
"libraryName": "env-paths",
|
||||
"typingsPackageName": "env-paths",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/env-paths",
|
||||
"asOfVersion": "2.1.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "error-stack-parser",
|
||||
"typingsPackageName": "error-stack-parser",
|
||||
@@ -606,6 +702,24 @@
|
||||
"sourceRepoURL": "https://github.com/taylorhakes/fecha",
|
||||
"asOfVersion": "2.3.1"
|
||||
},
|
||||
{
|
||||
"libraryName": "file-type",
|
||||
"typingsPackageName": "file-type",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/file-type",
|
||||
"asOfVersion": "10.9.1"
|
||||
},
|
||||
{
|
||||
"libraryName": "filenamify",
|
||||
"typingsPackageName": "filenamify",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/filenamify",
|
||||
"asOfVersion": "3.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "filenamify-url",
|
||||
"typingsPackageName": "filenamify-url",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/filenamify-url",
|
||||
"asOfVersion": "2.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "FineUploader",
|
||||
"typingsPackageName": "fine-uploader",
|
||||
@@ -618,6 +732,12 @@
|
||||
"sourceRepoURL": "https://www.firebase.com/docs/javascript/firebase",
|
||||
"asOfVersion": "3.2.1"
|
||||
},
|
||||
{
|
||||
"libraryName": "fkill",
|
||||
"typingsPackageName": "fkill",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/fkill",
|
||||
"asOfVersion": "6.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "flatpickr",
|
||||
"typingsPackageName": "flatpickr",
|
||||
@@ -666,6 +786,12 @@
|
||||
"sourceRepoURL": "https://github.com/manuelbieh/Geolib",
|
||||
"asOfVersion": "2.0.23"
|
||||
},
|
||||
{
|
||||
"libraryName": "get-stream",
|
||||
"typingsPackageName": "get-stream",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/get-stream",
|
||||
"asOfVersion": "5.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "github",
|
||||
"typingsPackageName": "github",
|
||||
@@ -678,6 +804,12 @@
|
||||
"sourceRepoURL": "https://github.com/jdalrymple/node-gitlab",
|
||||
"asOfVersion": "2.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "globby",
|
||||
"typingsPackageName": "globby",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/globby",
|
||||
"asOfVersion": "9.1.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "Google Cloud Storage",
|
||||
"typingsPackageName": "google-cloud__storage",
|
||||
@@ -714,12 +846,30 @@
|
||||
"sourceRepoURL": "https://github.com/ivogabe/gulp-typescript",
|
||||
"asOfVersion": "2.13.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "handlebars",
|
||||
"typingsPackageName": "handlebars",
|
||||
"sourceRepoURL": "https://github.com/wycats/handlebars.js",
|
||||
"asOfVersion": "4.1.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "handsontable",
|
||||
"typingsPackageName": "handsontable",
|
||||
"sourceRepoURL": "https://handsontable.com/",
|
||||
"asOfVersion": "0.35.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "has-yarn",
|
||||
"typingsPackageName": "has-yarn",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/has-yarn",
|
||||
"asOfVersion": "2.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "hasha",
|
||||
"typingsPackageName": "hasha",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/hasha",
|
||||
"asOfVersion": "4.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "hibp",
|
||||
"typingsPackageName": "hibp",
|
||||
@@ -738,6 +888,12 @@
|
||||
"sourceRepoURL": "https://github.com/prettymuchbryce/node-http-status",
|
||||
"asOfVersion": "1.2.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "humanize-string",
|
||||
"typingsPackageName": "humanize-string",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/humanize-string",
|
||||
"asOfVersion": "2.0.1"
|
||||
},
|
||||
{
|
||||
"libraryName": "i18next-browser-languagedetector",
|
||||
"typingsPackageName": "i18next-browser-languagedetector",
|
||||
@@ -762,6 +918,12 @@
|
||||
"sourceRepoURL": "https://github.com/bpmn-io/ids",
|
||||
"asOfVersion": "0.2.2"
|
||||
},
|
||||
{
|
||||
"libraryName": "image-type",
|
||||
"typingsPackageName": "image-type",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/image-type",
|
||||
"asOfVersion": "4.0.1"
|
||||
},
|
||||
{
|
||||
"libraryName": "immutability-helper",
|
||||
"typingsPackageName": "immutability-helper",
|
||||
@@ -786,6 +948,12 @@
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/internal-ip",
|
||||
"asOfVersion": "4.1.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "into-stream",
|
||||
"typingsPackageName": "into-stream",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/into-stream",
|
||||
"asOfVersion": "5.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "inversify",
|
||||
"typingsPackageName": "inversify",
|
||||
@@ -834,12 +1002,30 @@
|
||||
"sourceRepoURL": "https://github.com/blakeembrey/is-lower-case",
|
||||
"asOfVersion": "1.1.2"
|
||||
},
|
||||
{
|
||||
"libraryName": "is-online",
|
||||
"typingsPackageName": "is-online",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/is-online",
|
||||
"asOfVersion": "8.1.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "is-plain-object",
|
||||
"typingsPackageName": "is-plain-object",
|
||||
"sourceRepoURL": "https://github.com/jonschlinkert/is-plain-object",
|
||||
"asOfVersion": "2.0.4"
|
||||
},
|
||||
{
|
||||
"libraryName": "is-scoped",
|
||||
"typingsPackageName": "is-scoped",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/is-scoped",
|
||||
"asOfVersion": "2.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "is-svg",
|
||||
"typingsPackageName": "is-svg",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/is-svg",
|
||||
"asOfVersion": "4.0.1"
|
||||
},
|
||||
{
|
||||
"libraryName": "is-upper-case",
|
||||
"typingsPackageName": "is-upper-case",
|
||||
@@ -918,6 +1104,12 @@
|
||||
"sourceRepoURL": "https://github.com/keycloak/keycloak",
|
||||
"asOfVersion": "3.4.1"
|
||||
},
|
||||
{
|
||||
"libraryName": "knex",
|
||||
"typingsPackageName": "knex",
|
||||
"sourceRepoURL": "https://github.com/tgriesser/knex",
|
||||
"asOfVersion": "0.16.1"
|
||||
},
|
||||
{
|
||||
"libraryName": "knockout-paging",
|
||||
"typingsPackageName": "knockout-paging",
|
||||
@@ -942,6 +1134,12 @@
|
||||
"sourceRepoURL": "https://github.com/elitechance/lambda-phi",
|
||||
"asOfVersion": "1.0.1"
|
||||
},
|
||||
{
|
||||
"libraryName": "latest-version",
|
||||
"typingsPackageName": "latest-version",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/latest-version",
|
||||
"asOfVersion": "5.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "ldclient-js",
|
||||
"typingsPackageName": "ldclient-js",
|
||||
@@ -954,6 +1152,12 @@
|
||||
"sourceRepoURL": "https://github.com/stevemao/left-pad",
|
||||
"asOfVersion": "1.2.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "leven",
|
||||
"typingsPackageName": "leven",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/leven",
|
||||
"asOfVersion": "3.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "Linq.JS",
|
||||
"typingsPackageName": "linq",
|
||||
@@ -990,6 +1194,12 @@
|
||||
"sourceRepoURL": "https://github.com/steelsojka/lodash-decorators",
|
||||
"asOfVersion": "4.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "log-update",
|
||||
"typingsPackageName": "log-update",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/log-update",
|
||||
"asOfVersion": "3.1.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "log4javascript",
|
||||
"typingsPackageName": "log4javascript",
|
||||
@@ -1014,6 +1224,12 @@
|
||||
"sourceRepoURL": "https://github.com/blakeembrey/lower-case-first",
|
||||
"asOfVersion": "1.0.1"
|
||||
},
|
||||
{
|
||||
"libraryName": "make-dir",
|
||||
"typingsPackageName": "make-dir",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/make-dir",
|
||||
"asOfVersion": "2.1.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "mali",
|
||||
"typingsPackageName": "mali",
|
||||
@@ -1032,6 +1248,12 @@
|
||||
"sourceRepoURL": "https://github.com/runk/node-maxmind",
|
||||
"asOfVersion": "2.0.5"
|
||||
},
|
||||
{
|
||||
"libraryName": "mem",
|
||||
"typingsPackageName": "mem",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/mem",
|
||||
"asOfVersion": "4.2.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "mendixmodelsdk",
|
||||
"typingsPackageName": "mendixmodelsdk",
|
||||
@@ -1086,6 +1308,12 @@
|
||||
"sourceRepoURL": "https://github.com/LearnBoost/monk.git",
|
||||
"asOfVersion": "6.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "move-file",
|
||||
"typingsPackageName": "move-file",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/move-file",
|
||||
"asOfVersion": "1.1.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "MQTT",
|
||||
"typingsPackageName": "mqtt",
|
||||
@@ -1128,6 +1356,36 @@
|
||||
"sourceRepoURL": "https://github.com/paularmstrong/normalizr",
|
||||
"asOfVersion": "2.0.18"
|
||||
},
|
||||
{
|
||||
"libraryName": "npm-email",
|
||||
"typingsPackageName": "npm-email",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/npm-email",
|
||||
"asOfVersion": "3.1.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "npm-keyword",
|
||||
"typingsPackageName": "npm-keyword",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/npm-keyword",
|
||||
"asOfVersion": "6.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "npm-name",
|
||||
"typingsPackageName": "npm-name",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/npm-name",
|
||||
"asOfVersion": "5.2.1"
|
||||
},
|
||||
{
|
||||
"libraryName": "npm-run-path",
|
||||
"typingsPackageName": "npm-run-path",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/npm-run-path",
|
||||
"asOfVersion": "3.0.1"
|
||||
},
|
||||
{
|
||||
"libraryName": "npm-user",
|
||||
"typingsPackageName": "npm-user",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/npm-user",
|
||||
"asOfVersion": "4.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "Nuka Carousel",
|
||||
"typingsPackageName": "nuka-carousel",
|
||||
@@ -1140,30 +1398,180 @@
|
||||
"sourceRepoURL": "https://github.com/foretagsplatsen/numbro/",
|
||||
"asOfVersion": "1.9.3"
|
||||
},
|
||||
{
|
||||
"libraryName": "on-change",
|
||||
"typingsPackageName": "on-change",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/on-change",
|
||||
"asOfVersion": "1.1.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "Onsen UI",
|
||||
"typingsPackageName": "onsenui",
|
||||
"sourceRepoURL": "http://onsen.io",
|
||||
"asOfVersion": "2.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "ora",
|
||||
"typingsPackageName": "ora",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/ora",
|
||||
"asOfVersion": "3.2.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "p-any",
|
||||
"typingsPackageName": "p-any",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/p-any",
|
||||
"asOfVersion": "2.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "p-cancelable",
|
||||
"typingsPackageName": "p-cancelable",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/p-cancelable",
|
||||
"asOfVersion": "1.1.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "p-catch-if",
|
||||
"typingsPackageName": "p-catch-if",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/p-catch-if",
|
||||
"asOfVersion": "2.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "p-debounce",
|
||||
"typingsPackageName": "p-debounce",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/p-debounce",
|
||||
"asOfVersion": "2.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "p-each-series",
|
||||
"typingsPackageName": "p-each-series",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/p-each-series",
|
||||
"asOfVersion": "2.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "p-event",
|
||||
"typingsPackageName": "p-event",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/p-event",
|
||||
"asOfVersion": "3.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "p-every",
|
||||
"typingsPackageName": "p-every",
|
||||
"sourceRepoURL": "https://github.com/kevva/p-every",
|
||||
"asOfVersion": "2.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "p-limit",
|
||||
"typingsPackageName": "p-limit",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/p-limit",
|
||||
"asOfVersion": "2.2.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "p-locate",
|
||||
"typingsPackageName": "p-locate",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/p-locate",
|
||||
"asOfVersion": "4.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "p-log",
|
||||
"typingsPackageName": "p-log",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/p-log",
|
||||
"asOfVersion": "2.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "p-map",
|
||||
"typingsPackageName": "p-map",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/p-map",
|
||||
"asOfVersion": "2.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "p-map-series",
|
||||
"typingsPackageName": "p-map-series",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/p-map-series",
|
||||
"asOfVersion": "2.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "p-memoize",
|
||||
"typingsPackageName": "p-memoize",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/p-memoize",
|
||||
"asOfVersion": "3.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "p-one",
|
||||
"typingsPackageName": "p-one",
|
||||
"sourceRepoURL": "https://github.com/kevva/p-one",
|
||||
"asOfVersion": "2.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "p-pipe",
|
||||
"typingsPackageName": "p-pipe",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/p-pipe",
|
||||
"asOfVersion": "2.0.1"
|
||||
},
|
||||
{
|
||||
"libraryName": "p-progress",
|
||||
"typingsPackageName": "p-progress",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/p-progress",
|
||||
"asOfVersion": "0.3.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "p-props",
|
||||
"typingsPackageName": "p-props",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/p-props",
|
||||
"asOfVersion": "2.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "p-queue",
|
||||
"typingsPackageName": "p-queue",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/p-queue",
|
||||
"asOfVersion": "3.2.1"
|
||||
},
|
||||
{
|
||||
"libraryName": "p-reduce",
|
||||
"typingsPackageName": "p-reduce",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/p-reduce",
|
||||
"asOfVersion": "2.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "p-retry",
|
||||
"typingsPackageName": "p-retry",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/p-retry",
|
||||
"asOfVersion": "4.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "p-series",
|
||||
"typingsPackageName": "p-series",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/p-series",
|
||||
"asOfVersion": "2.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "p-some",
|
||||
"typingsPackageName": "p-some",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/p-some",
|
||||
"asOfVersion": "4.0.1"
|
||||
},
|
||||
{
|
||||
"libraryName": "p-tap",
|
||||
"typingsPackageName": "p-tap",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/p-tap",
|
||||
"asOfVersion": "2.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "p-throttle",
|
||||
"typingsPackageName": "p-throttle",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/p-throttle",
|
||||
"asOfVersion": "2.1.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "p-timeout",
|
||||
"typingsPackageName": "p-timeout",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/p-timeout",
|
||||
"asOfVersion": "3.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "package-json",
|
||||
"typingsPackageName": "package-json",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/package-json",
|
||||
"asOfVersion": "6.1.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "param-case",
|
||||
"typingsPackageName": "param-case",
|
||||
@@ -1188,12 +1596,24 @@
|
||||
"sourceRepoURL": "https://github.com/blakeembrey/path-case",
|
||||
"asOfVersion": "1.1.2"
|
||||
},
|
||||
{
|
||||
"libraryName": "path-key",
|
||||
"typingsPackageName": "path-key",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/path-key",
|
||||
"asOfVersion": "3.0.1"
|
||||
},
|
||||
{
|
||||
"libraryName": "path-to-regexp",
|
||||
"typingsPackageName": "path-to-regexp",
|
||||
"sourceRepoURL": "https://github.com/pillarjs/path-to-regexp",
|
||||
"asOfVersion": "1.7.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "path-type",
|
||||
"typingsPackageName": "path-type",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/path-type",
|
||||
"asOfVersion": "4.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "perfect-scrollbar",
|
||||
"typingsPackageName": "perfect-scrollbar",
|
||||
@@ -1230,12 +1650,36 @@
|
||||
"sourceRepoURL": "https://github.com/PeculiarVentures/pkcs11js",
|
||||
"asOfVersion": "1.0.4"
|
||||
},
|
||||
{
|
||||
"libraryName": "pkg-conf",
|
||||
"typingsPackageName": "pkg-conf",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/pkg-conf",
|
||||
"asOfVersion": "3.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "pkg-dir",
|
||||
"typingsPackageName": "pkg-dir",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/pkg-dir",
|
||||
"asOfVersion": "4.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "pkg-versions",
|
||||
"typingsPackageName": "pkg-versions",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/pkg-versions",
|
||||
"asOfVersion": "2.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "plottable",
|
||||
"typingsPackageName": "plottable",
|
||||
"sourceRepoURL": "http://plottablejs.org/",
|
||||
"asOfVersion": "3.7.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "png-async",
|
||||
"typingsPackageName": "png-async",
|
||||
"sourceRepoURL": "https://github.com/kanreisa/node-png-async",
|
||||
"asOfVersion": "0.9.4"
|
||||
},
|
||||
{
|
||||
"libraryName": "poly2tri.js",
|
||||
"typingsPackageName": "poly2tri",
|
||||
@@ -1266,6 +1710,12 @@
|
||||
"sourceRepoURL": "https://github.com/angular/protractor",
|
||||
"asOfVersion": "4.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "ps-list",
|
||||
"typingsPackageName": "ps-list",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/ps-list",
|
||||
"asOfVersion": "6.2.1"
|
||||
},
|
||||
{
|
||||
"libraryName": "qiniu",
|
||||
"typingsPackageName": "qiniu",
|
||||
@@ -1278,6 +1728,18 @@
|
||||
"sourceRepoURL": "https://github.com/kazuhikoarase/qrcode-generator",
|
||||
"asOfVersion": "1.0.6"
|
||||
},
|
||||
{
|
||||
"libraryName": "query-string",
|
||||
"typingsPackageName": "query-string",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/query-string",
|
||||
"asOfVersion": "6.3.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "quick-lru",
|
||||
"typingsPackageName": "quick-lru",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/quick-lru",
|
||||
"asOfVersion": "3.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "Raven JS",
|
||||
"typingsPackageName": "raven-js",
|
||||
@@ -1404,6 +1866,12 @@
|
||||
"sourceRepoURL": "https://github.com/tanem/react-svg",
|
||||
"asOfVersion": "5.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "read-chunk",
|
||||
"typingsPackageName": "read-chunk",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/read-chunk",
|
||||
"asOfVersion": "3.1.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "realm",
|
||||
"typingsPackageName": "realm",
|
||||
@@ -1542,6 +2010,12 @@
|
||||
"sourceRepoURL": "https://github.com/Lellansin/node-scanf",
|
||||
"asOfVersion": "0.7.3"
|
||||
},
|
||||
{
|
||||
"libraryName": "screenfull",
|
||||
"typingsPackageName": "screenfull",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/screenfull.js",
|
||||
"asOfVersion": "4.1.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "sendgrid",
|
||||
"typingsPackageName": "sendgrid",
|
||||
@@ -1578,6 +2052,18 @@
|
||||
"sourceRepoURL": "https://github.com/zeh/simplesignal",
|
||||
"asOfVersion": "1.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "@sindresorhus/df",
|
||||
"typingsPackageName": "sindresorhus__df",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/df",
|
||||
"asOfVersion": "3.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "@sindresorhus/slugify",
|
||||
"typingsPackageName": "sindresorhus__slugify",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/slugify",
|
||||
"asOfVersion": "0.9.1"
|
||||
},
|
||||
{
|
||||
"libraryName": "sip.js",
|
||||
"typingsPackageName": "sip.js",
|
||||
@@ -1686,6 +2172,12 @@
|
||||
"sourceRepoURL": "http://tabrisjs.com",
|
||||
"asOfVersion": "1.8.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "tabris-plugin-firebase",
|
||||
"typingsPackageName": "tabris-plugin-firebase",
|
||||
"sourceRepoURL": "https://github.com/eclipsesource/tabris-plugin-firebase",
|
||||
"asOfVersion": "2.1.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "tcomb",
|
||||
"typingsPackageName": "tcomb",
|
||||
@@ -1698,6 +2190,12 @@
|
||||
"sourceRepoURL": "https://github.com/terser-js/terser",
|
||||
"asOfVersion": "3.12.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "time-span",
|
||||
"typingsPackageName": "time-span",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/time-span",
|
||||
"asOfVersion": "3.0.1"
|
||||
},
|
||||
{
|
||||
"libraryName": "timezonecomplete",
|
||||
"typingsPackageName": "timezonecomplete",
|
||||
@@ -1710,6 +2208,12 @@
|
||||
"sourceRepoURL": "https://github.com/blakeembrey/title-case",
|
||||
"asOfVersion": "1.1.2"
|
||||
},
|
||||
{
|
||||
"libraryName": "trash",
|
||||
"typingsPackageName": "trash",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/trash",
|
||||
"asOfVersion": "5.0.1"
|
||||
},
|
||||
{
|
||||
"libraryName": "TsMonad",
|
||||
"typingsPackageName": "tsmonad",
|
||||
@@ -1758,6 +2262,12 @@
|
||||
"sourceRepoURL": "https://github.com/kriasoft/universal-router",
|
||||
"asOfVersion": "8.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "unused-filename",
|
||||
"typingsPackageName": "unused-filename",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/unused-filename",
|
||||
"asOfVersion": "2.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "upper-case",
|
||||
"typingsPackageName": "upper-case",
|
||||
@@ -1818,6 +2328,12 @@
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/wait-for-localhost",
|
||||
"asOfVersion": "3.1.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "wallpaper",
|
||||
"typingsPackageName": "wallpaper",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/wallpaper",
|
||||
"asOfVersion": "4.3.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "webcola",
|
||||
"typingsPackageName": "webcola",
|
||||
@@ -1898,9 +2414,9 @@
|
||||
},
|
||||
{
|
||||
"libraryName": "@xmpp/jid",
|
||||
"typingsPackageName": "xmpp-jid",
|
||||
"typingsPackageName": "xmpp__jid",
|
||||
"sourceRepoURL": "github.com/node-xmpp/node-xmpp/",
|
||||
"asOfVersion": "1.2.0"
|
||||
"asOfVersion": "1.2.1"
|
||||
},
|
||||
{
|
||||
"libraryName": "xterm.js",
|
||||
@@ -1914,6 +2430,12 @@
|
||||
"sourceRepoURL": "none",
|
||||
"asOfVersion": "2.1.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "zapier-platform-core",
|
||||
"typingsPackageName": "zapier-platform-core",
|
||||
"sourceRepoURL": "https://github.com/zapier/zapier-platform-core",
|
||||
"asOfVersion": "6.1.1"
|
||||
},
|
||||
{
|
||||
"libraryName": "zetapush-js",
|
||||
"typingsPackageName": "zetapush-js",
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
"scripts": {
|
||||
"compile-scripts": "tsc -p scripts",
|
||||
"not-needed": "node scripts/not-needed.js",
|
||||
"update-codeowners": "node scripts/update-codeowners.js",
|
||||
"test": "node node_modules/types-publisher/bin/tester/test.js --run-from-definitely-typed",
|
||||
"lint": "dtslint types"
|
||||
},
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"allowJs": true,
|
||||
"checkJs": true,
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": true,
|
||||
"noImplicitReturns": true,
|
||||
"noImplicitThis": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"strict": true,
|
||||
"baseUrl": "../types",
|
||||
"typeRoots": [
|
||||
"../types"
|
||||
@@ -15,4 +12,4 @@
|
||||
"types": [],
|
||||
"forceConsistentCasingInFileNames": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
126
scripts/update-codeowners.js
Normal file
126
scripts/update-codeowners.js
Normal file
@@ -0,0 +1,126 @@
|
||||
/// <reference lib="esnext.asynciterable" />
|
||||
// Must reference esnext.asynciterable lib, since octokit uses AsyncIterable internally
|
||||
const cp = require("child_process");
|
||||
const Octokit = require("@octokit/rest");
|
||||
const { AllPackages, getDefinitelyTyped, loggerWithErrors,
|
||||
parseDefinitions, parseNProcesses, clean } = require("types-publisher");
|
||||
const { writeFile } = require("fs-extra");
|
||||
|
||||
async function main() {
|
||||
const options = { definitelyTypedPath: ".", progress: false, parseInParallel: true };
|
||||
const log = loggerWithErrors()[0];
|
||||
|
||||
clean();
|
||||
const dt = await getDefinitelyTyped(options, log);
|
||||
await parseDefinitions(dt, { nProcesses: parseNProcesses(), definitelyTypedPath: "." }, log);
|
||||
const allPackages = await AllPackages.read(dt);
|
||||
const typings = allPackages.allTypings();
|
||||
const maxPathLen = Math.max(...typings.map(t => t.subDirectoryPath.length));
|
||||
const entries = mapDefined(typings, t => getEntry(t, maxPathLen));
|
||||
await writeFile([options.definitelyTypedPath, ".github", "CODEOWNERS"].join("/"), `${header}\n\n${entries.join("\n")}\n`, { encoding: "utf-8" });
|
||||
}
|
||||
|
||||
const token = /** @type {string} */(process.env.GH_TOKEN);
|
||||
const gh = new Octokit();
|
||||
const reviewers = ["weswigham", "sandersn", "RyanCavanaugh"]
|
||||
const now = new Date();
|
||||
const branchName = `codeowner-update-${now.getFullYear()}${padNum(now.getMonth())}${padNum(now.getDay())}`;
|
||||
const remoteUrl = `https://${token}@github.com/DefinitelyTyped/DefinitelyTyped.git`;
|
||||
runSequence([
|
||||
["git", ["checkout", "."]], // reset any changes
|
||||
]);
|
||||
|
||||
main().then(() => {
|
||||
runSequence([
|
||||
["git", ["checkout", "-b", branchName]], // create a branch
|
||||
["git", ["add", ".github/CODEOWNERS"]], // Add CODEOWNERS
|
||||
["git", ["commit", "-m", `"Update CODEOWNERS"`]], // Commit all changes
|
||||
["git", ["remote", "add", "fork", remoteUrl]], // Add the remote fork
|
||||
["git", ["push", "--set-upstream", "fork", branchName, "-f"]] // push the branch
|
||||
]);
|
||||
|
||||
gh.authenticate({
|
||||
type: "token",
|
||||
token,
|
||||
});
|
||||
return gh.pulls.create({
|
||||
owner: "DefinitelyTyped",
|
||||
repo: "DefinitelyTyped",
|
||||
maintainer_can_modify: true,
|
||||
title: `🤖 CODEOWNERS has changed`,
|
||||
head: `DefinitelyTyped:${branchName}`,
|
||||
base: "master",
|
||||
body:
|
||||
`Please review the diff and merge if no changes are unexpected.
|
||||
|
||||
cc ${reviewers.map(r => "@" + r).join(" ")}`,
|
||||
})
|
||||
}).then(r => {
|
||||
const num = r.data.number;
|
||||
console.log(`Pull request ${num} created.`);
|
||||
return gh.pulls.createReviewRequest({
|
||||
owner: "DefinitelyTyped",
|
||||
repo: "DefinitelyTyped",
|
||||
number: num,
|
||||
reviewers,
|
||||
});
|
||||
}).then(() => {
|
||||
console.log(`Reviewers requested, done.`);
|
||||
}).catch(e => {
|
||||
console.error(e);
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
/** @param {[string, string[]][]} tasks */
|
||||
function runSequence(tasks) {
|
||||
for (const task of tasks) {
|
||||
console.log(`${task[0]} ${task[1].join(" ")}`);
|
||||
const result = cp.spawnSync(task[0], task[1], { timeout: 100000, shell: true, stdio: "inherit" });
|
||||
if (result.status !== 0) throw new Error(`${task[0]} ${task[1].join(" ")} failed: ${result.stderr && result.stderr.toString()}`);
|
||||
}
|
||||
}
|
||||
|
||||
/** @param {number} number */
|
||||
function padNum(number) {
|
||||
const str = "" + number;
|
||||
return str.length >= 2 ? str : "0" + str;
|
||||
}
|
||||
|
||||
|
||||
const header =
|
||||
`# This file is generated.
|
||||
# Add yourself to the "Definitions by:" list instead.
|
||||
# See https://github.com/DefinitelyTyped/DefinitelyTyped#edit-an-existing-package`;
|
||||
|
||||
/**
|
||||
* @param { { contributors: ReadonlyArray<{githubUsername?: string }>, subDirectoryPath: string} } pkg
|
||||
* @param {number} maxPathLen
|
||||
* @return {string | undefined}
|
||||
*/
|
||||
function getEntry(pkg, maxPathLen) {
|
||||
const users = mapDefined(pkg.contributors, c => c.githubUsername);
|
||||
if (!users.length) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const path = `${pkg.subDirectoryPath}/`.padEnd(maxPathLen);
|
||||
return `/types/${path} ${users.map(u => `@${u}`).join(" ")}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* @template T,U
|
||||
* @param {ReadonlyArray<T>} arr
|
||||
* @param {(t: T) => U | undefined} mapper
|
||||
* @return U[]
|
||||
*/
|
||||
function mapDefined(arr, mapper) {
|
||||
const out = [];
|
||||
for (const a of arr) {
|
||||
const res = mapper(a);
|
||||
if (res !== undefined) {
|
||||
out.push(res);
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"npm-naming": false,
|
||||
"eofline": false,
|
||||
"export-just-namespace": false,
|
||||
"import-spacing": false,
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"npm-naming": false,
|
||||
"eofline": false,
|
||||
"export-just-namespace": false,
|
||||
"import-spacing": false,
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"npm-naming": false,
|
||||
"eofline": false,
|
||||
"export-just-namespace": false,
|
||||
"import-spacing": false,
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"npm-naming": false,
|
||||
"eofline": false,
|
||||
"export-just-namespace": false,
|
||||
"import-spacing": false,
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
import addZero from "add-zero";
|
||||
import addZero = require("add-zero");
|
||||
|
||||
addZero(5, 2);
|
||||
|
||||
3
types/add-zero/index.d.ts
vendored
3
types/add-zero/index.d.ts
vendored
@@ -3,4 +3,5 @@
|
||||
// Definitions by: Giles Roadnight <https://github.com/Roaders>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export default function addZero(value: string | number, digits?: number): string;
|
||||
export = addZero;
|
||||
declare function addZero(value: string | number, digits?: number): string;
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"npm-naming": false,
|
||||
"eofline": false,
|
||||
"export-just-namespace": false,
|
||||
"import-spacing": false,
|
||||
|
||||
@@ -30,7 +30,7 @@ declare namespace adone.collection {
|
||||
/**
|
||||
* Ends the stream
|
||||
*/
|
||||
end(chunk?: Buffer): void;
|
||||
end(chunk?: Buffer | string): void;
|
||||
end(chunk?: () => void): void;
|
||||
|
||||
/**
|
||||
|
||||
2
types/adone/index.d.ts
vendored
2
types/adone/index.d.ts
vendored
@@ -2,7 +2,7 @@
|
||||
// Project: https://github.com/ciferox/adone
|
||||
// Definitions by: am <https://github.com/s0m3on3>, Maximus <https://github.com/maxveres>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.6
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
/// <reference path="./adone.d.ts" />
|
||||
/// <reference path="./glosses/app.d.ts" />
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
"no-unnecessary-qualifier": false,
|
||||
"unified-signatures": false,
|
||||
"space-before-function-paren": false,
|
||||
"await-promise": false
|
||||
"await-promise": false,
|
||||
"no-restricted-globals": false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"npm-naming": false,
|
||||
"eofline": false,
|
||||
"export-just-namespace": false,
|
||||
"import-spacing": false,
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
import AggregateError = require('aggregate-error');
|
||||
|
||||
const err = new AggregateError([new Error('foo'), 'bar']);
|
||||
|
||||
for (const el of Array.from(err)) {
|
||||
const err: Error = el;
|
||||
}
|
||||
|
||||
throw err;
|
||||
12
types/aggregate-error/index.d.ts
vendored
12
types/aggregate-error/index.d.ts
vendored
@@ -1,12 +0,0 @@
|
||||
// Type definitions for aggregate-error 1.0
|
||||
// Project: https://github.com/sindresorhus/aggregate-error#readme
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = AggregateError;
|
||||
|
||||
declare class AggregateError extends Error implements Iterable<Error> {
|
||||
constructor(errors: Iterable<Error | string>);
|
||||
|
||||
[Symbol.iterator](): Iterator<Error>;
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"aggregate-error-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -8,6 +8,7 @@
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"npm-naming": false,
|
||||
"eofline": false,
|
||||
"export-just-namespace": false,
|
||||
"import-spacing": false,
|
||||
|
||||
@@ -98,6 +98,7 @@ let _algoliaIndexSettings: IndexSettings = {
|
||||
placeholders: { '': [''] },
|
||||
camelCaseAttributes: [''],
|
||||
sortFacetValuesBy: 'count',
|
||||
queryLanguages: ['fr', 'es'],
|
||||
};
|
||||
|
||||
let _algoliaQueryParameters: QueryParameters = {
|
||||
@@ -147,6 +148,7 @@ let _algoliaQueryParameters: QueryParameters = {
|
||||
tagFilters: [''],
|
||||
facetFilters: [''],
|
||||
analytics: false,
|
||||
clickAnalytics: true,
|
||||
analyticsTags: [''],
|
||||
synonyms: true,
|
||||
replaceSynonymsInHighlight: false,
|
||||
|
||||
23
types/algoliasearch/index.d.ts
vendored
23
types/algoliasearch/index.d.ts
vendored
@@ -1,4 +1,4 @@
|
||||
// Type definitions for algoliasearch-client-js 3.30.0
|
||||
// Type definitions for algoliasearch-client-js 3.30.1
|
||||
// Project: https://github.com/algolia/algoliasearch-client-js
|
||||
// Definitions by: Baptiste Coquelle <https://github.com/cbaptiste>
|
||||
// Haroen Viaene <https://github.com/haroenv>
|
||||
@@ -6,6 +6,7 @@
|
||||
// Samuel Vaillant <https://github.com/samouss>
|
||||
// Kai Eichinger <https://github.com/keichinger>
|
||||
// Nery Ortez <https://github.com/neryortez>
|
||||
// Antoine Rousseau <https://github.com/antoinerousseau>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
@@ -1425,6 +1426,12 @@ declare namespace algoliasearch {
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/analytics/
|
||||
*/
|
||||
analytics?: boolean;
|
||||
/**
|
||||
* If set to true, enables the Click Analytics feature
|
||||
* default false
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/clickAnalytics/
|
||||
*/
|
||||
clickAnalytics?: boolean;
|
||||
/**
|
||||
* If set, tag your query with the specified identifiers
|
||||
* default: []
|
||||
@@ -1778,12 +1785,20 @@ declare namespace algoliasearch {
|
||||
};
|
||||
/**
|
||||
* List of attributes on which to do a decomposition of camel case words.
|
||||
*
|
||||
https://www.algolia.com/doc/api-reference/api-parameters/camelCaseAttributes/
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/camelCaseAttributes/
|
||||
*/
|
||||
camelCaseAttributes?: string[];
|
||||
|
||||
/**
|
||||
* Controls how facet values are sorted.
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/sortFacetValuesBy/
|
||||
*/
|
||||
sortFacetValuesBy?: 'count' | 'alpha';
|
||||
/**
|
||||
* Sets the languages to be used by language-specific settings and functionalities
|
||||
* such as ignorePlurals, removeStopWords, and CJK word-detection.
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/queryLanguages/
|
||||
*/
|
||||
queryLanguages?: Array<'af' | 'ar' | 'az' | 'bg' | 'bn' | 'ca' | 'cs' | 'cy' | 'da' | 'de' | 'el' | 'en' | 'eo' | 'es' | 'et' | 'eu' | 'fa' | 'fi' | 'fo' | 'fr' | 'ga' | 'gl' | 'he' | 'hi' | 'hu' | 'hy' | 'id' | 'is' | 'it' | 'ja' | 'ka' | 'kk' | 'ko' | 'ku' | 'ky' | 'lt' | 'lv' | 'mi' | 'mn' | 'mr' | 'ms' | 'mt' | 'nb' | 'nl' | 'no' | 'ns' | 'pl' | 'ps' | 'pt' | 'pt-br' | 'qu' | 'ro' | 'ru' | 'sk' | 'sq' | 'sv' | 'sw' | 'ta' | 'te' | 'th' | 'tl' | 'tn' | 'tr' | 'tt' | 'uk' | 'ur' | 'uz' | 'zh'>;
|
||||
}
|
||||
|
||||
interface Response<T=any> {
|
||||
|
||||
16
types/algoliasearch/lite/index.d.ts
vendored
16
types/algoliasearch/lite/index.d.ts
vendored
@@ -1,4 +1,4 @@
|
||||
// Type definitions for algoliasearch-client-js 3.30.0
|
||||
// Type definitions for algoliasearch-client-js 3.30.1
|
||||
// Project: https://github.com/algolia/algoliasearch-client-js
|
||||
// Definitions by: Baptiste Coquelle <https://github.com/cbaptiste>
|
||||
// Haroen Viaene <https://github.com/haroenv>
|
||||
@@ -7,6 +7,7 @@
|
||||
// Claas Brüggemann <https://github.com/ClaasBrueggemann>
|
||||
// Kai Eichinger <https://github.com/keichinger>
|
||||
// Nery Ortez <https://github.com/neryortez>
|
||||
// Antoine Rousseau <https://github.com/antoinerousseau>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
@@ -505,6 +506,12 @@ declare namespace algoliasearch {
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/analytics/
|
||||
*/
|
||||
analytics?: boolean;
|
||||
/**
|
||||
* If set to true, enables the Click Analytics feature
|
||||
* default false
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/clickAnalytics/
|
||||
*/
|
||||
clickAnalytics?: boolean;
|
||||
/**
|
||||
* If set, tag your query with the specified identifiers
|
||||
* default: []
|
||||
@@ -534,9 +541,16 @@ declare namespace algoliasearch {
|
||||
userData?: string | object;
|
||||
|
||||
/**
|
||||
* Controls how facet values are sorted.
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/sortFacetValuesBy/
|
||||
*/
|
||||
sortFacetValuesBy?: 'count' | 'alpha';
|
||||
/**
|
||||
* Sets the languages to be used by language-specific settings and functionalities
|
||||
* such as ignorePlurals, removeStopWords, and CJK word-detection.
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/queryLanguages/
|
||||
*/
|
||||
queryLanguages?: Array<'af' | 'ar' | 'az' | 'bg' | 'bn' | 'ca' | 'cs' | 'cy' | 'da' | 'de' | 'el' | 'en' | 'eo' | 'es' | 'et' | 'eu' | 'fa' | 'fi' | 'fo' | 'fr' | 'ga' | 'gl' | 'he' | 'hi' | 'hu' | 'hy' | 'id' | 'is' | 'it' | 'ja' | 'ka' | 'kk' | 'ko' | 'ku' | 'ky' | 'lt' | 'lv' | 'mi' | 'mn' | 'mr' | 'ms' | 'mt' | 'nb' | 'nl' | 'no' | 'ns' | 'pl' | 'ps' | 'pt' | 'pt-br' | 'qu' | 'ro' | 'ru' | 'sk' | 'sq' | 'sv' | 'sw' | 'ta' | 'te' | 'th' | 'tl' | 'tn' | 'tr' | 'tt' | 'uk' | 'ur' | 'uz' | 'zh'>;
|
||||
}
|
||||
|
||||
namespace SearchForFacetValues {
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"npm-naming": false,
|
||||
"eofline": false,
|
||||
"export-just-namespace": false,
|
||||
"import-spacing": false,
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"npm-naming": false,
|
||||
"eofline": false,
|
||||
"export-just-namespace": false,
|
||||
"import-spacing": false,
|
||||
|
||||
114
types/amap-js-api-indoor-map/amap-js-api-indoor-map-tests.ts
Normal file
114
types/amap-js-api-indoor-map/amap-js-api-indoor-map-tests.ts
Normal file
@@ -0,0 +1,114 @@
|
||||
// $ExpectType IndoorMap
|
||||
new AMap.IndoorMap();
|
||||
// $ExpectType IndoorMap
|
||||
new AMap.IndoorMap({});
|
||||
// $ExpectType IndoorMap
|
||||
const indoorMap = new AMap.IndoorMap({
|
||||
zIndex: 1,
|
||||
opacity: 0.5,
|
||||
cursor: 'cursor',
|
||||
hideFloorBar: false,
|
||||
alaysShow: true
|
||||
});
|
||||
|
||||
// $ExpectType void
|
||||
indoorMap.showIndoorMap('indoorMapId');
|
||||
// $ExpectType void
|
||||
indoorMap.showIndoorMap('indoorMapId', (error, result) => {
|
||||
// $ExpectType Error | null
|
||||
error;
|
||||
// $ExpectType SearchResult
|
||||
result;
|
||||
// $ExpectType string
|
||||
result.id;
|
||||
// $ExpectType 0 | 1
|
||||
result.status;
|
||||
if (result.status === 0) {
|
||||
// $ExpectType Building
|
||||
const building = result.building;
|
||||
{
|
||||
// $ExpectType number
|
||||
building.floor;
|
||||
// $ExpectType FloorDetails
|
||||
const floorDetails = building.floor_details;
|
||||
{
|
||||
// $ExpectType number[]
|
||||
floorDetails.floor_indexs;
|
||||
// $ExpectType string[]
|
||||
floorDetails.floor_names;
|
||||
// $ExpectType string[]
|
||||
floorDetails.floor_nonas;
|
||||
}
|
||||
// $ExpectType string
|
||||
building.id;
|
||||
// $ExpectType LngLat
|
||||
building.lnglat;
|
||||
// $ExpectType string
|
||||
building.name;
|
||||
}
|
||||
} else {
|
||||
// $ExpectType Error
|
||||
result.error;
|
||||
}
|
||||
});
|
||||
// $ExpectType void
|
||||
indoorMap.showIndoorMap('indoorMapId', 1);
|
||||
// $ExpectType void
|
||||
indoorMap.showIndoorMap('indoorMapId', 1, () => { });
|
||||
// $ExpectType void
|
||||
indoorMap.showIndoorMap('indoorMapId', 1, 'shopId');
|
||||
// $ExpectType void
|
||||
indoorMap.showIndoorMap('indoorMapId', 1, 'shopId', () => { });
|
||||
// $ExpectType void
|
||||
indoorMap.showIndoorMap('indoorMapId', 1, 'shopId', true);
|
||||
// $ExpectType void
|
||||
indoorMap.showIndoorMap('indoorMapId', 1, 'shopId', true, () => { });
|
||||
|
||||
let floor: undefined | false;
|
||||
floor = indoorMap.showFloor(1);
|
||||
floor = indoorMap.showFloor(1, true);
|
||||
|
||||
// $ExpectType void
|
||||
indoorMap.showFloorBar();
|
||||
|
||||
// $ExpectType void
|
||||
indoorMap.hideFloorBar();
|
||||
|
||||
// $ExpectType void
|
||||
indoorMap.hideLabels();
|
||||
|
||||
// $ExpectType string | null
|
||||
indoorMap.getSelectedBuildingId();
|
||||
|
||||
// $ExpectType Building | null
|
||||
const building = indoorMap.getSelectedBuilding();
|
||||
if (building) {
|
||||
// $ExpectType number
|
||||
building.floor;
|
||||
// $ExpectType FloorDetails
|
||||
building.floor_details;
|
||||
// $ExpectType string
|
||||
building.id;
|
||||
// $ExpectType LngLat
|
||||
building.lnglat;
|
||||
// $ExpectType string
|
||||
building.name;
|
||||
}
|
||||
|
||||
indoorMap.on('complete', (event: AMap.IndoorMap.EventMap['complete']) => {
|
||||
// $ExpectType "complete"
|
||||
event.type;
|
||||
});
|
||||
|
||||
indoorMap.on('click', (event: AMap.IndoorMap.EventMap['click']) => {
|
||||
// $ExpectType string
|
||||
event.building_id;
|
||||
// $ExpectType number
|
||||
event.floor;
|
||||
// $ExpectType LngLat
|
||||
event.lnglat;
|
||||
// $ExpectType Shop
|
||||
event.shop;
|
||||
// $ExpectType "click"
|
||||
event.type;
|
||||
});
|
||||
239
types/amap-js-api-indoor-map/index.d.ts
vendored
Normal file
239
types/amap-js-api-indoor-map/index.d.ts
vendored
Normal file
@@ -0,0 +1,239 @@
|
||||
// Type definitions for non-npm package amap-js-api-indoor-map 1.4
|
||||
// Project: https://lbs.amap.com/api/javascript-api/reference/indoormap
|
||||
// Definitions by: breeze9527 <https://github.com/breeze9527>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
/// <reference types="amap-js-api" />
|
||||
|
||||
declare namespace AMap {
|
||||
namespace IndoorMap {
|
||||
interface EventMap {
|
||||
complete: Event<'complete'>;
|
||||
click: MouseEvent<'click'>;
|
||||
|
||||
floor_complete: Event<'floor_complete', SearchResult>;
|
||||
mouseover: MouseEvent<'mouseover'>;
|
||||
mouseout: MouseEvent<'mouseout'>;
|
||||
}
|
||||
type MouseEvent<N extends string> = Event<N, {
|
||||
/**
|
||||
* 店铺所属楼宇信息
|
||||
*/
|
||||
building_id: string;
|
||||
/**
|
||||
* 经纬度
|
||||
*/
|
||||
lnglat: LngLat;
|
||||
/**
|
||||
* 楼层
|
||||
*/
|
||||
floor: number;
|
||||
/**
|
||||
* 商店
|
||||
*/
|
||||
shop: Shop;
|
||||
}>;
|
||||
interface Options extends Layer.Options {
|
||||
/**
|
||||
* 图层叠加的顺序值
|
||||
*/
|
||||
zIndex?: number;
|
||||
/**
|
||||
* 图层的透明度
|
||||
*/
|
||||
opacity?: number;
|
||||
/**
|
||||
* 鼠标悬停到店铺面时的鼠标样式
|
||||
*/
|
||||
cursor?: string;
|
||||
/**
|
||||
* 是否隐藏楼层切换控件
|
||||
*/
|
||||
hideFloorBar?: boolean;
|
||||
/**
|
||||
* 是否持续显示
|
||||
*/
|
||||
alaysShow?: boolean;
|
||||
|
||||
// internal
|
||||
visible?: boolean;
|
||||
featurezIndex?: number;
|
||||
zooms?: [number, number];
|
||||
disableIconRender?: boolean;
|
||||
disableLabelRender?: boolean;
|
||||
disableHoverMarker?: boolean;
|
||||
autoLoadBuildingsInTile?: boolean;
|
||||
}
|
||||
interface FloorDetails {
|
||||
/**
|
||||
* 各楼层索引
|
||||
*/
|
||||
floor_indexs: number[];
|
||||
/**
|
||||
* 各楼层英文
|
||||
*/
|
||||
floor_nonas: string[];
|
||||
/**
|
||||
* 各楼层名字
|
||||
*/
|
||||
floor_names: string[];
|
||||
}
|
||||
type ShopCategory = 'public' | 'connection' | 'shop';
|
||||
interface Shop {
|
||||
/**
|
||||
* 店铺的id
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* 兴趣点ID
|
||||
*/
|
||||
poiId: string;
|
||||
/**
|
||||
* 店铺所属楼宇ID
|
||||
*/
|
||||
building_id: string;
|
||||
/**
|
||||
* 店铺名称
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* 店铺的经纬度
|
||||
*/
|
||||
lnglat: LngLat;
|
||||
/**
|
||||
* 分类
|
||||
*/
|
||||
category: ShopCategory;
|
||||
}
|
||||
interface Building {
|
||||
/**
|
||||
* 所属楼宇ID
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* 楼层名称
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* 楼层的经纬度
|
||||
*/
|
||||
lnglat: LngLat;
|
||||
/**
|
||||
* 所在楼层
|
||||
*/
|
||||
floor: number;
|
||||
floor_details: FloorDetails;
|
||||
}
|
||||
interface SearchSuccessResult {
|
||||
/**
|
||||
* 楼层的id
|
||||
*/
|
||||
id: string;
|
||||
status: 0;
|
||||
/**
|
||||
* 建筑信息
|
||||
*/
|
||||
building: Building;
|
||||
}
|
||||
interface SearchErrorResult {
|
||||
/**
|
||||
* 楼宇id
|
||||
*/
|
||||
id: string;
|
||||
status: 1;
|
||||
error: Error;
|
||||
}
|
||||
type SearchResult = SearchSuccessResult | SearchErrorResult;
|
||||
}
|
||||
|
||||
class IndoorMap extends Layer {
|
||||
/**
|
||||
* 室内地图
|
||||
* @param options 选项
|
||||
*/
|
||||
constructor(options?: IndoorMap.Options);
|
||||
/**
|
||||
* 显示指定室内地图信息
|
||||
* @param indoorId 建筑物ID
|
||||
* @param callback 回调
|
||||
*/
|
||||
showIndoorMap(
|
||||
indoorId: string,
|
||||
callback?: (error: null | Error, result: IndoorMap.SearchResult) => void
|
||||
): void;
|
||||
/**
|
||||
* 显示指定室内地图信息
|
||||
* @param indoorId 建筑物ID
|
||||
* @param floor 楼层
|
||||
* @param callback 回调
|
||||
*/
|
||||
showIndoorMap(
|
||||
indoorId: string,
|
||||
floor?: number,
|
||||
callback?: (error: null | Error, result: IndoorMap.SearchResult) => void
|
||||
): void;
|
||||
/**
|
||||
* 显示指定室内地图信息
|
||||
* @param indoorId 建筑物ID
|
||||
* @param floor 楼层
|
||||
* @param shopId 商铺ID
|
||||
* @param callback 回调
|
||||
*/
|
||||
showIndoorMap(
|
||||
indoorId: string,
|
||||
floor?: number,
|
||||
shopId?: string,
|
||||
callback?: (error: null | Error, result: IndoorMap.SearchResult) => void
|
||||
): void;
|
||||
/**
|
||||
* 显示指定室内地图信息
|
||||
* @param indoorId 建筑物ID
|
||||
* @param floor 楼层
|
||||
* @param shopId 商铺ID
|
||||
* @param noMove 阻止移动
|
||||
* @param callback 回调
|
||||
*/
|
||||
showIndoorMap(
|
||||
indoorId: string,
|
||||
floor?: number,
|
||||
shopId?: string,
|
||||
noMove?: boolean,
|
||||
callback?: (error: null | Error, result: IndoorMap.SearchResult) => void
|
||||
): void;
|
||||
/**
|
||||
* 显示指定的楼层
|
||||
* @param floor 楼层
|
||||
* @param noMove 禁止移动
|
||||
*/
|
||||
showFloor(floor: number, noMove?: boolean): false | undefined;
|
||||
/**
|
||||
* 显示楼层切换控件
|
||||
*/
|
||||
showFloorBar(): void;
|
||||
/**
|
||||
* 隐藏楼层切换控件
|
||||
*/
|
||||
hideFloorBar(): void;
|
||||
/**
|
||||
* 显示室内地图标注
|
||||
*/
|
||||
showLabels(): void;
|
||||
/**
|
||||
* 隐藏室内地图标注
|
||||
*/
|
||||
hideLabels(): void;
|
||||
/**
|
||||
* 获取处于被选中状态的室内地图的ID
|
||||
*/
|
||||
getSelectedBuildingId(): string | null;
|
||||
/**
|
||||
* 获取处于被选中状态的室内地图的一些基本信息
|
||||
*/
|
||||
getSelectedBuilding(): IndoorMap.Building | null;
|
||||
|
||||
// internal
|
||||
getFloorBar(): void;
|
||||
setSelectedBuildingId(id: string): void;
|
||||
}
|
||||
}
|
||||
24
types/amap-js-api-indoor-map/tsconfig.json
Normal file
24
types/amap-js-api-indoor-map/tsconfig.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noEmit": true,
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"amap-js-api-indoor-map-tests.ts"
|
||||
]
|
||||
}
|
||||
489
types/amap-js-api-map3d/amap-js-api-map3d-tests.ts
Normal file
489
types/amap-js-api-map3d/amap-js-api-map3d-tests.ts
Normal file
@@ -0,0 +1,489 @@
|
||||
/**
|
||||
* preset.ts
|
||||
*/
|
||||
|
||||
declare const map: AMap.Map;
|
||||
declare const lnglat: AMap.LngLat;
|
||||
declare const size: AMap.Size;
|
||||
declare const lnglatTuple: [number, number];
|
||||
declare const pixel: AMap.Pixel;
|
||||
declare const layer: AMap.Layer;
|
||||
declare const ambientLight: AMap.Lights.AmbientLight;
|
||||
declare const directionLight: AMap.Lights.DirectionLight;
|
||||
declare const line: AMap.Object3D.Line;
|
||||
declare const mesh: AMap.Object3D.Mesh;
|
||||
declare const object3d: AMap.Object3D;
|
||||
declare const geometry: AMap.Geometry3D.Mesh;
|
||||
|
||||
/**
|
||||
* lights.ts
|
||||
*/
|
||||
|
||||
// $ExpectType AmbientLight
|
||||
const testAmbientLight = new AMap.Lights.AmbientLight([0.1, 0, 0.1], 1);
|
||||
|
||||
// $ExpectType void
|
||||
testAmbientLight.setColor([0.1, 1, 0.5]);
|
||||
|
||||
// $ExpectType void
|
||||
testAmbientLight.setIntensity(1);
|
||||
|
||||
// $ExpectType DirectionLight
|
||||
const testDirectionLight = new AMap.Lights.DirectionLight([1, 2, 3], [1, 2, 3], 1);
|
||||
|
||||
// $ExpectType void
|
||||
testDirectionLight.setColor([1, 2, 3]);
|
||||
|
||||
// $ExpectType void
|
||||
testDirectionLight.setIntensity(1);
|
||||
|
||||
// $ExpectType void
|
||||
testDirectionLight.setDirection([1, 2, 3]);
|
||||
|
||||
/**
|
||||
* map3d.ts
|
||||
*/
|
||||
|
||||
// $ExpectType Object3DResult | null
|
||||
map.getObject3DByContainerPos(pixel);
|
||||
|
||||
// $ExpectType Object3DResult | null
|
||||
const containserPos = map.getObject3DByContainerPos(pixel, [layer], true);
|
||||
if (containserPos) {
|
||||
// $ExpectType number
|
||||
containserPos.index;
|
||||
// $ExpectType Vector3
|
||||
containserPos.point;
|
||||
// $ExpectType number
|
||||
containserPos.distance;
|
||||
// $ExpectType Object3D
|
||||
containserPos.object;
|
||||
} else {
|
||||
// $ExpectType null
|
||||
containserPos;
|
||||
}
|
||||
|
||||
map.AmbientLight = ambientLight;
|
||||
map.AmbientLight = undefined;
|
||||
|
||||
map.DirectionLight = directionLight;
|
||||
map.DirectionLight = undefined;
|
||||
|
||||
/**
|
||||
* object3d-group.ts
|
||||
*/
|
||||
|
||||
// $ExpectType Object3DGroup<Object3D>
|
||||
const testObject3dGroup1 = new AMap.Object3DGroup();
|
||||
// $ExpectType Object3DGroup<Mesh>
|
||||
const testObject3dGroup2 = new AMap.Object3DGroup<AMap.Object3D.Mesh>();
|
||||
|
||||
// $ExpectType Object3D[]
|
||||
testObject3dGroup1.children;
|
||||
// $ExpectType Mesh[]
|
||||
testObject3dGroup2.children;
|
||||
|
||||
// $ExoectType void
|
||||
testObject3dGroup1.add(line);
|
||||
// $ExoectType void
|
||||
testObject3dGroup1.add(mesh);
|
||||
// $ExoectType void
|
||||
testObject3dGroup2.add(mesh);
|
||||
// $ExpectError
|
||||
testObject3dGroup2.add(line);
|
||||
|
||||
// $ExoectType void
|
||||
testObject3dGroup1.remove(line);
|
||||
// $ExoectType void
|
||||
testObject3dGroup1.remove(mesh);
|
||||
// $ExoectType void
|
||||
testObject3dGroup2.remove(mesh);
|
||||
// $ExpectError
|
||||
testObject3dGroup2.remove(line);
|
||||
|
||||
/**
|
||||
* object3d-Layer.ts
|
||||
*/
|
||||
|
||||
// $ExpectType Object3DLayer
|
||||
new AMap.Object3DLayer();
|
||||
// $ExpectType Object3DLayer
|
||||
new AMap.Object3DLayer({});
|
||||
// $ExpectType Object3DLayer
|
||||
const testObject3DLayer = new AMap.Object3DLayer({
|
||||
map,
|
||||
visible: true,
|
||||
opacity: 0.1,
|
||||
zIndex: 2,
|
||||
zooms: [1, 2]
|
||||
});
|
||||
|
||||
// $ExpectType void
|
||||
testObject3DLayer.setMap(null);
|
||||
// $ExpectType void
|
||||
testObject3DLayer.setMap(map);
|
||||
|
||||
// $ExpectType Map | null | undefined
|
||||
testObject3DLayer.getMap();
|
||||
|
||||
// $ExpectType void
|
||||
testObject3DLayer.hide();
|
||||
|
||||
// $ExpectType void
|
||||
testObject3DLayer.show();
|
||||
|
||||
// $ExpectType void
|
||||
testObject3DLayer.setOpacity(1);
|
||||
|
||||
// $ExpectType number
|
||||
testObject3DLayer.getOpacity();
|
||||
|
||||
// $ExpectType void
|
||||
testObject3DLayer.setzIndex(1);
|
||||
|
||||
// $ExpectType number
|
||||
testObject3DLayer.getzIndex();
|
||||
|
||||
// $ExpectType [number, number]
|
||||
testObject3DLayer.getZooms();
|
||||
|
||||
// $ExpectType void
|
||||
testObject3DLayer.add(object3d);
|
||||
|
||||
// $ExpectType void
|
||||
testObject3DLayer.remove(object3d);
|
||||
|
||||
// $ExpectType void
|
||||
testObject3DLayer.clear();
|
||||
|
||||
// $ExpectType void
|
||||
testObject3DLayer.reDraw();
|
||||
|
||||
/**
|
||||
* vector3.ts
|
||||
*/
|
||||
|
||||
// $ExpectType Vector3
|
||||
const testVector = new AMap.Vector3([1, 2, 3]);
|
||||
// $ExpectType Vector3
|
||||
new AMap.Vector3(testVector);
|
||||
|
||||
// $ExpectType [number, number, number]
|
||||
testVector.elements;
|
||||
|
||||
// $ExpectType void
|
||||
testVector.set(1, 2, 3);
|
||||
|
||||
// $ExpectType number
|
||||
testVector.dot();
|
||||
|
||||
// $ExpectType Vector3
|
||||
testVector.clone();
|
||||
|
||||
// $ExpectType Vector3
|
||||
testVector.add(testVector);
|
||||
// $ExpectType Vector3
|
||||
testVector.add([1, 2, 3]);
|
||||
|
||||
// $ExpectType Vector3
|
||||
testVector.sub(testVector);
|
||||
// $ExpectType Vector3
|
||||
testVector.sub([1, 2, 3]);
|
||||
|
||||
// $ExpectType Vector3
|
||||
testVector.addVectors(testVector, testVector);
|
||||
|
||||
// $ExpectType Vector3
|
||||
testVector.subVectors(testVector, testVector);
|
||||
|
||||
// $ExpectType Vector3
|
||||
testVector.crossVectors(testVector, testVector);
|
||||
|
||||
// $ExpectType Vector3
|
||||
testVector.normalize();
|
||||
|
||||
// $ExpectType number
|
||||
testVector.length();
|
||||
|
||||
/**
|
||||
* object3d/mesh.ts
|
||||
*/
|
||||
|
||||
// $ExpectType Mesh
|
||||
const testMesh = new AMap.Object3D.Mesh();
|
||||
|
||||
// $ExpectError
|
||||
testMesh.geometry = geometry;
|
||||
|
||||
// $ExpectType number[]
|
||||
testMesh.geometry.vertices;
|
||||
// $ExpectError
|
||||
testMesh.geometry.vertices = [];
|
||||
testMesh.geometry.vertices.shift();
|
||||
|
||||
// $ExpectType number[]
|
||||
testMesh.geometry.vertexColors;
|
||||
// $ExpectError
|
||||
testMesh.geometry.vertexColors = [];
|
||||
testMesh.geometry.vertexColors.shift();
|
||||
|
||||
// $ExpectType number[]
|
||||
testMesh.geometry.vertexUVs;
|
||||
// $ExpectError
|
||||
testMesh.geometry.vertexUVs = [];
|
||||
testMesh.geometry.vertexUVs.shift();
|
||||
|
||||
// $ExpectType number[]
|
||||
testMesh.geometry.faces;
|
||||
// $ExpectError
|
||||
testMesh.geometry.faces = [];
|
||||
testMesh.geometry.faces.shift();
|
||||
|
||||
// $ExpectType number[]
|
||||
testMesh.geometry.textureIndices;
|
||||
// $ExpectError
|
||||
testMesh.geometry.textureIndices = [];
|
||||
testMesh.geometry.textureIndices.shift();
|
||||
|
||||
// $ExpectType (string | HTMLCanvasElement)[]
|
||||
testMesh.textures;
|
||||
|
||||
// $ExpectType boolean
|
||||
testMesh.needUpdate;
|
||||
|
||||
// $ExpectType boolean
|
||||
testMesh.transparent;
|
||||
|
||||
// $ExpectType boolean
|
||||
testMesh.DEPTH_TEST;
|
||||
|
||||
// $ExpectType void
|
||||
testMesh.reDraw();
|
||||
|
||||
/**
|
||||
* object3d/meshAcceptLights.ts
|
||||
*/
|
||||
|
||||
// $ExpectType MeshAcceptLights
|
||||
const testMeshAcceptLights = new AMap.Object3D.MeshAcceptLights();
|
||||
|
||||
// $ExpectError
|
||||
testMeshAcceptLights.geometry = geometry;
|
||||
|
||||
// $ExpectType number[]
|
||||
testMeshAcceptLights.geometry.vertices;
|
||||
// $ExpectError
|
||||
testMeshAcceptLights.geometry.vertices = [];
|
||||
testMeshAcceptLights.geometry.vertices.shift();
|
||||
|
||||
// $ExpectType number[]
|
||||
testMeshAcceptLights.geometry.vertexColors;
|
||||
// $ExpectError
|
||||
testMeshAcceptLights.geometry.vertexColors = [];
|
||||
testMeshAcceptLights.geometry.vertexColors.shift();
|
||||
|
||||
// $ExpectType number[]
|
||||
testMeshAcceptLights.geometry.vertexUVs;
|
||||
// $ExpectError
|
||||
testMeshAcceptLights.geometry.vertexUVs = [];
|
||||
testMeshAcceptLights.geometry.vertexUVs.shift();
|
||||
|
||||
// $ExpectType number[]
|
||||
testMeshAcceptLights.geometry.faces;
|
||||
// $ExpectError
|
||||
testMeshAcceptLights.geometry.faces = [];
|
||||
testMeshAcceptLights.geometry.faces.shift();
|
||||
|
||||
// $ExpectType number[]
|
||||
testMeshAcceptLights.geometry.textureIndices;
|
||||
// $ExpectError
|
||||
testMeshAcceptLights.geometry.textureIndices = [];
|
||||
testMeshAcceptLights.geometry.textureIndices.shift();
|
||||
|
||||
// $ExpectType number[]
|
||||
testMeshAcceptLights.geometry.vertexNormals;
|
||||
// $ExpectError
|
||||
testMeshAcceptLights.geometry.vertexNormals = [];
|
||||
testMeshAcceptLights.geometry.vertexNormals.shift();
|
||||
|
||||
// $ExpectType (string | HTMLCanvasElement)[]
|
||||
testMeshAcceptLights.textures;
|
||||
|
||||
// $ExpectType boolean
|
||||
testMeshAcceptLights.needUpdate;
|
||||
|
||||
// $ExpectType boolean
|
||||
testMeshAcceptLights.transparent;
|
||||
|
||||
// $ExpectType boolean
|
||||
testMeshAcceptLights.DEPTH_TEST;
|
||||
|
||||
// $ExpectType void
|
||||
testMeshAcceptLights.reDraw();
|
||||
|
||||
/**
|
||||
* object3d/meshLine.ts
|
||||
*/
|
||||
|
||||
// $ExpectError
|
||||
new AMap.Object3D.MeshLine();
|
||||
// $ExpectError
|
||||
new AMap.Object3D.MeshLine({});
|
||||
// $ExpectType MeshLine
|
||||
const testMeshLine = new AMap.Object3D.MeshLine({
|
||||
path: [lnglat],
|
||||
width: 1,
|
||||
height: 1,
|
||||
color: 'red'
|
||||
});
|
||||
// $ExpectType MeshLine
|
||||
new AMap.Object3D.MeshLine({
|
||||
path: [lnglat],
|
||||
color: [0, 0, 1, 1]
|
||||
});
|
||||
// $ExpectType MeshLine
|
||||
new AMap.Object3D.MeshLine({
|
||||
path: [[1, 2]]
|
||||
});
|
||||
// $ExpectType MeshLine
|
||||
new AMap.Object3D.MeshLine({
|
||||
path: [lnglat],
|
||||
unit: 'meter'
|
||||
});
|
||||
// $ExpectType MeshLine
|
||||
new AMap.Object3D.MeshLine({
|
||||
path: [pixel],
|
||||
unit: 'px'
|
||||
});
|
||||
// $ExpectError
|
||||
new AMap.Object3D.MeshLine({
|
||||
path: [lnglat],
|
||||
unit: 'px'
|
||||
});
|
||||
// $ExpectError
|
||||
new AMap.Object3D.MeshLine({
|
||||
path: [pixel],
|
||||
unit: 'meter'
|
||||
});
|
||||
|
||||
// $ExpectType number[]
|
||||
testMeshLine.geometry.vertices;
|
||||
// $ExpectError
|
||||
testMeshLine.geometry.vertices = [];
|
||||
testMeshLine.geometry.vertices.shift();
|
||||
|
||||
// $ExpectType number[]
|
||||
testMeshLine.geometry.vertexUVs;
|
||||
// $ExpectError
|
||||
testMeshLine.geometry.vertexUVs = [];
|
||||
testMeshLine.geometry.vertexUVs.shift();
|
||||
|
||||
// $ExpectType number[]
|
||||
testMeshLine.geometry.vertexColors;
|
||||
// $ExpectError
|
||||
testMeshLine.geometry.vertexColors = [];
|
||||
testMeshLine.geometry.vertexColors.shift();
|
||||
|
||||
// $ExpectType number[]
|
||||
testMeshLine.geometry.vertexColors;
|
||||
// $ExpectError
|
||||
testMeshLine.geometry.vertexColors = [];
|
||||
testMeshLine.geometry.vertexColors.shift();
|
||||
|
||||
// $ExpectType number[]
|
||||
testMeshLine.geometry.vertexIndices;
|
||||
// $ExpectError
|
||||
testMeshLine.geometry.vertexIndices = [];
|
||||
testMeshLine.geometry.vertexIndices.shift();
|
||||
|
||||
// $ExpectType number[]
|
||||
testMeshLine.geometry.directions;
|
||||
// $ExpectError
|
||||
testMeshLine.geometry.directions = [];
|
||||
testMeshLine.geometry.directions.shift();
|
||||
|
||||
// $ExpectType number[]
|
||||
testMeshLine.geometry.textureIndices;
|
||||
// $ExpectError
|
||||
testMeshLine.geometry.textureIndices = [];
|
||||
testMeshLine.geometry.textureIndices.shift();
|
||||
|
||||
// $ExpectType number
|
||||
testMeshLine.width;
|
||||
|
||||
// $ExpectType void
|
||||
testMeshLine.setPath([lnglat]);
|
||||
// $ExpectType void
|
||||
testMeshLine.setPath([lnglatTuple]);
|
||||
// $ExpectType void
|
||||
testMeshLine.setPath([pixel]);
|
||||
|
||||
// $ExpectType void
|
||||
testMeshLine.setWidth(10);
|
||||
|
||||
// $ExpectType void
|
||||
testMeshLine.setHeight(10);
|
||||
|
||||
// $ExpectType void
|
||||
testMeshLine.setColor('red');
|
||||
|
||||
/**
|
||||
* object3d/prism.ts
|
||||
*/
|
||||
|
||||
// $ExpectError
|
||||
new AMap.Object3D.Prism();
|
||||
// $ExpectError
|
||||
new AMap.Object3D.Prism({});
|
||||
// $ExpectType Prism
|
||||
new AMap.Object3D.Prism({
|
||||
path: [lnglat],
|
||||
color: 'red'
|
||||
});
|
||||
// $ExpectType Prism
|
||||
new AMap.Object3D.Prism({
|
||||
path: [lnglat],
|
||||
color: 'red',
|
||||
height: 1,
|
||||
color2: 'blue'
|
||||
});
|
||||
// $ExpectType Prism
|
||||
new AMap.Object3D.Prism({
|
||||
path: [pixel],
|
||||
color: 'red'
|
||||
});
|
||||
// $ExpectType Prism
|
||||
new AMap.Object3D.Prism({
|
||||
path: [lnglat],
|
||||
color: 'red'
|
||||
});
|
||||
// $ExpectType Prism
|
||||
new AMap.Object3D.Prism({
|
||||
path: [[lnglat]],
|
||||
color: 'red'
|
||||
});
|
||||
// $ExpectType Prism
|
||||
new AMap.Object3D.Prism({
|
||||
path: [[pixel]],
|
||||
color: 'red'
|
||||
});
|
||||
// $ExpectType Prism
|
||||
new AMap.Object3D.Prism({
|
||||
path: [[lnglatTuple]],
|
||||
color: 'red'
|
||||
});
|
||||
// $ExpectType Prism
|
||||
new AMap.Object3D.Prism({
|
||||
path: [lnglat],
|
||||
color: ['red']
|
||||
});
|
||||
// $ExpectType Prism
|
||||
new AMap.Object3D.Prism({
|
||||
path: [lnglat],
|
||||
color: [1, 1, 1, 1]
|
||||
});
|
||||
// $ExpectType Prism
|
||||
new AMap.Object3D.Prism({
|
||||
path: [lnglat],
|
||||
color: [[1, 1, 1, 1]]
|
||||
});
|
||||
28
types/amap-js-api-map3d/geometry-3d.d.ts
vendored
Normal file
28
types/amap-js-api-map3d/geometry-3d.d.ts
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
declare namespace AMap {
|
||||
abstract class Geometry3D {
|
||||
readonly vertices: number[];
|
||||
readonly vertexUVs: number[];
|
||||
readonly vertexColors: number[];
|
||||
}
|
||||
|
||||
namespace Geometry3D {
|
||||
class Mesh extends Geometry3D {
|
||||
readonly type: 'mesh';
|
||||
readonly faces: number[];
|
||||
readonly textureIndices: number[];
|
||||
}
|
||||
|
||||
class Line extends Geometry3D {
|
||||
readonly type: 'line';
|
||||
readonly segments: number[];
|
||||
readonly textureIndices: number[];
|
||||
}
|
||||
|
||||
class Points extends Geometry3D {
|
||||
readonly type: 'points';
|
||||
readonly pointSizes: number[];
|
||||
readonly pointAreas: number[];
|
||||
readonly textureIndices: number[];
|
||||
}
|
||||
}
|
||||
}
|
||||
15
types/amap-js-api-map3d/index.d.ts
vendored
Normal file
15
types/amap-js-api-map3d/index.d.ts
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
// Type definitions for non-npm package amap-js-api-map3d 1.4
|
||||
// Project: https://lbs.amap.com/api/javascript-api/reference/maps-3d
|
||||
// Definitions by: breeze9527 <https://github.com/breeze9527>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
/// <reference types="amap-js-api" />
|
||||
|
||||
/// <reference path="geometry-3d.d.ts" />
|
||||
/// <reference path="lights.d.ts" />
|
||||
/// <reference path="map3d.d.ts" />
|
||||
/// <reference path="object3d-group.d.ts" />
|
||||
/// <reference path="object3d-layer.d.ts" />
|
||||
/// <reference path="object3d.d.ts" />
|
||||
/// <reference path="vector3.d.ts" />
|
||||
17
types/amap-js-api-map3d/lights.d.ts
vendored
Normal file
17
types/amap-js-api-map3d/lights.d.ts
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
declare namespace AMap {
|
||||
namespace Lights {
|
||||
class AmbientLight {
|
||||
constructor(color: [number, number, number], intensity: number);
|
||||
setColor(color: [number, number, number]): void;
|
||||
setIntensity(intensity: number): void;
|
||||
}
|
||||
|
||||
class DirectionLight {
|
||||
constructor(direction: [number, number, number], color: [number, number, number], intensity: number);
|
||||
update(): void;
|
||||
setDirection(direction: [number, number, number]): void;
|
||||
setColor(direction: [number, number, number]): void;
|
||||
setIntensity(intensity: number): void;
|
||||
}
|
||||
}
|
||||
}
|
||||
15
types/amap-js-api-map3d/map3d.d.ts
vendored
Normal file
15
types/amap-js-api-map3d/map3d.d.ts
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
declare namespace AMap {
|
||||
namespace Map {
|
||||
interface Object3DResult {
|
||||
index: number;
|
||||
point: Vector3;
|
||||
distance: number;
|
||||
object: Object3D;
|
||||
}
|
||||
}
|
||||
interface Map {
|
||||
AmbientLight?: Lights.AmbientLight;
|
||||
DirectionLight?: Lights.DirectionLight;
|
||||
getObject3DByContainerPos(pixel: Pixel, layers?: Layer[], all?: boolean): Map.Object3DResult | null;
|
||||
}
|
||||
}
|
||||
8
types/amap-js-api-map3d/object3d-group.d.ts
vendored
Normal file
8
types/amap-js-api-map3d/object3d-group.d.ts
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
declare namespace AMap {
|
||||
class Object3DGroup<C extends Object3D = Object3D> extends Object3D {
|
||||
constructor();
|
||||
children: C[];
|
||||
add(object3d: C): void;
|
||||
remove(object3d: C): void;
|
||||
}
|
||||
}
|
||||
27
types/amap-js-api-map3d/object3d-layer.d.ts
vendored
Normal file
27
types/amap-js-api-map3d/object3d-layer.d.ts
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
declare namespace AMap {
|
||||
namespace Object3DLayer {
|
||||
interface Options {
|
||||
map?: Map;
|
||||
visible?: boolean;
|
||||
opacity?: number;
|
||||
zIndex?: number;
|
||||
zooms?: [number, number];
|
||||
}
|
||||
}
|
||||
|
||||
class Object3DLayer extends Layer {
|
||||
constructor(options?: Object3DLayer.Options)
|
||||
add(object3d: Object3D): void;
|
||||
remove(object3d: Object3D): void;
|
||||
clear(): void;
|
||||
reDraw(): void;
|
||||
|
||||
// internal
|
||||
setOption(options: {
|
||||
position?: number;
|
||||
scale?: number;
|
||||
height?: number;
|
||||
scene?: number;
|
||||
}): void;
|
||||
}
|
||||
}
|
||||
92
types/amap-js-api-map3d/object3d.d.ts
vendored
Normal file
92
types/amap-js-api-map3d/object3d.d.ts
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
declare namespace AMap {
|
||||
class Object3D {
|
||||
readonly geometry: Geometry3D;
|
||||
transparent: boolean;
|
||||
DEPTH_TEST: boolean;
|
||||
textures: Array<string | HTMLCanvasElement>;
|
||||
needUpdate: boolean;
|
||||
reDraw(): void;
|
||||
|
||||
// internal
|
||||
reset(): void;
|
||||
}
|
||||
|
||||
namespace Object3D {
|
||||
class Mesh extends Object3D {
|
||||
readonly geometry: Geometry3D.Mesh;
|
||||
}
|
||||
|
||||
class MeshAcceptLights extends Mesh {
|
||||
readonly geometry: Geometry3D.Mesh & { readonly vertexNormals: number[] };
|
||||
}
|
||||
|
||||
namespace Prism {
|
||||
interface Options {
|
||||
path: LngLat[] | Pixel[] | Array<LngLat[] | Pixel[] | Array<[number, number]>>;
|
||||
color: string | number[] | Array<string | number[]>;
|
||||
height?: number;
|
||||
color2?: string | number[] | Array<string | number[]>;
|
||||
}
|
||||
}
|
||||
class Prism extends MeshAcceptLights {
|
||||
constructor(options: Prism.Options);
|
||||
}
|
||||
|
||||
// tslint:disable-next-line
|
||||
class Wall extends Prism { }
|
||||
|
||||
class Line extends Object3D {
|
||||
readonly geometry: Geometry3D.Line;
|
||||
}
|
||||
|
||||
namespace ThinLine {
|
||||
interface Options {
|
||||
path: Array<[number, number]>;
|
||||
color: string;
|
||||
altitude?: number;
|
||||
dashArray?: number[];
|
||||
}
|
||||
}
|
||||
class ThinLine extends Line {
|
||||
constructor(options: ThinLine.Options);
|
||||
}
|
||||
|
||||
class Points extends Object3D {
|
||||
readonly geometry: Geometry3D.Points;
|
||||
borderColor: string;
|
||||
borderWeight: number;
|
||||
}
|
||||
|
||||
class RoundPoints extends Points {
|
||||
merge: boolean;
|
||||
}
|
||||
|
||||
namespace MeshLine {
|
||||
type Options = {
|
||||
width?: number;
|
||||
height?: number | number[];
|
||||
color?: string | number[];
|
||||
} & ({
|
||||
unit?: 'meter';
|
||||
path: Array<[number, number]> | LngLat[];
|
||||
} | {
|
||||
unit: 'px';
|
||||
path: Array<[number, number]> | Pixel[];
|
||||
});
|
||||
}
|
||||
// inherit from WideLine
|
||||
class MeshLine extends Object3D {
|
||||
constructor(options: MeshLine.Options);
|
||||
readonly geometry: Geometry3D & {
|
||||
readonly vertexIndices: number[];
|
||||
readonly directions: number[];
|
||||
readonly textureIndices: number[];
|
||||
};
|
||||
width: number;
|
||||
setPath(path: LngLat[] | Pixel[] | Array<[number, number]>): void;
|
||||
setWidth(width: number): void;
|
||||
setHeight(height: number | number[]): void;
|
||||
setColor(color: string): void;
|
||||
}
|
||||
}
|
||||
}
|
||||
31
types/amap-js-api-map3d/tsconfig.json
Normal file
31
types/amap-js-api-map3d/tsconfig.json
Normal file
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noEmit": true,
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"geometry-3d.d.ts",
|
||||
"index.d.ts",
|
||||
"lights.d.ts",
|
||||
"map3d.d.ts",
|
||||
"object3d-group.d.ts",
|
||||
"object3d-layer.d.ts",
|
||||
"object3d.d.ts",
|
||||
"vector3.d.ts",
|
||||
"amap-js-api-map3d-tests.ts"
|
||||
]
|
||||
}
|
||||
16
types/amap-js-api-map3d/vector3.d.ts
vendored
Normal file
16
types/amap-js-api-map3d/vector3.d.ts
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
declare namespace AMap {
|
||||
class Vector3 {
|
||||
readonly elements: [number, number, number];
|
||||
constructor(elements: [number, number, number] | Vector3);
|
||||
set(x: number, y: number, z: number): void;
|
||||
dot(): number;
|
||||
clone(): Vector3;
|
||||
add(elements: [number, number, number] | Vector3): this;
|
||||
sub(elements: [number, number, number] | Vector3): this;
|
||||
addVectors(a: Vector3, b: Vector3): this;
|
||||
subVectors(a: Vector3, b: Vector3): this;
|
||||
crossVectors(a: Vector3, b: Vector3): this;
|
||||
normalize(): this;
|
||||
length(): number;
|
||||
}
|
||||
}
|
||||
3376
types/amap-js-api/amap-js-api-tests.ts
Normal file
3376
types/amap-js-api/amap-js-api-tests.ts
Normal file
File diff suppressed because it is too large
Load Diff
15
types/amap-js-api/array-bounds.d.ts
vendored
Normal file
15
types/amap-js-api/array-bounds.d.ts
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
declare namespace AMap {
|
||||
class ArrayBounds {
|
||||
constructor(bounds: LocationValue[]);
|
||||
bounds: LngLat[];
|
||||
/**
|
||||
* 判断传入的点是否在ArrayBounds内
|
||||
* @param point 目标点
|
||||
*/
|
||||
contains(point: LocationValue): boolean;
|
||||
|
||||
// internal
|
||||
toBounds(): Bounds;
|
||||
getCenter(): LngLat;
|
||||
}
|
||||
}
|
||||
39
types/amap-js-api/bounds.d.ts
vendored
Normal file
39
types/amap-js-api/bounds.d.ts
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
declare namespace AMap {
|
||||
class Bounds {
|
||||
/**
|
||||
* 地物对象的经纬度矩形范围。
|
||||
* @param southWest 西南角经纬度
|
||||
* @param northEast 东北角经纬度
|
||||
*/
|
||||
constructor(southWest: LngLat, northEast: LngLat);
|
||||
/**
|
||||
* 指定点坐标是否在矩形范围内
|
||||
* @param point 制定坐标
|
||||
*/
|
||||
contains(point: LocationValue): boolean;
|
||||
/**
|
||||
* 获取当前Bounds的中心点经纬度坐标
|
||||
*/
|
||||
getCenter(): LngLat;
|
||||
/**
|
||||
* 获取西南角坐标
|
||||
*/
|
||||
getSouthWest(): LngLat;
|
||||
/**
|
||||
* 获取东南角坐标
|
||||
*/
|
||||
getSouthEast(): LngLat;
|
||||
/**
|
||||
* 获取东北角坐标
|
||||
*/
|
||||
getNorthEast(): LngLat;
|
||||
/**
|
||||
* 获取西北角坐标
|
||||
*/
|
||||
getNorthWest(): LngLat;
|
||||
/**
|
||||
* 以字符串形式返回地物对象的矩形范围
|
||||
*/
|
||||
toString(): string;
|
||||
}
|
||||
}
|
||||
192
types/amap-js-api/browser.d.ts
vendored
Normal file
192
types/amap-js-api/browser.d.ts
vendored
Normal file
@@ -0,0 +1,192 @@
|
||||
declare namespace AMap {
|
||||
namespace Browser {
|
||||
/**
|
||||
* 当前浏览器userAgent
|
||||
*/
|
||||
const ua: string;
|
||||
/**
|
||||
* 是否移动设备
|
||||
*/
|
||||
const mobile: boolean;
|
||||
/**
|
||||
* 平台类型,如:'windows'、'mac'、'ios'、'android'、'other'
|
||||
*/
|
||||
const plat: 'android' | 'ios' | 'windows' | 'mac' | 'other';
|
||||
/**
|
||||
* 是否mac设备
|
||||
*/
|
||||
const mac: boolean;
|
||||
/**
|
||||
* 是否windows设备
|
||||
*/
|
||||
const windows: boolean;
|
||||
/**
|
||||
* 是否iOS设备
|
||||
*/
|
||||
const ios: boolean;
|
||||
/**
|
||||
* 是否iPad
|
||||
*/
|
||||
const iPad: boolean;
|
||||
/**
|
||||
* 是否iPhone
|
||||
*/
|
||||
const iPhone: boolean;
|
||||
/**
|
||||
* 是否安卓设备
|
||||
*/
|
||||
const android: boolean;
|
||||
/**
|
||||
* 是否安卓4以下系统
|
||||
*/
|
||||
const android23: boolean;
|
||||
/**
|
||||
* 是否Chrome浏览器
|
||||
*/
|
||||
const chrome: boolean;
|
||||
/**
|
||||
* 是否火狐浏览器
|
||||
*/
|
||||
const firefox: boolean;
|
||||
/**
|
||||
* 是否Safari浏览器
|
||||
*/
|
||||
const safari: boolean;
|
||||
/**
|
||||
* 是否微信
|
||||
*/
|
||||
const wechat: boolean;
|
||||
/**
|
||||
* 是否UC浏览器
|
||||
*/
|
||||
const uc: boolean;
|
||||
/**
|
||||
* 是否QQ或者QQ浏览器
|
||||
*/
|
||||
const qq: boolean;
|
||||
/**
|
||||
* 是否IE
|
||||
*/
|
||||
const ie: boolean;
|
||||
/**
|
||||
* 是否IE6
|
||||
*/
|
||||
const ie6: boolean;
|
||||
/**
|
||||
* 是否IE7
|
||||
*/
|
||||
const ie7: boolean;
|
||||
/**
|
||||
* 是否IE8
|
||||
*/
|
||||
const ie8: boolean;
|
||||
/**
|
||||
* 是否IE9
|
||||
*/
|
||||
const ie9: boolean;
|
||||
/**
|
||||
* 是否IE10
|
||||
*/
|
||||
const ie10: boolean;
|
||||
/**
|
||||
* 是否IE11
|
||||
*/
|
||||
const ie11: boolean;
|
||||
/**
|
||||
* 是否Edge浏览器
|
||||
*/
|
||||
const edge: boolean;
|
||||
/**
|
||||
* 是否IE9以下
|
||||
*/
|
||||
const ielt9: boolean;
|
||||
/**
|
||||
* 是否百度浏览器
|
||||
*/
|
||||
const baidu: boolean;
|
||||
/**
|
||||
* 是否支持LocaStorage
|
||||
*/
|
||||
const isLocalStorage: boolean;
|
||||
/**
|
||||
* 是否支持Geolocation
|
||||
*/
|
||||
const isGeolocation: boolean;
|
||||
/**
|
||||
* 是否Webkit移动浏览器
|
||||
*/
|
||||
const mobileWebkit: boolean;
|
||||
/**
|
||||
* 是否支持Css3D的Webkit移动端浏览器
|
||||
*/
|
||||
const mobileWebkit3d: boolean;
|
||||
/**
|
||||
* 是否Opera移动浏览器
|
||||
*/
|
||||
const mobileOpera: boolean;
|
||||
/**
|
||||
* 是否高清屏幕,devicePixelRatio>1
|
||||
*/
|
||||
const retina: boolean;
|
||||
/**
|
||||
* 是否触屏
|
||||
*/
|
||||
const touch: boolean;
|
||||
/**
|
||||
* 是否msPointer设备
|
||||
*/
|
||||
const msPointer: boolean;
|
||||
/**
|
||||
* 是否pointer设备
|
||||
*/
|
||||
const pointer: boolean;
|
||||
/**
|
||||
* 是否webkit浏览器
|
||||
*/
|
||||
const webkit: boolean;
|
||||
/**
|
||||
* 是否支持Css3D的ie浏览器
|
||||
*/
|
||||
const ie3d: boolean;
|
||||
/**
|
||||
* 是否支持Css3D的Webkit浏览器
|
||||
*/
|
||||
const webkit3d: boolean;
|
||||
/**
|
||||
* 是否支持Css3D的gecko浏览器
|
||||
*/
|
||||
const gecko3d: boolean;
|
||||
/**
|
||||
* 是否支持Css3D的opera浏览器
|
||||
*/
|
||||
const opera3d: boolean;
|
||||
/**
|
||||
* 是否支持Css3D的浏览器
|
||||
*/
|
||||
const any3d: boolean;
|
||||
/**
|
||||
* 是否支持canvas
|
||||
*/
|
||||
const isCanvas: boolean;
|
||||
/**
|
||||
* 是否支持svg
|
||||
*/
|
||||
const isSvg: boolean;
|
||||
/**
|
||||
* 是否支持vml
|
||||
*/
|
||||
const isVML: boolean;
|
||||
/**
|
||||
* 是否支持WebWorker
|
||||
*/
|
||||
const isWorker: boolean;
|
||||
/**
|
||||
* 是否支持WebSocket
|
||||
*/
|
||||
const isWebsocket: boolean;
|
||||
/**
|
||||
* 判断是否支持webgl
|
||||
*/
|
||||
function isWebGL(): boolean;
|
||||
}
|
||||
}
|
||||
31
types/amap-js-api/common.d.ts
vendored
Normal file
31
types/amap-js-api/common.d.ts
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
declare namespace AMap {
|
||||
type SizeValue = Size | [number, number];
|
||||
type LocationValue = LngLat | [number, number];
|
||||
type Lang = 'zh_cn' | 'en' | 'zh_en';
|
||||
|
||||
type Event<N extends string = string, V = undefined> = { type: N } &
|
||||
(V extends HTMLElement ? { value: V }
|
||||
: V extends object ? V
|
||||
: V extends undefined ? {}
|
||||
: { value: V });
|
||||
type MapsEvent<N extends string, I> = Event<N, {
|
||||
/**
|
||||
* 经纬度坐标
|
||||
*/
|
||||
lnglat: LngLat;
|
||||
/**
|
||||
* 像素坐标
|
||||
*/
|
||||
pixel: Pixel;
|
||||
/**
|
||||
* 触发对象
|
||||
*/
|
||||
target: I
|
||||
}>;
|
||||
|
||||
type StrokeLineJoin = 'miter' | 'round' | 'bevel';
|
||||
type StrokeLineCap = 'butt' | 'round' | 'square';
|
||||
type StrokeStyle = 'dashed' | 'solid';
|
||||
|
||||
type AnimationName = 'AMAP_ANIMATION_NONE' | 'AMAP_ANIMATION_DROP' | 'AMAP_ANIMATION_BOUNCE';
|
||||
}
|
||||
27
types/amap-js-api/convert-from.d.ts
vendored
Normal file
27
types/amap-js-api/convert-from.d.ts
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
declare namespace AMap {
|
||||
namespace convertFrom {
|
||||
interface Result {
|
||||
/**
|
||||
* 成功状态文字描述
|
||||
*/
|
||||
info: string; // 'ok'
|
||||
/**
|
||||
* 高德坐标集合
|
||||
*/
|
||||
locations: LngLat[];
|
||||
}
|
||||
type Type = 'gps' | 'baidu' | 'mapbar';
|
||||
type SearchStatus = 'complete' | 'error';
|
||||
}
|
||||
/**
|
||||
* 为坐标转换类,支持将其他坐标系的坐标点转换为高德坐标系。
|
||||
* @param lnglat 待转换坐标
|
||||
* @param type 用于说明是哪个服务商的坐标
|
||||
* @param callback 转换完成后的回调函数
|
||||
*/
|
||||
function convertFrom(
|
||||
lnglat: LocationValue | LocationValue[],
|
||||
type: convertFrom.Type | null,
|
||||
callback: (status: convertFrom.SearchStatus, result: string | convertFrom.Result) => void
|
||||
): void;
|
||||
}
|
||||
78
types/amap-js-api/dom-util.d.ts
vendored
Normal file
78
types/amap-js-api/dom-util.d.ts
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
declare namespace AMap {
|
||||
namespace DomUtil {
|
||||
/**
|
||||
* 获取DOM元素的大小
|
||||
* @param dom DOM元素
|
||||
*/
|
||||
function getViewport(dom: HTMLElement): Size;
|
||||
/**
|
||||
* 获取DOM元素距离窗口左上角的距离
|
||||
* @param dom DOM元素
|
||||
*/
|
||||
function getViewportOffset(dom: HTMLElement): Pixel;
|
||||
/**
|
||||
* 在parentNode内部创建一个className类名的tagName元素
|
||||
* @param tagName 标签名称
|
||||
* @param parent 父节点
|
||||
* @param className 类名
|
||||
*/
|
||||
function create<K extends keyof HTMLElementTagNameMap>(
|
||||
tagName: K,
|
||||
parent?: HTMLElement,
|
||||
className?: string
|
||||
): HTMLElementTagNameMap[K];
|
||||
/**
|
||||
* 给DOM元素设置为className样式
|
||||
* @param dom DOM元素
|
||||
* @param className 类名
|
||||
*/
|
||||
function setClass(dom: HTMLElement, className?: string): void;
|
||||
/**
|
||||
* DOM元素是否包含className
|
||||
* @param dom DOM元素
|
||||
* @param className 类名
|
||||
*/
|
||||
function hasClass(dom: HTMLElement, className: string): boolean;
|
||||
/**
|
||||
* 给DOM元素添加一个className
|
||||
* @param dom DOM元素
|
||||
* @param className 类名
|
||||
*/
|
||||
function addClass(dom: HTMLElement, className: string): void;
|
||||
/**
|
||||
* 给DOM元素删除一个className
|
||||
* @param dom DOM元素
|
||||
* @param className 类名
|
||||
*/
|
||||
function removeClass(dom: HTMLElement, className: string): void;
|
||||
/**
|
||||
* 给DOM元素设定一个透明度
|
||||
* @param dom DOM元素
|
||||
* @param opacity 透明度(0-1)
|
||||
*/
|
||||
function setOpacity(dom: HTMLElement, opacity: number): void;
|
||||
/**
|
||||
* 给DOM元素旋转一个角度,以center为中心,center以元素左上角为坐标原点
|
||||
* @param dom DOM元素
|
||||
* @param deg 旋转角度
|
||||
* @param origin 旋转中心
|
||||
*/
|
||||
function rotate(dom: HTMLElement, deg: number, origin?: { x: number, y: number }): void;
|
||||
/**
|
||||
* 给DOM元素删除一组样式,Object同样式表
|
||||
* @param dom DOM元素
|
||||
* @param style 样式
|
||||
*/
|
||||
function setCss(dom: HTMLElement | HTMLElement[], style: Partial<CSSStyleDeclaration>): typeof DomUtil; // this
|
||||
/**
|
||||
* 清空DOM元素
|
||||
* @param dom DOM元素
|
||||
*/
|
||||
function empty(dom: HTMLElement): void;
|
||||
/**
|
||||
* 将DOM元素从父节点删除
|
||||
* @param dom DOM元素
|
||||
*/
|
||||
function remove(dom: HTMLElement): void;
|
||||
}
|
||||
}
|
||||
102
types/amap-js-api/event.d.ts
vendored
Normal file
102
types/amap-js-api/event.d.ts
vendored
Normal file
@@ -0,0 +1,102 @@
|
||||
declare namespace AMap {
|
||||
abstract class EventEmitter {
|
||||
/**
|
||||
* 注册事件
|
||||
* @param eventName 事件名称
|
||||
* @param handler 事件回调函数
|
||||
* @param context 事件回调中的上下文
|
||||
* @param once 触发一次
|
||||
* @param unshift 更改事件顺序
|
||||
*/
|
||||
on<E extends Event, C = this>(
|
||||
eventName: string,
|
||||
// tslint:disable-next-line:no-unnecessary-generics
|
||||
handler: (this: C, event: E) => void,
|
||||
context?: C,
|
||||
once?: boolean,
|
||||
unshift?: boolean
|
||||
): this;
|
||||
/**
|
||||
* 移除事件绑定
|
||||
* @param eventName 事件名称
|
||||
* @param handler 事件功能函数
|
||||
* @param context 事件上下文
|
||||
*/
|
||||
off<E extends Event, C = this>(
|
||||
eventName: string,
|
||||
// tslint:disable-next-line
|
||||
handler: ((this: C, event: E) => void) | 'mv',
|
||||
context?: C
|
||||
): this;
|
||||
/**
|
||||
* 触发事件
|
||||
* @param eventName 事件名称
|
||||
* @param data 事件数据
|
||||
*/
|
||||
emit(eventName: string, data?: any): this;
|
||||
}
|
||||
|
||||
namespace event {
|
||||
interface EventListener<T extends 0 | 1> {
|
||||
type: T;
|
||||
}
|
||||
/**
|
||||
* 注册DOM对象事件
|
||||
* @param instance 需注册事件的DOM对象
|
||||
* @param eventName 事件名称
|
||||
* @param handler 事件功能函数
|
||||
* @param context 事件上下文
|
||||
*/
|
||||
function addDomListener<N extends keyof HTMLElementTagNameMap, E extends keyof HTMLElementEventMap, C = HTMLElementTagNameMap[N]>(
|
||||
// tslint:disable-next-line: no-unnecessary-generics
|
||||
instance: HTMLElementTagNameMap[N],
|
||||
eventName: E,
|
||||
handler: (this: C, event: HTMLElementEventMap[E]) => void,
|
||||
context?: C
|
||||
): EventListener<0>;
|
||||
/**
|
||||
* 给对象注册事件
|
||||
* @param instance 需注册事件的对象
|
||||
* @param eventName 事件名称
|
||||
* @param handler 事件功能函数
|
||||
* @param context 事件上下文
|
||||
*/
|
||||
function addListener<I extends EventEmitter, E extends Event, C = I>(
|
||||
// tslint:disable-next-line: no-unnecessary-generics
|
||||
instance: I,
|
||||
eventName: string,
|
||||
// tslint:disable-next-line: no-unnecessary-generics
|
||||
handler: (this: C, event: E) => void,
|
||||
// tslint:disable-next-line: no-unnecessary-generics
|
||||
context?: C
|
||||
): EventListener<1>;
|
||||
/**
|
||||
* 给对象注册一次性事件
|
||||
* @param instance 需注册事件的对象
|
||||
* @param eventName 事件名称
|
||||
* @param handler 事件功能函数
|
||||
* @param context 事件上下文
|
||||
*/
|
||||
function addListenerOnce<I extends EventEmitter, E extends Event, C = I>(
|
||||
// tslint:disable-next-line: no-unnecessary-generics
|
||||
instance: I,
|
||||
eventName: string,
|
||||
// tslint:disable-next-line: no-unnecessary-generics
|
||||
handler: (this: C, event: E) => void,
|
||||
// tslint:disable-next-line: no-unnecessary-generics
|
||||
context?: C
|
||||
): EventListener<1>;
|
||||
/**
|
||||
* 删除事件
|
||||
* @param listener 侦听器
|
||||
*/
|
||||
function removeListener(listener: EventListener<0 | 1>): void;
|
||||
/**
|
||||
* 触发非DOM事件
|
||||
* @param instance 触发对象
|
||||
* @param eventName 事件名称
|
||||
* @param data 事件数据
|
||||
*/
|
||||
function trigger(instance: EventEmitter, eventName: string, data?: any): void;
|
||||
}
|
||||
}
|
||||
192
types/amap-js-api/geometry-util.d.ts
vendored
Normal file
192
types/amap-js-api/geometry-util.d.ts
vendored
Normal file
@@ -0,0 +1,192 @@
|
||||
declare namespace AMap {
|
||||
namespace GeometryUtil {
|
||||
/**
|
||||
* 计算两个经纬度点之间的实际距离
|
||||
*/
|
||||
function distance(
|
||||
point1: LocationValue,
|
||||
point2: LocationValue | LocationValue[]
|
||||
): number;
|
||||
/**
|
||||
* 计算一个经纬度路径围成区域的实际面积
|
||||
*/
|
||||
function ringArea(ring: LocationValue[]): number;
|
||||
/**
|
||||
* 判断一个经纬度路径是否为顺时针
|
||||
*/
|
||||
function isClockwise(path: LocationValue[]): boolean;
|
||||
/**
|
||||
* 计算一个经纬度路径的实际长度
|
||||
*/
|
||||
function distanceOfLine(line: LocationValue[]): number;
|
||||
/**
|
||||
* 计算两个经纬度面的交叉区域
|
||||
*/
|
||||
function ringRingClip(
|
||||
ring1: LocationValue[],
|
||||
ring2: LocationValue[]
|
||||
): Array<[number, number]>;
|
||||
/**
|
||||
* 判断两个经纬度面是否交叉
|
||||
*/
|
||||
function doesRingRingIntersect(
|
||||
ring1: LocationValue[],
|
||||
ring2: LocationValue[]
|
||||
): boolean;
|
||||
/**
|
||||
* 判断经纬度路径和经纬度面是否交叉
|
||||
*/
|
||||
function doesLineRingIntersect(
|
||||
line: LocationValue[],
|
||||
ring: LocationValue[]
|
||||
): boolean;
|
||||
/**
|
||||
* 判断两个经纬度路径是否相交
|
||||
*/
|
||||
function doesLineLineIntersect(
|
||||
line1: LocationValue[],
|
||||
line2: LocationValue[]
|
||||
): boolean;
|
||||
/**
|
||||
* 判断线段和多个环是否相交
|
||||
*/
|
||||
function doesSegmentPolygonIntersect(
|
||||
point1: LocationValue,
|
||||
point2: LocationValue,
|
||||
polygon: LocationValue[][]
|
||||
): boolean;
|
||||
/**
|
||||
* 判断线段和一个环是否相交
|
||||
*/
|
||||
function doesSegmentRingIntersect(
|
||||
point1: LocationValue,
|
||||
point2: LocationValue,
|
||||
ring: LocationValue[]
|
||||
): boolean;
|
||||
/**
|
||||
* 判断线段和一个路径是否相交
|
||||
*/
|
||||
function doesSegmentLineIntersect(
|
||||
point1: LocationValue,
|
||||
point2: LocationValue,
|
||||
line: LocationValue[]
|
||||
): boolean;
|
||||
/**
|
||||
* 判断两个线段是否相交
|
||||
*/
|
||||
function doesSegmentsIntersect(
|
||||
point1: LocationValue,
|
||||
point2: LocationValue,
|
||||
point3: LocationValue,
|
||||
point4: LocationValue
|
||||
): boolean;
|
||||
/**
|
||||
* 判断点是否在环内
|
||||
*/
|
||||
function isPointInRing(point: LocationValue, ring: LocationValue[]): boolean;
|
||||
/**
|
||||
* 判断环是否在另一个环内
|
||||
*/
|
||||
function isRingInRing(ring1: LocationValue[], ring2: LocationValue[]): boolean;
|
||||
/**
|
||||
* 判断点是否在多个环组成区域内
|
||||
*/
|
||||
function isPointInPolygon(point: LocationValue, polygon: LocationValue[][]): boolean;
|
||||
/**
|
||||
* 判断点是否在多个环组成区域内
|
||||
*/
|
||||
function makesureClockwise(path: Array<[number, number]>): Array<[number, number]>;
|
||||
/**
|
||||
* 将一个路径变为逆时针
|
||||
*/
|
||||
function makesureAntiClockwise(path: Array<[number, number]>): Array<[number, number]>;
|
||||
/**
|
||||
* 计算P2P3上距离P1最近的点
|
||||
* @param point1 P1
|
||||
* @param point2 P2
|
||||
* @param point3 P3
|
||||
*/
|
||||
function closestOnSegment(
|
||||
point1: LocationValue,
|
||||
point2: LocationValue,
|
||||
point3: LocationValue
|
||||
): [number, number];
|
||||
/**
|
||||
* 计算line上距离P最近的点
|
||||
*/
|
||||
function closestOnLine(point: LocationValue, line: LocationValue[]): [number, number];
|
||||
/**
|
||||
* 计算P2P3到P1的距离
|
||||
* @param point1 P1
|
||||
* @param point2 P2
|
||||
* @param point3 P3
|
||||
*/
|
||||
function distanceToSegment(
|
||||
point1: LocationValue,
|
||||
point2: LocationValue,
|
||||
point3: LocationValue
|
||||
): number;
|
||||
/**
|
||||
* 计算P到line的距离
|
||||
*/
|
||||
function distanceToLine(point: LocationValue, line: LocationValue[]): number;
|
||||
/**
|
||||
* 判断P1是否在P2P3上
|
||||
* @param point1 P1
|
||||
* @param point2 P2
|
||||
* @param point3 P3
|
||||
* @param tolerance 误差范围
|
||||
*/
|
||||
function isPointOnSegment(
|
||||
point1: LocationValue,
|
||||
point2: LocationValue,
|
||||
point3: LocationValue,
|
||||
tolerance?: number
|
||||
): boolean;
|
||||
/**
|
||||
* 判断P是否在line上
|
||||
* @param point 点P
|
||||
* @param line 线
|
||||
* @param tolerance 误差范围
|
||||
*/
|
||||
function isPointOnLine(
|
||||
point: LocationValue,
|
||||
line: LocationValue[],
|
||||
tolerance?: number
|
||||
): boolean;
|
||||
/**
|
||||
* 判断P是否在ring的边上
|
||||
* @param point 点P
|
||||
* @param ring 环
|
||||
* @param tolerance 误差范围
|
||||
*/
|
||||
function isPointOnRing(
|
||||
point: LocationValue,
|
||||
ring: LocationValue[],
|
||||
tolerance?: number
|
||||
): boolean;
|
||||
/**
|
||||
* 判断P是否在多个ring的边上
|
||||
* @param point 点P
|
||||
* @param polygon 多边形
|
||||
* @param tolerance 误差范围
|
||||
*/
|
||||
function isPointOnPolygon(
|
||||
point: LocationValue,
|
||||
polygon: LocationValue[][],
|
||||
tolerance?: number
|
||||
): boolean;
|
||||
|
||||
function doesPolygonPolygonIntersect(
|
||||
polygon1: LocationValue[],
|
||||
polygon2: LocationValue[]
|
||||
): boolean;
|
||||
|
||||
function distanceToPolygon(point: LocationValue, polygon: LocationValue[]): number;
|
||||
|
||||
function triangulateShape(
|
||||
shape1: LngLat[] | Pixel[] | [number, number],
|
||||
shape2: LngLat[] | Pixel[] | [number, number]
|
||||
): number[];
|
||||
}
|
||||
}
|
||||
48
types/amap-js-api/index.d.ts
vendored
Normal file
48
types/amap-js-api/index.d.ts
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
// Type definitions for non-npm package amap-js-api 1.4
|
||||
// Project: https://lbs.amap.com/api/javascript-api/summary
|
||||
// Definitions by: breeze9527 <https://github.com/breeze9527>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
/// <reference path="array-bounds.d.ts" />
|
||||
/// <reference path="bounds.d.ts" />
|
||||
/// <reference path="browser.d.ts" />
|
||||
/// <reference path="common.d.ts" />
|
||||
/// <reference path="convert-from.d.ts" />
|
||||
/// <reference path="dom-util.d.ts" />
|
||||
/// <reference path="event.d.ts" />
|
||||
/// <reference path="geometry-util.d.ts" />
|
||||
/// <reference path="lngLat.d.ts" />
|
||||
/// <reference path="map.d.ts" />
|
||||
/// <reference path="pixel.d.ts" />
|
||||
/// <reference path="size.d.ts" />
|
||||
/// <reference path="type-util.d.ts" />
|
||||
/// <reference path="util.d.ts" />
|
||||
/// <reference path="view2D.d.ts" />
|
||||
/// <reference path="layer/building.d.ts" />
|
||||
/// <reference path="layer/flexible.d.ts" />
|
||||
/// <reference path="layer/layer.d.ts" />
|
||||
/// <reference path="layer/layerGroup.d.ts" />
|
||||
/// <reference path="layer/massMarks.d.ts" />
|
||||
/// <reference path="layer/mediaLayer.d.ts" />
|
||||
/// <reference path="layer/tileLayer.d.ts" />
|
||||
/// <reference path="layer/wms.d.ts" />
|
||||
/// <reference path="layer/wmts.d.ts" />
|
||||
/// <reference path="overlay/bezierCurve.d.ts" />
|
||||
/// <reference path="overlay/circle.d.ts" />
|
||||
/// <reference path="overlay/circleMarker.d.ts" />
|
||||
/// <reference path="overlay/contextMenu.d.ts" />
|
||||
/// <reference path="overlay/ellipse.d.ts" />
|
||||
/// <reference path="overlay/geoJSON.d.ts" />
|
||||
/// <reference path="overlay/icon.d.ts" />
|
||||
/// <reference path="overlay/infoWindow.d.ts" />
|
||||
/// <reference path="overlay/marker.d.ts" />
|
||||
/// <reference path="overlay/markerShape.d.ts" />
|
||||
/// <reference path="overlay/overlay.d.ts" />
|
||||
/// <reference path="overlay/overlayGroup.d.ts" />
|
||||
/// <reference path="overlay/pathOverlay.d.ts" />
|
||||
/// <reference path="overlay/polygon.d.ts" />
|
||||
/// <reference path="overlay/polyline.d.ts" />
|
||||
/// <reference path="overlay/rectangle.d.ts" />
|
||||
/// <reference path="overlay/shapeOverlay.d.ts" />
|
||||
/// <reference path="overlay/text.d.ts" />
|
||||
54
types/amap-js-api/layer/building.d.ts
vendored
Normal file
54
types/amap-js-api/layer/building.d.ts
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
declare namespace AMap {
|
||||
namespace Buildings {
|
||||
interface Options extends Layer.Options {
|
||||
/**
|
||||
* 可见级别范围
|
||||
*/
|
||||
zooms?: [number, number];
|
||||
/**
|
||||
* 不透明度
|
||||
*/
|
||||
opacity?: number;
|
||||
/**
|
||||
* 高度比例系数,可控制3D视图下的楼块高度
|
||||
*/
|
||||
heightFactor?: number;
|
||||
/**
|
||||
* 是否可见
|
||||
*/
|
||||
visible?: boolean;
|
||||
/**
|
||||
* 层级
|
||||
*/
|
||||
zIndex?: number;
|
||||
|
||||
// inner
|
||||
merge?: boolean;
|
||||
sort?: boolean;
|
||||
}
|
||||
interface AreaStyle {
|
||||
color1: string;
|
||||
path: LocationValue[];
|
||||
color2?: string;
|
||||
visible?: boolean;
|
||||
rejectTexture?: boolean;
|
||||
}
|
||||
interface Style {
|
||||
hideWithoutStyle?: boolean;
|
||||
areas: AreaStyle[];
|
||||
}
|
||||
}
|
||||
|
||||
class Buildings extends Layer {
|
||||
/**
|
||||
* 楼块图层,单独展示矢量化的楼块图层
|
||||
* @param opts 图层选项
|
||||
*/
|
||||
constructor(opts?: Buildings.Options);
|
||||
/**
|
||||
* 按区域设置楼块的颜色
|
||||
* @param style 颜色设置
|
||||
*/
|
||||
setStyle(style: Buildings.Style): void;
|
||||
}
|
||||
}
|
||||
38
types/amap-js-api/layer/flexible.d.ts
vendored
Normal file
38
types/amap-js-api/layer/flexible.d.ts
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
declare namespace AMap {
|
||||
namespace TileLayer {
|
||||
namespace Flexible {
|
||||
interface Options extends TileLayer.Options {
|
||||
/**
|
||||
* 创建切片回调
|
||||
* @param x 横坐标
|
||||
* @param y 纵坐标
|
||||
* @param z 层级
|
||||
* @param success 成功回调
|
||||
* @param fail 失败回调
|
||||
*/
|
||||
createTile?(
|
||||
x: number,
|
||||
y: number,
|
||||
z: number,
|
||||
success: (tile: HTMLImageElement | HTMLCanvasElement) => void,
|
||||
fail: () => void
|
||||
): void;
|
||||
/**
|
||||
* 内存中缓存的切片的数量上限
|
||||
*/
|
||||
cacheSize?: number;
|
||||
/**
|
||||
* 是否显示
|
||||
*/
|
||||
visible?: boolean;
|
||||
}
|
||||
}
|
||||
class Flexible extends TileLayer {
|
||||
/**
|
||||
* 灵活切片图层
|
||||
* @param options 图层选项
|
||||
*/
|
||||
constructor(options?: Flexible.Options);
|
||||
}
|
||||
}
|
||||
}
|
||||
56
types/amap-js-api/layer/layer.d.ts
vendored
Normal file
56
types/amap-js-api/layer/layer.d.ts
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
declare namespace AMap {
|
||||
namespace Layer {
|
||||
interface Options {
|
||||
/**
|
||||
* 所属的地图对象
|
||||
*/
|
||||
map?: Map;
|
||||
}
|
||||
}
|
||||
|
||||
abstract class Layer extends EventEmitter {
|
||||
/**
|
||||
* 图层获取DOM节点
|
||||
*/
|
||||
getContainer(): HTMLDivElement | undefined;
|
||||
/**
|
||||
* 获取图层缩放范围
|
||||
*/
|
||||
getZooms(): [number, number];
|
||||
/**
|
||||
* 设置透明度
|
||||
* @param alpha 透明度
|
||||
*/
|
||||
setOpacity(alpha: number): void;
|
||||
/**
|
||||
* 设置透明度
|
||||
*/
|
||||
getOpacity(): number;
|
||||
/**
|
||||
* 显示图层
|
||||
*/
|
||||
show(): void;
|
||||
/**
|
||||
* 隐藏图层
|
||||
*/
|
||||
hide(): void;
|
||||
/**
|
||||
* 设置图层所属地图
|
||||
* @param map map对象
|
||||
*/
|
||||
setMap(map?: Map | null): void;
|
||||
/**
|
||||
* 获取图层所属地图
|
||||
*/
|
||||
getMap(): Map | null | undefined;
|
||||
/**
|
||||
* 设置图层的层级
|
||||
* @param index 层级
|
||||
*/
|
||||
setzIndex(index: number): void;
|
||||
/**
|
||||
* 获取图层的层级
|
||||
*/
|
||||
getzIndex(): number;
|
||||
}
|
||||
}
|
||||
56
types/amap-js-api/layer/layerGroup.d.ts
vendored
Normal file
56
types/amap-js-api/layer/layerGroup.d.ts
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
declare namespace AMap {
|
||||
class LayerGroup<L = any> extends Layer {
|
||||
/**
|
||||
* 图层集合
|
||||
* @param layers 集合中的图层
|
||||
*/
|
||||
constructor(layers: L | L[]);
|
||||
/**
|
||||
* 添加单个图层到集合中,不支持添加重复的图层
|
||||
* @param layer 图层
|
||||
*/
|
||||
addLayer(layer: L | L[]): this;
|
||||
/**
|
||||
* 添加图层数组到集合中,不支持添加重复的图层
|
||||
* @param layers 图层数组
|
||||
*/
|
||||
addLayers(layers: L | L[]): this;
|
||||
/**
|
||||
* 返回当前集合中所有的图层
|
||||
*/
|
||||
getLayers(): L[];
|
||||
getLayer(finder: (this: null, item: L, index: number, list: L[]) => boolean): L | null;
|
||||
/**
|
||||
* 判断传入的图层实例是否在集合中
|
||||
* @param layer 目标图层
|
||||
*/
|
||||
hasLayer(layer: L | ((this: null, item: L, index: number, list: L[]) => boolean)): boolean;
|
||||
/**
|
||||
* 从集合中删除传入的图层实例
|
||||
* @param layer 图层
|
||||
*/
|
||||
removeLayer(layer: L | L[]): this;
|
||||
/**
|
||||
* 从集合中删除传入的图层实例数组
|
||||
* @param layers 图层数组
|
||||
*/
|
||||
removeLayers(layers: L | L[]): this;
|
||||
/**
|
||||
* 清空集合
|
||||
*/
|
||||
clearLayers(): this;
|
||||
/**
|
||||
* 对集合中的图层做迭代操作
|
||||
* @param iterator 迭代回调
|
||||
* @param context 执行上下文
|
||||
*/
|
||||
eachLayer<C = L>(iterator: (this: C, layer: L, index: number, list: L[]) => void, context?: C): void;
|
||||
|
||||
// overwrite
|
||||
setMap(map?: Map): this;
|
||||
hide(): this;
|
||||
show(): this;
|
||||
reload(): this;
|
||||
setOptions(options: any): this;
|
||||
}
|
||||
}
|
||||
99
types/amap-js-api/layer/massMarks.d.ts
vendored
Normal file
99
types/amap-js-api/layer/massMarks.d.ts
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
declare namespace AMap {
|
||||
namespace MassMarks {
|
||||
interface EventMap<I = MassMarks> {
|
||||
click: UIEvent<'click', I>;
|
||||
dblclick: UIEvent<'dblclick', I>;
|
||||
mousedown: UIEvent<'mousedown', I>;
|
||||
mouseup: UIEvent<'mouseup', I>;
|
||||
mouseover: UIEvent<'mouseover', I>;
|
||||
mouseout: UIEvent<'mouseout', I>;
|
||||
touchstart: UIEvent<'touchstart', I>;
|
||||
touchend: UIEvent<'touchend', I>;
|
||||
}
|
||||
|
||||
interface Style {
|
||||
/**
|
||||
* 图标显示位置偏移量,以图标的左上角为基准点(0,0)点
|
||||
*/
|
||||
anchor: Pixel;
|
||||
/**
|
||||
* 图标的地址
|
||||
*/
|
||||
url: string;
|
||||
/**
|
||||
* 图标的尺寸
|
||||
*/
|
||||
size: Size;
|
||||
/**
|
||||
* 旋转角度
|
||||
*/
|
||||
rotation?: number;
|
||||
}
|
||||
|
||||
type UIEvent<N extends string, I> = Event<N, {
|
||||
/**
|
||||
* 事件触发目标
|
||||
*/
|
||||
target: I;
|
||||
/**
|
||||
* 目标点的数据
|
||||
*/
|
||||
data: I extends MassMarks<infer D> ? D : Data;
|
||||
}>;
|
||||
|
||||
interface Options extends Layer.Options {
|
||||
/**
|
||||
* 显示层级
|
||||
*/
|
||||
zIndex?: number;
|
||||
/**
|
||||
* 指针样式
|
||||
*/
|
||||
cursor?: string;
|
||||
/**
|
||||
* 是否在拖拽缩放过程中实时重绘
|
||||
*/
|
||||
alwayRender?: boolean;
|
||||
/**
|
||||
* 设置点的样式
|
||||
*/
|
||||
style: Style | Style[];
|
||||
// rejectMapMask
|
||||
}
|
||||
interface Data {
|
||||
lnglat: LocationValue;
|
||||
style?: number;
|
||||
}
|
||||
}
|
||||
|
||||
class MassMarks<D extends MassMarks.Data = MassMarks.Data> extends Layer {
|
||||
/**
|
||||
* 海量点类,利用该类可同时在地图上展示万级别的点
|
||||
* @param data 点对象数组或url
|
||||
* @param opts 选项
|
||||
*/
|
||||
constructor(data: D[] | string, opts: MassMarks.Options);
|
||||
/**
|
||||
* 设置显示样式
|
||||
* @param style 样式设置
|
||||
*/
|
||||
setStyle(style: MassMarks.Style | MassMarks.Style[]): void;
|
||||
/**
|
||||
* 获取显示样式
|
||||
*/
|
||||
getStyle(): MassMarks.Style | MassMarks.Style[];
|
||||
/**
|
||||
* 设置数据集
|
||||
* @param data 数据集
|
||||
*/
|
||||
setData(data: D[] | string): void;
|
||||
/**
|
||||
* 获取数据集
|
||||
*/
|
||||
getData(): Array<Pick<D, Exclude<keyof D, 'lnglat'>> & { lnglat: LngLat }>;
|
||||
/**
|
||||
* 清除海量点
|
||||
*/
|
||||
clear(): void;
|
||||
}
|
||||
}
|
||||
94
types/amap-js-api/layer/mediaLayer.d.ts
vendored
Normal file
94
types/amap-js-api/layer/mediaLayer.d.ts
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
declare namespace AMap {
|
||||
namespace MediaLayer {
|
||||
interface Options extends Layer.Options {
|
||||
/**
|
||||
* 显示范围
|
||||
*/
|
||||
bounds?: Bounds;
|
||||
/**
|
||||
* 是否可见
|
||||
*/
|
||||
visible?: boolean;
|
||||
/**
|
||||
* 缩放范围
|
||||
*/
|
||||
zooms?: [number, number];
|
||||
/**
|
||||
* 透明度
|
||||
*/
|
||||
opacity?: number;
|
||||
}
|
||||
}
|
||||
|
||||
abstract class MediaLayer<E extends HTMLElement> extends Layer {
|
||||
/**
|
||||
* @param options 图层选项
|
||||
*/
|
||||
constructor(options?: MediaLayer.Options);
|
||||
/**
|
||||
* 设置显示范围
|
||||
* @param bounds 显示范围
|
||||
*/
|
||||
setBounds(bounds: Bounds): void;
|
||||
/**
|
||||
* 获取显示的范围
|
||||
*/
|
||||
getBounds(): Bounds;
|
||||
/**
|
||||
* 设置图层选项
|
||||
* @param options 图层选项
|
||||
*/
|
||||
setOptions(options: Partial<MediaLayer.Options>): void;
|
||||
/**
|
||||
* 获取图层选项
|
||||
*/
|
||||
getOptions(): Partial<MediaLayer.Options>;
|
||||
/**
|
||||
* 获取元素
|
||||
*/
|
||||
getElement(): E | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 图片图层
|
||||
*/
|
||||
class ImageLayer extends MediaLayer<HTMLImageElement> {
|
||||
/**
|
||||
* 修改Image的Url
|
||||
* @param url url
|
||||
*/
|
||||
setImageUrl(url: string): void;
|
||||
/**
|
||||
* 返回Image的Url
|
||||
*/
|
||||
getImageUrl(): string | undefined;
|
||||
}
|
||||
|
||||
class VideoLayer extends MediaLayer<HTMLVideoElement> {
|
||||
/**
|
||||
* 修改Video的Url
|
||||
* @param source url
|
||||
*/
|
||||
setVideoUrl(source: string | string[]): void;
|
||||
/**
|
||||
* 返回Video的Url
|
||||
*/
|
||||
getVideoUrl(): string | string[] | undefined;
|
||||
}
|
||||
|
||||
class CanvasLayer extends MediaLayer<HTMLCanvasElement> {
|
||||
/**
|
||||
* 修改显示的Canvas
|
||||
* @param canvas Canvas对象
|
||||
*/
|
||||
setCanvas(canvas: HTMLCanvasElement): void;
|
||||
/**
|
||||
* 返回Canvas对象
|
||||
*/
|
||||
getCanvas(): HTMLCanvasElement | undefined;
|
||||
/**
|
||||
* 当canvas的内容发生改变是用于刷新图层
|
||||
*/
|
||||
reFresh(): void;
|
||||
}
|
||||
}
|
||||
91
types/amap-js-api/layer/tileLayer.d.ts
vendored
Normal file
91
types/amap-js-api/layer/tileLayer.d.ts
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
declare namespace AMap {
|
||||
namespace TileLayer {
|
||||
interface EventMap {
|
||||
complete: Event<'complete'>;
|
||||
}
|
||||
|
||||
interface Options extends Layer.Options {
|
||||
/**
|
||||
* 切片大小
|
||||
*/
|
||||
tileSize?: number;
|
||||
/**
|
||||
* 切片取图地址(自1.3版本起,该属性与getTileUrl属性合并)
|
||||
*/
|
||||
tileUrl?: string;
|
||||
/**
|
||||
* 取图错误时的代替地址
|
||||
*/
|
||||
errorUrl?: string;
|
||||
/**
|
||||
* 获取图块取图地址
|
||||
*/
|
||||
getTileUrl?: string | ((x: number, y: number, level: number) => string);
|
||||
/**
|
||||
* 图层叠加的顺序值
|
||||
*/
|
||||
zIndex?: number;
|
||||
/**
|
||||
* 图层的透明度
|
||||
*/
|
||||
opacity?: number;
|
||||
/**
|
||||
* 支持的缩放级别范围
|
||||
*/
|
||||
zooms?: [number, number];
|
||||
/**
|
||||
* 是否在高清屏下进行清晰度适配
|
||||
*/
|
||||
detectRetina?: boolean;
|
||||
}
|
||||
/**
|
||||
* 卫星图层
|
||||
*/
|
||||
class Satellite extends TileLayer { }
|
||||
/**
|
||||
* 路网图层
|
||||
*/
|
||||
class RoadNet extends TileLayer { }
|
||||
|
||||
namespace Traffic {
|
||||
interface Options extends TileLayer.Options {
|
||||
/**
|
||||
* 是否设置可以自动刷新实时路况信息
|
||||
*/
|
||||
autoRefresh?: boolean;
|
||||
/**
|
||||
* 设置刷新间隔时长
|
||||
*/
|
||||
interval?: number;
|
||||
}
|
||||
}
|
||||
class Traffic extends TileLayer {
|
||||
/**
|
||||
* 实时交通图层
|
||||
* @param options 图层选项
|
||||
*/
|
||||
constructor(options?: Traffic.Options);
|
||||
}
|
||||
}
|
||||
|
||||
class TileLayer extends Layer {
|
||||
/**
|
||||
* 切片图层
|
||||
* @param options 图层选项
|
||||
*/
|
||||
constructor(options?: TileLayer.Options);
|
||||
/**
|
||||
* 获取当前图层所有切片号
|
||||
*/
|
||||
getTiles(): string[];
|
||||
/**
|
||||
* 重新加载此图层
|
||||
*/
|
||||
reload(): void;
|
||||
/**
|
||||
* 设置图层的取图地址
|
||||
* @param url 取图地址
|
||||
*/
|
||||
setTileUrl(url: string | ((x: number, y: number, level: number) => string)): void;
|
||||
}
|
||||
}
|
||||
56
types/amap-js-api/layer/wms.d.ts
vendored
Normal file
56
types/amap-js-api/layer/wms.d.ts
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
declare namespace AMap {
|
||||
namespace TileLayer {
|
||||
namespace WMS {
|
||||
interface Params {
|
||||
VERSION?: string;
|
||||
LAYERS?: string;
|
||||
STYLES?: string;
|
||||
FORMAT?: string;
|
||||
TRANSPARENT?: 'TRUE' | 'FALSE';
|
||||
BGCOLOR?: string;
|
||||
EXCEPTIONS?: string;
|
||||
TIME?: string;
|
||||
ELEVATION?: string;
|
||||
}
|
||||
interface Options extends Flexible.Options {
|
||||
/**
|
||||
* wms服务的url地址
|
||||
*/
|
||||
url: string;
|
||||
/**
|
||||
* OGC标准的WMS地图服务的GetMap接口的参数
|
||||
*/
|
||||
params: Params;
|
||||
/**
|
||||
* 地图级别切换时,不同级别的图片是否进行混合
|
||||
*/
|
||||
blend?: boolean;
|
||||
}
|
||||
}
|
||||
class WMS extends Flexible {
|
||||
/**
|
||||
* WMS图层
|
||||
* @param options 图层选项
|
||||
*/
|
||||
constructor(options: WMS.Options);
|
||||
/**
|
||||
* 设置wms服务地址
|
||||
* @param url 服务地址
|
||||
*/
|
||||
setUrl(url: string): void;
|
||||
/**
|
||||
* 返回wms服务地址
|
||||
*/
|
||||
getUrl(): string;
|
||||
/**
|
||||
* 设置OGC标准的WMS getMap接口的参数
|
||||
* @param params 接口参数
|
||||
*/
|
||||
setParams(params: WMS.Params): void;
|
||||
/**
|
||||
* 返回OGC标准的WMS getMap接口的参数
|
||||
*/
|
||||
getParams(): WMS.Params;
|
||||
}
|
||||
}
|
||||
}
|
||||
52
types/amap-js-api/layer/wmts.d.ts
vendored
Normal file
52
types/amap-js-api/layer/wmts.d.ts
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
declare namespace AMap {
|
||||
namespace TileLayer {
|
||||
namespace WMTS {
|
||||
interface Params {
|
||||
Version?: string;
|
||||
Layer?: string;
|
||||
Style?: string;
|
||||
Format?: string;
|
||||
}
|
||||
interface Options extends Flexible.Options {
|
||||
/**
|
||||
* wmts服务的url地址
|
||||
*/
|
||||
url: string;
|
||||
/**
|
||||
* OGC标准的WMTS地图服务的GetTile接口的参数
|
||||
*/
|
||||
params: Params;
|
||||
/**
|
||||
* 地图级别切换时,不同级别的图片是否进行混合
|
||||
*/
|
||||
blend?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
class WMTS extends Flexible {
|
||||
/**
|
||||
* WMTS图层
|
||||
* @param options 图层选项
|
||||
*/
|
||||
constructor(options: WMTS.Options);
|
||||
/**
|
||||
* 设置wmts服务地址
|
||||
* @param url 服务地址
|
||||
*/
|
||||
setUrl(url: string): void;
|
||||
/**
|
||||
* 返回wmts服务地址
|
||||
*/
|
||||
getUrl(): string;
|
||||
/**
|
||||
* 设置OGC标准的WMTS getTile接口的参数
|
||||
* @param params 接口参数
|
||||
*/
|
||||
setParams(params: WMTS.Params): void;
|
||||
/**
|
||||
* 返回OGC标准的WMTS getTile接口的参数
|
||||
*/
|
||||
getParams(): WMTS.Params;
|
||||
}
|
||||
}
|
||||
}
|
||||
45
types/amap-js-api/lngLat.d.ts
vendored
Normal file
45
types/amap-js-api/lngLat.d.ts
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
declare namespace AMap {
|
||||
class LngLat {
|
||||
/**
|
||||
* 构造一个地理坐标对象
|
||||
* @param lng 经度
|
||||
* @param lat 纬度
|
||||
* @param noAutofix 是否自动修正
|
||||
*/
|
||||
constructor(lng: number, lat: number, noAutofix?: boolean);
|
||||
/**
|
||||
* 移动当前经纬度坐标得到新的坐标
|
||||
* @param east 移动经度,向右为正值
|
||||
* @param north 移动维度,向上为正值
|
||||
*/
|
||||
offset(east: number, north: number): LngLat;
|
||||
/**
|
||||
* 当前经纬度和传入经纬度或者经纬度数组连线之间的地面距离,单位为米
|
||||
* @param lnglat 对比目标
|
||||
*/
|
||||
distance(lnglat: LngLat | LngLat[]): number;
|
||||
/**
|
||||
* 获取经度值
|
||||
*/
|
||||
getLng(): number;
|
||||
/**
|
||||
* 获取纬度值
|
||||
*/
|
||||
getLat(): number;
|
||||
/**
|
||||
* 判断当前坐标对象与传入坐标对象是否相等
|
||||
* @param lnglat 判断目标
|
||||
*/
|
||||
equals(lnglat: LngLat): boolean;
|
||||
/**
|
||||
* 以字符串的形式返回
|
||||
*/
|
||||
toString(): string;
|
||||
|
||||
// internal
|
||||
add(lnglat: LngLat, noAutofix?: boolean): LngLat;
|
||||
subtract(lnglat: LngLat, noAutofix?: boolean): LngLat;
|
||||
divideBy(num: number, noAutofix?: boolean): LngLat;
|
||||
multiplyBy(num: number, noAutofix?: boolean): LngLat;
|
||||
}
|
||||
}
|
||||
568
types/amap-js-api/map.d.ts
vendored
Normal file
568
types/amap-js-api/map.d.ts
vendored
Normal file
@@ -0,0 +1,568 @@
|
||||
declare namespace AMap {
|
||||
namespace Map {
|
||||
type Feature = 'bg' | 'point' | 'road' | 'building';
|
||||
type ViewMode = '2D' | '3D';
|
||||
interface Options {
|
||||
/**
|
||||
* 地图视口,用于控制影响地图静态显示的属性
|
||||
*/
|
||||
view?: View2D;
|
||||
/**
|
||||
* 地图图层数组,数组可以是图层 中的一个或多个,默认为普通二维地图
|
||||
*/
|
||||
layers?: Layer[];
|
||||
/**
|
||||
* 地图显示的缩放级别
|
||||
*/
|
||||
zoom?: number;
|
||||
/**
|
||||
* 地图中心点坐标值
|
||||
*/
|
||||
center?: LocationValue;
|
||||
/**
|
||||
* 地图标注显示顺序
|
||||
*/
|
||||
labelzIndex?: number;
|
||||
/**
|
||||
* 地图显示的缩放级别范围
|
||||
*/
|
||||
zooms?: [number, number];
|
||||
/**
|
||||
* 地图语言类型
|
||||
*/
|
||||
lang?: Lang;
|
||||
/**
|
||||
* 地图默认鼠标样式
|
||||
*/
|
||||
defaultCursor?: string;
|
||||
/**
|
||||
* 地图显示的参考坐标系
|
||||
*/
|
||||
crs?: 'EPSG3857' | 'EPSG3395' | 'EPSG4326';
|
||||
/**
|
||||
* 地图平移过程中是否使用动画
|
||||
*/
|
||||
animateEnable?: boolean;
|
||||
/**
|
||||
* 是否开启地图热点和标注的hover效果
|
||||
*/
|
||||
isHotspot?: boolean;
|
||||
/**
|
||||
* 当前地图中默认显示的图层
|
||||
*/
|
||||
defaultLayer?: TileLayer;
|
||||
/**
|
||||
* 地图是否可旋转
|
||||
*/
|
||||
rotateEnable?: boolean;
|
||||
/**
|
||||
* 是否监控地图容器尺寸变化
|
||||
*/
|
||||
resizeEnable?: boolean;
|
||||
/**
|
||||
* 是否在有矢量底图的时候自动展示室内地图
|
||||
*/
|
||||
showIndoorMap?: boolean;
|
||||
/**
|
||||
* 在展示矢量图的时候自动展示室内地图图层
|
||||
*/
|
||||
// indoorMap?: IndorMap
|
||||
/**
|
||||
* 是否支持可以扩展最大缩放级别
|
||||
*/
|
||||
expandZoomRange?: boolean;
|
||||
/**
|
||||
* 地图是否可通过鼠标拖拽平移
|
||||
*/
|
||||
dragEnable?: boolean;
|
||||
/**
|
||||
* 地图是否可缩放
|
||||
*/
|
||||
zoomEnable?: boolean;
|
||||
/**
|
||||
* 地图是否可通过双击鼠标放大地图
|
||||
*/
|
||||
doubleClickZoom?: boolean;
|
||||
/**
|
||||
* 地图是否可通过键盘控制
|
||||
*/
|
||||
keyboardEnable?: boolean;
|
||||
/**
|
||||
* 地图是否使用缓动效果
|
||||
*/
|
||||
jogEnable?: boolean;
|
||||
/**
|
||||
* 地图是否可通过鼠标滚轮缩放浏览
|
||||
*/
|
||||
scrollWheel?: boolean;
|
||||
/**
|
||||
* 地图在移动终端上是否可通过多点触控缩放浏览地图
|
||||
*/
|
||||
touchZoom?: boolean;
|
||||
/**
|
||||
* 当touchZoomCenter=1的时候,手机端双指缩放的以地图中心为中心,否则默认以双指中间点为中心
|
||||
*/
|
||||
touchZoomCenter?: number;
|
||||
/**
|
||||
* 设置地图的显示样式
|
||||
*/
|
||||
mapStyle?: string;
|
||||
/**
|
||||
* 设置地图上显示的元素种类
|
||||
*/
|
||||
features?: Feature[] | 'all' | Feature;
|
||||
/**
|
||||
* 设置地图显示3D楼块效果
|
||||
*/
|
||||
showBuildingBlock?: boolean;
|
||||
/**
|
||||
* 视图模式
|
||||
*/
|
||||
viewMode?: ViewMode;
|
||||
/**
|
||||
* 俯仰角度
|
||||
*/
|
||||
pitch?: number;
|
||||
/**
|
||||
* 是否允许设置俯仰角度
|
||||
*/
|
||||
pitchEnable?: boolean;
|
||||
/**
|
||||
* 楼块出现和消失的时候是否显示动画过程
|
||||
*/
|
||||
buildingAnimation?: boolean;
|
||||
/**
|
||||
* 调整天空颜色
|
||||
*/
|
||||
skyColor?: string;
|
||||
/**
|
||||
* 设置地图的预加载模式
|
||||
*/
|
||||
preloadMode?: boolean;
|
||||
/**
|
||||
* 为 Map 实例指定掩模的路径,各图层将只显示路径范围内图像
|
||||
*/
|
||||
mask?: Array<[number, number]> | Array<Array<[number, number]>> | Array<Array<Array<[number, number]>>>;
|
||||
maxPitch?: number;
|
||||
rotation?: number;
|
||||
forceVector?: boolean;
|
||||
|
||||
// internal
|
||||
baseRender?: 'vw' | 'd' | 'dv' | 'v';
|
||||
overlayRender?: 'c' | 'd';
|
||||
showLabel?: boolean;
|
||||
gridMapForeign?: boolean;
|
||||
logoUrl?: string;
|
||||
logoUrlRetina?: string;
|
||||
copyright?: string;
|
||||
turboMode?: boolean;
|
||||
workerMode?: boolean;
|
||||
// continuousZoomEnable?: boolean;
|
||||
// showFog: boolean;
|
||||
// yaw: number;
|
||||
// scale: number;
|
||||
// detectRetina: number;
|
||||
}
|
||||
interface Status {
|
||||
/**
|
||||
* 是否开启动画
|
||||
*/
|
||||
animateEnable: boolean;
|
||||
/**
|
||||
* 是否双击缩放
|
||||
*/
|
||||
doubleClickZoom: boolean;
|
||||
/**
|
||||
* 是否支持拖拽
|
||||
*/
|
||||
dragEnable: boolean;
|
||||
isHotspot: boolean;
|
||||
/**
|
||||
* 是否开启缓动效果
|
||||
*/
|
||||
jogEnable: boolean;
|
||||
/**
|
||||
* 是否支持键盘
|
||||
*/
|
||||
keyboardEnable: boolean;
|
||||
/**
|
||||
* 是否支持调整俯仰角
|
||||
*/
|
||||
pitchEnable: boolean;
|
||||
resizeEnable: boolean;
|
||||
/**
|
||||
* 是否支持旋转
|
||||
*/
|
||||
rotateEnable: boolean;
|
||||
/**
|
||||
* 是否支持滚轮缩放
|
||||
*/
|
||||
scrollWheel: boolean;
|
||||
/**
|
||||
* 是否支持触摸缩放
|
||||
*/
|
||||
touchZoom: boolean;
|
||||
/**
|
||||
* 是否支持缩放
|
||||
*/
|
||||
zoomEnable: boolean;
|
||||
}
|
||||
type HotspotEvent<N extends string> = Event<N, {
|
||||
/**
|
||||
* 经纬度坐标
|
||||
*/
|
||||
lnglat: LngLat;
|
||||
/**
|
||||
* 热点名称
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* 热点id
|
||||
*/
|
||||
id: string;
|
||||
|
||||
// internal
|
||||
/**
|
||||
* 是否室内热点
|
||||
*/
|
||||
isIndoorPOI: boolean;
|
||||
}>;
|
||||
interface EventMap {
|
||||
click: MapsEvent<'click', Map>;
|
||||
dblclick: MapsEvent<'dblclick', Map>;
|
||||
rightclick: MapsEvent<'rightclick', Map>;
|
||||
rdblclick: MapsEvent<'rdblclick', Map>;
|
||||
mouseup: MapsEvent<'mouseup', Map>;
|
||||
mousedown: MapsEvent<'mousedown', Map>;
|
||||
mousemove: MapsEvent<'mousemove', Map>;
|
||||
mousewheel: MapsEvent<'mousewheel', Map>;
|
||||
mouseover: MapsEvent<'mouseover', Map>;
|
||||
mouseout: MapsEvent<'mouseout', Map>;
|
||||
touchstart: MapsEvent<'touchstart', Map>;
|
||||
touchmove: MapsEvent<'touchmove', Map>;
|
||||
touchend: MapsEvent<'touchend', Map>;
|
||||
contextmenu: MapsEvent<'contextmenu', Map>;
|
||||
|
||||
hotspotclick: HotspotEvent<'hotspotclick'>;
|
||||
hotspotover: HotspotEvent<'hotspotover'>;
|
||||
hotspotout: HotspotEvent<'hotspotout'>;
|
||||
|
||||
complete: Event<'complete'>;
|
||||
mapmove: Event<'mapmove'>;
|
||||
movestart: Event<'movestart'>;
|
||||
moveend: Event<'moveend'>;
|
||||
zoomchange: Event<'zoomchange'>;
|
||||
zoomstart: Event<'zoomstart'>;
|
||||
zoomend: Event<'zoomend'>;
|
||||
dragstart: Event<'dragstart'>;
|
||||
dragging: Event<'dragging'>;
|
||||
dragend: Event<'dragend'>;
|
||||
resize: Event<'resize'>;
|
||||
}
|
||||
}
|
||||
|
||||
class Map extends EventEmitter {
|
||||
/**
|
||||
* 构造一个地图对象
|
||||
* @param container 地图容器的id或者是DOM元素
|
||||
* @param opts 选项
|
||||
*/
|
||||
constructor(container: string | HTMLElement, opts?: Map.Options);
|
||||
/**
|
||||
* 唤起高德地图客户端marker页
|
||||
* @param obj 唤起参数
|
||||
*/
|
||||
poiOnAMAP(obj: { id: string; location?: LocationValue; name?: string }): void;
|
||||
/**
|
||||
* 唤起高德地图客户端marker详情页
|
||||
* @param obj 唤起参数
|
||||
*/
|
||||
detailOnAMAP(obj: { id: string; location?: LocationValue; name?: string }): void;
|
||||
/**
|
||||
* 获取当前地图缩放级别
|
||||
*/
|
||||
getZoom(): number;
|
||||
/**
|
||||
* 获取地图图层数组
|
||||
*/
|
||||
getLayers(): Layer[];
|
||||
/**
|
||||
* 获取地图中心点经纬度坐标值
|
||||
*/
|
||||
getCenter(): LngLat;
|
||||
/**
|
||||
* 返回地图对象的容器
|
||||
*/
|
||||
getContainer(): HTMLElement | null;
|
||||
/**
|
||||
* 获取地图中心点所在区域
|
||||
*/
|
||||
getCity(callback: (cityData: {
|
||||
/**
|
||||
* 市名称
|
||||
*/
|
||||
city: string;
|
||||
/**
|
||||
* 市代码
|
||||
*/
|
||||
citycode: string;
|
||||
/**
|
||||
* 区名称
|
||||
*/
|
||||
district: string;
|
||||
/**
|
||||
* 省
|
||||
*/
|
||||
province: string | never[]; // province is empty array when getCity fail
|
||||
}) => void): void;
|
||||
/**
|
||||
* 获取当前地图视图范围,获取当前可视区域
|
||||
*/
|
||||
getBounds(): Bounds;
|
||||
/**
|
||||
* 获取当前地图标注的显示顺序
|
||||
*/
|
||||
getLabelzIndex(): number;
|
||||
/**
|
||||
* 获取Map的限制区域
|
||||
*/
|
||||
getLimitBounds(): Bounds;
|
||||
/**
|
||||
* 获取地图语言类型
|
||||
*/
|
||||
getLang(): Lang;
|
||||
/**
|
||||
* 获取地图容器像素大小
|
||||
*/
|
||||
getSize(): Size;
|
||||
/**
|
||||
* 获取地图顺时针旋转角度
|
||||
*/
|
||||
getRotation(): number;
|
||||
/**
|
||||
* 获取当前地图状态信息
|
||||
*/
|
||||
getStatus(): Map.Status;
|
||||
/**
|
||||
* 获取地图默认鼠标指针样式
|
||||
*/
|
||||
getDefaultCursor(): string;
|
||||
/**
|
||||
* 获取指定位置的地图分辨率
|
||||
* @param point 指定经纬度
|
||||
*/
|
||||
getResolution(point?: LocationValue): number;
|
||||
/**
|
||||
* 获取当前地图比例尺
|
||||
* @param dpi dpi
|
||||
*/
|
||||
getScale(dpi?: number): number;
|
||||
/**
|
||||
* 设置地图显示的缩放级别
|
||||
* @param level 缩放级别
|
||||
*/
|
||||
setZoom(level: number): void;
|
||||
/**
|
||||
* 设置地图标注显示的顺序
|
||||
* @param index 显示顺序
|
||||
*/
|
||||
setLabelzIndex(index: number): void;
|
||||
/**
|
||||
* 设置地图图层数组
|
||||
* @param layers 图层数组
|
||||
*/
|
||||
setLayers(layers: Layer[]): void;
|
||||
/**
|
||||
* 添加覆盖物/图层
|
||||
* @param overlay 覆盖物/图层
|
||||
*/
|
||||
add(overlay: Overlay | Overlay[]): void;
|
||||
/**
|
||||
* 删除覆盖物/图层
|
||||
* @param overlay 覆盖物/图层
|
||||
*/
|
||||
remove(overlay: Overlay | Overlay[]): void;
|
||||
/**
|
||||
* 返回添加的覆盖物对象
|
||||
* @param type 覆盖物类型
|
||||
*/
|
||||
getAllOverlays(type?: 'marker' | 'circle' | 'polyline' | 'polygon'): Overlay[];
|
||||
/**
|
||||
* 设置地图显示的中心点
|
||||
* @param center 中心点经纬度
|
||||
*/
|
||||
setCenter(center: LocationValue): void;
|
||||
/**
|
||||
* 地图缩放至指定级别并以指定点为地图显示中心点
|
||||
* @param zoomLevel 缩放等级
|
||||
* @param center 缩放中心
|
||||
*/
|
||||
setZoomAndCenter(zoomLevel: number, center: LocationValue): void;
|
||||
/**
|
||||
* 按照行政区名称或adcode来设置地图显示的中心点。
|
||||
* @param city 城市名称或城市编码
|
||||
* @param callback 回调
|
||||
*/
|
||||
setCity(city: string, callback: (this: this, coord: [string, string], zoom: number) => void): void;
|
||||
/**
|
||||
* 指定当前地图显示范围
|
||||
* @param bound 显示范围
|
||||
*/
|
||||
setBounds(bound: Bounds): Bounds;
|
||||
/**
|
||||
* 设置Map的限制区域
|
||||
* @param bound 限制区域
|
||||
*/
|
||||
setLimitBounds(bound: Bounds): void;
|
||||
/**
|
||||
* 清除限制区域
|
||||
*/
|
||||
clearLimitBounds(): void;
|
||||
/**
|
||||
* 设置地图语言类型
|
||||
* @param lang 语言类型
|
||||
*/
|
||||
setLang(lang: Lang): void;
|
||||
/**
|
||||
* 设置地图顺时针旋转角度,旋转原点为地图容器中心点
|
||||
* @param rotation 旋转角度
|
||||
*/
|
||||
setRotation(rotation: number): void;
|
||||
/**
|
||||
* 设置当前地图显示状态
|
||||
* @param status 状态
|
||||
*/
|
||||
setStatus(status: Partial<Map.Status>): void;
|
||||
/**
|
||||
* 设置鼠标指针默认样式
|
||||
* @param cursor 指针样式
|
||||
*/
|
||||
setDefaultCursor(cursor: string): void;
|
||||
/**
|
||||
* 地图放大一级显示
|
||||
*/
|
||||
zoomIn(): void;
|
||||
/**
|
||||
* 地图缩小一级显示
|
||||
*/
|
||||
zoomOut(): void;
|
||||
/**
|
||||
* 地图中心点平移至指定点位置
|
||||
* @param position 目标位置经纬度
|
||||
*/
|
||||
panTo(position: LocationValue): void;
|
||||
/**
|
||||
* 以像素为单位,沿x方向和y方向移动地图
|
||||
* @param x 横向移动像素,向右为正
|
||||
* @param y 纵向移动像素,向下为正
|
||||
*/
|
||||
panBy(x: number, y: number): void;
|
||||
/**
|
||||
* 根据地图上添加的覆盖物分布情况,自动缩放地图到合适的视野级别
|
||||
* @param overlayList 覆盖物数组
|
||||
* @param immediately 是否需要动画过程
|
||||
* @param avoid 上下左右的像素避让宽度
|
||||
* @param maxZoom 最大缩放级别
|
||||
*/
|
||||
setFitView(
|
||||
overlayList?: Overlay | Overlay[],
|
||||
immediately?: boolean,
|
||||
avoid?: [number, number, number, number],
|
||||
maxZoom?: number
|
||||
): Bounds | false | undefined;
|
||||
/**
|
||||
* 删除地图上所有的覆盖物
|
||||
*/
|
||||
clearMap(): void;
|
||||
/**
|
||||
* 注销地图对象,并清空地图容器
|
||||
*/
|
||||
destroy(): void;
|
||||
/**
|
||||
* 加载插件,
|
||||
* tips: 插件的类型定义不在本类型定义中给出,需要另行安装例如
|
||||
* 3d地图:@types/amap-js-api-map3d
|
||||
* 地区搜索:@types/amap-js-api-place-search
|
||||
* @param name 插件名称
|
||||
* @param callback 插件加载完成后的回调函数
|
||||
*/
|
||||
plugin(name: string | string[], callback: () => void): this;
|
||||
/**
|
||||
* 添加控件
|
||||
* @param control 控件
|
||||
*/
|
||||
addControl(control: {}): void; // TODO
|
||||
/**
|
||||
* 移除控件
|
||||
* @param control 控件
|
||||
*/
|
||||
removeControl(control: {}): void; // TODO
|
||||
/**
|
||||
* 清除地图上的信息窗体。
|
||||
*/
|
||||
clearInfoWindow(): void;
|
||||
/**
|
||||
* 平面地图像素坐标转换为地图经纬度坐标
|
||||
* @param pixel 像素坐标
|
||||
* @param level 缩放等级
|
||||
*/
|
||||
pixelToLngLat(pixel: Pixel, level?: number): LngLat;
|
||||
/**
|
||||
* 地图经纬度坐标转换为平面地图像素坐标
|
||||
* @param lnglat 经纬度坐标
|
||||
* @param level 缩放等级
|
||||
*/
|
||||
lnglatToPixel(lnglat: LocationValue, level?: number): Pixel;
|
||||
/**
|
||||
* 地图容器像素坐标转为地图经纬度坐标
|
||||
* @param pixel 地图像素坐标
|
||||
*/
|
||||
containerToLngLat(pixel: Pixel): LngLat;
|
||||
/**
|
||||
* 地图经纬度坐标转为地图容器像素坐标
|
||||
* @param lnglat 经纬度坐标
|
||||
*/
|
||||
lngLatToContainer(lnglat: LocationValue): Pixel;
|
||||
/**
|
||||
* 地图经纬度坐标转为地图容器像素坐标
|
||||
* @param lnglat 经纬度坐标
|
||||
*/
|
||||
lnglatTocontainer(lnglat: LocationValue): Pixel;
|
||||
/**
|
||||
* 设置地图的显示样式
|
||||
* @param style 地图样式
|
||||
*/
|
||||
setMapStyle(style: string): void;
|
||||
/**
|
||||
* 获取地图显示样式
|
||||
*/
|
||||
getMapStyle(): string;
|
||||
/**
|
||||
* 设置地图上显示的元素种类
|
||||
* @param feature 元素
|
||||
*/
|
||||
setFeatures(feature: Map.Feature | Map.Feature[] | 'all'): void;
|
||||
/**
|
||||
* 获取地图显示元素种类
|
||||
*/
|
||||
getFeatures(): Map.Feature | Map.Feature[] | 'all';
|
||||
/**
|
||||
* 修改底图图层
|
||||
* @param layer 图层
|
||||
*/
|
||||
setDefaultLayer(layer: TileLayer): void;
|
||||
/**
|
||||
* 设置俯仰角
|
||||
* @param pitch 俯仰角
|
||||
*/
|
||||
setPitch(pitch: number): void;
|
||||
/**
|
||||
* 获取俯仰角
|
||||
*/
|
||||
getPitch(): number;
|
||||
|
||||
getViewMode_(): Map.ViewMode;
|
||||
lngLatToGeodeticCoord(lnglat: LocationValue): Pixel;
|
||||
geodeticCoordToLngLat(pixel: Pixel): LngLat;
|
||||
}
|
||||
}
|
||||
35
types/amap-js-api/overlay/bezierCurve.d.ts
vendored
Normal file
35
types/amap-js-api/overlay/bezierCurve.d.ts
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
declare namespace AMap {
|
||||
namespace BezierCurve {
|
||||
interface EventMap<I = BezierCurve> extends Polyline.EventMap<I> { }
|
||||
type Options<ExtraData = any> = Merge<Polyline.Options<ExtraData>, {
|
||||
/**
|
||||
* 贝瑟尔曲线的路径
|
||||
*/
|
||||
path: Array<Array<number | string | Array<string | number>>>;
|
||||
// internal
|
||||
tolerance?: number;
|
||||
interpolateNumLimit?: [number | number];
|
||||
}>;
|
||||
|
||||
interface GetOptionsResult<ExtraData = any> extends Polyline.GetOptionsResult<ExtraData> {
|
||||
/**
|
||||
* 贝瑟尔曲线的路径
|
||||
*/
|
||||
path: Array<LngLat & { controlPoints: LngLat[] }>;
|
||||
}
|
||||
}
|
||||
class BezierCurve<ExtraData = any> extends Polyline<ExtraData> {
|
||||
/**
|
||||
* 贝瑟尔曲线
|
||||
* @param options 覆盖物选项
|
||||
*/
|
||||
constructor(options: BezierCurve.Options<ExtraData>);
|
||||
/**
|
||||
* 获取覆盖物选项
|
||||
*/
|
||||
getOptions(): Partial<BezierCurve.GetOptionsResult<ExtraData>>;
|
||||
// internal
|
||||
getInterpolateLngLats(): LngLat[];
|
||||
getSerializedPath(): number[][];
|
||||
}
|
||||
}
|
||||
84
types/amap-js-api/overlay/circle.d.ts
vendored
Normal file
84
types/amap-js-api/overlay/circle.d.ts
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
declare namespace AMap {
|
||||
namespace Circle {
|
||||
interface EventMap<I = Circle> extends ShapeOverlay.EventMap<I> {
|
||||
setCenter: Event<'setCenter'>;
|
||||
setRadius: Event<'setRadius'>;
|
||||
}
|
||||
|
||||
interface Options<ExtraData = any> {
|
||||
map?: Map;
|
||||
zIndex?: number;
|
||||
center?: LocationValue;
|
||||
bubble?: boolean;
|
||||
cursor?: string;
|
||||
radius?: number;
|
||||
strokeColor?: string;
|
||||
strokeOpcity?: number;
|
||||
strokeWeight?: number;
|
||||
fillColor?: string;
|
||||
fillOpacity?: number;
|
||||
strokeStyle?: StrokeStyle;
|
||||
extData?: ExtraData;
|
||||
strokeDasharray?: number[];
|
||||
|
||||
// internal
|
||||
visible?: boolean;
|
||||
unit?: 'meter' | 'px'; // 'might be typo'
|
||||
}
|
||||
|
||||
type GetOptionsResult<ExtraData = any> = Merge<Polygon.GetOptionsResult<ExtraData>, {
|
||||
path: LngLat[];
|
||||
center: LngLat;
|
||||
radius: number;
|
||||
}>;
|
||||
}
|
||||
|
||||
class Circle<ExtraData = any> extends ShapeOverlay<ExtraData> {
|
||||
/**
|
||||
* 圆形覆盖物
|
||||
* @param options 覆盖物选项
|
||||
*/
|
||||
constructor(options?: Circle.Options<ExtraData>);
|
||||
/**
|
||||
* 设置圆中心点
|
||||
* @param center 中心点经纬度
|
||||
* @param preventEvent 阻止触发事件
|
||||
*/
|
||||
setCenter(center: LocationValue, preventEvent?: boolean): void;
|
||||
/**
|
||||
* 获取圆中心点
|
||||
*/
|
||||
getCenter(): LngLat | undefined;
|
||||
/**
|
||||
* 获取圆外切矩形范围
|
||||
*/
|
||||
getBounds(): Bounds | null;
|
||||
/**
|
||||
* 设置圆形的半径
|
||||
* @param radius 半径
|
||||
* @param preventEvent 阻止触发事件
|
||||
*/
|
||||
setRadius(radius: number, preventEvent?: boolean): void;
|
||||
/**
|
||||
* 获取圆形的半径
|
||||
*/
|
||||
getRadius(): number;
|
||||
/**
|
||||
* 修改选项
|
||||
* @param options 选项
|
||||
*/
|
||||
setOptions(options?: Circle.Options<ExtraData>): void;
|
||||
/**
|
||||
* 获取选项
|
||||
*/
|
||||
getOptions(): Partial<Circle.GetOptionsResult<ExtraData>>;
|
||||
/**
|
||||
* 判断指定点坐标是否在圆内
|
||||
* @param point 坐标
|
||||
*/
|
||||
contains(point: LocationValue): boolean;
|
||||
|
||||
// internal
|
||||
getPath(count?: number): LngLat[];
|
||||
}
|
||||
}
|
||||
7
types/amap-js-api/overlay/circleMarker.d.ts
vendored
Normal file
7
types/amap-js-api/overlay/circleMarker.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
declare namespace AMap {
|
||||
// tslint:disable-next-line;
|
||||
/**
|
||||
* 圆点标记
|
||||
*/
|
||||
class CircleMarker<ExtraData = any> extends Circle<ExtraData> {}
|
||||
}
|
||||
50
types/amap-js-api/overlay/contextMenu.d.ts
vendored
Normal file
50
types/amap-js-api/overlay/contextMenu.d.ts
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
declare namespace AMap {
|
||||
namespace ContextMenu {
|
||||
interface Options {
|
||||
/**
|
||||
* 右键菜单内容
|
||||
*/
|
||||
content?: string | HTMLElement;
|
||||
|
||||
// internal
|
||||
visible?: boolean;
|
||||
}
|
||||
|
||||
interface EventMap<I> {
|
||||
items: Event<'items'>;
|
||||
open: Event<'open', { target: I }>;
|
||||
close: Event<'close', { target: I }>;
|
||||
}
|
||||
}
|
||||
|
||||
class ContextMenu<ExtraData = any> extends Overlay<ExtraData> {
|
||||
/**
|
||||
* 地图右键菜单
|
||||
* @param options 选项
|
||||
*/
|
||||
constructor(options?: ContextMenu.Options);
|
||||
/**
|
||||
* 右键菜单中添加菜单项
|
||||
* @param text 菜单显示内容
|
||||
* @param fn 该菜单下需进行的操作
|
||||
* @param num 当前菜单项在右键菜单中的排序位置,以0开始
|
||||
*/
|
||||
addItem(text: string, fn: (this: HTMLLIElement) => void, num?: number): void;
|
||||
/**
|
||||
* 删除一个菜单项
|
||||
* @param text 菜单显示内容
|
||||
* @param fn 该菜单下需进行的操作
|
||||
*/
|
||||
removeItem(text: string, fn: (this: HTMLLIElement) => void): void;
|
||||
/**
|
||||
* 在地图的指定位置打开右键菜单。
|
||||
* @param map 目标地图
|
||||
* @param position 打开位置经纬度
|
||||
*/
|
||||
open(map: Map, position: LocationValue): void;
|
||||
/**
|
||||
* 关闭右键菜单
|
||||
*/
|
||||
close(): void;
|
||||
}
|
||||
}
|
||||
49
types/amap-js-api/overlay/ellipse.d.ts
vendored
Normal file
49
types/amap-js-api/overlay/ellipse.d.ts
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
declare namespace AMap {
|
||||
namespace Ellipse {
|
||||
interface EventMap<I = Ellipse> extends ShapeOverlay.EventMap<I> {
|
||||
setPath: Event<'setPath'>;
|
||||
setCenter: Event<'setCenter'>;
|
||||
}
|
||||
|
||||
interface Options<ExtraData = any> extends Polygon.Options<ExtraData> {
|
||||
/**
|
||||
* 椭圆的中心
|
||||
*/
|
||||
center?: LocationValue;
|
||||
/**
|
||||
* 椭圆半径
|
||||
*/
|
||||
radius?: [number, number];
|
||||
}
|
||||
type GetOptionsResult<ExtraData = any> = Merge<Circle.GetOptionsResult<ExtraData>, {
|
||||
radius: [number, number];
|
||||
}>;
|
||||
}
|
||||
|
||||
class Ellipse<ExtraData = any> extends Polygon<ExtraData> {
|
||||
/**
|
||||
* 椭圆
|
||||
* @param options 选项
|
||||
*/
|
||||
constructor(options?: Ellipse.Options<ExtraData>);
|
||||
/**
|
||||
* 获取椭圆的中心点
|
||||
*/
|
||||
getCenter(): LngLat | undefined;
|
||||
/**
|
||||
* 设置椭圆的中心点
|
||||
* @param center 中心点
|
||||
* @param preventEvent 阻止触发事件
|
||||
*/
|
||||
setCenter(center: LocationValue, preventEvent?: boolean): void;
|
||||
/**
|
||||
* 修改椭圆属性
|
||||
* @param options 属性
|
||||
*/
|
||||
setOptions(options: Ellipse.Options<ExtraData>): void;
|
||||
|
||||
// internal
|
||||
setRadius(radius: [number, number], preventEvent?: boolean): void;
|
||||
getRadius(): [number, number];
|
||||
}
|
||||
}
|
||||
72
types/amap-js-api/overlay/geoJSON.d.ts
vendored
Normal file
72
types/amap-js-api/overlay/geoJSON.d.ts
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
declare namespace AMap {
|
||||
namespace GeoJSON {
|
||||
type Geometry = {
|
||||
type: 'Point';
|
||||
coordinates: [number, number];
|
||||
} | {
|
||||
type: 'MultiPoint' | 'LineString' | 'Polygon';
|
||||
coordinates: Array<[number, number]>;
|
||||
} | {
|
||||
type: 'MultiLineString' | 'MultiPolygon';
|
||||
coordinates: Array<Array<[number, number]>>;
|
||||
} | {
|
||||
type: 'GeometryCollection';
|
||||
geometries: Geometry[];
|
||||
};
|
||||
|
||||
type GeoJSONObject = {
|
||||
type: 'Feature';
|
||||
properties: any;
|
||||
geometry: Geometry;
|
||||
} | {
|
||||
type: 'FeatureCollection',
|
||||
properties: any;
|
||||
features: GeoJSONObject[];
|
||||
};
|
||||
interface Options {
|
||||
/**
|
||||
* 要加载的标准GeoJSON对象
|
||||
*/
|
||||
geoJSON?: GeoJSONObject | GeoJSONObject[];
|
||||
/**
|
||||
* 指定点要素的绘制方式
|
||||
* @param obj GeoJSON对象
|
||||
* @param lnglat 点的位置
|
||||
*/
|
||||
getMarker?(obj: GeoJSONObject, lnglat: LngLat): Marker;
|
||||
/**
|
||||
* 指定线要素的绘制方式
|
||||
* @param obj GeoJSON对象
|
||||
* @param lnglats 线的路径
|
||||
*/
|
||||
getPolyline?(obj: GeoJSONObject, lnglats: LngLat[]): Polyline;
|
||||
/**
|
||||
* 指定面要素的绘制方式
|
||||
* @param obj GeoJSON对象
|
||||
* @param lnglats 面的路径
|
||||
*/
|
||||
getPolygon?(obj: GeoJSONObject, lnglats: LngLat[]): Polygon;
|
||||
coordsToLatLng?(lnglat: LngLat): LngLat;
|
||||
|
||||
// internal
|
||||
coordsToLatLngs?(lnglats: LngLat[]): LngLat[];
|
||||
}
|
||||
}
|
||||
|
||||
class GeoJSON<ExtraData = any> extends OverlayGroup<Overlay, ExtraData> {
|
||||
/**
|
||||
* GeoJSON
|
||||
* @param options 选项
|
||||
*/
|
||||
constructor(options?: GeoJSON.Options);
|
||||
/**
|
||||
* 加载新的GeoJSON对象,转化为覆盖物,旧的覆盖物将移除
|
||||
* @param obj GeoJSON对象
|
||||
*/
|
||||
importData(obj: GeoJSON.GeoJSONObject | GeoJSON.GeoJSONObject[]): void;
|
||||
/**
|
||||
* 将当前对象包含的覆盖物转换为GeoJSON对象
|
||||
*/
|
||||
toGeoJSON(): GeoJSON.GeoJSONObject[];
|
||||
}
|
||||
}
|
||||
39
types/amap-js-api/overlay/icon.d.ts
vendored
Normal file
39
types/amap-js-api/overlay/icon.d.ts
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
declare namespace AMap {
|
||||
namespace Icon {
|
||||
interface Options {
|
||||
/**
|
||||
* 图标尺寸
|
||||
*/
|
||||
size?: SizeValue;
|
||||
/**
|
||||
* 图标取图偏移量
|
||||
*/
|
||||
imageOffset?: Pixel;
|
||||
/**
|
||||
* 图标的取图地址
|
||||
*/
|
||||
image?: string;
|
||||
/**
|
||||
* 图标所用图片大小
|
||||
*/
|
||||
imageSize?: SizeValue;
|
||||
}
|
||||
}
|
||||
|
||||
class Icon extends EventEmitter {
|
||||
/**
|
||||
* 点标记的图标
|
||||
* @param options 选项
|
||||
*/
|
||||
constructor(options?: Icon.Options);
|
||||
/**
|
||||
* 设置图标图片大小
|
||||
* @param size 大小
|
||||
*/
|
||||
setImageSize(size: SizeValue): void;
|
||||
/**
|
||||
* 获取图标图片大小
|
||||
*/
|
||||
getImageSize(): Size;
|
||||
}
|
||||
}
|
||||
98
types/amap-js-api/overlay/infoWindow.d.ts
vendored
Normal file
98
types/amap-js-api/overlay/infoWindow.d.ts
vendored
Normal file
@@ -0,0 +1,98 @@
|
||||
declare namespace AMap {
|
||||
namespace InfoWindow {
|
||||
interface EventMap<I> {
|
||||
change: Event<'change', { target: I }>;
|
||||
open: Event<'open', { target: I }>;
|
||||
close: Event<'close', { target: I }>;
|
||||
}
|
||||
|
||||
interface Options<ExtraData = any> extends Overlay.Options<ExtraData> {
|
||||
/**
|
||||
* 是否自定义窗体
|
||||
*/
|
||||
isCustom?: boolean;
|
||||
/**
|
||||
* 是否自动调整窗体到视野内
|
||||
*/
|
||||
autoMove?: boolean;
|
||||
/**
|
||||
* 控制是否在鼠标点击地图后关闭信息窗体
|
||||
*/
|
||||
closeWhenClickMap?: boolean;
|
||||
/**
|
||||
* 显示内容
|
||||
*/
|
||||
content?: string | HTMLElement;
|
||||
/**
|
||||
* 信息窗体尺寸
|
||||
*/
|
||||
size?: SizeValue;
|
||||
/**
|
||||
* 信息窗体显示位置偏移量
|
||||
*/
|
||||
offset?: Pixel;
|
||||
/**
|
||||
* 信息窗体显示基点位置
|
||||
*/
|
||||
position?: LocationValue;
|
||||
/**
|
||||
* 是否显示信息窗体阴影
|
||||
*/
|
||||
showShadow?: boolean;
|
||||
// internal
|
||||
height?: number;
|
||||
}
|
||||
}
|
||||
|
||||
class InfoWindow<ExtraData = any> extends Overlay<ExtraData> {
|
||||
/**
|
||||
* 信息展示窗体
|
||||
* @param options 选项
|
||||
*/
|
||||
constructor(options?: InfoWindow.Options);
|
||||
/**
|
||||
* 在地图的指定位置打开信息窗体
|
||||
* @param map 地图
|
||||
* @param position 打开的位置
|
||||
*/
|
||||
open(map: Map, position?: LocationValue): void;
|
||||
/**
|
||||
* 关闭信息窗体
|
||||
*/
|
||||
close(): void;
|
||||
/**
|
||||
* 获取信息窗体是否打开
|
||||
*/
|
||||
getIsOpen(): boolean;
|
||||
/**
|
||||
* 设置信息窗体内容
|
||||
* @param content 窗体内容
|
||||
*/
|
||||
setContent(content: string | HTMLElement): void;
|
||||
/**
|
||||
* 获取信息窗体内容
|
||||
*/
|
||||
getContent(): string | HTMLElement | undefined;
|
||||
/**
|
||||
* 设置信息窗体显示基点位置
|
||||
* @param lnglat 位置经纬度
|
||||
*/
|
||||
setPosition(lnglat: LocationValue): void;
|
||||
/**
|
||||
* 获取信息窗体显示基点位置
|
||||
*/
|
||||
getPosition(): LngLat | undefined;
|
||||
/**
|
||||
* 设置信息窗体大小
|
||||
* @param size 大小
|
||||
*/
|
||||
setSize(size: SizeValue): void;
|
||||
/**
|
||||
* 获取信息窗体大小
|
||||
*/
|
||||
getSize(): Size | undefined;
|
||||
|
||||
// internal
|
||||
setOffset(offset: Pixel): void;
|
||||
}
|
||||
}
|
||||
293
types/amap-js-api/overlay/marker.d.ts
vendored
Normal file
293
types/amap-js-api/overlay/marker.d.ts
vendored
Normal file
@@ -0,0 +1,293 @@
|
||||
declare namespace AMap {
|
||||
namespace Marker {
|
||||
interface EventMap<I = Marker> {
|
||||
click: MapsEvent<'click', I>;
|
||||
dblclick: MapsEvent<'dblclick', I>;
|
||||
rightclick: MapsEvent<'rightclick', I>;
|
||||
mousemove: MapsEvent<'mousemove', I>;
|
||||
mouseover: MapsEvent<'mouseover', I>;
|
||||
mouseout: MapsEvent<'mouseout', I>;
|
||||
mousedown: MapsEvent<'mousedown', I>;
|
||||
mouseup: MapsEvent<'mouseup', I>;
|
||||
dragstart: MapsEvent<'dragstart', I>;
|
||||
dragging: MapsEvent<'dragging', I>;
|
||||
dragend: MapsEvent<'dragend', I>;
|
||||
moving: Event<'moving', { passwdPath: LngLat[]; }>;
|
||||
moveend: Event<'moveend'>;
|
||||
movealong: Event<'movealong'>;
|
||||
touchstart: MapsEvent<'touchstart', I>;
|
||||
touchmove: MapsEvent<'touchmove', I>;
|
||||
touchend: MapsEvent<'touchend', I>;
|
||||
}
|
||||
|
||||
interface Label {
|
||||
content?: string;
|
||||
offset?: Pixel;
|
||||
}
|
||||
|
||||
interface Options<ExtraData = any> extends Overlay.Options<ExtraData> {
|
||||
/**
|
||||
* 点标记在地图上显示的位置
|
||||
*/
|
||||
position?: LocationValue;
|
||||
/**
|
||||
* 点标记显示位置偏移量
|
||||
*/
|
||||
offset?: Pixel;
|
||||
/**
|
||||
* 需在点标记中显示的图标
|
||||
*/
|
||||
icon?: string | Icon;
|
||||
/**
|
||||
* 点标记显示内容
|
||||
*/
|
||||
content?: string | HTMLElement;
|
||||
/**
|
||||
* 鼠标点击时marker是否置顶
|
||||
*/
|
||||
topWhenClick?: boolean;
|
||||
/**
|
||||
* 是否将覆盖物的鼠标或touch等事件冒泡到地图上
|
||||
*/
|
||||
bubble?: boolean;
|
||||
/**
|
||||
* 点标记是否可拖拽移动
|
||||
*/
|
||||
draggable?: boolean;
|
||||
/**
|
||||
* 拖拽点标记时是否开启点标记离开地图的效果
|
||||
*/
|
||||
raiseOnDrag?: boolean;
|
||||
/**
|
||||
* 鼠标悬停时的鼠标样式
|
||||
*/
|
||||
cursor?: string;
|
||||
/**
|
||||
* 点标记是否可见
|
||||
*/
|
||||
visible?: boolean;
|
||||
/**
|
||||
* 点标记的叠加顺序
|
||||
*/
|
||||
zIndex?: number;
|
||||
/**
|
||||
* 点标记的旋转角度
|
||||
*/
|
||||
angle?: number;
|
||||
/**
|
||||
* 是否自动旋转
|
||||
*/
|
||||
autoRotation?: boolean;
|
||||
/**
|
||||
* 点标记的动画效果
|
||||
*/
|
||||
animation?: AnimationName;
|
||||
/**
|
||||
* 点标记阴影
|
||||
*/
|
||||
shadow?: Icon | string;
|
||||
/**
|
||||
* 鼠标滑过点标记时的文字提示
|
||||
*/
|
||||
title?: string;
|
||||
/**
|
||||
* 可点击区域
|
||||
*/
|
||||
shape?: MarkerShape;
|
||||
/**
|
||||
* 文本标注
|
||||
*/
|
||||
label?: Label;
|
||||
|
||||
// internal
|
||||
zooms?: [number, number];
|
||||
topWhenMouseOver?: boolean;
|
||||
height?: number;
|
||||
}
|
||||
}
|
||||
|
||||
class Marker<ExtraData = any> extends Overlay<ExtraData> {
|
||||
/**
|
||||
* 点标记
|
||||
* @param options 选项
|
||||
*/
|
||||
constructor(options?: Marker.Options<ExtraData>);
|
||||
/**
|
||||
* 唤起高德地图客户端标注页
|
||||
* @param obj 唤起参数
|
||||
*/
|
||||
markOnAMAP(obj?: { name?: string, position?: LocationValue }): void;
|
||||
/**
|
||||
* 获取偏移量
|
||||
*/
|
||||
getOffset(): Pixel;
|
||||
/**
|
||||
* 设置偏移量
|
||||
* @param offset 偏移量
|
||||
*/
|
||||
setOffset(offset: Pixel): void;
|
||||
/**
|
||||
* 设置点标记的动画效果
|
||||
* @param animate 动画效果类型
|
||||
*/
|
||||
setAnimation(animate: AnimationName, prevent?: boolean): void;
|
||||
/**
|
||||
* 获取点标记的动画效果类型
|
||||
*/
|
||||
getAnimation(): AnimationName;
|
||||
/**
|
||||
* 设置点标记是支持鼠标单击事件
|
||||
* @param cilckable 是否支持点击
|
||||
*/
|
||||
setClickable(cilckable: boolean): void;
|
||||
/**
|
||||
* 获取点标记是否支持鼠标单击事件
|
||||
*/
|
||||
getClickable(): boolean;
|
||||
/**
|
||||
* 获取点标记的位置
|
||||
*/
|
||||
getPosition(): LngLat | undefined;
|
||||
/**
|
||||
* 设置点标记位置
|
||||
* @param position 位置经纬度
|
||||
*/
|
||||
setPosition(position: LocationValue): void;
|
||||
/**
|
||||
* 设置点标记的旋转角度
|
||||
* @param angle 旋转角度
|
||||
*/
|
||||
setAngle(angle: number): void;
|
||||
/**
|
||||
* 设置点标记文本标签内容
|
||||
* @param label 标签内容
|
||||
*/
|
||||
setLabel(label?: Marker.Label): void;
|
||||
/**
|
||||
* 获取点标记文本标签内容
|
||||
*/
|
||||
getLabel(): Marker.Label | undefined;
|
||||
/**
|
||||
* 获取点标记的旋转角度
|
||||
*/
|
||||
getAngle(): number;
|
||||
/**
|
||||
* 设置点标记的叠加顺序
|
||||
* @param index 层级
|
||||
*/
|
||||
setzIndex(index: number): void;
|
||||
/**
|
||||
* 获取点标记的叠加顺序
|
||||
*/
|
||||
getzIndex(): number;
|
||||
/**
|
||||
* 设置点标记的显示图标
|
||||
* @param content 图标
|
||||
*/
|
||||
setIcon(content: string | Icon): void;
|
||||
/**
|
||||
* 获取Icon内容
|
||||
*/
|
||||
getIcon(): string | Icon | undefined;
|
||||
/**
|
||||
* 设置点标记对象是否可拖拽移动
|
||||
* @param draggable 是否可拖拽移动
|
||||
*/
|
||||
setDraggable(draggable: boolean): void;
|
||||
/**
|
||||
* 获取点标记对象是否可拖拽移动
|
||||
*/
|
||||
getDraggable(): boolean;
|
||||
/**
|
||||
* 设置鼠标悬停时的光标
|
||||
* @param cursor 光标
|
||||
*/
|
||||
setCursor(cursor: string): void;
|
||||
/**
|
||||
* 设置点标记显示内容,可以是HTML要素字符串或者HTML DOM对象
|
||||
* @param content 显示内容
|
||||
*/
|
||||
setContent(content: string | HTMLElement): void;
|
||||
/**
|
||||
* 获取点标记内容
|
||||
*/
|
||||
getContent(): string | HTMLElement;
|
||||
/**
|
||||
* 以指定的速度,点标记沿指定的路径移动
|
||||
* @param path 移动轨迹
|
||||
* @param speed 速度
|
||||
* @param timingFunction 缓动函数
|
||||
* @param circleable 是否循环
|
||||
*/
|
||||
moveAlong(
|
||||
path: LngLat[],
|
||||
speed: number,
|
||||
timingFunction?: (t: number) => number,
|
||||
circleable?: boolean
|
||||
): void;
|
||||
/**
|
||||
* 以给定速度移动点标记到指定位置
|
||||
* @param lnglat 目标位置
|
||||
* @param speed 速度
|
||||
* @param timingFunction 缓动函数
|
||||
*/
|
||||
moveTo(
|
||||
lnglat: LocationValue,
|
||||
speed: number,
|
||||
timingFunction?: (t: number) => number
|
||||
): void;
|
||||
/**
|
||||
* 点标记停止动画
|
||||
*/
|
||||
stopMove(): void;
|
||||
/**
|
||||
* 暂定点标记的动画效果
|
||||
*/
|
||||
pauseMove(): boolean;
|
||||
/**
|
||||
* 重新开始点标记的动画效果
|
||||
*/
|
||||
resumeMove(): boolean;
|
||||
/**
|
||||
* 指定目标显示地图
|
||||
* @param map 地图
|
||||
*/
|
||||
setMap(map: null | Map): void;
|
||||
/**
|
||||
* 鼠标滑过点标时的文字提示
|
||||
* @param title 提示文字
|
||||
*/
|
||||
setTitle(title: string): void;
|
||||
/**
|
||||
* 获取点标记的文字提示
|
||||
*/
|
||||
getTitle(): string | undefined;
|
||||
/**
|
||||
* 设置是否展示在最顶层
|
||||
* @param isTop 是否展示在最顶层
|
||||
*/
|
||||
setTop(isTop: boolean): void;
|
||||
/**
|
||||
* 获取是否展示在最顶层
|
||||
*/
|
||||
getTop(): boolean;
|
||||
/**
|
||||
* 设置阴影效果
|
||||
* @param icon 阴影效果
|
||||
*/
|
||||
setShadow(icon?: Icon | string): void;
|
||||
/**
|
||||
* 获取阴影图标
|
||||
*/
|
||||
getShadow(): Icon | undefined | string;
|
||||
/**
|
||||
* 设置可点击区域
|
||||
* @param shape 可点击区域
|
||||
*/
|
||||
setShape(shape?: MarkerShape): void;
|
||||
/**
|
||||
* 获取可点击区域
|
||||
*/
|
||||
getShape(): MarkerShape | undefined;
|
||||
}
|
||||
}
|
||||
25
types/amap-js-api/overlay/markerShape.d.ts
vendored
Normal file
25
types/amap-js-api/overlay/markerShape.d.ts
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
declare namespace AMap {
|
||||
namespace MarkerShape {
|
||||
interface CircleOptions {
|
||||
type: 'circle';
|
||||
coords: [number, number, number];
|
||||
}
|
||||
interface PolyOptions {
|
||||
type: 'poly';
|
||||
coords: number[];
|
||||
}
|
||||
interface RectOptions {
|
||||
type: 'rect';
|
||||
coords: [number, number, number, number];
|
||||
}
|
||||
type Options = CircleOptions | PolyOptions | RectOptions;
|
||||
}
|
||||
|
||||
class MarkerShape extends EventEmitter {
|
||||
/**
|
||||
* Marker点击范围
|
||||
* @param options 选项
|
||||
*/
|
||||
constructor(options: MarkerShape.Options);
|
||||
}
|
||||
}
|
||||
75
types/amap-js-api/overlay/overlay.d.ts
vendored
Normal file
75
types/amap-js-api/overlay/overlay.d.ts
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
declare namespace AMap {
|
||||
namespace Overlay {
|
||||
interface EventMap<I> {
|
||||
touchstart: MapsEvent<'touchstart', I>;
|
||||
touchmove: MapsEvent<'touchmove', I>;
|
||||
touchend: MapsEvent<'touchend', I>;
|
||||
click: MapsEvent<'click', I>;
|
||||
rightclick: MapsEvent<'rightclick', I>;
|
||||
dblclick: MapsEvent<'dblclick', I>;
|
||||
mousemove: MapsEvent<'mousemove', I>;
|
||||
mouseover: MapsEvent<'mouseover', I>;
|
||||
mousedown: MapsEvent<'mousedown', I>;
|
||||
mouseup: MapsEvent<'mouseup', I>;
|
||||
}
|
||||
interface Options<ExtraData = any> {
|
||||
/**
|
||||
* 所属地图
|
||||
*/
|
||||
map?: Map;
|
||||
/**
|
||||
* 鼠标悬停时的鼠标样式
|
||||
*/
|
||||
cursor?: string;
|
||||
/**
|
||||
* 自定义数据
|
||||
*/
|
||||
extData?: ExtraData;
|
||||
/**
|
||||
* 事件是否穿透到地图
|
||||
*/
|
||||
bubble?: boolean;
|
||||
/**
|
||||
* 是否支持点击
|
||||
*/
|
||||
clickable?: boolean;
|
||||
/**
|
||||
* 是否支持拖拽
|
||||
*/
|
||||
draggable?: boolean;
|
||||
}
|
||||
}
|
||||
abstract class Overlay<ExtraData = any> extends EventEmitter {
|
||||
constructor(options?: Overlay.Options);
|
||||
/**
|
||||
* 显示覆盖物
|
||||
*/
|
||||
show(): void;
|
||||
/**
|
||||
* 隐藏覆盖物
|
||||
*/
|
||||
hide(): void;
|
||||
/**
|
||||
* 获取所属地图
|
||||
*/
|
||||
getMap(): Map | null | undefined;
|
||||
/**
|
||||
* 设置所属地图
|
||||
* @param map 地图
|
||||
*/
|
||||
setMap(map: Map | null): void;
|
||||
/**
|
||||
* 设置自定义数据
|
||||
* @param extData 自定义数据
|
||||
*/
|
||||
setExtData(extData: ExtraData): void;
|
||||
/**
|
||||
* 获取自定义数据
|
||||
*/
|
||||
getExtData(): ExtraData | {};
|
||||
|
||||
// internal
|
||||
setHeight(height?: number | string): void;
|
||||
getHeight(): number | string;
|
||||
}
|
||||
}
|
||||
82
types/amap-js-api/overlay/overlayGroup.d.ts
vendored
Normal file
82
types/amap-js-api/overlay/overlayGroup.d.ts
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
type ReferOverlayOptions<O> =
|
||||
O extends AMap.BezierCurve ? AMap.BezierCurve.Options
|
||||
: O extends AMap.Polyline ? AMap.Polyline.Options
|
||||
: O extends AMap.Circle ? AMap.Circle.Options
|
||||
: O extends AMap.Ellipse ? AMap.Ellipse.Options
|
||||
: O extends AMap.Polygon ? AMap.Polygon.Options
|
||||
: O extends AMap.Text ? AMap.Text.Options
|
||||
: O extends AMap.Marker ? AMap.Marker.Options
|
||||
: O extends AMap.Rectangle ? AMap.Rectangle.Options
|
||||
: any;
|
||||
|
||||
declare namespace AMap {
|
||||
class OverlayGroup<O extends Overlay = Overlay, ExtraData = any> extends Overlay<ExtraData> {
|
||||
/**
|
||||
* 覆盖物集合
|
||||
* @param overlays 覆盖物
|
||||
*/
|
||||
constructor(overlays?: O | O[]);
|
||||
/**
|
||||
* 添加单个覆盖物到集合中,不支持添加重复的覆盖物
|
||||
* @param overlay 覆盖物
|
||||
*/
|
||||
addOverlay(overlay: O | O[]): this;
|
||||
/**
|
||||
* 添加覆盖物数组到集合中,不支持添加重复的覆盖物
|
||||
* @param overlay 覆盖物数组
|
||||
*/
|
||||
addOverlays(overlay: O | O[]): this;
|
||||
/**
|
||||
* 返回当前集合中所有的覆盖物
|
||||
*/
|
||||
getOverlays(): O[];
|
||||
/**
|
||||
* 判断传入的覆盖物实例是否在集合中
|
||||
* @param overlay 覆盖物
|
||||
*/
|
||||
hasOverlay(overlay: O | ((this: null, item: O, index: number, list: O[]) => boolean)): boolean;
|
||||
/**
|
||||
* 从集合中删除传入的覆盖物实例
|
||||
* @param overlay 覆盖物
|
||||
*/
|
||||
removeOverlay(overlay: O | O[]): this;
|
||||
/**
|
||||
* 从集合中删除传入的覆盖物实例数组
|
||||
* @param overlay 覆盖物数组
|
||||
*/
|
||||
removeOverlays(overlay: O | O[]): this;
|
||||
/**
|
||||
* 清空集合
|
||||
*/
|
||||
clearOverlays(): this;
|
||||
/**
|
||||
* 对集合中的覆盖物做迭代操作
|
||||
* @param iterator 迭代回调
|
||||
* @param context 执行上下文
|
||||
*/
|
||||
eachOverlay<C = O>(iterator: (this: C, overlay: O, index: number, overlays: O[]) => void, context?: C): this;
|
||||
/**
|
||||
* 指定集合中里覆盖物的显示地图
|
||||
* @param map 地图
|
||||
*/
|
||||
setMap(map: null | Map): this;
|
||||
/**
|
||||
* 修改覆盖物属性
|
||||
* @param options 属性
|
||||
*/
|
||||
setOptions(options: ReferOverlayOptions<O>): this;
|
||||
/**
|
||||
* 在地图上显示集合中覆盖物
|
||||
*/
|
||||
show(): this;
|
||||
/**
|
||||
* 在地图上隐藏集合中覆盖物
|
||||
*/
|
||||
hide(): this;
|
||||
/**
|
||||
* 查找集合中的覆盖物
|
||||
* @param finder 查找回调
|
||||
*/
|
||||
getOverlay(finder: ((this: null, item: O, index: number, list: O[]) => boolean) | O): O | null;
|
||||
}
|
||||
}
|
||||
50
types/amap-js-api/overlay/pathOverlay.d.ts
vendored
Normal file
50
types/amap-js-api/overlay/pathOverlay.d.ts
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
declare namespace AMap {
|
||||
namespace PathOverlay {
|
||||
interface EventMap<I = PathOverlay> extends ShapeOverlay.EventMap<I> { }
|
||||
interface Options<ExtraData = any> extends Overlay.Options<ExtraData> {
|
||||
/**
|
||||
* 是否可见
|
||||
*/
|
||||
visible?: boolean;
|
||||
/**
|
||||
* 覆盖物层级
|
||||
*/
|
||||
zIndex?: number;
|
||||
/**
|
||||
* 描边线条颜色
|
||||
*/
|
||||
strokeColor?: string;
|
||||
/**
|
||||
* 描边线条透明度
|
||||
*/
|
||||
strokeOpacity?: number;
|
||||
/**
|
||||
* 描边宽度
|
||||
*/
|
||||
strokeWeight?: number;
|
||||
/**
|
||||
* 描边样式
|
||||
*/
|
||||
strokeStyle?: StrokeStyle;
|
||||
/**
|
||||
* 虚线间隔
|
||||
*/
|
||||
strokeDasharray?: number[];
|
||||
/**
|
||||
* 折线拐点的绘制样式
|
||||
*/
|
||||
lineJoin?: StrokeLineJoin;
|
||||
/**
|
||||
* 折线两端线帽的绘制样式
|
||||
*/
|
||||
lineCap?: StrokeLineCap;
|
||||
}
|
||||
}
|
||||
abstract class PathOverlay<ExtraData = any> extends ShapeOverlay<ExtraData> {
|
||||
constructor(options?: PathOverlay.Options<ExtraData>);
|
||||
/**
|
||||
* 获取范围
|
||||
*/
|
||||
getBounds(): Bounds | (this extends Rectangle ? undefined : null);
|
||||
}
|
||||
}
|
||||
78
types/amap-js-api/overlay/polygon.d.ts
vendored
Normal file
78
types/amap-js-api/overlay/polygon.d.ts
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
declare namespace AMap {
|
||||
namespace Polygon {
|
||||
interface EventMap<I = Polygon> extends PathOverlay.EventMap<I> { }
|
||||
interface Options<ExtraData = any> extends PathOverlay.Options<ExtraData> {
|
||||
/**
|
||||
* 多边形轮廓线的节点坐标数组
|
||||
*/
|
||||
path?: LocationValue[] | LocationValue[][];
|
||||
/**
|
||||
* 多边形填充颜色
|
||||
*/
|
||||
fillColor?: string;
|
||||
/**
|
||||
* 边形填充透明度
|
||||
*/
|
||||
fillOpacity?: number;
|
||||
}
|
||||
|
||||
interface GetOptionsResult<ExtraData = any> extends ShapeOverlay.GetOptionsResult<ExtraData> {
|
||||
/**
|
||||
* 多边形填充颜色
|
||||
*/
|
||||
fillColor: string;
|
||||
/**
|
||||
* 边形填充透明度
|
||||
*/
|
||||
fillOpacity: number;
|
||||
/**
|
||||
* 多边形轮廓线的节点坐标数组
|
||||
*/
|
||||
path: LngLat[] | LngLat[][];
|
||||
/**
|
||||
* 折线拐点的绘制样式
|
||||
*/
|
||||
lineJoin: StrokeLineJoin;
|
||||
texture: string;
|
||||
}
|
||||
}
|
||||
|
||||
class Polygon<ExtraData = any> extends PathOverlay<ExtraData> {
|
||||
/**
|
||||
* 多边形
|
||||
* @param options 选项
|
||||
*/
|
||||
constructor(options?: Polygon.Options<ExtraData>);
|
||||
/**
|
||||
* 设置多边形轮廓线节点数组
|
||||
* @param path 轮廓线节点
|
||||
*/
|
||||
setPath(path: LocationValue[] | LocationValue[][]): void;
|
||||
/**
|
||||
* 获取多边形轮廓线节点数组
|
||||
*/
|
||||
getPath(): LngLat[] | LngLat[][];
|
||||
/**
|
||||
* 修改多边形属性
|
||||
* @param options 属性
|
||||
*/
|
||||
setOptions(options: Polygon.Options<ExtraData>): void;
|
||||
/**
|
||||
* 获取多边形的属性
|
||||
*/
|
||||
getOptions(): Partial<
|
||||
this extends Omit<Ellipse, keyof Polygon> ? Ellipse.GetOptionsResult<ExtraData> :
|
||||
this extends Omit<Rectangle, keyof Polygon> ? Rectangle.GetOptionsResult<ExtraData> :
|
||||
Polygon.GetOptionsResult<ExtraData>
|
||||
>;
|
||||
/**
|
||||
* 获取多边形的面积
|
||||
*/
|
||||
getArea(): number;
|
||||
/**
|
||||
* 判断指定点坐标是否在多边形范围内
|
||||
* @param point 坐标
|
||||
*/
|
||||
contains(point: LocationValue): boolean;
|
||||
}
|
||||
}
|
||||
119
types/amap-js-api/overlay/polyline.d.ts
vendored
Normal file
119
types/amap-js-api/overlay/polyline.d.ts
vendored
Normal file
@@ -0,0 +1,119 @@
|
||||
declare namespace AMap {
|
||||
namespace Polyline {
|
||||
interface EventMap<I = Polyline> extends PathOverlay.EventMap<I> { }
|
||||
interface GetOptionsResult<ExtraData = any> extends ShapeOverlay.GetOptionsResult<ExtraData> {
|
||||
/**
|
||||
* 线条是否带描边
|
||||
*/
|
||||
isOutline: boolean;
|
||||
/**
|
||||
* 线条描边颜色
|
||||
*/
|
||||
outlineColor: string;
|
||||
/**
|
||||
* 是否绘制成大地线
|
||||
*/
|
||||
geodesic: boolean;
|
||||
/**
|
||||
* 折线的节点数组
|
||||
*/
|
||||
path: LngLat[];
|
||||
/**
|
||||
* 折线拐点的绘制样式
|
||||
*/
|
||||
lineJoin: StrokeLineJoin;
|
||||
/**
|
||||
* 折线两端线帽的绘制样式
|
||||
*/
|
||||
lineCap: StrokeLineCap;
|
||||
/**
|
||||
* 描边的宽度
|
||||
*/
|
||||
borderWeight: number;
|
||||
/**
|
||||
* 是否延路径显示方向箭头
|
||||
*/
|
||||
showDir: boolean;
|
||||
/**
|
||||
* 方向箭头颜色
|
||||
*/
|
||||
dirColor: string;
|
||||
/**
|
||||
* 方向箭头图片
|
||||
*/
|
||||
dirImg: string;
|
||||
}
|
||||
|
||||
interface Options<ExtraData = any> extends PathOverlay.Options<ExtraData> {
|
||||
/**
|
||||
* 线条是否带描边
|
||||
*/
|
||||
isOutline?: boolean;
|
||||
/**
|
||||
* 线条描边颜色
|
||||
*/
|
||||
outlineColor?: string;
|
||||
/**
|
||||
* 是否绘制成大地线
|
||||
*/
|
||||
geodesic?: boolean;
|
||||
/**
|
||||
* 方向箭头颜色
|
||||
*/
|
||||
dirColor?: string;
|
||||
/**
|
||||
* 描边的宽度
|
||||
*/
|
||||
borderWeight?: number;
|
||||
/**
|
||||
* 是否延路径显示方向箭头
|
||||
*/
|
||||
showDir?: boolean;
|
||||
|
||||
// internal
|
||||
/**
|
||||
* 折线的节点数组
|
||||
*/
|
||||
path?: LocationValue[];
|
||||
}
|
||||
}
|
||||
|
||||
class Polyline<ExtraData = any> extends PathOverlay<ExtraData> {
|
||||
/**
|
||||
* 折线
|
||||
* @param options 选项
|
||||
*/
|
||||
constructor(options?: BezierCurve.Options<ExtraData> | Polyline.Options<ExtraData>);
|
||||
/**
|
||||
* 设置组成该折线的节点数组
|
||||
* @param path 节点数组
|
||||
*/
|
||||
setPath(
|
||||
path: this extends Omit<BezierCurve, keyof Polyline> ?
|
||||
Array<Array<number | string | Array<string | number>>>
|
||||
: LocationValue[]
|
||||
): void;
|
||||
/**
|
||||
* 获取折线路径的节点数组
|
||||
*/
|
||||
getPath(): this extends Omit<BezierCurve, keyof Polyline> ?
|
||||
Array<LngLat & { controlPoints: LngLat[] }>
|
||||
: LngLat[];
|
||||
/**
|
||||
* 获取折线的总长度(单位:米)
|
||||
*/
|
||||
getLength(): number;
|
||||
/**
|
||||
* 设置线的属性
|
||||
* @param options 属性
|
||||
*/
|
||||
setOptions(options: this extends Omit<BezierCurve, keyof Polyline> ?
|
||||
Partial<BezierCurve.Options<ExtraData>>
|
||||
: Polyline.Options<ExtraData>
|
||||
): void;
|
||||
/**
|
||||
* 获取线的属性
|
||||
*/
|
||||
getOptions(): Partial<Polyline.GetOptionsResult<ExtraData>>;
|
||||
}
|
||||
}
|
||||
43
types/amap-js-api/overlay/rectangle.d.ts
vendored
Normal file
43
types/amap-js-api/overlay/rectangle.d.ts
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
declare namespace AMap {
|
||||
namespace Rectangle {
|
||||
interface EventMap<I = Rectangle> extends Polygon.EventMap<I> {
|
||||
setBounds: Event<'setBounds'>;
|
||||
}
|
||||
|
||||
interface Options<ExtraData = any> extends Polygon.Options<ExtraData> {
|
||||
/**
|
||||
* 矩形的范围
|
||||
*/
|
||||
bounds?: Bounds;
|
||||
}
|
||||
type GetOptionsResult<ExtraData = any> = Merge<Polygon.GetOptionsResult<ExtraData>, {
|
||||
/**
|
||||
* 路径节点数组
|
||||
*/
|
||||
path: LngLat[];
|
||||
/**
|
||||
* 矩形的范围
|
||||
*/
|
||||
bounds: Bounds;
|
||||
texture: string;
|
||||
}>;
|
||||
}
|
||||
class Rectangle<ExtraData = any> extends Polygon<ExtraData> {
|
||||
/**
|
||||
* 矩形
|
||||
* @param options 选项
|
||||
*/
|
||||
constructor(options?: Rectangle.Options<ExtraData>);
|
||||
/**
|
||||
* 获取矩形范围
|
||||
* @param bounds 矩形的范围
|
||||
* @param preventEvent 阻止触发事件
|
||||
*/
|
||||
setBounds(bounds: Bounds, preventEvent?: boolean): void;
|
||||
/**
|
||||
* 修改矩形属性
|
||||
* @param options 属性
|
||||
*/
|
||||
setOptions(options: Partial<Rectangle.Options>): void;
|
||||
}
|
||||
}
|
||||
80
types/amap-js-api/overlay/shapeOverlay.d.ts
vendored
Normal file
80
types/amap-js-api/overlay/shapeOverlay.d.ts
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
declare namespace AMap {
|
||||
namespace ShapeOverlay {
|
||||
interface EventMap<I = ShapeOverlay> extends Overlay.EventMap<I> {
|
||||
show: Event<'show', { target: I }>;
|
||||
hide: Event<'hide', { target: I }>;
|
||||
options: Event<'options'>;
|
||||
change: Event<'change', { target: I }>;
|
||||
}
|
||||
interface GetOptionsResult<ExtraData = any> {
|
||||
/**
|
||||
* 所属地图
|
||||
*/
|
||||
map: Map;
|
||||
/**
|
||||
* 层级
|
||||
*/
|
||||
zIndex: number;
|
||||
/**
|
||||
* 线条颜色
|
||||
*/
|
||||
strokeColor: string;
|
||||
/**
|
||||
* 线条透明度
|
||||
*/
|
||||
strokeOpacity: number;
|
||||
/**
|
||||
* 线条宽度
|
||||
*/
|
||||
strokeWeight: number;
|
||||
/**
|
||||
* 线条样式,虚线或者实线
|
||||
*/
|
||||
strokeStyle: StrokeStyle;
|
||||
/**
|
||||
* 虚线的分段
|
||||
*/
|
||||
strokeDasharray: number[];
|
||||
/**
|
||||
* 自定义属性
|
||||
*/
|
||||
extData: ExtraData | {};
|
||||
/**
|
||||
* 事件是否穿透到地图
|
||||
*/
|
||||
bubble: boolean;
|
||||
/**
|
||||
* 是否支持点击
|
||||
*/
|
||||
clickable: boolean;
|
||||
}
|
||||
}
|
||||
abstract class ShapeOverlay<ExtraData = any> extends Overlay<ExtraData> {
|
||||
/**
|
||||
* 设置覆盖物属性
|
||||
* @param options 属性
|
||||
*/
|
||||
abstract setOptions(options: {}): void;
|
||||
/**
|
||||
* 获得属性
|
||||
*/
|
||||
abstract getOptions(): {};
|
||||
/**
|
||||
* 获得层级
|
||||
*/
|
||||
getzIndex(): number;
|
||||
/**
|
||||
* 设置层级
|
||||
* @param zIndex 层级
|
||||
*/
|
||||
setzIndex(zIndex: number): void;
|
||||
/**
|
||||
* 返回可见
|
||||
*/
|
||||
getVisible(): boolean;
|
||||
/**
|
||||
* 设置是否可以拖拽
|
||||
*/
|
||||
setDraggable(draggable: boolean): void;
|
||||
}
|
||||
}
|
||||
41
types/amap-js-api/overlay/text.d.ts
vendored
Normal file
41
types/amap-js-api/overlay/text.d.ts
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
declare namespace AMap {
|
||||
namespace Text {
|
||||
type TextAlign = 'left' | 'right' | 'center';
|
||||
type VerticalAlign = 'top' | 'middle' | 'bottom';
|
||||
interface EventMap<I = Text> extends Marker.EventMap<I> { }
|
||||
interface Options extends Marker.Options {
|
||||
/**
|
||||
* 文本内容
|
||||
*/
|
||||
text?: string;
|
||||
/**
|
||||
* 对齐方式
|
||||
*/
|
||||
textAlign?: TextAlign;
|
||||
|
||||
verticalAlign?: VerticalAlign;
|
||||
}
|
||||
}
|
||||
|
||||
class Text<ExtraData = any> extends Marker<ExtraData> {
|
||||
/**
|
||||
* 纯文本标记
|
||||
* @param options 选项
|
||||
*/
|
||||
constructor(options?: Text.Options);
|
||||
/**
|
||||
* 标记显示的文本内容
|
||||
*/
|
||||
getText(): string;
|
||||
/**
|
||||
* 修改文本内容
|
||||
* @param text 文本内容
|
||||
*/
|
||||
setText(text: string): void;
|
||||
/**
|
||||
* 设置文本样式
|
||||
* @param style 文本样式
|
||||
*/
|
||||
setStyle(style: object): void;
|
||||
}
|
||||
}
|
||||
36
types/amap-js-api/pixel.d.ts
vendored
Normal file
36
types/amap-js-api/pixel.d.ts
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
declare namespace AMap {
|
||||
class Pixel {
|
||||
/**
|
||||
* 像素坐标,确定地图上的一个像素点
|
||||
* @param x 横轴坐标
|
||||
* @param y 纵轴坐标
|
||||
* @param round 是否四舍五入
|
||||
*/
|
||||
constructor(x: number, y: number, round?: boolean);
|
||||
/**
|
||||
* 获得X方向像素坐标
|
||||
*/
|
||||
getX(): number;
|
||||
/**
|
||||
* 获得Y方向像素坐标
|
||||
*/
|
||||
getY(): number;
|
||||
/**
|
||||
* 当前像素坐标与传入像素坐标是否相等
|
||||
* @param point 目标像素坐标
|
||||
*/
|
||||
equals(point: Pixel): boolean;
|
||||
/**
|
||||
* 以字符串形式返回像素坐标对象
|
||||
*/
|
||||
toString(): string;
|
||||
|
||||
// internal
|
||||
add(offset: {x: number; y: number}, round?: boolean): Pixel;
|
||||
round(): Pixel;
|
||||
floor(): Pixel;
|
||||
length(): number;
|
||||
direction(): null | number;
|
||||
toFixed(decimals?: number): this;
|
||||
}
|
||||
}
|
||||
25
types/amap-js-api/size.d.ts
vendored
Normal file
25
types/amap-js-api/size.d.ts
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
declare namespace AMap {
|
||||
class Size {
|
||||
/**
|
||||
* 地物对象的像素尺寸
|
||||
* @param width 宽度像素
|
||||
* @param height 长度像素
|
||||
*/
|
||||
constructor(width: number, height: number);
|
||||
/**
|
||||
* 获得宽度
|
||||
*/
|
||||
getWidth(): number;
|
||||
/**
|
||||
* 获得高度
|
||||
*/
|
||||
getHeight(): number;
|
||||
/**
|
||||
* 以字符串形式返回尺寸大小对象
|
||||
*/
|
||||
toString(): string;
|
||||
|
||||
// internal
|
||||
contains(size: { x: number; y: number }): boolean;
|
||||
}
|
||||
}
|
||||
66
types/amap-js-api/tsconfig.json
Normal file
66
types/amap-js-api/tsconfig.json
Normal file
@@ -0,0 +1,66 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noEmit": true,
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"array-bounds.d.ts",
|
||||
"bounds.d.ts",
|
||||
"browser.d.ts",
|
||||
"common.d.ts",
|
||||
"convert-from.d.ts",
|
||||
"dom-util.d.ts",
|
||||
"event.d.ts",
|
||||
"geometry-util.d.ts",
|
||||
"index.d.ts",
|
||||
"layer/building.d.ts",
|
||||
"layer/flexible.d.ts",
|
||||
"layer/layer.d.ts",
|
||||
"layer/layerGroup.d.ts",
|
||||
"layer/massMarks.d.ts",
|
||||
"layer/mediaLayer.d.ts",
|
||||
"layer/tileLayer.d.ts",
|
||||
"layer/wms.d.ts",
|
||||
"layer/wmts.d.ts",
|
||||
"lngLat.d.ts",
|
||||
"map.d.ts",
|
||||
"overlay/bezierCurve.d.ts",
|
||||
"overlay/circle.d.ts",
|
||||
"overlay/circleMarker.d.ts",
|
||||
"overlay/contextMenu.d.ts",
|
||||
"overlay/ellipse.d.ts",
|
||||
"overlay/geoJSON.d.ts",
|
||||
"overlay/icon.d.ts",
|
||||
"overlay/infoWindow.d.ts",
|
||||
"overlay/marker.d.ts",
|
||||
"overlay/markerShape.d.ts",
|
||||
"overlay/overlay.d.ts",
|
||||
"overlay/overlayGroup.d.ts",
|
||||
"overlay/pathOverlay.d.ts",
|
||||
"overlay/polygon.d.ts",
|
||||
"overlay/polyline.d.ts",
|
||||
"overlay/rectangle.d.ts",
|
||||
"overlay/shapeOverlay.d.ts",
|
||||
"overlay/text.d.ts",
|
||||
"pixel.d.ts",
|
||||
"size.d.ts",
|
||||
"type-util.d.ts",
|
||||
"util.d.ts",
|
||||
"view2D.d.ts",
|
||||
"amap-js-api-tests.ts"
|
||||
]
|
||||
}
|
||||
12
types/amap-js-api/type-util.d.ts
vendored
Normal file
12
types/amap-js-api/type-util.d.ts
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
type Omit<T, E extends keyof T> = {
|
||||
[K in Exclude<keyof T, E>]: T[K]
|
||||
};
|
||||
|
||||
type OptionalKey<T> = { [K in keyof T]-?: undefined extends T[K] ? K : never }[keyof T];
|
||||
// type OmitUndefined<M> = Omit<M, { [K in keyof M]: M[K] extends undefined ? K : never }[keyof M]>;
|
||||
// type PickUndefined<M> = Omit<M, keyof OmitUndefined<M>>;
|
||||
|
||||
type Merge<O, T> =
|
||||
{ [K in Exclude<keyof O, keyof T | OptionalKey<O>>]-?: O[K]; } &
|
||||
{ [K in Extract<Exclude<keyof O, keyof T>, OptionalKey<O>>]?: O[K]; } &
|
||||
T;
|
||||
76
types/amap-js-api/util.d.ts
vendored
Normal file
76
types/amap-js-api/util.d.ts
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
declare namespace AMap {
|
||||
namespace Util {
|
||||
/**
|
||||
* 将颜色名转换为16进制RGB颜色值
|
||||
* @param colorName 颜色名
|
||||
*/
|
||||
function colorNameToHex(colorName: string): string;
|
||||
/**
|
||||
* 将16进制RGB转为rgba(R,G,B,A)
|
||||
* @param hex 16进制RGB
|
||||
*/
|
||||
function rgbHex2Rgba(hex: string): string;
|
||||
/**
|
||||
* 将16进制RGBA转为rgba(R,G,B,A)
|
||||
* @param hex 16进制RGBA
|
||||
*/
|
||||
function argbHex2Rgba(hex: string): string;
|
||||
/**
|
||||
* 判断一个对象是都为空
|
||||
* @param obj 目标对象
|
||||
*/
|
||||
function isEmpty(obj: object): boolean;
|
||||
/**
|
||||
* 从数组删除元素
|
||||
* @param array 数组
|
||||
* @param item 元素
|
||||
*/
|
||||
function deleteItemFromArray<T = any>(array: T[], item: T): T[];
|
||||
/**
|
||||
* 按索引删除数组元素
|
||||
* @param array 数组
|
||||
* @param index 索引
|
||||
*/
|
||||
function deleteItemFromArrayByIndex<T = any>(array: T[], index: number): T[];
|
||||
/**
|
||||
* 返回元素索引
|
||||
* @param array 数组
|
||||
* @param item 元素
|
||||
*/
|
||||
function indexOf<T = any>(array: T[], item: T): number;
|
||||
/**
|
||||
* 保留小数点后指定位
|
||||
* @param floatNumber 数值
|
||||
* @param digits 小数点位数
|
||||
*/
|
||||
function format(floatNumber: number, digits?: number): number;
|
||||
/**
|
||||
* 判断是否数组
|
||||
* @param data 判断对象
|
||||
*/
|
||||
function isArray(data: any): data is any[];
|
||||
/**
|
||||
* 判断参数是否为DOM元素
|
||||
* @param data 判断对象
|
||||
*/
|
||||
function isDOM(data: any): data is HTMLElement;
|
||||
/**
|
||||
* 判断数组是否包含某个元素
|
||||
* @param array 数组
|
||||
* @param item 元素
|
||||
*/
|
||||
function includes<T = any>(array: T[], item: T): boolean;
|
||||
|
||||
function requestIdleCallback(callback: (...args: any[]) => any, options?: { timeout?: number }): number;
|
||||
|
||||
function cancelIdleCallback(handle: number): void;
|
||||
|
||||
function requestAnimFrame<C = undefined>(callback: (this: C, ...args: any[]) => any, context?: C): number;
|
||||
|
||||
function cancelAnimFrame(handle: number): void;
|
||||
|
||||
function color2RgbaArray(color: string | number[]): [number, number, number, number];
|
||||
|
||||
function color2Rgba(color: string | number[]): string;
|
||||
}
|
||||
}
|
||||
29
types/amap-js-api/view2D.d.ts
vendored
Normal file
29
types/amap-js-api/view2D.d.ts
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
declare namespace AMap {
|
||||
namespace View2D {
|
||||
interface Options {
|
||||
/**
|
||||
* 地图中心点坐标值
|
||||
*/
|
||||
center?: LocationValue;
|
||||
/**
|
||||
* 地图顺时针旋转角度
|
||||
*/
|
||||
rotation?: number;
|
||||
/**
|
||||
* 地图显示的缩放级别
|
||||
*/
|
||||
zoom?: number;
|
||||
/**
|
||||
* 地图显示的参考坐标系
|
||||
*/
|
||||
crs?: 'EPGS3857' | 'EPGS3395' | 'EPGS4326';
|
||||
}
|
||||
}
|
||||
class View2D extends EventEmitter {
|
||||
/**
|
||||
* 二维地图显示视口,用于定义二维地图静态显示属性
|
||||
* @param options 选项
|
||||
*/
|
||||
constructor(options?: View2D.Options);
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"npm-naming": false,
|
||||
"eofline": false,
|
||||
"export-just-namespace": false,
|
||||
"import-spacing": false,
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"npm-naming": false,
|
||||
"eofline": false,
|
||||
"export-just-namespace": false,
|
||||
"import-spacing": false,
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"npm-naming": false,
|
||||
"eofline": false,
|
||||
"export-just-namespace": false,
|
||||
"import-spacing": false,
|
||||
|
||||
@@ -14,6 +14,14 @@ amqp.connect('amqp://localhost')
|
||||
|
||||
amqp.connect('amqp://localhost')
|
||||
.then(connection => {
|
||||
connection.serverProperties.copyright; // $ExpectType string | undefined
|
||||
connection.serverProperties.platform; // $ExpectType string
|
||||
connection.serverProperties.information; // $ExpectType string
|
||||
connection.serverProperties.host; // $ExpectType string
|
||||
connection.serverProperties.product; // $ExpectType string
|
||||
connection.serverProperties.version; // $ExpectType string
|
||||
connection.serverProperties.customField; // $ExpectType string | undefined
|
||||
|
||||
return connection.createChannel()
|
||||
.tap(channel => channel.checkQueue('myQueue'))
|
||||
.then(channel => {
|
||||
@@ -37,6 +45,14 @@ import amqpcb = require('amqplib/callback_api');
|
||||
|
||||
amqpcb.connect('amqp://localhost', (err, connection) => {
|
||||
if (!err) {
|
||||
connection.serverProperties.copyright; // $ExpectType string | undefined
|
||||
connection.serverProperties.platform; // $ExpectType string
|
||||
connection.serverProperties.information; // $ExpectType string
|
||||
connection.serverProperties.host; // $ExpectType string
|
||||
connection.serverProperties.product; // $ExpectType string
|
||||
connection.serverProperties.version; // $ExpectType string
|
||||
connection.serverProperties.customField; // $ExpectType string | undefined
|
||||
|
||||
connection.createChannel((err, channel) => {
|
||||
if (!err) {
|
||||
channel.assertQueue('myQueue', {}, (err, ok) => {
|
||||
|
||||
3
types/amqplib/callback_api.d.ts
vendored
3
types/amqplib/callback_api.d.ts
vendored
@@ -1,11 +1,12 @@
|
||||
import events = require('events');
|
||||
import { Replies, Options, Message } from './properties';
|
||||
import { Replies, Options, Message, ServerProperties } from './properties';
|
||||
export * from './properties';
|
||||
|
||||
export interface Connection extends events.EventEmitter {
|
||||
close(callback?: (err: any) => void): void;
|
||||
createChannel(callback: (err: any, channel: Channel) => void): void;
|
||||
createConfirmChannel(callback: (err: any, confirmChannel: ConfirmChannel) => void): void;
|
||||
serverProperties: ServerProperties;
|
||||
}
|
||||
|
||||
export interface Channel extends events.EventEmitter {
|
||||
|
||||
3
types/amqplib/index.d.ts
vendored
3
types/amqplib/index.d.ts
vendored
@@ -8,13 +8,14 @@
|
||||
|
||||
import * as Promise from 'bluebird';
|
||||
import * as events from 'events';
|
||||
import { Replies, Options, Message, GetMessage, ConsumeMessage } from './properties';
|
||||
import { Replies, Options, Message, GetMessage, ConsumeMessage, ServerProperties } from './properties';
|
||||
export * from './properties';
|
||||
|
||||
export interface Connection extends events.EventEmitter {
|
||||
close(): Promise<void>;
|
||||
createChannel(): Promise<Channel>;
|
||||
createConfirmChannel(): Promise<ConfirmChannel>;
|
||||
serverProperties: ServerProperties;
|
||||
}
|
||||
|
||||
export interface Channel extends events.EventEmitter {
|
||||
|
||||
10
types/amqplib/properties.d.ts
vendored
10
types/amqplib/properties.d.ts
vendored
@@ -210,3 +210,13 @@ export interface XDeath {
|
||||
"original-expiration"?: any;
|
||||
"routing-keys": string[];
|
||||
}
|
||||
|
||||
export interface ServerProperties {
|
||||
host: string;
|
||||
product: string;
|
||||
version: string;
|
||||
platform: string;
|
||||
copyright?: string;
|
||||
information: string;
|
||||
[key: string]: string | undefined;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"npm-naming": false,
|
||||
"eofline": false,
|
||||
"export-just-namespace": false,
|
||||
"import-spacing": false,
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"npm-naming": false,
|
||||
"eofline": false,
|
||||
"export-just-namespace": false,
|
||||
"import-spacing": false,
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"npm-naming": false,
|
||||
"eofline": false,
|
||||
"export-just-namespace": false,
|
||||
"import-spacing": false,
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"npm-naming": false,
|
||||
"eofline": false,
|
||||
"export-just-namespace": false,
|
||||
"import-spacing": false,
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"npm-naming": false,
|
||||
"eofline": false,
|
||||
"export-just-namespace": false,
|
||||
"import-spacing": false,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user