diff --git a/leaflet.gridlayer.googlemutant/index.d.ts b/leaflet.gridlayer.googlemutant/index.d.ts new file mode 100644 index 0000000000..2f62268fcd --- /dev/null +++ b/leaflet.gridlayer.googlemutant/index.d.ts @@ -0,0 +1,78 @@ +// Type definitions for leaflet.gridlayer.googlemutant 0.4 +// Project: https://gitlab.com/IvanSanchez/Leaflet.GridLayer.GoogleMutant#README +// Definitions by: Ernest Rhinozeros +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare namespace L.GridLayer { + export interface GoogleMutant extends L.GridLayer { + setElementSize(e: HTMLElement, size: L.Point): void ; + } + + export type GoogleMutantType = 'roadmap' | 'satellite' | 'terrain' | 'hybrid'; + + export interface GoogleMutantStyler { + hue?: string; + lightness?: number; + saturation?: number; + gamma?: number; + invert_lightness?: boolean; + visibility?: string; + color?: string; + weight?: number; + } + + /** + * Google's map style. + * + * https://developers.google.com/maps/documentation/javascript/style-reference + */ + export interface GoogleMutantStyle { + + /** + * https://developers.google.com/maps/documentation/javascript/style-reference#style-features + */ + featureType?: string; + + /** + * https://developers.google.com/maps/documentation/javascript/style-reference#style-elements + */ + elementType?: string; + + /** + * https://developers.google.com/maps/documentation/javascript/style-reference#stylers + */ + stylers?: GoogleMutantStyler[]; + } + + export interface GoogleMutantOptions extends L.TileLayerOptions { + minZoom?: number; + maxZoom?: number; + maxNativeZoom?: number; + tileSize?: number | Point; + subdomains?: string | Array; + errorTileUrl?: string; + + /** + * The mutant container will add its own attribution anyways. + */ + attribution?: string; + + opacity?: number; + continuousWorld?: boolean, + noWrap?: boolean; + + /** + * Google's map type. 'hybrid' is not really supported. + */ + type?: GoogleMutantType; + + /** + * Google's map styles. + */ + styles?: GoogleMutantStyle[] + } + + export function googleMutant(options?: GoogleMutantOptions): GoogleMutant; +} diff --git a/leaflet.gridlayer.googlemutant/leaflet.gridlayer.googlemutant-tests.ts b/leaflet.gridlayer.googlemutant/leaflet.gridlayer.googlemutant-tests.ts new file mode 100644 index 0000000000..53e8dc3e1c --- /dev/null +++ b/leaflet.gridlayer.googlemutant/leaflet.gridlayer.googlemutant-tests.ts @@ -0,0 +1,13 @@ +let map = L.map('foo'); + +let roads = L.GridLayer.googleMutant({ + type: 'roadmap' +}).addTo(map); + +let styled = L.GridLayer.googleMutant({ + type: 'satellite', + styles: [ + { elementType: 'labels', stylers: [ { visibility: 'off' } ] }, + { featureType: 'water' , stylers: [ { color: '#444444' } ] } + ] +}).addTo(map); diff --git a/leaflet.gridlayer.googlemutant/tsconfig.json b/leaflet.gridlayer.googlemutant/tsconfig.json new file mode 100644 index 0000000000..2e8651b58b --- /dev/null +++ b/leaflet.gridlayer.googlemutant/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "leaflet.gridlayer.googlemutant-tests.ts" + ] +} diff --git a/leaflet.gridlayer.googlemutant/tslint.json b/leaflet.gridlayer.googlemutant/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/leaflet.gridlayer.googlemutant/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" }