@2gis/mapgl
Advanced tools
Comparing version 1.0.0 to 1.2.0
{ | ||
"name": "@2gis/mapgl", | ||
"version": "1.0.0", | ||
"version": "1.2.0", | ||
"description": "MapGL API script loader with typings", | ||
"main": "dist/index.js", | ||
"typings": "dist/index.d.ts", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://gitlab.2gis.ru/WebMaps/jakarta.git", | ||
"directory": "packages/mapgl" | ||
}, | ||
"scripts": { | ||
"build": "npm run build:sdk-typings && npm run build:loader", | ||
"build:loader": "rm -rf dist | true && tsc -d --outDir dist", | ||
"build:sdk-typings": "rm -rf types | true && cd ../../ && npm run build:typings && cp -r dist/es6/sdk packages/mapgl/types", | ||
"build": "npm run typings && npm run build:loader", | ||
"build:loader": "rm -rf dist | true && tsc -p tsconfig.build.json -d --outDir dist", | ||
"build:example": "cd example && rm -rf dist && webpack --production", | ||
"watch": "tsc --watch" | ||
"typings": "cp -rf ./node_modules/@webmaps/mapgl-api/dist/types ./", | ||
"clean": "rm -rf types dist" | ||
}, | ||
@@ -21,2 +26,5 @@ "author": "", | ||
], | ||
"dependencies": { | ||
"@webmaps/mapgl-api": "*" | ||
}, | ||
"devDependencies": { | ||
@@ -23,0 +31,0 @@ "ts-loader": "^7.0.1", |
# @2gis/mapgl | ||
Async loader for [2gis MapGL API](https://mapgl-docs.2gis.com/) with typings. | ||
Async loader for [2gis MapGL API](https://docs.2gis.com/en/mapgl/overview) with typings. | ||
@@ -5,0 +5,0 @@ **Browser usage only!** |
export declare const scriptUrl = "https://mapgl.2gis.com/api/js"; | ||
export declare const defaultControls: { | ||
zoomControl: boolean; | ||
geoControl: boolean; | ||
trafficControl: boolean; | ||
rulerControl: boolean; | ||
rotationControl: boolean; | ||
copyright: boolean; | ||
}; |
@@ -1,2 +0,2 @@ | ||
import { Control } from '..'; | ||
import { Control } from '../control'; | ||
import { Map } from '../../map'; | ||
@@ -3,0 +3,0 @@ import { ControlOptions } from '../../types'; |
@@ -9,5 +9,6 @@ import { Map } from './map'; | ||
import { Polygon } from './objects/polygon'; | ||
import { Control } from './controls'; | ||
import { Control } from './controls/control'; | ||
import { ZoomControl } from './controls/zoom'; | ||
export { Map, Marker, Label, HtmlMarker, Control, ZoomControl, CircleMarker, Circle, Polygon, Polyline, }; | ||
import { TrafficControl } from './controls/traffic'; | ||
export { Map, Marker, Label, HtmlMarker, Control, ZoomControl, TrafficControl, CircleMarker, Circle, Polygon, Polyline, }; | ||
export { AnimationOptions, RotationAnimationOptions, Easing } from './types/animations'; | ||
@@ -14,0 +15,0 @@ export { MapOptions, MarkerOptions, LabelOptions, ControlOptions, HtmlMarkerOptions, LngLatBounds, CircleMarkerOptions, CircleOptions, PolygonOptions, PolylineOptions, } from './types'; |
@@ -120,2 +120,24 @@ import { MapOptions, LngLatBounds } from './types'; | ||
/** | ||
* Shows the traffic layer on the map. | ||
*/ | ||
showTraffic(): this; | ||
/** | ||
* Hides the traffic layer from the map. | ||
*/ | ||
hideTraffic(): this; | ||
/** | ||
* Sets options that affect the map style. | ||
* @param options The style options. | ||
* | ||
* @hidden | ||
*/ | ||
setStyleOptions(options: { | ||
traffic: boolean; | ||
}): this; | ||
/** | ||
* Selects objects on the map by identifiers. | ||
* @param ids An array of identifiers of objects that should be selected. | ||
*/ | ||
setSelectedObjects(ids?: string[]): this; | ||
/** | ||
* Destroys the map and frees all related resources. | ||
@@ -122,0 +144,0 @@ */ |
@@ -27,3 +27,3 @@ import { Map } from '../map'; | ||
*/ | ||
setCoordinates(coordinates: number[]): void; | ||
setCoordinates(coordinates: number[]): this; | ||
/** | ||
@@ -33,3 +33,3 @@ * Sets the anchor relative to the top-left corner of the HTML marker. | ||
*/ | ||
setAnchor(anchor: number[]): void; | ||
setAnchor(anchor: number[]): this; | ||
/** | ||
@@ -39,3 +39,3 @@ * Sets the HTML content of the HTML marker. | ||
*/ | ||
setContent(html: HTMLElement | string): void; | ||
setContent(html: HTMLElement | string): this; | ||
/** | ||
@@ -42,0 +42,0 @@ * Returns current position of the top-left corner of the HTML marker with its anchor in geographical coordinates `[longitude, latitude]`. |
@@ -28,7 +28,7 @@ import { Map } from '../map'; | ||
*/ | ||
show(): void; | ||
show(): this; | ||
/** | ||
* Hides the label. | ||
*/ | ||
hide(): void; | ||
hide(): this; | ||
/** | ||
@@ -38,3 +38,3 @@ * Sets geographical coordinates of the label. | ||
*/ | ||
setCoordinates(coordinates: number[]): void; | ||
setCoordinates(coordinates: number[]): this; | ||
/** | ||
@@ -41,0 +41,0 @@ * Returns geographical coordinates `[longitude, latitude]` of the label. |
@@ -24,3 +24,3 @@ import { Map } from '../map'; | ||
*/ | ||
setCoordinates(coordinates: number[]): void; | ||
setCoordinates(coordinates: number[]): this; | ||
/** | ||
@@ -33,7 +33,7 @@ * Returns current marker center in geographical coordinates `[longitude, latitude]`. | ||
*/ | ||
show(): void; | ||
show(): this; | ||
/** | ||
* Hides the marker. | ||
*/ | ||
hide(): void; | ||
hide(): this; | ||
/** | ||
@@ -40,0 +40,0 @@ * Destroys the marker. |
@@ -31,4 +31,4 @@ /** | ||
/** | ||
* A set of [https://easings.net/en](easing functions). | ||
* A set of easing functions (https://easings.net/en). | ||
*/ | ||
export declare type Easing = 'linear' | 'easeInQuad' | 'easeOutQuad' | 'easeInOutQuad' | 'easeInCubic' | 'easeOutCubic' | 'easeInOutCubic' | 'easeInQuart' | 'easeOutQuart' | 'easeInOutQuart' | 'easeInQuint' | 'easeOutQuint' | 'easeInOutQuint' | 'easeInSine' | 'easeOutSine' | 'easeInOutSine' | 'easeInExpo' | 'easeOutExpo' | 'easeInOutExpo' | 'easeInCirc' | 'easeOutCirc' | 'easeInOutCirc' | 'easeInElastic' | 'easeOutElastic' | 'easeInOutElastic' | 'easeInBack' | 'easeOutBack' | 'easeInOutBack' | 'easeOutBounce'; |
@@ -110,2 +110,14 @@ /** | ||
resize: MapEvent; | ||
/** | ||
* Emitted before the traffic layer showed on the map. | ||
*/ | ||
trafficshow: MapEvent; | ||
/** | ||
* Emitted after the traffic layer hid from the map. | ||
*/ | ||
traffichide: MapEvent; | ||
/** | ||
* Emitted after update current traffic score. | ||
*/ | ||
trafficscore: TrafficScoreEvent; | ||
} | ||
@@ -188,1 +200,4 @@ /** | ||
} | ||
export interface TrafficScoreEvent { | ||
score: number; | ||
} |
@@ -42,5 +42,17 @@ /** | ||
/** | ||
* Whether a zoom control is added to the map by default | ||
* Whether a zoom control should be added during the map initialization. By default it's true. | ||
*/ | ||
zoomControl?: boolean; | ||
/** | ||
* Whether a traffic control should be added during the map initialization. By default it's false. | ||
*/ | ||
trafficControl?: boolean; | ||
/** | ||
* Enable OSM copyright auto hide after 5 sec | ||
*/ | ||
autoHideOSMCopyright?: boolean; | ||
/** | ||
* Disable map zoom on scrolling over the map container. | ||
*/ | ||
disableZoomOnScroll?: boolean; | ||
} | ||
@@ -115,2 +127,6 @@ /** | ||
/** | ||
* Image background for the label | ||
*/ | ||
image?: LabelImage; | ||
/** | ||
* Minimum display zoom level of the label. | ||
@@ -148,6 +164,20 @@ */ | ||
/** | ||
* The position in pixels of the "tip" of the label relative to its center. | ||
* The offset distance of text box from its `relativeAnchor`. | ||
* Positive values indicate left and up, while negative values indicate right and down. | ||
* | ||
* DEPRECATED! Will be removed in the next major release, use the `offset` option instead. | ||
*/ | ||
anchor?: number[]; | ||
/** | ||
* The offset distance of text box from its `relativeAnchor`. | ||
* Positive values indicate right and down, while negative values indicate left and up. | ||
*/ | ||
offset?: number[]; | ||
/** | ||
* The relative, from 0 to 1 in each dimension, coordinates of the text box "tip". relative to its top left corner, for example: | ||
* [0, 0] value is the top left corner, [0.5, 0.5] — center point, and [1, 1] is the bottom right corner of the box. | ||
* The label will be placed so that this point is at geographical `coordinates` respects the absolute `offset`. | ||
*/ | ||
relativeAnchor?: number[]; | ||
/** | ||
* Draw order. | ||
@@ -405,1 +435,37 @@ */ | ||
} | ||
/** | ||
* Stretchable image config object. | ||
*/ | ||
export interface StretchableImageSource { | ||
/** | ||
* Source image URL. | ||
*/ | ||
url: string; | ||
/** | ||
* `[width, height]` — image size in logical pixels | ||
*/ | ||
size: [number, number]; | ||
/** | ||
* Defines the parts of the image that can be stretched horizontally. | ||
*/ | ||
stretchX?: Array<[number, number]>; | ||
/** | ||
* Defines the parts of the image that can be stretched vertically. | ||
*/ | ||
stretchY?: Array<[number, number]>; | ||
/** | ||
* The ratio of logical pixels in the image to physical pixels on the screen. | ||
*/ | ||
pixelRatio?: number; | ||
} | ||
/** | ||
* Source image for text label background. | ||
*/ | ||
export interface LabelImage extends StretchableImageSource { | ||
/** | ||
* Sets the space in pixels between the label text box and the edge of the stretched image | ||
* for all four sides [top, right, bottom, left], like in CSS. | ||
* [0, 0, 0, 0] by default. | ||
*/ | ||
padding?: [number, number, number, number]; | ||
} |
@@ -1,13 +0,1 @@ | ||
/** | ||
* Взят из https://github.com/ai/nanoid/blob/master/non-secure/index.js | ||
* | ||
* Generate URL-friendly unique ID. This method use non-secure predictable | ||
* random generator. | ||
* | ||
* By default, ID will have 21 symbols to have a collision probability similar | ||
* to UUID v4. | ||
* | ||
* @param size The number of symbols in ID. | ||
* @return Random string. | ||
*/ | ||
export declare const uuid: (size?: number) => string; | ||
export {}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Wildcard dependency
QualityPackage has a dependency with a floating version range. This can cause issues if the dependency publishes a new major version.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
40494
1303
0
1
30
1
+ Added@webmaps/mapgl-api@*