Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setup full typescript support #48

Merged
merged 4 commits into from
Aug 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const tsConfig = require('./tsconfig.json');

module.exports = {
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'],
parser: '@typescript-eslint/parser',
Expand All @@ -6,5 +8,6 @@ module.exports = {
//"@typescript-eslint/ban-ts-comment": "warn"
rules: {
"@typescript-eslint/ban-ts-comment": "warn",
}
};
},
ignorePatterns: tsConfig.exclude,
};
53 changes: 28 additions & 25 deletions demos/maptiler-sdk.umd.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 15 additions & 19 deletions dist/maptiler-sdk.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as maplibre_gl from 'maplibre-gl';
import maplibre_gl__default, { MapOptions as MapOptions$1, StyleSpecification, ControlPosition, StyleOptions, RequestTransformFunction, Map as Map$1, LogoOptions as LogoOptions$1 } from 'maplibre-gl';
import maplibre_gl__default, { MapOptions as MapOptions$1, StyleSpecification, ControlPosition, StyleSwapOptions, StyleOptions, RequestTransformFunction, Map as Map$1, LogoOptions as LogoOptions$1, IControl } from 'maplibre-gl';
export * from 'maplibre-gl';
import { FetchFunction, ReferenceMapStyle, MapStyleVariant } from '@maptiler/client';
export { AutomaticStaticMapOptions, BBox, BoundedStaticMapOptions, CenteredStaticMapOptions, CoordinatesSearchOptions, GeocodingOptions, LanguageGeocoding, LanguageGeocodingString, MapStyle, MapStyleType, MapStyleVariant, Position, ReferenceMapStyle, ServiceError, coordinates, data, geocoding, geolocation, staticMaps } from '@maptiler/client';
Expand Down Expand Up @@ -121,12 +121,12 @@ declare class SdkConfig extends EventEmitter {
/**
* The primary language. By default, the language of the web browser is used.
*/
primaryLanguage: LanguageString | null;
primaryLanguage: LanguageString;
/**
* The secondary language, to overwrite the default language defined in the map style.
* This settings is highly dependant on the style compatibility and may not work in most cases.
*/
secondaryLanguage: LanguageString | null;
secondaryLanguage?: LanguageString;
/**
* Setting on whether of not the SDK runs with a session logic.
* A "session" is started at the initialization of the SDK and finished when the browser
Expand Down Expand Up @@ -179,11 +179,6 @@ type LoadWithTerrainEvent = {
exaggeration: number;
};
};
type TransformStyleFunction = (previous: StyleSpecification, next: StyleSpecification) => StyleSpecification;
type StyleSwapOptions = {
diff?: boolean;
transformStyle?: TransformStyleFunction;
};
declare const GeolocationType: {
POINT: "POINT";
COUNTRY: "COUNTRY";
Expand Down Expand Up @@ -277,7 +272,7 @@ declare class Map extends maplibre_gl__default.Map {
private isTerrainEnabled;
private terrainExaggeration;
private primaryLanguage;
private secondaryLanguage;
private secondaryLanguage?;
private terrainGrowing;
private terrainFlattening;
constructor(options: MapOptions);
Expand Down Expand Up @@ -306,13 +301,13 @@ declare class Map extends maplibre_gl__default.Map {
* @param options
* @returns
*/
setStyle(style: ReferenceMapStyle | MapStyleVariant | StyleSpecification | string, options?: StyleSwapOptions & StyleOptions): this;
setStyle(style: null | ReferenceMapStyle | MapStyleVariant | StyleSpecification | string, options?: StyleSwapOptions & StyleOptions): this;
/**
* Define the primary language of the map. Note that not all the languages shorthands provided are available.
* This function is a short for `.setPrimaryLanguage()`
* @param language
*/
setLanguage(language?: LanguageString): any;
setLanguage(language?: LanguageString): void;
/**
* Define the primary language of the map. Note that not all the languages shorthands provided are available.
* @param language
Expand All @@ -333,7 +328,7 @@ declare class Map extends maplibre_gl__default.Map {
* Get the secondary language
* @returns
*/
getSecondaryLanguage(): LanguageString;
getSecondaryLanguage(): LanguageString | undefined;
/**
* Get the exaggeration factor applied to the terrain
* @returns
Expand Down Expand Up @@ -566,6 +561,7 @@ type LogoOptions = LogoOptions$1 & {
* any link URL. By default this is using MapTiler logo and URL.
*/
declare class MaptilerLogoControl extends LogoControl {
_compact: boolean;
private logoURL;
private linkURL;
constructor(options?: LogoOptions);
Expand All @@ -576,7 +572,7 @@ declare class MaptilerLogoControl extends LogoControl {
* A `MaptilerTerrainControl` control adds a button to turn terrain on and off
* by triggering the terrain logic that is already deployed in the Map object.
*/
declare class MaptilerTerrainControl implements maplibregl.IControl {
declare class MaptilerTerrainControl implements IControl {
_map: Map;
_container: HTMLElement;
_terrainButton: HTMLButtonElement;
Expand All @@ -588,14 +584,14 @@ declare class MaptilerTerrainControl implements maplibregl.IControl {
}

type HTMLButtonElementPlus = HTMLButtonElement & {
clickFunction: (e?: any) => unknown;
clickFunction: (e?: Event) => unknown;
};
declare class MaptilerNavigationControl extends NavigationControl {
constructor();
/**
* Overloading: the button now stores its click callback so that we can later on delete it and replace it
*/
_createButton(className: string, fn: (e?: any) => unknown): HTMLButtonElementPlus;
_createButton(className: string, fn: (e?: Event) => unknown): HTMLButtonElementPlus;
/**
* Overloading: Limit how flat the compass icon can get
*/
Expand Down Expand Up @@ -734,21 +730,21 @@ declare class Point {
* @param {Point} other the other point
* @return {boolean} whether the points are equal
*/
equals(other: any): boolean;
equals(other: Point): boolean;
/**
* Calculate the distance from this point to another point
* @param {Point} p the other point
* @return {Number} distance
*/
dist(p: any): number;
dist(p: Point): number;
/**
* Calculate the distance from this point to another point,
* without the square root step. Useful if you're comparing
* relative distances.
* @param {Point} p the other point
* @return {Number} distance
*/
distSqr(p: any): number;
distSqr(p: Point): number;
/**
* Get the angle from the 0, 0 coordinate to this point, in radians
* coordinates.
Expand Down Expand Up @@ -782,7 +778,7 @@ declare class Point {
static convert(a: Point | Array<number>): Point;
}

declare const setRTLTextPlugin: (url: string, callback: (error?: Error) => void, deferred?: boolean) => void;
declare const setRTLTextPlugin: (url: string, callback: (error?: Error | undefined) => void, deferred?: boolean | undefined) => void;
declare const getRTLTextPluginStatus: () => string;
declare const prewarm: () => void;
declare const clearPrewarmedResources: () => void;
Expand Down
2 changes: 1 addition & 1 deletion dist/maptiler-sdk.min.mjs

Large diffs are not rendered by default.

Loading