@forgeroute/ui 0.4.87 → 0.4.89
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/fesm2022/forgeroute-ui-map.mjs +2799 -0
- package/fesm2022/forgeroute-ui-map.mjs.map +1 -0
- package/fesm2022/{forgeroute-ui-ui-labels.es-jZuBPL40.mjs → forgeroute-ui-ui-labels.es-D3a6iMnB.mjs} +121 -2
- package/fesm2022/forgeroute-ui-ui-labels.es-D3a6iMnB.mjs.map +1 -0
- package/fesm2022/forgeroute-ui.mjs +12876 -10775
- package/fesm2022/forgeroute-ui.mjs.map +1 -1
- package/package.json +9 -1
- package/types/forgeroute-ui-map.d.ts +743 -0
- package/types/forgeroute-ui-messaging.d.ts +5 -5
- package/types/forgeroute-ui-stripe.d.ts +1 -1
- package/types/forgeroute-ui.d.ts +598 -0
- package/fesm2022/forgeroute-ui-ui-labels.es-jZuBPL40.mjs.map +0 -1
|
@@ -0,0 +1,743 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { InjectionToken, TemplateRef } from "@angular/core";
|
|
3
|
+
import { UiLabelsService } from "@forgeroute/ui";
|
|
4
|
+
/**
|
|
5
|
+
* Pure geography helpers of the map entry point. No Angular, no Leaflet, no DOM: the same maths is mirrored in SQL on the backend
|
|
6
|
+
* (so the list a user gets for a drawn area equals the markers the map shows for it), which is why every definition is spelled out.
|
|
7
|
+
*
|
|
8
|
+
* Conventions (the SQL mirror must use the same ones):
|
|
9
|
+
* - Coordinates are WGS84 degrees: `lat` in [-90, 90], `lng` in [-180, 180].
|
|
10
|
+
* - Distances use a sphere of radius `EARTH_RADIUS_METERS` (the IUGG mean radius, 6,371,008.8 m) and the haversine formula.
|
|
11
|
+
* - `pointInPolygon` treats `lng` as x and `lat` as y on a flat plane (even-odd ray casting) and counts the boundary as inside. That is right
|
|
12
|
+
* for the search areas people draw (a city, a district); it does not wrap over the antimeridian and does not enclose a pole.
|
|
13
|
+
* - Bounding boxes are `{ north, south, east, west }` with `west <= east` (no antimeridian wrap).
|
|
14
|
+
*/
|
|
15
|
+
interface LatLng {
|
|
16
|
+
lat: number;
|
|
17
|
+
lng: number;
|
|
18
|
+
}
|
|
19
|
+
/** `south <= north` and `west <= east`, degrees. */
|
|
20
|
+
interface GeoBounds {
|
|
21
|
+
north: number;
|
|
22
|
+
south: number;
|
|
23
|
+
east: number;
|
|
24
|
+
west: number;
|
|
25
|
+
}
|
|
26
|
+
/** The IUGG mean Earth radius in metres: the radius every distance of this file (and of its SQL mirror) uses. */
|
|
27
|
+
export declare const EARTH_RADIUS_METERS = 6371008.8;
|
|
28
|
+
/** true for a finite latitude in [-90, 90]. */
|
|
29
|
+
export declare function isValidLat(value: unknown): value is number;
|
|
30
|
+
/** true for a finite longitude in [-180, 180]. */
|
|
31
|
+
export declare function isValidLng(value: unknown): value is number;
|
|
32
|
+
/** true when both coordinates are valid. */
|
|
33
|
+
export declare function isValidLatLng(value: unknown): value is LatLng;
|
|
34
|
+
/** The latitude limited to [-90, 90] (NaN stays NaN). */
|
|
35
|
+
export declare function clampLat(value: number): number;
|
|
36
|
+
/** The longitude limited to [-180, 180]. The map does not repeat the world, so a point beyond the edge is the edge. */
|
|
37
|
+
export declare function clampLng(value: number): number;
|
|
38
|
+
/** Great-circle distance between two points in metres (haversine, sphere of `EARTH_RADIUS_METERS`). */
|
|
39
|
+
export declare function haversineMeters(a: LatLng, b: LatLng): number;
|
|
40
|
+
/**
|
|
41
|
+
* true when `point` lies inside `polygon` or on its boundary. `polygon` is the ring of corners in order, open or closed (a repeated
|
|
42
|
+
* first point at the end is ignored). Fewer than 3 distinct corners = false.
|
|
43
|
+
*/
|
|
44
|
+
export declare function pointInPolygon(point: LatLng, polygon: readonly LatLng[]): boolean;
|
|
45
|
+
/** The smallest box holding every point, or null for none. Points with a non-finite coordinate are ignored. */
|
|
46
|
+
export declare function boundsOf(points: readonly LatLng[]): GeoBounds | null;
|
|
47
|
+
/**
|
|
48
|
+
* The box around a circle: exact on a sphere for the latitude span (`radius / R`) and for the longitude span
|
|
49
|
+
* (`asin(sin(radius / R) / cos(lat))`). Where the box would pass a pole or the antimeridian it is widened to the whole longitude range
|
|
50
|
+
* (a safe, never-too-small box for a SQL prefilter: it may include a few points the exact circle test then drops).
|
|
51
|
+
*/
|
|
52
|
+
export declare function circleToBounds(center: LatLng, radiusMeters: number): GeoBounds;
|
|
53
|
+
/** The four corners of a box as a closed-less polygon ring: north-west, north-east, south-east, south-west. */
|
|
54
|
+
export declare function boundsToPolygon(b: GeoBounds): LatLng[];
|
|
55
|
+
/** true when the point is inside the box or on its edge. */
|
|
56
|
+
export declare function boundsContains(b: GeoBounds, p: LatLng): boolean;
|
|
57
|
+
/** true when two boxes share any area or edge. */
|
|
58
|
+
export declare function boundsIntersect(a: GeoBounds, b: GeoBounds): boolean;
|
|
59
|
+
/** true when the two closed segments share at least one point (touching ends and overlapping collinear parts count). */
|
|
60
|
+
declare function segmentsIntersect(a: LatLng, b: LatLng, c: LatLng, d: LatLng): boolean;
|
|
61
|
+
/**
|
|
62
|
+
* true when the ring is a simple polygon: at least 3 corners, no two corners on the same spot, no edge crossing or touching another edge except neighbours
|
|
63
|
+
* at their shared corner (a "bowtie", a figure eight or a spike that doubles back on itself is not simple). A repeated closing point is ignored.
|
|
64
|
+
* Both the drawing tool and `isValidArea` refuse a polygon that is not simple, because even-odd containment is ambiguous for it.
|
|
65
|
+
*/
|
|
66
|
+
export declare function isSimplePolygon(polygon: readonly LatLng[]): boolean;
|
|
67
|
+
/** true when adding `next` to the open chain `points` (the last point joins it) would make the new edge cross or touch an earlier edge (not the one it continues from). */
|
|
68
|
+
declare function edgeCrossesChain(points: readonly LatLng[], next: LatLng): boolean;
|
|
69
|
+
/** One place on the map. */
|
|
70
|
+
interface UiMapMarker<T = unknown> {
|
|
71
|
+
/** Unique id; reported by `markerClick` and used for `selectedId`. */
|
|
72
|
+
id: string;
|
|
73
|
+
lat: number;
|
|
74
|
+
lng: number;
|
|
75
|
+
/** Visible name: the tooltip, the list entry and the accessible name (unless `ariaLabel` is set). */
|
|
76
|
+
label: string;
|
|
77
|
+
/** Spoken name when it must differ from `label` ("Oak Plaza, retail, 12,000 sq ft, for lease"). */
|
|
78
|
+
ariaLabel?: string;
|
|
79
|
+
/** Groups markers: each category gets its own shape AND colour (colour is never the only signal). */
|
|
80
|
+
category?: string;
|
|
81
|
+
/** Any CSS colour; overrides the category colour. */
|
|
82
|
+
color?: string;
|
|
83
|
+
/** One or two characters drawn inside the pin ("$", "L", "3"). Defaults to the first letter of the label. */
|
|
84
|
+
icon?: string;
|
|
85
|
+
/** The host's own record, handed back in the info template. */
|
|
86
|
+
data?: T;
|
|
87
|
+
}
|
|
88
|
+
/** The visible part of the map. */
|
|
89
|
+
interface UiMapBounds extends GeoBounds {
|
|
90
|
+
zoom: number;
|
|
91
|
+
}
|
|
92
|
+
/** The centre and zoom of the map. */
|
|
93
|
+
interface UiMapView {
|
|
94
|
+
center: LatLng;
|
|
95
|
+
zoom: number;
|
|
96
|
+
}
|
|
97
|
+
type UiMapDrawShape = 'circle' | 'rectangle' | 'polygon';
|
|
98
|
+
interface UiMapCircleArea {
|
|
99
|
+
type: 'circle';
|
|
100
|
+
lat: number;
|
|
101
|
+
lng: number;
|
|
102
|
+
radiusMeters: number;
|
|
103
|
+
}
|
|
104
|
+
interface UiMapBboxArea {
|
|
105
|
+
type: 'bbox';
|
|
106
|
+
north: number;
|
|
107
|
+
south: number;
|
|
108
|
+
east: number;
|
|
109
|
+
west: number;
|
|
110
|
+
}
|
|
111
|
+
interface UiMapPolygonArea {
|
|
112
|
+
type: 'polygon';
|
|
113
|
+
points: LatLng[];
|
|
114
|
+
}
|
|
115
|
+
/** A search area drawn on the map or typed into the area form. */
|
|
116
|
+
type UiMapArea = UiMapCircleArea | UiMapBboxArea | UiMapPolygonArea;
|
|
117
|
+
/** Context of the info template: `<ng-template uiMapInfo let-marker>`. */
|
|
118
|
+
interface UiMapInfoContext<T = unknown> {
|
|
119
|
+
$implicit: UiMapMarker<T>;
|
|
120
|
+
marker: UiMapMarker<T>;
|
|
121
|
+
}
|
|
122
|
+
/** The shapes a category can get. Together with the colour they make every category readable without colour. */
|
|
123
|
+
declare const PIN_SHAPES: readonly ["circle", "square", "diamond", "hexagon"];
|
|
124
|
+
type PinShape = typeof PIN_SHAPES[number];
|
|
125
|
+
/**
|
|
126
|
+
* Pin colours: dark enough for white text on them (every one is at least 4.5:1 against white) and for 3:1 against the light map tiles with the
|
|
127
|
+
* white outline the pin has.
|
|
128
|
+
*/
|
|
129
|
+
declare const PIN_COLORS: readonly ["#1d4ed8", "#047857", "#b45309", "#be123c", "#6d28d9", "#0e7490", "#a21caf", "#475569"];
|
|
130
|
+
interface PinStyle {
|
|
131
|
+
shape: PinShape;
|
|
132
|
+
color: string;
|
|
133
|
+
}
|
|
134
|
+
/** The sorted list of distinct categories of the markers (the key of the shape / colour assignment). */
|
|
135
|
+
declare function categoriesOf(markers: readonly UiMapMarker[]): string[];
|
|
136
|
+
/**
|
|
137
|
+
* The look of one marker: its category's position in the sorted category list picks the colour (index mod 8) and the shape (index mod 4), so up to 8
|
|
138
|
+
* categories get a unique shape + colour pair, and a marker without a category is the first colour as a circle. A `color` on the marker wins over the
|
|
139
|
+
* colour (the shape stays the category's).
|
|
140
|
+
*/
|
|
141
|
+
declare function pinStyle(marker: Pick<UiMapMarker, 'category' | 'color'>, categories: readonly string[]): PinStyle;
|
|
142
|
+
/** The one or two characters drawn inside a pin: the marker's `icon`, else the first letter of its label (upper case). */
|
|
143
|
+
declare function pinGlyph(marker: Pick<UiMapMarker, 'icon' | 'label'>): string;
|
|
144
|
+
/** Pixel size of a pin (the Leaflet icon box); the hit area is enlarged to 44px on touch screens by CSS. */
|
|
145
|
+
declare const PIN_SIZE = 32;
|
|
146
|
+
declare const CLUSTER_SIZE = 44;
|
|
147
|
+
/** Builds the DOM of a pin. Text goes in with `textContent` and the colour through the CSS property API, so nothing a host sends can inject markup. */
|
|
148
|
+
declare function buildPin(doc: Document, style: PinStyle, glyph: string, selected: boolean): HTMLElement;
|
|
149
|
+
/** Builds the DOM of a cluster circle showing how many places it holds. */
|
|
150
|
+
declare function buildCluster(doc: Document, countText: string): HTMLElement;
|
|
151
|
+
/**
|
|
152
|
+
* Marks the template of the info panel that opens for the selected marker: `<ng-template [uiMapInfo]="markers()" let-marker>`.
|
|
153
|
+
* Bind the markers to type the template (`marker.data` then has the host's type); the bare `<ng-template uiMapInfo let-marker>` also works.
|
|
154
|
+
*/
|
|
155
|
+
export declare class UiMapInfoDirective<T = unknown> {
|
|
156
|
+
/** Only used to infer the marker type in the template; the value is never read. */
|
|
157
|
+
readonly typeFrom: import("@angular/core").InputSignal<"" | readonly UiMapMarker<T>[]>;
|
|
158
|
+
readonly template: TemplateRef<UiMapInfoContext<T>>;
|
|
159
|
+
static ngTemplateContextGuard<T>(_dir: UiMapInfoDirective<T>, _ctx: unknown): _ctx is UiMapInfoContext<T>;
|
|
160
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<UiMapInfoDirective<any>, never>;
|
|
161
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<UiMapInfoDirective<any>, "ng-template[uiMapInfo]", never, {
|
|
162
|
+
"typeFrom": {
|
|
163
|
+
"alias": "uiMapInfo";
|
|
164
|
+
"required": false;
|
|
165
|
+
"isSignal": true;
|
|
166
|
+
};
|
|
167
|
+
}, {}, never, never, true, never>;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Tile map with places, grouping, a search area and a list of places, built on Leaflet (loaded only in the browser, only when the map can be drawn).
|
|
171
|
+
* Lives in its own entry point (`@forgeroute/ui/map`) so apps that never show a map never ship the map engine.
|
|
172
|
+
*
|
|
173
|
+
* <ui-map [markers]="places()" [tileUrlTemplate]="tiles.url" [tileAttribution]="tiles.credit" [(selectedId)]="selected"
|
|
174
|
+
* [drawModes]="['circle','rectangle','polygon']" [(area)]="searchArea" (boundsChange)="load($event)" (markerClick)="open($event)">
|
|
175
|
+
* <ng-template [uiMapInfo]="places()" let-marker> ...details of the selected place... </ng-template>
|
|
176
|
+
* </ui-map>
|
|
177
|
+
*
|
|
178
|
+
* Provider-agnostic: there is no built-in tile vendor. Without a tile source (or with one that has no attribution text) the map shows
|
|
179
|
+
* "Map unavailable: ..." and the places stay available as a list - never a blank box.
|
|
180
|
+
*
|
|
181
|
+
* Accessibility: the map is a named group with keyboard help (arrows pan, + / - zoom); every place is in a list below it (Tab into it, Up / Down /
|
|
182
|
+
* Home / End to move, Enter to select) that is the keyboard and screen-reader way to every marker; pins differ by shape AND colour AND carry a
|
|
183
|
+
* glyph; the zoom, fit and drawing tools are real buttons (44px on touch screens); drawing works with the pointer (click points), the keyboard
|
|
184
|
+
* (Space adds a point at the crosshair in the middle of the map, Enter finishes, Backspace removes the last point, Escape cancels) and the typed
|
|
185
|
+
* form (`ui-map-area-form`); every step is announced in a polite live region. Reduced motion switches the pan / zoom animations off; forced
|
|
186
|
+
* colors draw real borders.
|
|
187
|
+
*/
|
|
188
|
+
export declare class MapComponent<T = unknown> {
|
|
189
|
+
protected readonly labels: UiLabelsService;
|
|
190
|
+
private readonly zone;
|
|
191
|
+
private readonly destroyRef;
|
|
192
|
+
private readonly isBrowser;
|
|
193
|
+
private readonly loadEngine;
|
|
194
|
+
protected readonly helpId: string;
|
|
195
|
+
/** The places. Each needs a unique `id`, `lat`, `lng` and a `label`; markers with an invalid coordinate are left out. */
|
|
196
|
+
readonly markers: import("@angular/core").InputSignal<readonly UiMapMarker<T>[]>;
|
|
197
|
+
/** Id of the selected place (two-way: `[(selectedId)]`). Choosing a place from the map or the list sets it; `null` closes the info panel. */
|
|
198
|
+
readonly selectedId: import("@angular/core").ModelSignal<string | null>;
|
|
199
|
+
/** Controlled centre: the map moves there when the value changes. Leave it `null` to let the user (and `fitToMarkers`) decide. */
|
|
200
|
+
readonly center: import("@angular/core").InputSignal<LatLng | null>;
|
|
201
|
+
/** Controlled zoom level (see `center`). */
|
|
202
|
+
readonly zoom: import("@angular/core").InputSignal<number | null>;
|
|
203
|
+
/** Where the map starts when it has no markers, no `center` and no `zoom`. */
|
|
204
|
+
readonly initialCenter: import("@angular/core").InputSignal<LatLng>;
|
|
205
|
+
readonly initialZoom: import("@angular/core").InputSignal<number>;
|
|
206
|
+
/**
|
|
207
|
+
* true = fit the places ONCE: the first time there are any (and the user has not moved the map yet). It never refits when the places change afterwards,
|
|
208
|
+
* so a host that loads places for the visible area from `boundsChange` cannot start a fit / reload loop. Use `fitKey` or `fitMarkers()` to fit again.
|
|
209
|
+
*/
|
|
210
|
+
readonly fitToMarkers: import("@angular/core").InputSignal<boolean>;
|
|
211
|
+
/**
|
|
212
|
+
* Explicit "fit now": every time this value changes (any value; a counter or the id of a search works) the map fits the places. Unlike `fitToMarkers` it fits
|
|
213
|
+
* also after the user has moved the map. Ignored while `center` / `zoom` are controlled.
|
|
214
|
+
*/
|
|
215
|
+
readonly fitKey: import("@angular/core").InputSignal<unknown>;
|
|
216
|
+
/** Padding in pixels kept around the markers by fit-to-markers. */
|
|
217
|
+
readonly fitPadding: import("@angular/core").InputSignal<number>;
|
|
218
|
+
/** Highest zoom a fit may use (so a single marker does not zoom to street level of nothing). */
|
|
219
|
+
readonly fitMaxZoom: import("@angular/core").InputSignal<number>;
|
|
220
|
+
/** Tile address, e.g. `https://tiles.example.com/{z}/{x}/{y}.png` (`{s}` for subdomains, `{r}` for retina). There is no built-in vendor. */
|
|
221
|
+
readonly tileUrlTemplate: import("@angular/core").InputSignal<string>;
|
|
222
|
+
/** The credit text the tile provider requires. A tile source without it is refused (the map is not drawn). */
|
|
223
|
+
readonly tileAttribution: import("@angular/core").InputSignal<string>;
|
|
224
|
+
/** Optional link of the credit (an http(s) address). */
|
|
225
|
+
readonly tileAttributionUrl: import("@angular/core").InputSignal<string>;
|
|
226
|
+
/** Letters (`'abc'`) or names for the `{s}` placeholder. */
|
|
227
|
+
readonly subdomains: import("@angular/core").InputSignal<string | readonly string[]>;
|
|
228
|
+
readonly minZoom: import("@angular/core").InputSignal<number>;
|
|
229
|
+
readonly maxZoom: import("@angular/core").InputSignal<number>;
|
|
230
|
+
/** true = group markers that would overlap. */
|
|
231
|
+
readonly clustering: import("@angular/core").InputSignal<boolean>;
|
|
232
|
+
/** Size of the grouping grid in pixels. */
|
|
233
|
+
readonly clusterRadius: import("@angular/core").InputSignal<number>;
|
|
234
|
+
/** From this zoom on nothing is grouped. */
|
|
235
|
+
readonly clusterMaxZoom: import("@angular/core").InputSignal<number>;
|
|
236
|
+
/** The search-area shapes the map offers a drawing tool for (none = no drawing tools). */
|
|
237
|
+
readonly drawModes: import("@angular/core").InputSignal<readonly UiMapDrawShape[]>;
|
|
238
|
+
/** The search area (two-way: `[(area)]`): drawn on the map, or set by the host / `ui-map-area-form`. `null` = none. */
|
|
239
|
+
readonly area: import("@angular/core").ModelSignal<UiMapArea | null>;
|
|
240
|
+
/** true = the area cannot be drawn or cleared (a read-only user); places can still be selected. */
|
|
241
|
+
readonly readOnly: import("@angular/core").InputSignal<boolean>;
|
|
242
|
+
/** true = move the map to a new `area` that did not come from drawing. */
|
|
243
|
+
readonly fitToArea: import("@angular/core").InputSignal<boolean>;
|
|
244
|
+
/** Accessible name of the map. */
|
|
245
|
+
readonly ariaLabel: import("@angular/core").InputSignal<string | null>;
|
|
246
|
+
/** Height of the map (any CSS length). */
|
|
247
|
+
readonly height: import("@angular/core").InputSignal<string>;
|
|
248
|
+
/** true = the list of places is always visible; otherwise it is visually hidden until one of its places has the keyboard focus. */
|
|
249
|
+
readonly showList: import("@angular/core").InputSignal<boolean>;
|
|
250
|
+
/** Most places the list draws (the ones in view first). */
|
|
251
|
+
readonly listLimit: import("@angular/core").InputSignal<number>;
|
|
252
|
+
/** Marks the map busy (the host is loading places). */
|
|
253
|
+
readonly loading: import("@angular/core").InputSignal<boolean>;
|
|
254
|
+
/** How long the map waits after it stops moving before it emits `boundsChange` / `viewChange`. */
|
|
255
|
+
readonly idleDelay: import("@angular/core").InputSignal<number>;
|
|
256
|
+
/** false = the mouse wheel scrolls the page instead of zooming the map (use it when the map sits inside a long page). */
|
|
257
|
+
readonly scrollWheelZoom: import("@angular/core").InputSignal<boolean>;
|
|
258
|
+
/** The visible part of the map, after the user (or the host) stopped moving it. Also once when the map is first ready. */
|
|
259
|
+
readonly boundsChange: import("@angular/core").OutputEmitterRef<UiMapBounds>;
|
|
260
|
+
/** The centre and zoom, at the same moments as `boundsChange`. */
|
|
261
|
+
readonly viewChange: import("@angular/core").OutputEmitterRef<UiMapView>;
|
|
262
|
+
/** A place was chosen on the map or in the list. */
|
|
263
|
+
readonly markerClick: import("@angular/core").OutputEmitterRef<UiMapMarker<T>>;
|
|
264
|
+
protected readonly info: import("@angular/core").Signal<UiMapInfoDirective<T> | undefined>;
|
|
265
|
+
private readonly canvas;
|
|
266
|
+
/** The running engine (null until Leaflet is loaded, or when the map is unavailable). Private: Leaflet's types stay out of this entry's public declarations. */
|
|
267
|
+
private readonly engine;
|
|
268
|
+
protected readonly engineFailed: import("@angular/core").WritableSignal<boolean>;
|
|
269
|
+
protected readonly tilesFailed: import("@angular/core").WritableSignal<boolean>;
|
|
270
|
+
protected readonly announcement: import("@angular/core").WritableSignal<string>;
|
|
271
|
+
/** The zoom level of the map (also available before the engine runs: the initial one). */
|
|
272
|
+
readonly zoomLevel: import("@angular/core").WritableSignal<number>;
|
|
273
|
+
/** The visible part of the map; null until the map has been laid out. */
|
|
274
|
+
readonly bounds: import("@angular/core").WritableSignal<UiMapBounds | null>;
|
|
275
|
+
/** The shape being drawn, or null. */
|
|
276
|
+
readonly drawing: import("@angular/core").WritableSignal<UiMapDrawShape | null>;
|
|
277
|
+
/** The points clicked so far while drawing. */
|
|
278
|
+
readonly draftPoints: import("@angular/core").WritableSignal<readonly LatLng[]>;
|
|
279
|
+
/** true once the map is created and shown. */
|
|
280
|
+
readonly ready: import("@angular/core").Signal<boolean>;
|
|
281
|
+
protected readonly tileState: import("@angular/core").Signal<import("@forgeroute/ui/map").TileSourceState>;
|
|
282
|
+
protected readonly unavailable: import("@angular/core").Signal<boolean>;
|
|
283
|
+
protected readonly unavailableText: import("@angular/core").Signal<string>;
|
|
284
|
+
protected readonly regionLabel: import("@angular/core").Signal<string>;
|
|
285
|
+
protected readonly attributionUrl: import("@angular/core").Signal<string | null>;
|
|
286
|
+
protected readonly drawEnabled: import("@angular/core").Signal<boolean>;
|
|
287
|
+
protected readonly canZoomIn: import("@angular/core").Signal<boolean>;
|
|
288
|
+
protected readonly canZoomOut: import("@angular/core").Signal<boolean>;
|
|
289
|
+
private readonly validMarkers;
|
|
290
|
+
protected readonly selectedMarker: import("@angular/core").Signal<UiMapMarker<T> | null>;
|
|
291
|
+
private readonly categories;
|
|
292
|
+
private readonly styles;
|
|
293
|
+
/** What is drawn on the map: single markers and groups. The selected marker is never grouped, so it stays visible. */
|
|
294
|
+
private readonly renderItems;
|
|
295
|
+
/** The zoom from which places are never grouped: the grouping limit, but never above what the map can zoom to (or groups of equal places could not be opened). */
|
|
296
|
+
private readonly dissolveZoom;
|
|
297
|
+
private readonly markerSignature;
|
|
298
|
+
private readonly inView;
|
|
299
|
+
protected readonly listItems: import("@angular/core").Signal<UiMapMarker<T>[]>;
|
|
300
|
+
protected readonly listSummary: import("@angular/core").Signal<string>;
|
|
301
|
+
protected readonly listTab: import("@angular/core").WritableSignal<string | null>;
|
|
302
|
+
protected readonly listTabId: import("@angular/core").Signal<string>;
|
|
303
|
+
protected readonly areaText: import("@angular/core").Signal<string>;
|
|
304
|
+
protected readonly drawInstruction: import("@angular/core").Signal<string>;
|
|
305
|
+
private session;
|
|
306
|
+
private lastDrawn;
|
|
307
|
+
private autoFitDone;
|
|
308
|
+
private userMoved;
|
|
309
|
+
private lastFitKey;
|
|
310
|
+
/** A `fitKey` change that found no places: the fit waits for the places (the next change of the set of places, or `loading` ending). */
|
|
311
|
+
private pendingFit;
|
|
312
|
+
private wasLoading;
|
|
313
|
+
/** The grouping cell (px) the drawn window was built for: a change of `clustering` / `clusterRadius` rebuilds it. */
|
|
314
|
+
private windowCell;
|
|
315
|
+
private listenersAbort;
|
|
316
|
+
/** The area (and zoom) the places are drawn for: the visible part padded by half a screen on every side. Places outside it are neither drawn nor grouped. */
|
|
317
|
+
private readonly renderWindow;
|
|
318
|
+
/** The visible part padded by a quarter of a screen: while the view stays inside it the drawn places are kept. */
|
|
319
|
+
private renderInner;
|
|
320
|
+
private emitTimer;
|
|
321
|
+
private resizeObserver;
|
|
322
|
+
private readonly layerById;
|
|
323
|
+
private readonly itemById;
|
|
324
|
+
private readyWaiters;
|
|
325
|
+
private cursor;
|
|
326
|
+
/** The map's own centre at the last move (Mercator: not the middle of the bounds). */
|
|
327
|
+
private centerNow;
|
|
328
|
+
constructor();
|
|
329
|
+
/** Resolves `true` once the map is created, `false` when it cannot be (no usable tile source, or the map engine failed to load). */
|
|
330
|
+
whenReady(): Promise<boolean>;
|
|
331
|
+
/** Moves the map so every place is visible (animated unless the user prefers reduced motion; `animate = false` jumps). */
|
|
332
|
+
fitMarkers(animate?: boolean): void;
|
|
333
|
+
/** Moves the map so the box is visible. */
|
|
334
|
+
fitBounds(b: GeoBounds, animate?: boolean, maxZoom?: number): void;
|
|
335
|
+
setView(center: LatLng, zoom?: number): void;
|
|
336
|
+
/** Zooms one level in. A move the host makes: it does not switch the automatic first fit off (the zoom buttons of the map do, see `onZoomButton`). */
|
|
337
|
+
zoomIn(): void;
|
|
338
|
+
/** Zooms one level out (a host move, like `zoomIn`). */
|
|
339
|
+
zoomOut(): void;
|
|
340
|
+
/** The map's own zoom buttons: the user's zoom, so it switches the automatic first fit off (and drops a waiting fit), then zooms. */
|
|
341
|
+
protected onZoomButton(direction: 'in' | 'out'): void;
|
|
342
|
+
/** The user changed the view: the automatic first fit is off for good and a fit that was waiting for places is dropped (the user's view wins). */
|
|
343
|
+
private markUserMoved;
|
|
344
|
+
/** Re-measures the map (call it after the host resized or showed the container; a ResizeObserver already does it for normal layout changes). */
|
|
345
|
+
invalidateSize(): void;
|
|
346
|
+
/** Starts drawing a search area of this shape (ignored when read-only, not offered by `drawModes`, or the map is not ready). */
|
|
347
|
+
startDraw(shape: UiMapDrawShape): void;
|
|
348
|
+
/** Adds a point where the crosshair (the middle of the map) is: the keyboard way to draw. */
|
|
349
|
+
addPointAtCenter(): void;
|
|
350
|
+
/** Finishes a polygon (the circle and the rectangle finish by themselves at their second point). */
|
|
351
|
+
finishDraw(): void;
|
|
352
|
+
/** Removes the last point of the drawing. */
|
|
353
|
+
undoDrawPoint(): void;
|
|
354
|
+
/** Stops drawing without a result. */
|
|
355
|
+
cancelDraw(): void;
|
|
356
|
+
/** Removes the search area. */
|
|
357
|
+
clearArea(): void;
|
|
358
|
+
protected styleOf(m: UiMapMarker<T>): PinStyle;
|
|
359
|
+
protected glyphOf(m: UiMapMarker<T>): string;
|
|
360
|
+
protected drawLabel(shape: UiMapDrawShape): string;
|
|
361
|
+
protected closeInfo(): void;
|
|
362
|
+
protected selectFromList(m: UiMapMarker<T>): void;
|
|
363
|
+
/** Says which place was chosen (and that its details are open, when the host has an info template). */
|
|
364
|
+
private announceSelected;
|
|
365
|
+
protected onListKey(event: KeyboardEvent): void;
|
|
366
|
+
/** Keyboard on the map: while drawing, Space / Enter / Backspace / Escape; otherwise Escape closes the info panel. */
|
|
367
|
+
protected onStageKey(event: KeyboardEvent): void;
|
|
368
|
+
private reducedMotion;
|
|
369
|
+
private create;
|
|
370
|
+
private teardown;
|
|
371
|
+
private resolveWaiters;
|
|
372
|
+
private syncTiles;
|
|
373
|
+
/** The map stopped moving: the `bounds` signal follows at once (the list uses it), the outputs after the idle delay. */
|
|
374
|
+
private onMoveEnd;
|
|
375
|
+
/** The visible part of the map, clamped to the world (no events, no signals). */
|
|
376
|
+
private visibleBox;
|
|
377
|
+
/** `move` fires all through a drag or an animation: a cheap comparison with the margin, and a rebuild only once the view is past it. */
|
|
378
|
+
private onMove;
|
|
379
|
+
/**
|
|
380
|
+
* Rebuilds the drawn area when the zoom changed or the view left the margin of the last build; panning inside the margin keeps the drawn places.
|
|
381
|
+
* The margin is at least one grouping cell: a cell that touches the visible area is then drawn whole, so no group shows a count that leaves out places
|
|
382
|
+
* beyond the window's edge (inner margin >= 1 cell, outer margin >= inner + 1 cell, both at least a quarter / half of the screen).
|
|
383
|
+
*/
|
|
384
|
+
private updateRenderWindow;
|
|
385
|
+
private syncMarkers;
|
|
386
|
+
/** The pins are decoration for pointer users: the list is the way for screen readers and the keyboard, so the pin icons are hidden from them. */
|
|
387
|
+
private markIconHidden;
|
|
388
|
+
private onItemClick;
|
|
389
|
+
private panToMarker;
|
|
390
|
+
private applyControlledView;
|
|
391
|
+
/** The one automatic fit: the first time there are places, unless the user already moved the map or the view is controlled. */
|
|
392
|
+
private autoFit;
|
|
393
|
+
/**
|
|
394
|
+
* `fitKey` changed: fit now (also after the user moved the map). With no places yet (a search whose results are still loading) nothing is fitted and the
|
|
395
|
+
* fit stays PENDING until the places arrive (the next change of the set of places, or `loading` going from true to false); the first-fit rule is untouched.
|
|
396
|
+
*/
|
|
397
|
+
private fitOnKey;
|
|
398
|
+
private describeArea;
|
|
399
|
+
private describeRadius;
|
|
400
|
+
private announce;
|
|
401
|
+
private onMapClick;
|
|
402
|
+
private addDrawPoint;
|
|
403
|
+
private commitArea;
|
|
404
|
+
private endSession;
|
|
405
|
+
private syncDrawMode;
|
|
406
|
+
private syncArea;
|
|
407
|
+
private onCursor;
|
|
408
|
+
private syncDraft;
|
|
409
|
+
/** Draws the points clicked so far and, while the pointer moves, the shape they would make with the pointer's position. */
|
|
410
|
+
private drawDraft;
|
|
411
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MapComponent<any>, never>;
|
|
412
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<MapComponent<any>, "ui-map", never, {
|
|
413
|
+
"markers": {
|
|
414
|
+
"alias": "markers";
|
|
415
|
+
"required": false;
|
|
416
|
+
"isSignal": true;
|
|
417
|
+
};
|
|
418
|
+
"selectedId": {
|
|
419
|
+
"alias": "selectedId";
|
|
420
|
+
"required": false;
|
|
421
|
+
"isSignal": true;
|
|
422
|
+
};
|
|
423
|
+
"center": {
|
|
424
|
+
"alias": "center";
|
|
425
|
+
"required": false;
|
|
426
|
+
"isSignal": true;
|
|
427
|
+
};
|
|
428
|
+
"zoom": {
|
|
429
|
+
"alias": "zoom";
|
|
430
|
+
"required": false;
|
|
431
|
+
"isSignal": true;
|
|
432
|
+
};
|
|
433
|
+
"initialCenter": {
|
|
434
|
+
"alias": "initialCenter";
|
|
435
|
+
"required": false;
|
|
436
|
+
"isSignal": true;
|
|
437
|
+
};
|
|
438
|
+
"initialZoom": {
|
|
439
|
+
"alias": "initialZoom";
|
|
440
|
+
"required": false;
|
|
441
|
+
"isSignal": true;
|
|
442
|
+
};
|
|
443
|
+
"fitToMarkers": {
|
|
444
|
+
"alias": "fitToMarkers";
|
|
445
|
+
"required": false;
|
|
446
|
+
"isSignal": true;
|
|
447
|
+
};
|
|
448
|
+
"fitKey": {
|
|
449
|
+
"alias": "fitKey";
|
|
450
|
+
"required": false;
|
|
451
|
+
"isSignal": true;
|
|
452
|
+
};
|
|
453
|
+
"fitPadding": {
|
|
454
|
+
"alias": "fitPadding";
|
|
455
|
+
"required": false;
|
|
456
|
+
"isSignal": true;
|
|
457
|
+
};
|
|
458
|
+
"fitMaxZoom": {
|
|
459
|
+
"alias": "fitMaxZoom";
|
|
460
|
+
"required": false;
|
|
461
|
+
"isSignal": true;
|
|
462
|
+
};
|
|
463
|
+
"tileUrlTemplate": {
|
|
464
|
+
"alias": "tileUrlTemplate";
|
|
465
|
+
"required": false;
|
|
466
|
+
"isSignal": true;
|
|
467
|
+
};
|
|
468
|
+
"tileAttribution": {
|
|
469
|
+
"alias": "tileAttribution";
|
|
470
|
+
"required": false;
|
|
471
|
+
"isSignal": true;
|
|
472
|
+
};
|
|
473
|
+
"tileAttributionUrl": {
|
|
474
|
+
"alias": "tileAttributionUrl";
|
|
475
|
+
"required": false;
|
|
476
|
+
"isSignal": true;
|
|
477
|
+
};
|
|
478
|
+
"subdomains": {
|
|
479
|
+
"alias": "subdomains";
|
|
480
|
+
"required": false;
|
|
481
|
+
"isSignal": true;
|
|
482
|
+
};
|
|
483
|
+
"minZoom": {
|
|
484
|
+
"alias": "minZoom";
|
|
485
|
+
"required": false;
|
|
486
|
+
"isSignal": true;
|
|
487
|
+
};
|
|
488
|
+
"maxZoom": {
|
|
489
|
+
"alias": "maxZoom";
|
|
490
|
+
"required": false;
|
|
491
|
+
"isSignal": true;
|
|
492
|
+
};
|
|
493
|
+
"clustering": {
|
|
494
|
+
"alias": "clustering";
|
|
495
|
+
"required": false;
|
|
496
|
+
"isSignal": true;
|
|
497
|
+
};
|
|
498
|
+
"clusterRadius": {
|
|
499
|
+
"alias": "clusterRadius";
|
|
500
|
+
"required": false;
|
|
501
|
+
"isSignal": true;
|
|
502
|
+
};
|
|
503
|
+
"clusterMaxZoom": {
|
|
504
|
+
"alias": "clusterMaxZoom";
|
|
505
|
+
"required": false;
|
|
506
|
+
"isSignal": true;
|
|
507
|
+
};
|
|
508
|
+
"drawModes": {
|
|
509
|
+
"alias": "drawModes";
|
|
510
|
+
"required": false;
|
|
511
|
+
"isSignal": true;
|
|
512
|
+
};
|
|
513
|
+
"area": {
|
|
514
|
+
"alias": "area";
|
|
515
|
+
"required": false;
|
|
516
|
+
"isSignal": true;
|
|
517
|
+
};
|
|
518
|
+
"readOnly": {
|
|
519
|
+
"alias": "readOnly";
|
|
520
|
+
"required": false;
|
|
521
|
+
"isSignal": true;
|
|
522
|
+
};
|
|
523
|
+
"fitToArea": {
|
|
524
|
+
"alias": "fitToArea";
|
|
525
|
+
"required": false;
|
|
526
|
+
"isSignal": true;
|
|
527
|
+
};
|
|
528
|
+
"ariaLabel": {
|
|
529
|
+
"alias": "ariaLabel";
|
|
530
|
+
"required": false;
|
|
531
|
+
"isSignal": true;
|
|
532
|
+
};
|
|
533
|
+
"height": {
|
|
534
|
+
"alias": "height";
|
|
535
|
+
"required": false;
|
|
536
|
+
"isSignal": true;
|
|
537
|
+
};
|
|
538
|
+
"showList": {
|
|
539
|
+
"alias": "showList";
|
|
540
|
+
"required": false;
|
|
541
|
+
"isSignal": true;
|
|
542
|
+
};
|
|
543
|
+
"listLimit": {
|
|
544
|
+
"alias": "listLimit";
|
|
545
|
+
"required": false;
|
|
546
|
+
"isSignal": true;
|
|
547
|
+
};
|
|
548
|
+
"loading": {
|
|
549
|
+
"alias": "loading";
|
|
550
|
+
"required": false;
|
|
551
|
+
"isSignal": true;
|
|
552
|
+
};
|
|
553
|
+
"idleDelay": {
|
|
554
|
+
"alias": "idleDelay";
|
|
555
|
+
"required": false;
|
|
556
|
+
"isSignal": true;
|
|
557
|
+
};
|
|
558
|
+
"scrollWheelZoom": {
|
|
559
|
+
"alias": "scrollWheelZoom";
|
|
560
|
+
"required": false;
|
|
561
|
+
"isSignal": true;
|
|
562
|
+
};
|
|
563
|
+
}, {
|
|
564
|
+
"selectedId": "selectedIdChange";
|
|
565
|
+
"area": "areaChange";
|
|
566
|
+
"boundsChange": "boundsChange";
|
|
567
|
+
"viewChange": "viewChange";
|
|
568
|
+
"markerClick": "markerClick";
|
|
569
|
+
}, ["info"], never, true, never>;
|
|
570
|
+
}
|
|
571
|
+
/**
|
|
572
|
+
* How `ui-map` gets Leaflet: a function returning a promise of the Leaflet module (or of `{ default: <module> }`). The default is `() => import('leaflet')`,
|
|
573
|
+
* evaluated in the browser only and only when the map can be drawn. Override it to load Leaflet another way (a CDN build, a test double):
|
|
574
|
+
* `{ provide: UI_MAP_ENGINE_LOADER, useValue: () => import('./my-leaflet') }`. A rejected promise shows "Map unavailable: the map could not be loaded"
|
|
575
|
+
* and keeps the list of places (this is also what an app without `leaflet` installed ends up with).
|
|
576
|
+
*/
|
|
577
|
+
export declare const UI_MAP_ENGINE_LOADER: InjectionToken<() => Promise<unknown>>;
|
|
578
|
+
type UiMapRadiusUnit = 'm' | 'km' | 'mi';
|
|
579
|
+
/**
|
|
580
|
+
* The typed way to set a search area: the keyboard- and screen-reader-friendly twin of drawing on the map. Place it next to a `ui-map` and share
|
|
581
|
+
* the area signal: `<ui-map [(area)]="area" /> <ui-map-area-form [(area)]="area" />`. Circle (centre latitude / longitude + radius with a unit),
|
|
582
|
+
* rectangle (north / south / east / west) and polygon (add points one by one, remove any, at least 3) are supported; every field shows its own
|
|
583
|
+
* message and Apply stays blocked while one is wrong. A new `area` from outside (drawn on the map, loaded from a saved search) fills the form.
|
|
584
|
+
*/
|
|
585
|
+
export declare class MapAreaFormComponent {
|
|
586
|
+
protected readonly labels: UiLabelsService;
|
|
587
|
+
/** The search area (two-way: `[(area)]`). Apply sets it, Clear sets it to `null`; a value that arrives from outside fills the form. */
|
|
588
|
+
readonly area: import("@angular/core").ModelSignal<UiMapArea | null>;
|
|
589
|
+
/** Which shapes the shape select offers. */
|
|
590
|
+
readonly shapes: import("@angular/core").InputSignal<readonly UiMapDrawShape[]>;
|
|
591
|
+
/** The unit the radius field starts in. */
|
|
592
|
+
readonly defaultUnit: import("@angular/core").InputSignal<UiMapRadiusUnit>;
|
|
593
|
+
/** true = every field and button is disabled (a read-only user). */
|
|
594
|
+
readonly readOnly: import("@angular/core").InputSignal<boolean>;
|
|
595
|
+
protected readonly shape: import("@angular/core").WritableSignal<UiMapDrawShape>;
|
|
596
|
+
protected readonly unit: import("@angular/core").WritableSignal<UiMapRadiusUnit>;
|
|
597
|
+
protected readonly lat: import("@angular/core").WritableSignal<number | null>;
|
|
598
|
+
protected readonly lng: import("@angular/core").WritableSignal<number | null>;
|
|
599
|
+
/** What the radius field SHOWS, in the chosen unit (rounded to 6 decimals for display only). */
|
|
600
|
+
protected readonly radius: import("@angular/core").WritableSignal<number | null>;
|
|
601
|
+
/** The radius in metres, exact: what Apply saves. Switching the unit only changes how it is shown, so m -> mi -> m never drifts. */
|
|
602
|
+
private readonly meters;
|
|
603
|
+
protected readonly north: import("@angular/core").WritableSignal<number | null>;
|
|
604
|
+
protected readonly south: import("@angular/core").WritableSignal<number | null>;
|
|
605
|
+
protected readonly east: import("@angular/core").WritableSignal<number | null>;
|
|
606
|
+
protected readonly west: import("@angular/core").WritableSignal<number | null>;
|
|
607
|
+
protected readonly pointLat: import("@angular/core").WritableSignal<number | null>;
|
|
608
|
+
protected readonly pointLng: import("@angular/core").WritableSignal<number | null>;
|
|
609
|
+
protected readonly points: import("@angular/core").WritableSignal<LatLng[]>;
|
|
610
|
+
/** Errors show after the first Apply (or Add point), not while the user is still typing the first value. */
|
|
611
|
+
protected readonly touched: import("@angular/core").WritableSignal<boolean>;
|
|
612
|
+
protected readonly pointTouched: import("@angular/core").WritableSignal<boolean>;
|
|
613
|
+
protected readonly announcement: import("@angular/core").WritableSignal<string>;
|
|
614
|
+
private lastApplied;
|
|
615
|
+
private unitChosen;
|
|
616
|
+
protected readonly shapeOptions: import("@angular/core").Signal<{
|
|
617
|
+
value: UiMapDrawShape;
|
|
618
|
+
label: string;
|
|
619
|
+
}[]>;
|
|
620
|
+
protected readonly unitOptions: import("@angular/core").Signal<{
|
|
621
|
+
value: string;
|
|
622
|
+
label: string;
|
|
623
|
+
}[]>;
|
|
624
|
+
/** The message of every field (an empty string = fine). */
|
|
625
|
+
protected readonly errors: import("@angular/core").Signal<{
|
|
626
|
+
lat: string;
|
|
627
|
+
lng: string;
|
|
628
|
+
radius: string;
|
|
629
|
+
north: string;
|
|
630
|
+
south: string;
|
|
631
|
+
east: string;
|
|
632
|
+
west: string;
|
|
633
|
+
pointLat: string;
|
|
634
|
+
pointLng: string;
|
|
635
|
+
points: string;
|
|
636
|
+
}>;
|
|
637
|
+
/**
|
|
638
|
+
* Whether the SHAPE has a problem (what Apply cares about). The messages of the "add a point" fields belong to Add point: a half-typed point never blocks
|
|
639
|
+
* Apply of a polygon that is already valid (it is simply not part of the area).
|
|
640
|
+
*/
|
|
641
|
+
protected readonly hasErrors: import("@angular/core").Signal<boolean>;
|
|
642
|
+
constructor();
|
|
643
|
+
protected num(value: unknown): number | null;
|
|
644
|
+
/** The user typed a radius: it is in the unit chosen now. */
|
|
645
|
+
protected onRadius(value: number | null): void;
|
|
646
|
+
protected fmt(value: number): string;
|
|
647
|
+
protected setShape(value: string): void;
|
|
648
|
+
/** Changing the unit keeps the length the user means: 2 miles becomes 3.218688 km, not 2 km. */
|
|
649
|
+
protected setUnit(value: string): void;
|
|
650
|
+
protected addPoint(): void;
|
|
651
|
+
protected removePoint(index: number): void;
|
|
652
|
+
protected apply(): void;
|
|
653
|
+
protected clear(): void;
|
|
654
|
+
private build;
|
|
655
|
+
private fillFrom;
|
|
656
|
+
private reset;
|
|
657
|
+
private round;
|
|
658
|
+
private announce;
|
|
659
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MapAreaFormComponent, never>;
|
|
660
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<MapAreaFormComponent, "ui-map-area-form", never, {
|
|
661
|
+
"area": {
|
|
662
|
+
"alias": "area";
|
|
663
|
+
"required": false;
|
|
664
|
+
"isSignal": true;
|
|
665
|
+
};
|
|
666
|
+
"shapes": {
|
|
667
|
+
"alias": "shapes";
|
|
668
|
+
"required": false;
|
|
669
|
+
"isSignal": true;
|
|
670
|
+
};
|
|
671
|
+
"defaultUnit": {
|
|
672
|
+
"alias": "defaultUnit";
|
|
673
|
+
"required": false;
|
|
674
|
+
"isSignal": true;
|
|
675
|
+
};
|
|
676
|
+
"readOnly": {
|
|
677
|
+
"alias": "readOnly";
|
|
678
|
+
"required": false;
|
|
679
|
+
"isSignal": true;
|
|
680
|
+
};
|
|
681
|
+
}, {
|
|
682
|
+
"area": "areaChange";
|
|
683
|
+
}, never, never, true, never>;
|
|
684
|
+
}
|
|
685
|
+
/** The smallest box around the area (a safe prefilter for the exact `areaContains` test; widened near the poles / antimeridian for circles). */
|
|
686
|
+
export declare function areaBounds(area: UiMapArea): GeoBounds | null;
|
|
687
|
+
/** true when the point is inside the area (the boundary counts as inside). Same rules as the backend's SQL. */
|
|
688
|
+
export declare function areaContains(area: UiMapArea, point: LatLng): boolean;
|
|
689
|
+
/** The area as a polygon ring (a circle has none: null). */
|
|
690
|
+
export declare function areaRing(area: UiMapArea): LatLng[] | null;
|
|
691
|
+
/** true when the area is well formed: valid coordinates, a radius above 0, `south < north`, `west < east`, a polygon of at least 3 points that does not cross itself. */
|
|
692
|
+
export declare function isValidArea(area: UiMapArea | null | undefined): area is UiMapArea;
|
|
693
|
+
/** Two areas are the same shape with the same numbers. */
|
|
694
|
+
export declare function sameArea(a: UiMapArea | null | undefined, b: UiMapArea | null | undefined): boolean;
|
|
695
|
+
interface GridClusterOptions {
|
|
696
|
+
/** Size of a grid cell in screen pixels: markers closer than this at the given zoom are grouped. Default 60. */
|
|
697
|
+
radiusPx?: number;
|
|
698
|
+
/** At this zoom and above nothing is grouped. Default 16. */
|
|
699
|
+
maxZoom?: number;
|
|
700
|
+
}
|
|
701
|
+
/** A marker drawn on its own. */
|
|
702
|
+
interface SingleMapItem<T> {
|
|
703
|
+
kind: 'marker';
|
|
704
|
+
item: T;
|
|
705
|
+
}
|
|
706
|
+
/** Two or more markers drawn as one counted circle. */
|
|
707
|
+
interface ClusterMapItem<T> {
|
|
708
|
+
kind: 'cluster';
|
|
709
|
+
/** Stable for the same grid cell at the same zoom: `cluster:<zoom>:<cellX>:<cellY>`. */
|
|
710
|
+
id: string;
|
|
711
|
+
/** Mean position of the members. */
|
|
712
|
+
lat: number;
|
|
713
|
+
lng: number;
|
|
714
|
+
count: number;
|
|
715
|
+
members: T[];
|
|
716
|
+
/** The smallest box around the members (zoom to it to open the cluster). */
|
|
717
|
+
bounds: GeoBounds;
|
|
718
|
+
}
|
|
719
|
+
type MapItem<T> = SingleMapItem<T> | ClusterMapItem<T>;
|
|
720
|
+
/** Web Mercator pixel position of a point at a zoom level (256 px tiles). Latitude is clamped to the projection's limit. */
|
|
721
|
+
export declare function projectToPixels(point: LatLng, zoom: number): {
|
|
722
|
+
x: number;
|
|
723
|
+
y: number;
|
|
724
|
+
};
|
|
725
|
+
/**
|
|
726
|
+
* Groups markers that would overlap at `zoom` with a simple grid: each marker goes into the cell of its pixel position, a cell with one marker stays a
|
|
727
|
+
* marker, a cell with several becomes one cluster at their mean position. Deterministic (output follows the order of the first member of each cell),
|
|
728
|
+
* no dependency, O(n). Markers with a non-finite coordinate are left out.
|
|
729
|
+
*/
|
|
730
|
+
export declare function clusterMarkers<T extends LatLng>(items: readonly T[], zoom: number, options?: GridClusterOptions): MapItem<T>[];
|
|
731
|
+
/** Why the map can or cannot draw tiles with the configuration it was given. */
|
|
732
|
+
type TileSourceState = 'ok' | 'none' | 'invalid' | 'no-attribution';
|
|
733
|
+
/**
|
|
734
|
+
* Checks the tile source of a `ui-map`: a template (`https://tiles.example.com/{z}/{x}/{y}.png`), the attribution text the provider requires, nothing else.
|
|
735
|
+
* - no template = `none` (the map is not drawn; the places are still listed);
|
|
736
|
+
* - a template that is not an `http(s):` address, a protocol-relative `//host/...` address, a root-relative `/path/...` address or a `data:image/` address
|
|
737
|
+
* (`javascript:` and everything else are refused) = `invalid`;
|
|
738
|
+
* - a valid template with an empty attribution = `no-attribution`: map data providers require their credit to be shown, so the map is not drawn without it.
|
|
739
|
+
*/
|
|
740
|
+
export declare function tileSourceState(template: string | null | undefined, attribution: string | null | undefined): TileSourceState;
|
|
741
|
+
/** The subdomain letters of the `{s}` placeholder: a string of letters ("abc"), an array of names or nothing. Empty / invalid = Leaflet's default `abc`. */
|
|
742
|
+
declare function normalizeSubdomains(value: string | readonly string[] | null | undefined): string | string[];
|
|
743
|
+
export type { ClusterMapItem, GeoBounds, GridClusterOptions, LatLng, MapItem, SingleMapItem, TileSourceState, UiMapArea, UiMapBboxArea, UiMapBounds, UiMapCircleArea, UiMapDrawShape, UiMapInfoContext, UiMapMarker, UiMapPolygonArea, UiMapRadiusUnit, UiMapView };
|