ts-maps 0.3.1 → 0.3.3
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/dist/core-map/control/FullscreenControl.d.ts +39 -0
- package/dist/core-map/control/GeocoderControl.d.ts +61 -0
- package/dist/core-map/control/LocateControl.d.ts +56 -0
- package/dist/core-map/control/NavigationControl.d.ts +39 -0
- package/dist/core-map/control/index.d.ts +8 -0
- package/dist/core-map/game/TerritoryLog.d.ts +66 -0
- package/dist/core-map/game/TerritoryStore.d.ts +59 -0
- package/dist/core-map/game/index.d.ts +11 -0
- package/dist/core-map/game/loop.d.ts +61 -0
- package/dist/core-map/geo/area.d.ts +52 -0
- package/dist/core-map/geo/index.d.ts +30 -0
- package/dist/core-map/geo/index.js +856 -31
- package/dist/core-map/geo/polygonClip.d.ts +75 -0
- package/dist/core-map/geo/validate.d.ts +54 -0
- package/dist/core-map/geometry/index.js +28 -28
- package/dist/core-map/index.d.ts +8 -2
- package/dist/core-map/layer/GeoJSONTileSource.d.ts +50 -0
- package/dist/core-map/layer/RunTrailLayer.d.ts +35 -0
- package/dist/core-map/layer/TerritoryLayer.d.ts +62 -0
- package/dist/core-map/layer/index.d.ts +6 -0
- package/dist/core-map/layer/tile/RasterDEMLayer.d.ts +4 -0
- package/dist/core-map/layer/tile/VectorTileMapLayer.d.ts +59 -11
- package/dist/core-map/layer/tile/urlTemplate.d.ts +1 -2
- package/dist/core-map/map/Map.d.ts +32 -1
- package/dist/core-map/mvt/DecodedTile.d.ts +20 -0
- package/dist/core-map/mvt/FlatTile.d.ts +25 -0
- package/dist/core-map/mvt/VectorTileFeature.d.ts +8 -0
- package/dist/core-map/services/index.js +48 -48
- package/dist/core-map/storage/index.js +5 -5
- package/dist/core-map/style-spec/expressions/formatted.d.ts +36 -0
- package/dist/core-map/style-spec/expressions/operators/binding.d.ts +1 -0
- package/dist/core-map/style-spec/expressions/operators/geometry.d.ts +19 -0
- package/dist/core-map/style-spec/expressions/types.d.ts +3 -0
- package/dist/core-map/style-spec/index.js +460 -60
- package/dist/core-map/style-spec/schema.d.ts +43 -3
- package/dist/core-map/style-spec/types.d.ts +47 -7
- package/dist/core-map/styles/basemap.d.ts +41 -0
- package/dist/core-map/styles/index.d.ts +5 -0
- package/dist/core-map/styles/palette.d.ts +31 -0
- package/dist/core-map/symbols/CollisionIndex.d.ts +22 -5
- package/dist/core-map/symbols/GlyphAtlas.d.ts +6 -1
- package/dist/core-map/symbols/GlyphProvider.d.ts +21 -0
- package/dist/core-map/symbols/GlyphRenderer.d.ts +48 -0
- package/dist/core-map/symbols/IconAtlas.d.ts +10 -1
- package/dist/core-map/symbols/SymbolOverlay.d.ts +47 -0
- package/dist/core-map/symbols/index.d.ts +4 -0
- package/dist/core-map/symbols/index.js +1072 -68
- package/dist/core-map/symbols/loadGlyphs.d.ts +53 -0
- package/dist/core-map/symbols/loadSprite.d.ts +57 -0
- package/dist/core-map/symbols/placement.d.ts +67 -0
- package/dist/core-map/symbols/sdf.d.ts +37 -0
- package/dist/core-map/symbols/sections.d.ts +32 -0
- package/dist/core-map/workers/WorkerPool.d.ts +40 -0
- package/dist/core-map/workers/decodeMvtFlat.d.ts +52 -0
- package/dist/index.js +11783 -6100
- package/package.json +2 -2
- package/src/core-map/ts-maps.css +576 -79
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { GeoJSONFeature, VectorTileProperties } from './VectorTileFeature';
|
|
2
|
+
import type { Point } from '../geometry/Point';
|
|
3
|
+
export declare interface DecodedFeature {
|
|
4
|
+
id?: number
|
|
5
|
+
type: 1 | 2 | 3
|
|
6
|
+
extent: number
|
|
7
|
+
properties: VectorTileProperties
|
|
8
|
+
loadGeometry: () => Point[][]
|
|
9
|
+
bbox: () => [number, number, number, number]
|
|
10
|
+
toGeoJSON: (x: number, y: number, z: number) => GeoJSONFeature
|
|
11
|
+
}
|
|
12
|
+
export declare interface DecodedLayer {
|
|
13
|
+
name?: string
|
|
14
|
+
extent: number
|
|
15
|
+
length: number
|
|
16
|
+
feature: (i: number) => DecodedFeature
|
|
17
|
+
}
|
|
18
|
+
export declare interface DecodedTile {
|
|
19
|
+
layers: Record<string, DecodedLayer>
|
|
20
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Point } from '../geometry/Point';
|
|
2
|
+
import type { FlatLayer, FlatTile as FlatTileData } from '../workers/decodeMvtFlat';
|
|
3
|
+
import type { GeoJSONFeature, VectorTileProperties } from './VectorTileFeature';
|
|
4
|
+
export declare class FlatTileFeature {
|
|
5
|
+
id?: number;
|
|
6
|
+
type: 1 | 2 | 3;
|
|
7
|
+
extent: number;
|
|
8
|
+
constructor(layer: FlatLayer, index: number);
|
|
9
|
+
get properties(): VectorTileProperties;
|
|
10
|
+
loadGeometry(): Point[][];
|
|
11
|
+
bbox(): [number, number, number, number];
|
|
12
|
+
toGeoJSON(x: number, y: number, z: number): GeoJSONFeature;
|
|
13
|
+
}
|
|
14
|
+
export declare class FlatTileLayer {
|
|
15
|
+
name: string;
|
|
16
|
+
version: number;
|
|
17
|
+
extent: number;
|
|
18
|
+
length: number;
|
|
19
|
+
constructor(data: FlatLayer);
|
|
20
|
+
feature(i: number): FlatTileFeature;
|
|
21
|
+
}
|
|
22
|
+
export declare class FlatTile {
|
|
23
|
+
layers: Record<string, FlatTileLayer>;
|
|
24
|
+
constructor(data: FlatTileData);
|
|
25
|
+
}
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { Point } from '../geometry/Point';
|
|
2
2
|
import type { Pbf } from '../proto/Pbf';
|
|
3
|
+
/**
|
|
4
|
+
* Project tile-local rings to WGS84 and wrap them as a GeoJSON feature.
|
|
5
|
+
*
|
|
6
|
+
* Shared rather than duplicated: tiles decoded in a worker arrive as flat
|
|
7
|
+
* typed arrays and are wrapped by `FlatTile`, which has the same job to do
|
|
8
|
+
* here and must produce byte-identical output.
|
|
9
|
+
*/
|
|
10
|
+
export declare function geometryToGeoJSON(type: number, rings: Point[][], extent: number, x: number, y: number, z: number, properties: VectorTileProperties, id?: number): GeoJSONFeature;
|
|
3
11
|
// MVT GeomType enum values (tile.proto).
|
|
4
12
|
export declare const MVT_GEOM_UNKNOWN: number;
|
|
5
13
|
export declare const MVT_GEOM_POINT: number;
|
|
@@ -40,17 +40,17 @@ var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
|
40
40
|
// src/core-map/core/Util.ts
|
|
41
41
|
var exports_Util = {};
|
|
42
42
|
__export(exports_Util, {
|
|
43
|
-
|
|
44
|
-
throttle: () => throttle,
|
|
45
|
-
template: () => template,
|
|
46
|
-
stamp: () => stamp,
|
|
47
|
-
splitWords: () => splitWords,
|
|
48
|
-
setOptions: () => setOptions,
|
|
49
|
-
setLastId: () => setLastId,
|
|
50
|
-
noop: () => noop,
|
|
51
|
-
lastId: () => lastId,
|
|
43
|
+
falseFn: () => falseFn,
|
|
52
44
|
formatNum: () => formatNum,
|
|
53
|
-
|
|
45
|
+
lastId: () => lastId,
|
|
46
|
+
noop: () => noop,
|
|
47
|
+
setLastId: () => setLastId,
|
|
48
|
+
setOptions: () => setOptions,
|
|
49
|
+
splitWords: () => splitWords,
|
|
50
|
+
stamp: () => stamp,
|
|
51
|
+
template: () => template,
|
|
52
|
+
throttle: () => throttle,
|
|
53
|
+
wrapNum: () => wrapNum
|
|
54
54
|
});
|
|
55
55
|
function stamp(obj) {
|
|
56
56
|
if (!("_tsmap_id" in obj)) {
|
|
@@ -133,26 +133,26 @@ var init_Util = __esm(() => {
|
|
|
133
133
|
// src/core-map/services/index.ts
|
|
134
134
|
var exports_services = {};
|
|
135
135
|
__export(exports_services, {
|
|
136
|
-
|
|
137
|
-
valhallaDirections: () => valhallaDirections,
|
|
138
|
-
defaultMatrix: () => defaultMatrix,
|
|
139
|
-
defaultIsochrone: () => defaultIsochrone,
|
|
140
|
-
defaultGeocoder: () => defaultGeocoder,
|
|
141
|
-
defaultDirections: () => defaultDirections,
|
|
142
|
-
ValhallaMatrix: () => ValhallaMatrix,
|
|
143
|
-
ValhallaIsochrone: () => ValhallaIsochrone,
|
|
144
|
-
ValhallaDirections: () => ValhallaDirections,
|
|
145
|
-
PhotonGeocoder: () => PhotonGeocoder,
|
|
146
|
-
OSRMMatrix: () => OSRMMatrix,
|
|
147
|
-
OSRMDirections: () => OSRMDirections,
|
|
148
|
-
NominatimGeocoder: () => NominatimGeocoder,
|
|
149
|
-
MaptilerGeocoder: () => MaptilerGeocoder,
|
|
150
|
-
MapboxMatrix: () => MapboxMatrix,
|
|
151
|
-
MapboxIsochrone: () => MapboxIsochrone,
|
|
152
|
-
MapboxGeocoder: () => MapboxGeocoder,
|
|
153
|
-
MapboxDirections: () => MapboxDirections,
|
|
136
|
+
GoogleDirections: () => GoogleDirections,
|
|
154
137
|
GoogleGeocoder: () => GoogleGeocoder,
|
|
155
|
-
|
|
138
|
+
MapboxDirections: () => MapboxDirections,
|
|
139
|
+
MapboxGeocoder: () => MapboxGeocoder,
|
|
140
|
+
MapboxIsochrone: () => MapboxIsochrone,
|
|
141
|
+
MapboxMatrix: () => MapboxMatrix,
|
|
142
|
+
MaptilerGeocoder: () => MaptilerGeocoder,
|
|
143
|
+
NominatimGeocoder: () => NominatimGeocoder,
|
|
144
|
+
OSRMDirections: () => OSRMDirections,
|
|
145
|
+
OSRMMatrix: () => OSRMMatrix,
|
|
146
|
+
PhotonGeocoder: () => PhotonGeocoder,
|
|
147
|
+
ValhallaDirections: () => ValhallaDirections,
|
|
148
|
+
ValhallaIsochrone: () => ValhallaIsochrone,
|
|
149
|
+
ValhallaMatrix: () => ValhallaMatrix,
|
|
150
|
+
defaultDirections: () => defaultDirections,
|
|
151
|
+
defaultGeocoder: () => defaultGeocoder,
|
|
152
|
+
defaultIsochrone: () => defaultIsochrone,
|
|
153
|
+
defaultMatrix: () => defaultMatrix,
|
|
154
|
+
valhallaDirections: () => valhallaDirections,
|
|
155
|
+
valhallaMatrix: () => valhallaMatrix
|
|
156
156
|
});
|
|
157
157
|
|
|
158
158
|
// src/core-map/services/providers/Google.ts
|
|
@@ -1207,24 +1207,24 @@ var defaultMatrix = () => new OSRMMatrix;
|
|
|
1207
1207
|
var valhallaMatrix = () => new ValhallaMatrix;
|
|
1208
1208
|
var valhallaDirections = () => new ValhallaDirections;
|
|
1209
1209
|
export {
|
|
1210
|
-
|
|
1211
|
-
valhallaDirections,
|
|
1212
|
-
defaultMatrix,
|
|
1213
|
-
defaultIsochrone,
|
|
1214
|
-
defaultGeocoder,
|
|
1215
|
-
defaultDirections,
|
|
1216
|
-
ValhallaMatrix,
|
|
1217
|
-
ValhallaIsochrone,
|
|
1218
|
-
ValhallaDirections,
|
|
1219
|
-
PhotonGeocoder,
|
|
1220
|
-
OSRMMatrix,
|
|
1221
|
-
OSRMDirections,
|
|
1222
|
-
NominatimGeocoder,
|
|
1223
|
-
MaptilerGeocoder,
|
|
1224
|
-
MapboxMatrix,
|
|
1225
|
-
MapboxIsochrone,
|
|
1226
|
-
MapboxGeocoder,
|
|
1227
|
-
MapboxDirections,
|
|
1210
|
+
GoogleDirections,
|
|
1228
1211
|
GoogleGeocoder,
|
|
1229
|
-
|
|
1212
|
+
MapboxDirections,
|
|
1213
|
+
MapboxGeocoder,
|
|
1214
|
+
MapboxIsochrone,
|
|
1215
|
+
MapboxMatrix,
|
|
1216
|
+
MaptilerGeocoder,
|
|
1217
|
+
NominatimGeocoder,
|
|
1218
|
+
OSRMDirections,
|
|
1219
|
+
OSRMMatrix,
|
|
1220
|
+
PhotonGeocoder,
|
|
1221
|
+
ValhallaDirections,
|
|
1222
|
+
ValhallaIsochrone,
|
|
1223
|
+
ValhallaMatrix,
|
|
1224
|
+
defaultDirections,
|
|
1225
|
+
defaultGeocoder,
|
|
1226
|
+
defaultIsochrone,
|
|
1227
|
+
defaultMatrix,
|
|
1228
|
+
valhallaDirections,
|
|
1229
|
+
valhallaMatrix
|
|
1230
1230
|
};
|
|
@@ -274,10 +274,10 @@ var init_storage = __esm(() => {
|
|
|
274
274
|
init_storage();
|
|
275
275
|
|
|
276
276
|
export {
|
|
277
|
-
|
|
278
|
-
resetDefaultCache,
|
|
279
|
-
getDefaultCache,
|
|
280
|
-
computeTileCoords,
|
|
277
|
+
TileCache,
|
|
281
278
|
cachedFetch,
|
|
282
|
-
|
|
279
|
+
computeTileCoords,
|
|
280
|
+
getDefaultCache,
|
|
281
|
+
resetDefaultCache,
|
|
282
|
+
saveOfflineRegion
|
|
283
283
|
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether these sections are just a string in disguise.
|
|
3
|
+
*
|
|
4
|
+
* Most `format` expressions in real styles carry no options at all — they are
|
|
5
|
+
* written for the newline, or for a conditional the author found easier to
|
|
6
|
+
* express there. Those take the plain text path, which measures and draws in
|
|
7
|
+
* one call instead of per section.
|
|
8
|
+
*/
|
|
9
|
+
export declare function isUniform(sections: FormattedSection[]): boolean;
|
|
10
|
+
/** Duck-typed, so a value crossing a module boundary is still recognised. */
|
|
11
|
+
export declare function isFormatted(value: unknown): value is Formatted;
|
|
12
|
+
// Formatted — the value `format` evaluates to.
|
|
13
|
+
//
|
|
14
|
+
// `["format", "Main", {}, " St", { "font-scale": 0.8 }]` is one label whose
|
|
15
|
+
// parts are drawn differently: a road shield's number larger than its prefix,
|
|
16
|
+
// a place name above a smaller subtitle, a unit in a lighter colour. The
|
|
17
|
+
// sections have to survive as structure all the way to the renderer, because
|
|
18
|
+
// the whole point of them is that they are not one uniform run of text.
|
|
19
|
+
//
|
|
20
|
+
// They also have to keep behaving like a string. `text-field` is read in
|
|
21
|
+
// several places that only want to know whether there is any text and how
|
|
22
|
+
// long it is, and a caller reading a feature's label through the query API
|
|
23
|
+
// expects a string. `toString` concatenates, so every one of those paths keeps
|
|
24
|
+
// working and only the drawing code needs to know sections exist.
|
|
25
|
+
export declare interface FormattedSection {
|
|
26
|
+
text: string
|
|
27
|
+
scale?: number
|
|
28
|
+
fontStack?: string[]
|
|
29
|
+
color?: string
|
|
30
|
+
}
|
|
31
|
+
export declare class Formatted {
|
|
32
|
+
sections: FormattedSection[];
|
|
33
|
+
constructor(sections: FormattedSection[]);
|
|
34
|
+
toString(): string;
|
|
35
|
+
get uniform(): boolean;
|
|
36
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function registerBindingOps(): void;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Great-circle distance in metres.
|
|
3
|
+
*
|
|
4
|
+
* Haversine rather than a planar approximation: a planar one is wrong by
|
|
5
|
+
* kilometres at high latitude, which is exactly where "is this within 500m"
|
|
6
|
+
* questions stop being decorative.
|
|
7
|
+
*/
|
|
8
|
+
export declare function haversine(a: Position, b: Position): number;
|
|
9
|
+
/**
|
|
10
|
+
* Even-odd ray casting, with the boundary counted as inside.
|
|
11
|
+
*
|
|
12
|
+
* A point exactly on an edge is a real case — shared borders, snapped data —
|
|
13
|
+
* and excluding it makes two adjacent polygons disagree about who owns it.
|
|
14
|
+
*/
|
|
15
|
+
export declare function pointInRing(point: Position, ring: Position[]): boolean;
|
|
16
|
+
/** Inside the outer ring and outside every hole. */
|
|
17
|
+
export declare function pointInPolygon(point: Position, polygon: Position[][]): boolean;
|
|
18
|
+
export declare function registerGeometryOps(): void;
|
|
19
|
+
declare type Position = [number, number];
|
|
@@ -8,14 +8,17 @@ export declare interface EvaluationContext {
|
|
|
8
8
|
type: 1 | 2 | 3
|
|
9
9
|
id?: number | string
|
|
10
10
|
properties: Record<string, unknown>
|
|
11
|
+
geometry?: () => unknown
|
|
11
12
|
}
|
|
12
13
|
featureState?: Record<string, unknown>
|
|
13
14
|
lineProgress?: number
|
|
15
|
+
heatmapDensity?: number
|
|
14
16
|
globalProperties?: {
|
|
15
17
|
bearing?: number
|
|
16
18
|
pitch?: number
|
|
17
19
|
zoom: number
|
|
18
20
|
}
|
|
21
|
+
bindings?: Record<string, unknown>
|
|
19
22
|
}
|
|
20
23
|
// A compiled expression: a closure plus metadata the renderer uses to decide
|
|
21
24
|
// whether it needs to re-evaluate on zoom change, on feature change, or on
|