diff --git a/package.json b/package.json index f751d8d..5226793 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@jawg/types", - "version": "1.1.0", + "version": "1.2.0", "description": "Shared TypeScript definitions for Jawg Maps projects", "types": "./index.d.ts", "type": "module", diff --git a/src/places-js.d.ts b/src/places-js.d.ts index f27ed93..2dc8f78 100644 --- a/src/places-js.d.ts +++ b/src/places-js.d.ts @@ -71,7 +71,7 @@ declare namespace JawgPlaces { } /** - * Option to activate reverse geocoding withing the input. + * Option to activate reverse geocoding within the input. * You can paste coordinates in the form {lat}/{lon} in the input. * The separation can be either `/` (slash), `,` (comma) or ` ` (space). * ```javascript @@ -131,19 +131,19 @@ declare namespace JawgPlaces { /** * Add a restriction by alpha-2 or alpha-3 ISO-3166 country code. Countries can be static or dynamic with the function. */ - countries: string[] | string | (() => string[]) | (() => string); + countries?: string[] | string | (() => string[]) | (() => string); /** * Search within a circular region. Circle can be static or dynamic with the function. */ - circle: CircleOptions | (() => CircleOptions); + circle?: CircleOptions | (() => CircleOptions); /** * Add a restriction by GIDs. GIDs can be static or dynamic with the function. */ - gids: string[] | string | (() => string[]) | (() => string); + gids?: string[] | string | (() => string[]) | (() => string); /** * Search within a rectangular region. Rectangle can be static or dynamic with the function. */ - rectangle: RectangleOptions | (() => RectangleOptions); + rectangle?: RectangleOptions | (() => RectangleOptions); } /** @@ -162,7 +162,7 @@ declare namespace JawgPlaces { /** * Add a priorities by alpha-2 or alpha-3 ISO-3166 country code. Countries can be static or dynamic with the function. */ - countries: string[] | string | (() => string[]) | (() => string); + countries?: string[] | string | (() => string[]) | (() => string); /** * Sort results in part by their proximity to the given coordinate. Coordinates can be static or dynamic with the function. */ @@ -170,7 +170,32 @@ declare namespace JawgPlaces { /** * Add a priorities by Jawg GIDs. GIDs can be static or dynamic with the function. */ - gids: string[] | string | (() => string[]) | (() => string); + gids?: string[] | string | (() => string[]) | (() => string); + } + + type GeometriesOptions = 'point' | 'source'; + + /** + * Option to activate Place Details within the input. + * You can paste one or many GIDs in the input. + * ```javascript + * new JawgPlaces({ + * place: { + * enabled: true, + * geometries: 'source' + * } + * }) + * ``` + */ + interface PlaceOptions { + /** + * Activate the place endpoint. + */ + enabled: boolean; + /** + * Set the type of return from Places Details API, either a point or the source geometry. + */ + geometries?: GeometriesOptions | (() => GeometriesOptions); } /** @@ -280,10 +305,15 @@ declare namespace JawgPlaces { * See {@link FocusOptions.point} */ focusPoint?: LatLon | (() => LatLon); + /** {@inheritDoc FocusOptions} */ + focus?: FocusOptions; + /** {@inheritDoc BoudaryOptions} */ + boundary?: BoudaryOptions; /** - * Set of options when you are looking for places in a particular region. + * {@inheritDoc PlaceOptions} + * @defaultValue false */ - boundary?: BoudaryOptions; + place?: PlaceOptions | boolean; /** * Show icon at the left each results. */ @@ -297,11 +327,14 @@ declare namespace JawgPlaces { */ size?: number; /** - * Option to activate reverse geocoding withing the input. - * You can paste coordinates in the form {lat}/{lon} in the input. - * The separation can be either `/` (slash), `,` (comma) or ` ` (space). + * {@inheritDoc ReverseOptions} + * @defaultValue false + */ + reverse?: ReverseOptions | boolean; + /** + * Set a custom message when no results are found. This can be disabled. */ - reverse?: ReverseOptions; + noResultsMessage?: string | false; /** * Callback triggered when Jawg Places API returns without error. * @param features The list of features returned by Jawg Places API @@ -432,22 +465,12 @@ declare namespace JawgPlaces { * Class to add to the input when it's generated by the library. */ inputClasses?: string | string[]; - /** - * Option to show administrative area when available. - */ + /** {@inheritDoc AdminAreaOptions} */ adminArea?: AdminAreaOptions; - /** - * Option to configure result markers on the map. - */ + /** {@inheritDoc MapGLMarkerOptions} */ marker?: MapGLMarkerOptions | boolean | 'all'; - /** - * Option to configure transition on result selection. - */ + /** {@inheritDoc MapGLTransitionOptions} */ transition?: MapGLTransitionOptions; - /** - * Set a custom message when no results are found. This can be disabled. - */ - noResultsMessage?: string | false; } /** @@ -468,22 +491,12 @@ declare namespace JawgPlaces { * Class to add to the input when it's generated by the library. */ inputClasses?: string | string[]; - /** - * Option to show administrative area when available. - */ + /** {@inheritDoc AdminAreaOptions} */ adminArea?: AdminAreaOptions; - /** - * Option to configure result markers on the map. - */ + /** {@inheritDoc LeafletMarkerOptions} */ marker?: LeafletMarkerOptions | boolean | 'all'; - /** - * Option to configure transition on result selection. - */ + /** {@inheritDoc LeafletTransitionOptions} */ transition?: LeafletTransitionOptions; - /** - * Set a custom message when no results are found. This can be disabled. - */ - noResultsMessage?: string | false; /** * Position of the input on the map. */