@duoquote/polytini 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +120 -120
- package/dist/types/cli.d.cts +2 -2
- package/dist/types/deckgl.d.cts +72 -60
- package/dist/types/flexible.d.cts +92 -80
- package/dist/types/geojson.jsr.d.cts +111 -0
- package/dist/types/google.d.cts +48 -48
- package/dist/types/google.jsr.d.cts +72 -60
- package/dist/types/index.d.cts +109 -87
- package/dist/types/leaflet-auto.d.cts +4 -4
- package/dist/types/leaflet-auto.jsr.d.cts +2 -2
- package/dist/types/leaflet.d.cts +39 -39
- package/dist/types/leaflet.jsr.d.cts +15 -13
- package/dist/types/mapbox.d.cts +50 -50
- package/dist/types/mapbox.jsr.d.cts +5 -0
- package/dist/types/maplibre.d.cts +54 -54
- package/dist/types/maplibre.jsr.d.cts +92 -0
- package/dist/types/openlayers.d.cts +23 -23
- package/dist/types/openlayers.jsr.d.cts +42 -0
- package/dist/types/presets.d.cts +70 -66
- package/dist/types/turf.d.cts +33 -33
- package/dist/types/turf.jsr.d.cts +46 -0
- package/dist/types/wasm.d.cts +42 -33
- package/package.json +200 -200
- package/src/browser.js +15 -15
- package/src/bun.js +4 -4
- package/src/cli-lib.js +160 -160
- package/src/cli.js +7 -7
- package/src/core.js +268 -268
- package/src/deckgl.js +176 -176
- package/src/deno.js +12 -12
- package/src/error.js +15 -15
- package/src/fast.js +179 -179
- package/src/flexible.js +283 -283
- package/src/google.js +70 -70
- package/src/leaflet-auto.js +11 -11
- package/src/leaflet.js +44 -44
- package/src/mapbox.js +10 -10
- package/src/maplibre.js +57 -57
- package/src/node.js +17 -17
- package/src/openlayers.js +172 -172
- package/src/presets.js +242 -242
- package/src/text.js +111 -111
- package/src/turf.js +80 -80
- package/src/wasm-bytes.js +2 -2
- package/src/wasm.js +235 -235
- package/src/web.js +9 -9
- package/types/cli.d.ts +2 -2
- package/types/deckgl.d.ts +72 -60
- package/types/flexible.d.ts +92 -80
- package/types/geojson.jsr.d.ts +111 -0
- package/types/google.d.ts +48 -48
- package/types/google.jsr.d.ts +72 -60
- package/types/index.d.ts +109 -87
- package/types/leaflet-auto.d.ts +4 -4
- package/types/leaflet-auto.jsr.d.ts +2 -2
- package/types/leaflet.d.ts +39 -39
- package/types/leaflet.jsr.d.ts +15 -13
- package/types/mapbox.d.ts +50 -50
- package/types/mapbox.jsr.d.ts +5 -0
- package/types/maplibre.d.ts +54 -54
- package/types/maplibre.jsr.d.ts +92 -0
- package/types/openlayers.d.ts +23 -23
- package/types/openlayers.jsr.d.ts +42 -0
- package/types/presets.d.ts +70 -66
- package/types/turf.d.ts +33 -33
- package/types/turf.jsr.d.ts +46 -0
- package/types/wasm.d.ts +42 -33
package/types/flexible.d.ts
CHANGED
|
@@ -1,80 +1,92 @@
|
|
|
1
|
-
// Types for @duoquote/polytini/flexible, HERE's Flexible Polyline format
|
|
2
|
-
// (version 1). Separate from the Google-format entry points.
|
|
3
|
-
import type { ErrorCode } from './index.d.ts';
|
|
4
|
-
|
|
5
|
-
/** Third dimension types, as stored in the header. */
|
|
6
|
-
|
|
7
|
-
export const
|
|
8
|
-
|
|
9
|
-
export const
|
|
10
|
-
/**
|
|
11
|
-
export const
|
|
12
|
-
/**
|
|
13
|
-
export const
|
|
14
|
-
|
|
15
|
-
export const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
thirdDim
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
/** The
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
*/
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
1
|
+
// Types for @duoquote/polytini/flexible, HERE's Flexible Polyline format
|
|
2
|
+
// (version 1). Separate from the Google-format entry points.
|
|
3
|
+
import type { ErrorCode } from './index.d.ts';
|
|
4
|
+
|
|
5
|
+
/** Third dimension types, as stored in the header. */
|
|
6
|
+
/** No third value: a 2D line. */
|
|
7
|
+
export const ABSENT: 0;
|
|
8
|
+
/** The third value is a level, such as a floor. */
|
|
9
|
+
export const LEVEL: 1;
|
|
10
|
+
/** The third value is altitude. */
|
|
11
|
+
export const ALTITUDE: 2;
|
|
12
|
+
/** The third value is elevation. */
|
|
13
|
+
export const ELEVATION: 3;
|
|
14
|
+
/** Reserved by the spec: decode accepts it, encode refuses it. */
|
|
15
|
+
export const RESERVED1: 4;
|
|
16
|
+
/** Reserved by the spec: decode accepts it, encode refuses it. */
|
|
17
|
+
export const RESERVED2: 5;
|
|
18
|
+
/** A third value of your own meaning. */
|
|
19
|
+
export const CUSTOM1: 6;
|
|
20
|
+
/** A second type for a third value of your own meaning. */
|
|
21
|
+
export const CUSTOM2: 7;
|
|
22
|
+
|
|
23
|
+
/** Any type a header can hold. */
|
|
24
|
+
export type ThirdDimension = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7;
|
|
25
|
+
/** The types encode accepts. */
|
|
26
|
+
export type EncodableThirdDimension = 0 | 1 | 2 | 3 | 6 | 7;
|
|
27
|
+
|
|
28
|
+
/** The header fields of an encoded line. */
|
|
29
|
+
export interface Header {
|
|
30
|
+
/** Decimal places of latitude and longitude, 0 to 15. */
|
|
31
|
+
precision: number;
|
|
32
|
+
/** What the third value means. ABSENT (0) for 2D lines. */
|
|
33
|
+
thirdDim: ThirdDimension;
|
|
34
|
+
/** Decimal places of the third value, 0 to 15. */
|
|
35
|
+
thirdDimPrecision: number;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** What decode returns: the header and the points. */
|
|
39
|
+
export interface DecodedResult extends Header {
|
|
40
|
+
/** [lat, lng] points, or [lat, lng, z] when thirdDim is not ABSENT. */
|
|
41
|
+
polyline: number[][];
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** The header fields encode writes. */
|
|
45
|
+
export interface EncodeOptions {
|
|
46
|
+
/** Decimal places of latitude and longitude, an integer from 0 to 15. Default 5. */
|
|
47
|
+
precision?: number;
|
|
48
|
+
/** Type of the third value. Default ABSENT, which ignores any third value. */
|
|
49
|
+
thirdDim?: EncodableThirdDimension;
|
|
50
|
+
/** Decimal places of the third value, an integer from 0 to 15. Default 0. */
|
|
51
|
+
thirdDimPrecision?: number;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** [lat, lng] or [lat, lng, z] points, or one flat array of numbers: [lat0, lng0, lat1, lng1, ...]. */
|
|
55
|
+
export type Points = ArrayLike<ArrayLike<number>> | ArrayLike<number>;
|
|
56
|
+
|
|
57
|
+
/** The argument of @here/flexpolyline's encode. */
|
|
58
|
+
export interface EncodeInput extends EncodeOptions {
|
|
59
|
+
/** The points. */
|
|
60
|
+
polyline: Points;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Codes of a PolylineError from this entry: the main entry's, plus 'version'
|
|
65
|
+
* for a format version other than 1 or a header with bits set above bit 10.
|
|
66
|
+
*/
|
|
67
|
+
export type FlexibleErrorCode = Exclude<ErrorCode, 'init'> | 'version';
|
|
68
|
+
|
|
69
|
+
/** The same class as the main entry's PolylineError. */
|
|
70
|
+
export class PolylineError extends Error {
|
|
71
|
+
/** Always "PolylineError". */
|
|
72
|
+
readonly name: 'PolylineError';
|
|
73
|
+
/** What went wrong. */
|
|
74
|
+
readonly code: FlexibleErrorCode;
|
|
75
|
+
/** Character index (decode) or point index (encode), when there is one. */
|
|
76
|
+
readonly index: number | undefined;
|
|
77
|
+
/** Makes an error; the message gets " at <index>" appended when there's an index. */
|
|
78
|
+
constructor(code: FlexibleErrorCode, message: string, index?: number);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Encodes a line. Takes @here/flexpolyline's argument, or the points with
|
|
83
|
+
* the header fields in `options`, which win over the input object's.
|
|
84
|
+
* Rounds half away from zero.
|
|
85
|
+
*/
|
|
86
|
+
export function encode(input: EncodeInput | Points, options?: EncodeOptions): string;
|
|
87
|
+
|
|
88
|
+
/** Decodes a line, with its header. The same result shape as @here/flexpolyline. */
|
|
89
|
+
export function decode(str: string): DecodedResult;
|
|
90
|
+
|
|
91
|
+
/** Reads only the header. */
|
|
92
|
+
export function header(str: string): Header;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
// The GeoJSON types the JSR type files need, written out here because JSR
|
|
2
|
+
// builds its docs without node_modules, so `geojson` (@types/geojson) can't
|
|
3
|
+
// be imported. The npm type files use @types/geojson itself. These follow
|
|
4
|
+
// RFC 7946 and have the same shape as @types/geojson's, so values flow
|
|
5
|
+
// between the two.
|
|
6
|
+
|
|
7
|
+
/** [longitude, latitude], then an optional altitude and anything else. */
|
|
8
|
+
export type Position = number[];
|
|
9
|
+
|
|
10
|
+
/** [west, south, east, north], or with altitudes [west, south, low, east, north, high]. */
|
|
11
|
+
export type BBox = [number, number, number, number] | [number, number, number, number, number, number];
|
|
12
|
+
|
|
13
|
+
/** The properties of a Feature: any JSON object, or null. */
|
|
14
|
+
export type GeoJsonProperties = { [name: string]: unknown } | null;
|
|
15
|
+
|
|
16
|
+
/** A GeoJSON Point. */
|
|
17
|
+
export interface Point {
|
|
18
|
+
/** Always "Point". */
|
|
19
|
+
type: 'Point';
|
|
20
|
+
/** The position. */
|
|
21
|
+
coordinates: Position;
|
|
22
|
+
/** Optional bounding box. */
|
|
23
|
+
bbox?: BBox;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** A GeoJSON MultiPoint. */
|
|
27
|
+
export interface MultiPoint {
|
|
28
|
+
/** Always "MultiPoint". */
|
|
29
|
+
type: 'MultiPoint';
|
|
30
|
+
/** The positions. */
|
|
31
|
+
coordinates: Position[];
|
|
32
|
+
/** Optional bounding box. */
|
|
33
|
+
bbox?: BBox;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** A GeoJSON LineString: two or more positions. */
|
|
37
|
+
export interface LineString {
|
|
38
|
+
/** Always "LineString". */
|
|
39
|
+
type: 'LineString';
|
|
40
|
+
/** The positions, [lng, lat]. */
|
|
41
|
+
coordinates: Position[];
|
|
42
|
+
/** Optional bounding box. */
|
|
43
|
+
bbox?: BBox;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** A GeoJSON MultiLineString. */
|
|
47
|
+
export interface MultiLineString {
|
|
48
|
+
/** Always "MultiLineString". */
|
|
49
|
+
type: 'MultiLineString';
|
|
50
|
+
/** One position array per line. */
|
|
51
|
+
coordinates: Position[][];
|
|
52
|
+
/** Optional bounding box. */
|
|
53
|
+
bbox?: BBox;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** A GeoJSON Polygon: the outer ring, then holes. */
|
|
57
|
+
export interface Polygon {
|
|
58
|
+
/** Always "Polygon". */
|
|
59
|
+
type: 'Polygon';
|
|
60
|
+
/** One closed position array per ring. */
|
|
61
|
+
coordinates: Position[][];
|
|
62
|
+
/** Optional bounding box. */
|
|
63
|
+
bbox?: BBox;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** A GeoJSON MultiPolygon. */
|
|
67
|
+
export interface MultiPolygon {
|
|
68
|
+
/** Always "MultiPolygon". */
|
|
69
|
+
type: 'MultiPolygon';
|
|
70
|
+
/** One ring array per polygon. */
|
|
71
|
+
coordinates: Position[][][];
|
|
72
|
+
/** Optional bounding box. */
|
|
73
|
+
bbox?: BBox;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** A GeoJSON GeometryCollection. */
|
|
77
|
+
export interface GeometryCollection {
|
|
78
|
+
/** Always "GeometryCollection". */
|
|
79
|
+
type: 'GeometryCollection';
|
|
80
|
+
/** The geometries. */
|
|
81
|
+
geometries: Geometry[];
|
|
82
|
+
/** Optional bounding box. */
|
|
83
|
+
bbox?: BBox;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/** Any GeoJSON geometry. */
|
|
87
|
+
export type Geometry = Point | MultiPoint | LineString | MultiLineString | Polygon | MultiPolygon | GeometryCollection;
|
|
88
|
+
|
|
89
|
+
/** A GeoJSON Feature. */
|
|
90
|
+
export interface Feature<G extends Geometry | null = Geometry, P = GeoJsonProperties> {
|
|
91
|
+
/** Always "Feature". */
|
|
92
|
+
type: 'Feature';
|
|
93
|
+
/** The geometry, or null. */
|
|
94
|
+
geometry: G;
|
|
95
|
+
/** The properties. */
|
|
96
|
+
properties: P;
|
|
97
|
+
/** Optional id. */
|
|
98
|
+
id?: string | number;
|
|
99
|
+
/** Optional bounding box. */
|
|
100
|
+
bbox?: BBox;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/** A GeoJSON FeatureCollection. */
|
|
104
|
+
export interface FeatureCollection<G extends Geometry | null = Geometry, P = GeoJsonProperties> {
|
|
105
|
+
/** Always "FeatureCollection". */
|
|
106
|
+
type: 'FeatureCollection';
|
|
107
|
+
/** The features. */
|
|
108
|
+
features: Feature<G, P>[];
|
|
109
|
+
/** Optional bounding box. */
|
|
110
|
+
bbox?: BBox;
|
|
111
|
+
}
|
package/types/google.d.ts
CHANGED
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
// Types for @duoquote/polytini/google, using the google.maps types from
|
|
2
|
-
// @types/google.maps. Those are global declarations, not a module, so they
|
|
3
|
-
// are pulled in with a reference directive: types only, nothing at runtime.
|
|
4
|
-
/// <reference types="google.maps" />
|
|
5
|
-
import type * as P from './index.d.ts';
|
|
6
|
-
import type { Options, Point } from './index.d.ts';
|
|
7
|
-
|
|
8
|
-
export declare const PolylineError: typeof P.PolylineError;
|
|
9
|
-
export type PolylineError = P.PolylineError;
|
|
10
|
-
|
|
11
|
-
/** A LatLng constructor: google.maps.LatLng or anything built the same way. */
|
|
12
|
-
export type LatLngConstructor = new (lat: number, lng: number, noClampNoWrap?: boolean) => google.maps.LatLng;
|
|
13
|
-
|
|
14
|
-
export interface DecodePathOptions extends Omit<Options, 'order'> {
|
|
15
|
-
/**
|
|
16
|
-
* The class to build points with. Default: globalThis.google.maps.LatLng
|
|
17
|
-
* when it exists. false or null returns LatLngLiteral objects.
|
|
18
|
-
*/
|
|
19
|
-
LatLng?: LatLngConstructor | false | null;
|
|
20
|
-
/** Passed to the LatLng constructor. Without it, LatLng clamps latitude and wraps longitude into [-180, 180). */
|
|
21
|
-
noClampNoWrap?: boolean;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/** A point encodePath takes: google.maps.LatLng, LatLngLiteral or a [lat, lng] tuple. */
|
|
25
|
-
export type PathPoint = google.maps.LatLng | google.maps.LatLngLiteral | Point;
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Decodes an encoded path to LatLngLiteral objects (`LatLng: false`).
|
|
29
|
-
*/
|
|
30
|
-
export function decodePath(encodedPath: string, options: DecodePathOptions & { LatLng: false | null }): google.maps.LatLngLiteral[];
|
|
31
|
-
/**
|
|
32
|
-
* Decodes an encoded path, like google.maps.geometry.encoding.decodePath,
|
|
33
|
-
* to google.maps.LatLng objects. Without a `LatLng` option this uses
|
|
34
|
-
* globalThis.google.maps.LatLng; when the Maps JavaScript API isn't loaded
|
|
35
|
-
* the result is LatLngLiteral objects at runtime, so pass `LatLng: false`
|
|
36
|
-
* there to get that type. Strict by default: a malformed string throws a
|
|
37
|
-
* PolylineError unless `strict: false`.
|
|
38
|
-
*/
|
|
39
|
-
export function decodePath(encodedPath: string, options?: number | (DecodePathOptions & { LatLng?: LatLngConstructor })): google.maps.LatLng[];
|
|
40
|
-
export function decodePath(encodedPath: string, options?: number | DecodePathOptions): google.maps.LatLng[] | google.maps.LatLngLiteral[];
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Encodes a path, like google.maps.geometry.encoding.encodePath: an array or
|
|
44
|
-
* MVCArray of google.maps.LatLng, LatLngLiteral or [lat, lng] tuples, mixed
|
|
45
|
-
* or not. Precision 5 by default. `order: 'lnglat'` applies to tuples and
|
|
46
|
-
* LatLng objects; literals are read by name. Strict by default.
|
|
47
|
-
*/
|
|
48
|
-
export function encodePath(path: readonly PathPoint[] | google.maps.MVCArray<PathPoint>, options?: number | Options): string;
|
|
1
|
+
// Types for @duoquote/polytini/google, using the google.maps types from
|
|
2
|
+
// @types/google.maps. Those are global declarations, not a module, so they
|
|
3
|
+
// are pulled in with a reference directive: types only, nothing at runtime.
|
|
4
|
+
/// <reference types="google.maps" />
|
|
5
|
+
import type * as P from './index.d.ts';
|
|
6
|
+
import type { Options, Point } from './index.d.ts';
|
|
7
|
+
|
|
8
|
+
export declare const PolylineError: typeof P.PolylineError;
|
|
9
|
+
export type PolylineError = P.PolylineError;
|
|
10
|
+
|
|
11
|
+
/** A LatLng constructor: google.maps.LatLng or anything built the same way. */
|
|
12
|
+
export type LatLngConstructor = new (lat: number, lng: number, noClampNoWrap?: boolean) => google.maps.LatLng;
|
|
13
|
+
|
|
14
|
+
export interface DecodePathOptions extends Omit<Options, 'order'> {
|
|
15
|
+
/**
|
|
16
|
+
* The class to build points with. Default: globalThis.google.maps.LatLng
|
|
17
|
+
* when it exists. false or null returns LatLngLiteral objects.
|
|
18
|
+
*/
|
|
19
|
+
LatLng?: LatLngConstructor | false | null;
|
|
20
|
+
/** Passed to the LatLng constructor. Without it, LatLng clamps latitude and wraps longitude into [-180, 180). */
|
|
21
|
+
noClampNoWrap?: boolean;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** A point encodePath takes: google.maps.LatLng, LatLngLiteral or a [lat, lng] tuple. */
|
|
25
|
+
export type PathPoint = google.maps.LatLng | google.maps.LatLngLiteral | Point;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Decodes an encoded path to LatLngLiteral objects (`LatLng: false`).
|
|
29
|
+
*/
|
|
30
|
+
export function decodePath(encodedPath: string, options: DecodePathOptions & { LatLng: false | null }): google.maps.LatLngLiteral[];
|
|
31
|
+
/**
|
|
32
|
+
* Decodes an encoded path, like google.maps.geometry.encoding.decodePath,
|
|
33
|
+
* to google.maps.LatLng objects. Without a `LatLng` option this uses
|
|
34
|
+
* globalThis.google.maps.LatLng; when the Maps JavaScript API isn't loaded
|
|
35
|
+
* the result is LatLngLiteral objects at runtime, so pass `LatLng: false`
|
|
36
|
+
* there to get that type. Strict by default: a malformed string throws a
|
|
37
|
+
* PolylineError unless `strict: false`.
|
|
38
|
+
*/
|
|
39
|
+
export function decodePath(encodedPath: string, options?: number | (DecodePathOptions & { LatLng?: LatLngConstructor })): google.maps.LatLng[];
|
|
40
|
+
export function decodePath(encodedPath: string, options?: number | DecodePathOptions): google.maps.LatLng[] | google.maps.LatLngLiteral[];
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Encodes a path, like google.maps.geometry.encoding.encodePath: an array or
|
|
44
|
+
* MVCArray of google.maps.LatLng, LatLngLiteral or [lat, lng] tuples, mixed
|
|
45
|
+
* or not. Precision 5 by default. `order: 'lnglat'` applies to tuples and
|
|
46
|
+
* LatLng objects; literals are read by name. Strict by default.
|
|
47
|
+
*/
|
|
48
|
+
export function encodePath(path: readonly PathPoint[] | google.maps.MVCArray<PathPoint>, options?: number | Options): string;
|
package/types/google.jsr.d.ts
CHANGED
|
@@ -1,60 +1,72 @@
|
|
|
1
|
-
// JSR copy of google.d.ts. JSR's type output can't carry the
|
|
2
|
-
// @types/google.maps reference, so the Maps shapes are described
|
|
3
|
-
// structurally here: anything with lat() and lng() is a LatLng. The npm
|
|
4
|
-
// package's google.d.ts uses the real google.maps types.
|
|
5
|
-
import type * as P from './index.d.ts';
|
|
6
|
-
import type { Options, Point } from './index.d.ts';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
export interface
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
export
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
|
|
60
|
-
|
|
1
|
+
// JSR copy of google.d.ts. JSR's type output can't carry the
|
|
2
|
+
// @types/google.maps reference, so the Maps shapes are described
|
|
3
|
+
// structurally here: anything with lat() and lng() is a LatLng. The npm
|
|
4
|
+
// package's google.d.ts uses the real google.maps types.
|
|
5
|
+
import type * as P from './index.d.ts';
|
|
6
|
+
import type { Options, Point } from './index.d.ts';
|
|
7
|
+
|
|
8
|
+
/** Anything with lat() and lng(), such as google.maps.LatLng. */
|
|
9
|
+
export interface LatLng {
|
|
10
|
+
/** Latitude in degrees. */
|
|
11
|
+
lat(): number;
|
|
12
|
+
/** Longitude in degrees. */
|
|
13
|
+
lng(): number;
|
|
14
|
+
}
|
|
15
|
+
/** A plain { lat, lng } object, like google.maps.LatLngLiteral. */
|
|
16
|
+
export interface LatLngLiteral {
|
|
17
|
+
/** Latitude in degrees. */
|
|
18
|
+
lat: number;
|
|
19
|
+
/** Longitude in degrees. */
|
|
20
|
+
lng: number;
|
|
21
|
+
}
|
|
22
|
+
/** Anything with getArray(), such as google.maps.MVCArray. */
|
|
23
|
+
export interface MVCArrayLike<T> {
|
|
24
|
+
/** The items as an array. */
|
|
25
|
+
getArray(): T[];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** The main entry's PolylineError. */
|
|
29
|
+
export declare const PolylineError: typeof P.PolylineError;
|
|
30
|
+
/** The main entry's PolylineError type. */
|
|
31
|
+
export type PolylineError = P.PolylineError;
|
|
32
|
+
|
|
33
|
+
/** A LatLng constructor: LatLng or anything built the same way. */
|
|
34
|
+
export type LatLngConstructor = new (lat: number, lng: number, noClampNoWrap?: boolean) => LatLng;
|
|
35
|
+
|
|
36
|
+
/** Options for decodePath: polytini's options without order, plus the LatLng class. */
|
|
37
|
+
export interface DecodePathOptions extends Omit<Options, 'order'> {
|
|
38
|
+
/**
|
|
39
|
+
* The class to build points with. Default: globalThis.LatLng
|
|
40
|
+
* when it exists. false or null returns LatLngLiteral objects.
|
|
41
|
+
*/
|
|
42
|
+
LatLng?: LatLngConstructor | false | null;
|
|
43
|
+
/** Passed to the LatLng constructor. Without it, LatLng clamps latitude and wraps longitude into [-180, 180). */
|
|
44
|
+
noClampNoWrap?: boolean;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** A point encodePath takes: LatLng, LatLngLiteral or a [lat, lng] tuple. */
|
|
48
|
+
export type PathPoint = LatLng | LatLngLiteral | Point;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Decodes an encoded path to LatLngLiteral objects (`LatLng: false`).
|
|
52
|
+
*/
|
|
53
|
+
export function decodePath(encodedPath: string, options: DecodePathOptions & { LatLng: false | null }): LatLngLiteral[];
|
|
54
|
+
/**
|
|
55
|
+
* Decodes an encoded path, like google.maps.geometry.encoding.decodePath,
|
|
56
|
+
* to LatLng objects. Without a `LatLng` option this uses
|
|
57
|
+
* globalThis.LatLng; when the Maps JavaScript API isn't loaded
|
|
58
|
+
* the result is LatLngLiteral objects at runtime, so pass `LatLng: false`
|
|
59
|
+
* there to get that type. Strict by default: a malformed string throws a
|
|
60
|
+
* PolylineError unless `strict: false`.
|
|
61
|
+
*/
|
|
62
|
+
export function decodePath(encodedPath: string, options?: number | (DecodePathOptions & { LatLng?: LatLngConstructor })): LatLng[];
|
|
63
|
+
/** decodePath when the LatLng option isn't known until runtime. */
|
|
64
|
+
export function decodePath(encodedPath: string, options?: number | DecodePathOptions): LatLng[] | LatLngLiteral[];
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Encodes a path, like google.maps.geometry.encoding.encodePath: an array or
|
|
68
|
+
* MVCArray of LatLng, LatLngLiteral or [lat, lng] tuples, mixed
|
|
69
|
+
* or not. Precision 5 by default. `order: 'lnglat'` applies to tuples and
|
|
70
|
+
* LatLng objects; literals are read by name. Strict by default.
|
|
71
|
+
*/
|
|
72
|
+
export function encodePath(path: readonly PathPoint[] | MVCArrayLike<PathPoint>, options?: number | Options): string;
|