@classic-homes/maps-core 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.
@@ -0,0 +1,1247 @@
1
+ import { MapTheme } from './theme/index.cjs';
2
+ export { MapDataColors, MapStyleSpec, MapThemeColors, THEME_DARK, THEME_LIGHT, darkBasicStyle, darkTheme, generateBasicStyle, generateDarkColors, generateDarkDataColors, generateDarkTheme, generateLightColors, generateLightDataColors, generateLightTheme, generateVectorStyle, getBasicStyle, getTheme, getTypography, lightBasicStyle, lightTheme } from './theme/index.cjs';
3
+ import { L as LngLat, G as GeoJSONFeatureCollection, b as MarkerData, M as MapBounds, B as BoundsArray, a as GeoJSONFeature, c as GeoJSONPolygon } from './data-DDS6ok7I.cjs';
4
+ export { C as ClusterConfig, E as ExtrusionData, e as GeoJSONGeometry, h as GeoJSONLineString, i as GeoJSONMultiLineString, g as GeoJSONMultiPoint, j as GeoJSONMultiPolygon, f as GeoJSONPoint, H as HeatmapPoint, k as MapSourceData, d as MapViewport } from './data-DDS6ok7I.cjs';
5
+ import { ControlPosition } from './types/index.cjs';
6
+ export { BaseControlProps, BaseLayerProps, BaseMapEventParams, BaseMapProps, CircleLayerProps, CoordinateDisplayProps, FeatureClickEventParams, FeatureHoverEventParams, FillExtrusionLayerProps, FillLayerProps, GeolocateControlProps, GradientStop, HeatmapLayerProps, LegendConfig, LegendGroupProps, LegendItem, LegendProps, LineLayerProps, MapClickEventParams, MapErrorEventParams, MapHoverEventParams, MapLoadEventParams, MapMoveEventParams, MapProps, MarkerClickEventParams, MarkerDragEventParams, MarkerProps, NavigationControlProps, PopupEventParams, PopupProps, RasterLayerProps, ScaleControlProps, SourceProps, SymbolLayerProps } from './types/index.cjs';
7
+ export { o as BuildRTreeIndexOptions, B as BuildSpatialIndexOptions, I as IdleViewportManagerOptions, r as IdleViewportResult, P as PanVelocity, p as PredictiveViewportResult, k as QuerySpatialIndexOptions, Q as QueryStats, n as RTreeIndex, m as RTreeItem, R as RTreeQueryStats, S as SpatialIndex, V as ViewportManagedDataOptions, l as ViewportManagedResult, e as buildRTreeIndex, b as buildSpatialIndex, j as createIdleViewportManager, i as createPredictiveViewportManager, h as createRTreeViewportManager, d as createViewportManager, c as createViewportQuery, q as queryByBounds, a as queryByBoundsWithStats, f as queryRTreeByBounds, g as queryRTreeByBoundsWithStats } from './spatial-J48Btm8f.cjs';
8
+ import 'rbush';
9
+
10
+ /**
11
+ * Accessibility utilities for maps
12
+ *
13
+ * Provides screen reader support and keyboard navigation guidance
14
+ */
15
+
16
+ /**
17
+ * Keyboard controls documentation for screen readers
18
+ */
19
+ declare const KEYBOARD_CONTROLS: {
20
+ readonly pan: {
21
+ readonly up: "Arrow Up";
22
+ readonly down: "Arrow Down";
23
+ readonly left: "Arrow Left";
24
+ readonly right: "Arrow Right";
25
+ };
26
+ readonly zoom: {
27
+ readonly in: "Plus (+) or Equals (=)";
28
+ readonly out: "Minus (-)";
29
+ };
30
+ readonly rotate: {
31
+ readonly left: "Shift + Arrow Left";
32
+ readonly right: "Shift + Arrow Right";
33
+ };
34
+ readonly pitch: {
35
+ readonly increase: "Shift + Arrow Up";
36
+ readonly decrease: "Shift + Arrow Down";
37
+ };
38
+ readonly reset: {
39
+ readonly bearing: "N key (reset north)";
40
+ readonly view: "R key (reset view)";
41
+ };
42
+ };
43
+ /**
44
+ * Generate a text description of keyboard controls
45
+ */
46
+ declare function generateKeyboardControlsDescription(): string;
47
+ /**
48
+ * Generate an accessible description for a map
49
+ */
50
+ declare function generateMapDescription(title: string, options?: {
51
+ center?: LngLat;
52
+ zoom?: number;
53
+ featureCount?: number;
54
+ markerCount?: number;
55
+ layerTypes?: string[];
56
+ }): string;
57
+ /**
58
+ * Generate description for GeoJSON features
59
+ */
60
+ declare function generateFeatureCollectionDescription(title: string, data: GeoJSONFeatureCollection): string;
61
+ /**
62
+ * Generate description for markers
63
+ */
64
+ declare function generateMarkersDescription(title: string, markers: MarkerData[]): string;
65
+ /**
66
+ * Generate a hidden data table for screen readers
67
+ */
68
+ declare function generateFeatureTable(features: GeoJSONFeatureCollection, propertyKeys: string[]): string;
69
+ /**
70
+ * Generate a hidden marker list for screen readers
71
+ */
72
+ declare function generateMarkerList(markers: MarkerData[]): string;
73
+ /**
74
+ * Generate live region announcement for map changes
75
+ */
76
+ declare function generateMoveAnnouncement(center: LngLat, zoom: number, action: 'pan' | 'zoom' | 'move'): string;
77
+
78
+ /**
79
+ * Style utilities for map layers
80
+ *
81
+ * Helper functions for creating MapLibre paint and layout expressions
82
+ */
83
+
84
+ /**
85
+ * Color expression for data-driven styling
86
+ */
87
+ type ColorExpression = string | unknown[];
88
+ /**
89
+ * Number expression for data-driven styling
90
+ */
91
+ type NumberExpression = number | unknown[];
92
+ /**
93
+ * Create a solid polygon/fill style
94
+ */
95
+ declare function createFillStyle(options: {
96
+ color: ColorExpression;
97
+ opacity?: NumberExpression;
98
+ outlineColor?: ColorExpression;
99
+ }): {
100
+ paint: Record<string, unknown>;
101
+ };
102
+ /**
103
+ * Create a line style
104
+ */
105
+ declare function createLineStyle(options: {
106
+ color: ColorExpression;
107
+ width: NumberExpression;
108
+ opacity?: NumberExpression;
109
+ dashArray?: number[];
110
+ cap?: 'butt' | 'round' | 'square';
111
+ join?: 'bevel' | 'round' | 'miter';
112
+ }): {
113
+ paint: Record<string, unknown>;
114
+ layout: Record<string, unknown>;
115
+ };
116
+ /**
117
+ * Create a circle/point style
118
+ */
119
+ declare function createCircleStyle(options: {
120
+ radius: NumberExpression;
121
+ color: ColorExpression;
122
+ opacity?: NumberExpression;
123
+ strokeWidth?: NumberExpression;
124
+ strokeColor?: ColorExpression;
125
+ blur?: number;
126
+ }): {
127
+ paint: Record<string, unknown>;
128
+ };
129
+ /**
130
+ * Create a 3D extrusion style for buildings
131
+ */
132
+ declare function createExtrusionStyle(options: {
133
+ height: NumberExpression;
134
+ baseHeight?: NumberExpression;
135
+ color: ColorExpression;
136
+ opacity?: number;
137
+ verticalGradient?: boolean;
138
+ }): {
139
+ paint: Record<string, unknown>;
140
+ };
141
+ /**
142
+ * Create a heatmap style
143
+ */
144
+ declare function createHeatmapStyle(options: {
145
+ weight?: NumberExpression;
146
+ intensity?: NumberExpression;
147
+ radius?: NumberExpression;
148
+ opacity?: NumberExpression;
149
+ colorRamp?: string[];
150
+ }): {
151
+ paint: Record<string, unknown>;
152
+ };
153
+ /**
154
+ * Create a hover expression for highlighting features
155
+ *
156
+ * @param baseValue - The default value
157
+ * @param hoverValue - The value when hovered (feature-state hover = true)
158
+ * @param featureStateName - The feature state property name (default: 'hover')
159
+ */
160
+ declare function createHoverExpression(baseValue: unknown, hoverValue: unknown, featureStateName?: string): unknown[];
161
+ /**
162
+ * Create a selection expression for highlighting selected features
163
+ */
164
+ declare function createSelectionExpression(baseValue: unknown, selectedValue: unknown, featureStateName?: string): unknown[];
165
+ /**
166
+ * Create a combined hover and selection expression
167
+ */
168
+ declare function createInteractiveExpression(baseValue: unknown, hoverValue: unknown, selectedValue: unknown): unknown[];
169
+ /**
170
+ * Create a data-driven color expression based on a property
171
+ *
172
+ * @param property - The feature property name
173
+ * @param colorMap - Map of property values to colors
174
+ * @param defaultColor - Default color for unmapped values
175
+ */
176
+ declare function createCategoricalColorExpression(property: string, colorMap: Record<string, string>, defaultColor: string): unknown[];
177
+ /**
178
+ * Create a continuous color ramp expression
179
+ *
180
+ * @param property - The feature property name
181
+ * @param stops - Array of [value, color] pairs
182
+ * @param interpolation - Interpolation type ('linear', 'exponential', 'cubic-bezier')
183
+ */
184
+ declare function createContinuousColorExpression(property: string, stops: [number, string][], interpolation?: 'linear' | 'exponential' | ['cubic-bezier', number, number, number, number]): unknown[];
185
+ /**
186
+ * Create a zoom-based interpolation expression
187
+ *
188
+ * @param stops - Array of [zoom, value] pairs
189
+ */
190
+ declare function createZoomExpression(stops: [number, number][]): unknown[];
191
+ /**
192
+ * Get pre-configured highlight style for the active theme
193
+ */
194
+ declare function getHighlightStyle(theme?: MapTheme): {
195
+ fill: Record<string, unknown>;
196
+ line: Record<string, unknown>;
197
+ circle: Record<string, unknown>;
198
+ };
199
+ /**
200
+ * Get pre-configured selection style for the active theme
201
+ */
202
+ declare function getSelectionStyle(theme?: MapTheme): {
203
+ fill: Record<string, unknown>;
204
+ line: Record<string, unknown>;
205
+ circle: Record<string, unknown>;
206
+ };
207
+ /**
208
+ * Options for creating lot fill styles
209
+ */
210
+ interface LotFillStyleOptions {
211
+ /** Default fill color */
212
+ defaultColor: string;
213
+ /** Color when hovered */
214
+ hoverColor: string;
215
+ /** Color when selected (optional) */
216
+ selectedColor?: string;
217
+ /** Fill opacity (0-1, default: 0.7) */
218
+ opacity?: number;
219
+ }
220
+ /**
221
+ * Create fill + hover style for polygon lots
222
+ *
223
+ * @example
224
+ * ```tsx
225
+ * const fillStyle = createLotFillStyle({
226
+ * defaultColor: '#22c55e',
227
+ * hoverColor: '#3b82f6',
228
+ * selectedColor: '#f59e0b',
229
+ * opacity: 0.7,
230
+ * });
231
+ *
232
+ * <FillLayer
233
+ * fillColor={fillStyle['fill-color']}
234
+ * fillOpacity={fillStyle['fill-opacity']}
235
+ * />
236
+ * ```
237
+ */
238
+ declare function createLotFillStyle(options: LotFillStyleOptions): {
239
+ 'fill-color': unknown[];
240
+ 'fill-opacity': number;
241
+ };
242
+ /**
243
+ * Options for creating lot outline styles
244
+ */
245
+ interface LotOutlineStyleOptions {
246
+ /** Default outline color */
247
+ defaultColor: string;
248
+ /** Color when hovered */
249
+ hoverColor: string;
250
+ /** Color when selected (optional) */
251
+ selectedColor?: string;
252
+ /** Default line width in pixels (default: 1) */
253
+ defaultWidth?: number;
254
+ /** Line width when hovered (default: 2) */
255
+ hoverWidth?: number;
256
+ /** Line width when selected (default: 3) */
257
+ selectedWidth?: number;
258
+ }
259
+ /**
260
+ * Create outline style with hover highlighting for polygon lots
261
+ *
262
+ * @example
263
+ * ```tsx
264
+ * const outlineStyle = createLotOutlineStyle({
265
+ * defaultColor: '#333',
266
+ * hoverColor: '#1d4ed8',
267
+ * defaultWidth: 1,
268
+ * hoverWidth: 2,
269
+ * });
270
+ *
271
+ * <LineLayer
272
+ * lineColor={outlineStyle['line-color']}
273
+ * lineWidth={outlineStyle['line-width']}
274
+ * />
275
+ * ```
276
+ */
277
+ declare function createLotOutlineStyle(options: LotOutlineStyleOptions): {
278
+ 'line-color': unknown[];
279
+ 'line-width': unknown[];
280
+ };
281
+ /**
282
+ * Options for creating extrusion height expressions
283
+ */
284
+ interface ExtrusionHeightOptions {
285
+ /** Scale factor to multiply property value by (default: 1) */
286
+ scale?: number;
287
+ /** Minimum height in meters (default: 0) */
288
+ minHeight?: number;
289
+ /** Maximum height cap in meters (optional) */
290
+ maxHeight?: number;
291
+ /** Default height when property is missing (default: 0) */
292
+ defaultHeight?: number;
293
+ }
294
+ /**
295
+ * Create data-driven extrusion height expression from a feature property
296
+ *
297
+ * This is useful for visualizing property values like price, square footage,
298
+ * or density as 3D heights on a map.
299
+ *
300
+ * @param property - The feature property name to use for height
301
+ * @param options - Configuration options for height calculation
302
+ *
303
+ * @example
304
+ * ```tsx
305
+ * // Simple height based on price (scaled down)
306
+ * const heightExpr = createExtrusionHeightExpression('price', {
307
+ * scale: 0.0001, // $100,000 = 10m height
308
+ * minHeight: 5,
309
+ * maxHeight: 100,
310
+ * });
311
+ *
312
+ * <FillExtrusionLayer
313
+ * fillExtrusionHeight={heightExpr}
314
+ * fillExtrusionBase={0}
315
+ * />
316
+ * ```
317
+ */
318
+ declare function createExtrusionHeightExpression(property: string, options?: ExtrusionHeightOptions): unknown[];
319
+ /**
320
+ * Create categorical color expression for lot status
321
+ *
322
+ * This creates a match expression that maps status values to colors.
323
+ * Commonly used for real estate lot statuses like available, sold, pending.
324
+ *
325
+ * @param statusColors - Map of status values to colors
326
+ * @param defaultColor - Fallback color for unknown statuses (default: '#888888')
327
+ *
328
+ * @example
329
+ * ```tsx
330
+ * const statusColorExpr = createStatusColorExpression({
331
+ * available: '#22c55e', // green
332
+ * pending: '#f59e0b', // amber
333
+ * sold: '#ef4444', // red
334
+ * reserved: '#3b82f6', // blue
335
+ * });
336
+ *
337
+ * <FillLayer fillColor={statusColorExpr} />
338
+ * <FillExtrusionLayer fillExtrusionColor={statusColorExpr} />
339
+ * ```
340
+ */
341
+ declare function createStatusColorExpression(statusColors: Record<string, string>, defaultColor?: string): unknown[];
342
+ /**
343
+ * Create a combined status color expression with hover/selection support
344
+ *
345
+ * This creates an expression that:
346
+ * 1. Uses status-based colors for the default state
347
+ * 2. Applies a highlight color on hover
348
+ * 3. Optionally applies a selection color when selected
349
+ *
350
+ * @example
351
+ * ```tsx
352
+ * const colorExpr = createInteractiveStatusColorExpression(
353
+ * { available: '#22c55e', sold: '#ef4444' },
354
+ * { hoverColor: '#3b82f6', selectedColor: '#f59e0b' }
355
+ * );
356
+ *
357
+ * <FillLayer fillColor={colorExpr} />
358
+ * ```
359
+ */
360
+ declare function createInteractiveStatusColorExpression(statusColors: Record<string, string>, options: {
361
+ hoverColor: string;
362
+ selectedColor?: string;
363
+ defaultColor?: string;
364
+ }): unknown[];
365
+
366
+ /**
367
+ * Formatting utilities for map data
368
+ */
369
+
370
+ /**
371
+ * Format coordinates for display
372
+ *
373
+ * @param coordinates - [lng, lat] coordinate pair
374
+ * @param precision - Decimal places (default: 6)
375
+ * @param format - Output format
376
+ */
377
+ declare function formatCoordinates(coordinates: LngLat, precision?: number, format?: 'decimal' | 'dms' | 'dd'): string;
378
+ /**
379
+ * Convert decimal degrees to DMS (degrees, minutes, seconds)
380
+ */
381
+ declare function decimalToDMS(decimal: number, type: 'lat' | 'lng'): string;
382
+ /**
383
+ * Format distance in meters to human-readable string
384
+ *
385
+ * @param meters - Distance in meters
386
+ * @param unit - Unit system
387
+ */
388
+ declare function formatDistance(meters: number, unit?: 'metric' | 'imperial'): string;
389
+ /**
390
+ * Format area in square meters to human-readable string
391
+ *
392
+ * @param sqMeters - Area in square meters
393
+ * @param unit - Unit system
394
+ */
395
+ declare function formatArea(sqMeters: number, unit?: 'metric' | 'imperial'): string;
396
+ /**
397
+ * Format a bounding box for display
398
+ */
399
+ declare function formatBounds(bounds: MapBounds | BoundsArray): string;
400
+ /**
401
+ * Format zoom level for display
402
+ */
403
+ declare function formatZoom(zoom: number): string;
404
+ /**
405
+ * Format bearing/rotation for display
406
+ */
407
+ declare function formatBearing(bearing: number): string;
408
+ /**
409
+ * Format pitch/tilt for display
410
+ */
411
+ declare function formatPitch(pitch: number): string;
412
+ /**
413
+ * Format a scale value for display
414
+ *
415
+ * @param scale - Scale ratio (e.g., 50000 for 1:50,000)
416
+ */
417
+ declare function formatScale(scale: number): string;
418
+ /**
419
+ * Approximate the scale from zoom level (rough estimate)
420
+ *
421
+ * @param zoom - Map zoom level
422
+ * @param latitude - Latitude (scale varies by latitude)
423
+ */
424
+ declare function zoomToScale(zoom: number, latitude?: number): number;
425
+ /**
426
+ * Format a property value for display in popups
427
+ */
428
+ declare function formatPropertyValue(value: unknown): string;
429
+ /**
430
+ * Create a popup content string from feature properties
431
+ */
432
+ declare function formatFeatureProperties(properties: Record<string, unknown>, options?: {
433
+ exclude?: string[];
434
+ include?: string[];
435
+ labelMap?: Record<string, string>;
436
+ }): string;
437
+ /**
438
+ * Format a property key as a human-readable label
439
+ */
440
+ declare function formatLabel(key: string): string;
441
+
442
+ /**
443
+ * Bounds calculation utilities for GeoJSON data
444
+ */
445
+
446
+ /**
447
+ * Calculate bounds from GeoJSON data
448
+ * @param geojson - GeoJSON FeatureCollection or Feature
449
+ * @returns BoundsArray [[sw_lng, sw_lat], [ne_lng, ne_lat]] or null if no valid coordinates
450
+ */
451
+ declare function calculateBounds(geojson: GeoJSONFeatureCollection | GeoJSONFeature): BoundsArray | null;
452
+ /**
453
+ * Extend bounds to include a new point
454
+ * @param bounds - Existing bounds
455
+ * @param point - Point to include [lng, lat]
456
+ * @returns Extended bounds
457
+ */
458
+ declare function extendBounds(bounds: BoundsArray, point: LngLat): BoundsArray;
459
+ /**
460
+ * Combine two bounds into one that encompasses both
461
+ * @param bounds1 - First bounds
462
+ * @param bounds2 - Second bounds
463
+ * @returns Combined bounds
464
+ */
465
+ declare function combineBounds(bounds1: BoundsArray, bounds2: BoundsArray): BoundsArray;
466
+ /**
467
+ * Validate that bounds are properly formed
468
+ * @param bounds - Bounds to validate
469
+ * @returns True if bounds are valid
470
+ */
471
+ declare function isValidBounds(bounds: BoundsArray): boolean;
472
+
473
+ /**
474
+ * Data loading and validation utilities for GeoJSON
475
+ */
476
+
477
+ /**
478
+ * Options for loading GeoJSON data
479
+ */
480
+ interface LoadGeoJSONOptions {
481
+ /** Request timeout in milliseconds (default: 30000) */
482
+ timeout?: number;
483
+ /** Additional fetch options */
484
+ fetchOptions?: RequestInit;
485
+ /** Validate the GeoJSON structure after loading */
486
+ validate?: boolean;
487
+ }
488
+ /**
489
+ * Result of loading GeoJSON data
490
+ */
491
+ interface LoadGeoJSONResult<T = GeoJSONFeatureCollection> {
492
+ /** The loaded data (null if error) */
493
+ data: T | null;
494
+ /** Error message if loading failed */
495
+ error: string | null;
496
+ /** Whether the request was successful */
497
+ success: boolean;
498
+ }
499
+ /**
500
+ * GeoJSON validation result
501
+ */
502
+ interface ValidationResult {
503
+ /** Whether the GeoJSON is valid */
504
+ valid: boolean;
505
+ /** List of validation errors */
506
+ errors: string[];
507
+ /** Number of features (if FeatureCollection) */
508
+ featureCount?: number;
509
+ /** Geometry types found */
510
+ geometryTypes?: string[];
511
+ }
512
+ /**
513
+ * Load GeoJSON data from a URL
514
+ * @param url - URL to fetch GeoJSON from
515
+ * @param options - Loading options
516
+ * @returns Promise with load result
517
+ */
518
+ declare function loadGeoJSON<T = GeoJSONFeatureCollection>(url: string, options?: LoadGeoJSONOptions): Promise<LoadGeoJSONResult<T>>;
519
+ /**
520
+ * Validate GeoJSON structure
521
+ * @param data - Data to validate
522
+ * @returns Validation result
523
+ */
524
+ declare function validateGeoJSON(data: unknown): ValidationResult;
525
+ /**
526
+ * Calculate the centroid of a GeoJSON FeatureCollection or Feature
527
+ * @param geojson - GeoJSON data
528
+ * @returns Centroid as [lng, lat] or null if no coordinates
529
+ */
530
+ declare function calculateCentroid(geojson: GeoJSONFeatureCollection | GeoJSONFeature): [number, number] | null;
531
+ /**
532
+ * Count features by geometry type in a FeatureCollection
533
+ * @param geojson - GeoJSON FeatureCollection
534
+ * @returns Object with geometry types as keys and counts as values
535
+ */
536
+ declare function countFeaturesByType(geojson: GeoJSONFeatureCollection): Record<string, number>;
537
+ /**
538
+ * Filter features by geometry type
539
+ * @param geojson - GeoJSON FeatureCollection
540
+ * @param types - Geometry types to include
541
+ * @returns Filtered FeatureCollection
542
+ */
543
+ declare function filterByGeometryType(geojson: GeoJSONFeatureCollection, types: string[]): GeoJSONFeatureCollection;
544
+
545
+ /**
546
+ * Positioning utilities for map controls
547
+ *
548
+ * Shared utilities for positioning Legend, CoordinateDisplay, and other custom controls
549
+ * in the four corners of the map.
550
+ */
551
+
552
+ /**
553
+ * Base offset from the edge (matches Tailwind's -2 which is 0.5rem = 8px)
554
+ */
555
+ declare const BASE_OFFSET = 8;
556
+ /**
557
+ * Position classes for each corner
558
+ * Maps position to Tailwind classes for absolute positioning
559
+ */
560
+ declare const POSITION_CLASSES: Record<ControlPosition, string>;
561
+ /**
562
+ * Horizontal offset classes when MapLibre controls are present at the same position
563
+ * These offset the custom control toward the center of the map (away from the corner)
564
+ */
565
+ declare const OFFSET_CLASSES: Record<ControlPosition, string>;
566
+ /**
567
+ * Compute position classes for a control
568
+ *
569
+ * @param position - The corner position for the control
570
+ * @param hasControlsAtPosition - Whether MapLibre controls exist at this position
571
+ * @returns Combined Tailwind classes for positioning
572
+ */
573
+ declare function computePositionClasses(position: ControlPosition, hasControlsAtPosition: boolean): string;
574
+ /**
575
+ * Compute vertical offset style for stacking multiple custom controls
576
+ *
577
+ * IMPORTANT: This uses direct position properties (top/bottom) instead of margins.
578
+ * For absolute positioned elements at the bottom, margin-bottom does nothing.
579
+ * We must override the actual positioning property.
580
+ *
581
+ * @param position - The corner position for the control
582
+ * @param customControlOffset - The offset from other custom controls (in pixels)
583
+ * @param baseOffset - The base offset from the edge (default: 8px from BASE_OFFSET)
584
+ * @returns CSS style object with the appropriate position offset
585
+ */
586
+ declare function computeVerticalOffsetStyle(position: ControlPosition, customControlOffset: number, baseOffset?: number): Record<string, string>;
587
+
588
+ /**
589
+ * Cluster utilities for MapLibre GL
590
+ *
591
+ * These utilities help with common clustering operations like
592
+ * expanding clusters on click and getting cluster information.
593
+ */
594
+
595
+ /**
596
+ * Properties automatically added to cluster features by MapLibre GL
597
+ */
598
+ interface ClusterFeatureProperties extends Record<string, unknown> {
599
+ /** Unique cluster identifier */
600
+ cluster_id: number;
601
+ /** Number of points in the cluster */
602
+ point_count: number;
603
+ /** Abbreviated point count (e.g., "1.2k") */
604
+ point_count_abbreviated: string;
605
+ /** Whether this is a cluster */
606
+ cluster: true;
607
+ }
608
+ /**
609
+ * Type guard to check if a feature is a cluster
610
+ */
611
+ declare function isClusterFeature(feature: {
612
+ properties?: Record<string, unknown> | null;
613
+ }): feature is {
614
+ properties: ClusterFeatureProperties;
615
+ };
616
+ /**
617
+ * Options for cluster expansion
618
+ */
619
+ interface ClusterExpandOptions {
620
+ /** Animation duration in milliseconds (default: 500) */
621
+ duration?: number;
622
+ /** Whether to animate the transition (default: true) */
623
+ animate?: boolean;
624
+ /** Padding around the expanded cluster bounds */
625
+ padding?: number | {
626
+ top: number;
627
+ bottom: number;
628
+ left: number;
629
+ right: number;
630
+ };
631
+ /** Maximum zoom level to expand to */
632
+ maxZoom?: number;
633
+ }
634
+ /**
635
+ * Result of getting cluster expansion zoom
636
+ */
637
+ interface ClusterExpansionResult {
638
+ /** The zoom level needed to expand the cluster */
639
+ zoom: number;
640
+ /** The cluster's center coordinates */
641
+ center: LngLat;
642
+ }
643
+ /**
644
+ * Get the zoom level needed to expand a cluster
645
+ *
646
+ * This is a wrapper around MapLibre GL's getClusterExpansionZoom method
647
+ * that provides a cleaner async interface.
648
+ *
649
+ * @param map - MapLibre GL map instance
650
+ * @param sourceId - ID of the GeoJSON source with clustering enabled
651
+ * @param clusterId - The cluster_id from the cluster feature properties
652
+ * @returns Promise resolving to the expansion zoom level
653
+ *
654
+ * @example
655
+ * ```typescript
656
+ * const zoom = await getClusterExpansionZoom(map, 'points', clusterId);
657
+ * map.easeTo({ center: clusterCoords, zoom });
658
+ * ```
659
+ */
660
+ declare function getClusterExpansionZoom(map: {
661
+ getSource: (id: string) => unknown;
662
+ }, sourceId: string, clusterId: number): Promise<number>;
663
+ /**
664
+ * Get the children features of a cluster
665
+ *
666
+ * Returns the immediate children of a cluster, which may be
667
+ * individual points or other clusters.
668
+ *
669
+ * @param map - MapLibre GL map instance
670
+ * @param sourceId - ID of the GeoJSON source with clustering enabled
671
+ * @param clusterId - The cluster_id from the cluster feature properties
672
+ * @returns Promise resolving to an array of child features
673
+ */
674
+ declare function getClusterChildren(map: {
675
+ getSource: (id: string) => unknown;
676
+ }, sourceId: string, clusterId: number): Promise<GeoJSONFeature[]>;
677
+ /**
678
+ * Get all leaf features (individual points) of a cluster
679
+ *
680
+ * Returns all individual points contained within a cluster,
681
+ * regardless of nesting level.
682
+ *
683
+ * @param map - MapLibre GL map instance
684
+ * @param sourceId - ID of the GeoJSON source with clustering enabled
685
+ * @param clusterId - The cluster_id from the cluster feature properties
686
+ * @param limit - Maximum number of features to return (default: 100)
687
+ * @param offset - Offset for pagination (default: 0)
688
+ * @returns Promise resolving to an array of leaf features
689
+ */
690
+ declare function getClusterLeaves(map: {
691
+ getSource: (id: string) => unknown;
692
+ }, sourceId: string, clusterId: number, limit?: number, offset?: number): Promise<GeoJSONFeature[]>;
693
+ /**
694
+ * Expand a cluster by zooming in to show its contents
695
+ *
696
+ * This is the main utility for handling cluster click-to-expand behavior.
697
+ * It gets the expansion zoom level and animates the map to that zoom.
698
+ *
699
+ * @param map - MapLibre GL map instance with easeTo method
700
+ * @param sourceId - ID of the GeoJSON source with clustering enabled
701
+ * @param clusterId - The cluster_id from the cluster feature properties
702
+ * @param center - The cluster's center coordinates [lng, lat]
703
+ * @param options - Animation and zoom options
704
+ *
705
+ * @example
706
+ * ```typescript
707
+ * // In a cluster click handler:
708
+ * function handleClusterClick(e) {
709
+ * const { cluster_id } = e.feature.properties;
710
+ * const [lng, lat] = e.feature.geometry.coordinates;
711
+ * expandCluster(map, 'points-source', cluster_id, [lng, lat]);
712
+ * }
713
+ * ```
714
+ */
715
+ declare function expandCluster(map: {
716
+ getSource: (id: string) => unknown;
717
+ easeTo: (options: {
718
+ center: [number, number];
719
+ zoom: number;
720
+ duration?: number;
721
+ animate?: boolean;
722
+ padding?: number | {
723
+ top: number;
724
+ bottom: number;
725
+ left: number;
726
+ right: number;
727
+ };
728
+ }) => void;
729
+ getZoom: () => number;
730
+ }, sourceId: string, clusterId: number, center: LngLat, options?: ClusterExpandOptions): Promise<void>;
731
+ /**
732
+ * Calculate bounds that encompass all leaves of a cluster
733
+ *
734
+ * Useful for fitting the map to show all points in a cluster.
735
+ *
736
+ * @param map - MapLibre GL map instance
737
+ * @param sourceId - ID of the GeoJSON source with clustering enabled
738
+ * @param clusterId - The cluster_id from the cluster feature properties
739
+ * @param limit - Maximum number of leaves to consider (default: 1000)
740
+ * @returns Promise resolving to bounds array [[sw_lng, sw_lat], [ne_lng, ne_lat]]
741
+ */
742
+ declare function getClusterBounds(map: {
743
+ getSource: (id: string) => unknown;
744
+ }, sourceId: string, clusterId: number, limit?: number): Promise<BoundsArray>;
745
+ /**
746
+ * Expand a cluster by fitting to the bounds of its leaves
747
+ *
748
+ * Alternative to expandCluster that zooms to fit all points
749
+ * rather than using the expansion zoom level.
750
+ *
751
+ * @param map - MapLibre GL map instance with fitBounds method
752
+ * @param sourceId - ID of the GeoJSON source with clustering enabled
753
+ * @param clusterId - The cluster_id from the cluster feature properties
754
+ * @param options - Animation and padding options
755
+ */
756
+ declare function expandClusterToBounds(map: {
757
+ getSource: (id: string) => unknown;
758
+ fitBounds: (bounds: BoundsArray, options?: {
759
+ padding?: number | {
760
+ top: number;
761
+ bottom: number;
762
+ left: number;
763
+ right: number;
764
+ };
765
+ duration?: number;
766
+ animate?: boolean;
767
+ maxZoom?: number;
768
+ }) => void;
769
+ }, sourceId: string, clusterId: number, options?: ClusterExpandOptions): Promise<void>;
770
+
771
+ /**
772
+ * Level-of-Detail (LOD) utilities for efficient rendering of large polygon datasets
773
+ *
774
+ * These utilities help manage rendering performance by:
775
+ * 1. Grouping features by hierarchy (community > filing > lot)
776
+ * 2. Generating boundary polygons for groups when not provided
777
+ * 3. Supporting zoom-based visibility switching
778
+ */
779
+
780
+ /**
781
+ * Options for grouping features
782
+ */
783
+ interface GroupFeaturesOptions {
784
+ /** Property name to group by */
785
+ groupBy: string;
786
+ /** Optional nested grouping property */
787
+ subGroupBy?: string;
788
+ }
789
+ /**
790
+ * A group of features with computed metadata
791
+ */
792
+ interface FeatureGroup {
793
+ /** Group identifier (property value) */
794
+ id: string;
795
+ /** Features in this group */
796
+ features: GeoJSONFeature[];
797
+ /** Bounds of all features in group */
798
+ bounds: BoundsArray | null;
799
+ /** Centroid of the group */
800
+ centroid: LngLat | null;
801
+ /** Total count of features */
802
+ count: number;
803
+ /** Sub-groups if nested grouping was used */
804
+ subGroups?: Map<string, FeatureGroup>;
805
+ }
806
+ /**
807
+ * Group GeoJSON features by a property value
808
+ *
809
+ * @example
810
+ * ```ts
811
+ * const groups = groupFeaturesByProperty(lotsData, {
812
+ * groupBy: 'community',
813
+ * subGroupBy: 'filing',
814
+ * });
815
+ *
816
+ * // Access groups
817
+ * groups.forEach((group, communityId) => {
818
+ * console.log(`Community ${communityId}: ${group.count} lots`);
819
+ * group.subGroups?.forEach((subGroup, filingId) => {
820
+ * console.log(` Filing ${filingId}: ${subGroup.count} lots`);
821
+ * });
822
+ * });
823
+ * ```
824
+ */
825
+ declare function groupFeaturesByProperty(geojson: GeoJSONFeatureCollection, options: GroupFeaturesOptions): Map<string, FeatureGroup>;
826
+ /**
827
+ * Generate a convex hull polygon from a set of features
828
+ *
829
+ * Uses the gift wrapping algorithm for simplicity
830
+ */
831
+ declare function generateConvexHull(features: GeoJSONFeature[]): GeoJSONPolygon | null;
832
+ /**
833
+ * Generate a bounding box polygon from features
834
+ * Simpler alternative to convex hull
835
+ */
836
+ declare function generateBoundingPolygon(features: GeoJSONFeature[], padding?: number): GeoJSONPolygon | null;
837
+ /**
838
+ * Convert bounds to a polygon
839
+ */
840
+ declare function boundsToPolygon(bounds: BoundsArray, padding?: number): GeoJSONPolygon;
841
+ /**
842
+ * Simplify a GeoJSON polygon geometry
843
+ *
844
+ * @example
845
+ * ```ts
846
+ * const simplified = simplifyPolygon(polygon, 0.0001);
847
+ * console.log(`Reduced from ${original.coordinates[0].length} to ${simplified.coordinates[0].length} points`);
848
+ * ```
849
+ */
850
+ declare function simplifyPolygon(polygon: GeoJSONPolygon, tolerance: number): GeoJSONPolygon;
851
+ /**
852
+ * Simplify a GeoJSON feature's geometry
853
+ *
854
+ * Supports Point, Polygon, and MultiPolygon geometries.
855
+ * Points are returned unchanged. Lines could be added if needed.
856
+ */
857
+ declare function simplifyFeature(feature: GeoJSONFeature, tolerance: number): GeoJSONFeature;
858
+ /**
859
+ * Simplify all features in a GeoJSON FeatureCollection
860
+ *
861
+ * @example
862
+ * ```ts
863
+ * const simplified = simplifyFeatureCollection(features, 0.0001);
864
+ * // Polygon vertices reduced by ~50-80%
865
+ * ```
866
+ */
867
+ declare function simplifyFeatureCollection(collection: GeoJSONFeatureCollection, tolerance: number): GeoJSONFeatureCollection;
868
+ /**
869
+ * Calculate simplification statistics
870
+ */
871
+ interface SimplificationStats {
872
+ /** Original total vertex count */
873
+ originalVertices: number;
874
+ /** Simplified total vertex count */
875
+ simplifiedVertices: number;
876
+ /** Percentage of vertices removed */
877
+ reductionPercent: number;
878
+ /** Number of features processed */
879
+ featureCount: number;
880
+ }
881
+ /**
882
+ * Simplify a feature collection and return with statistics
883
+ */
884
+ declare function simplifyFeatureCollectionWithStats(collection: GeoJSONFeatureCollection, tolerance: number): {
885
+ data: GeoJSONFeatureCollection;
886
+ stats: SimplificationStats;
887
+ };
888
+ /**
889
+ * Simplification threshold configuration
890
+ */
891
+ interface SimplificationThreshold {
892
+ /** Maximum zoom level to apply this simplification */
893
+ maxZoom: number;
894
+ /** Tolerance in degrees - higher = more simplification */
895
+ tolerance: number;
896
+ }
897
+ /**
898
+ * Options for generating LOD data
899
+ */
900
+ interface GenerateLODOptions {
901
+ /** Property to group by at the top level (e.g., 'community') */
902
+ groupBy: string;
903
+ /** Property to group by at the second level (e.g., 'filing') */
904
+ subGroupBy?: string;
905
+ /** Pre-provided boundary for top-level groups (keyed by group ID) */
906
+ groupBoundaries?: Map<string, GeoJSONPolygon>;
907
+ /** Pre-provided boundary for sub-groups (keyed by "groupId:subGroupId") */
908
+ subGroupBoundaries?: Map<string, GeoJSONPolygon>;
909
+ /** Use convex hull (true) or bounding box (false) for auto-generated boundaries */
910
+ useConvexHull?: boolean;
911
+ /** Padding to add around auto-generated bounding boxes (in degrees) */
912
+ boundaryPadding?: number;
913
+ /** Additional properties to aggregate for group features */
914
+ aggregateProperties?: string[];
915
+ /**
916
+ * Simplification thresholds for reducing polygon complexity at lower zoom levels
917
+ * @example [{ maxZoom: 12, tolerance: 0.0001 }, { maxZoom: 10, tolerance: 0.0005 }]
918
+ */
919
+ simplificationThresholds?: SimplificationThreshold[];
920
+ }
921
+ /**
922
+ * Result of LOD generation
923
+ */
924
+ interface LODData {
925
+ /** Top-level group boundaries (communities) */
926
+ groupBoundaries: GeoJSONFeatureCollection;
927
+ /** Second-level group boundaries (filings) */
928
+ subGroupBoundaries: GeoJSONFeatureCollection | null;
929
+ /** Original features with group info */
930
+ features: GeoJSONFeatureCollection;
931
+ /** Recommended zoom thresholds */
932
+ zoomThresholds: {
933
+ /** Show groups below this zoom */
934
+ groupMaxZoom: number;
935
+ /** Show sub-groups between groupMaxZoom and this */
936
+ subGroupMaxZoom: number;
937
+ };
938
+ }
939
+ /**
940
+ * Generate Level-of-Detail data from a feature collection
941
+ *
942
+ * Creates boundary polygons for each group level that can be shown
943
+ * at different zoom levels for better performance.
944
+ *
945
+ * @example
946
+ * ```tsx
947
+ * const lodData = generateLODData(lotsData, {
948
+ * groupBy: 'community',
949
+ * subGroupBy: 'filing',
950
+ * useConvexHull: true,
951
+ * });
952
+ *
953
+ * // Use in map
954
+ * <Source id="communities" data={lodData.groupBoundaries} />
955
+ * <FillLayer
956
+ * id="communities-fill"
957
+ * source="communities"
958
+ * maxZoom={lodData.zoomThresholds.groupMaxZoom}
959
+ * />
960
+ *
961
+ * <Source id="filings" data={lodData.subGroupBoundaries} />
962
+ * <FillLayer
963
+ * id="filings-fill"
964
+ * source="filings"
965
+ * minZoom={lodData.zoomThresholds.groupMaxZoom}
966
+ * maxZoom={lodData.zoomThresholds.subGroupMaxZoom}
967
+ * />
968
+ *
969
+ * <Source id="lots" data={lodData.features} />
970
+ * <FillLayer
971
+ * id="lots-fill"
972
+ * source="lots"
973
+ * minZoom={lodData.zoomThresholds.subGroupMaxZoom}
974
+ * />
975
+ * ```
976
+ */
977
+ declare function generateLODData(geojson: GeoJSONFeatureCollection, options: GenerateLODOptions): LODData;
978
+ /**
979
+ * Extended LOD data with pre-simplified versions
980
+ */
981
+ interface LODDataWithSimplification extends LODData {
982
+ /** Simplified versions of features for different zoom levels */
983
+ simplifiedFeatures?: Map<number, GeoJSONFeatureCollection>;
984
+ /** Simplification statistics */
985
+ simplificationStats?: Map<number, SimplificationStats>;
986
+ }
987
+ /**
988
+ * Generate LOD data with optional polygon simplification
989
+ *
990
+ * When simplificationThresholds are provided, creates pre-simplified
991
+ * versions of features that can be swapped in at lower zoom levels.
992
+ *
993
+ * @example
994
+ * ```tsx
995
+ * const lodData = generateLODDataWithSimplification(lotsData, {
996
+ * groupBy: 'community',
997
+ * subGroupBy: 'filing',
998
+ * useConvexHull: true,
999
+ * simplificationThresholds: [
1000
+ * { maxZoom: 14, tolerance: 0.00005 }, // Light simplification
1001
+ * { maxZoom: 12, tolerance: 0.0002 }, // Medium simplification
1002
+ * { maxZoom: 10, tolerance: 0.0005 }, // Heavy simplification
1003
+ * ],
1004
+ * });
1005
+ *
1006
+ * // Use appropriate data based on zoom
1007
+ * const featureData = zoom < 12
1008
+ * ? lodData.simplifiedFeatures?.get(10)
1009
+ * : zoom < 14
1010
+ * ? lodData.simplifiedFeatures?.get(12)
1011
+ * : lodData.features;
1012
+ * ```
1013
+ */
1014
+ declare function generateLODDataWithSimplification(geojson: GeoJSONFeatureCollection, options: GenerateLODOptions): LODDataWithSimplification;
1015
+ /**
1016
+ * Get the appropriate feature collection for a given zoom level
1017
+ *
1018
+ * @param lodData LOD data with simplification
1019
+ * @param zoom Current zoom level
1020
+ * @returns The most appropriate feature collection for the zoom level
1021
+ */
1022
+ declare function getSimplifiedFeaturesForZoom(lodData: LODDataWithSimplification, zoom: number): GeoJSONFeatureCollection;
1023
+ /**
1024
+ * Calculate appropriate zoom thresholds based on feature density
1025
+ */
1026
+ declare function calculateZoomThresholds(groups: Map<string, FeatureGroup>, options?: {
1027
+ /** Target max features visible at any time */
1028
+ targetMaxFeatures?: number;
1029
+ /** Minimum zoom difference between levels */
1030
+ minZoomGap?: number;
1031
+ }): {
1032
+ groupMaxZoom: number;
1033
+ subGroupMaxZoom: number;
1034
+ };
1035
+ /**
1036
+ * Options for dynamic LOD threshold management
1037
+ */
1038
+ interface DynamicLODOptions {
1039
+ /** Base thresholds to start from */
1040
+ baseThresholds: {
1041
+ groupMaxZoom: number;
1042
+ subGroupMaxZoom: number;
1043
+ };
1044
+ /** Target FPS to maintain. Default: 50 */
1045
+ targetFps?: number;
1046
+ /** FPS threshold below which to start adjusting. Default: 40 */
1047
+ adjustBelowFps?: number;
1048
+ /** Maximum zoom adjustment allowed. Default: 3 */
1049
+ maxAdjustment?: number;
1050
+ /** Adjustment step per FPS drop. Default: 0.5 */
1051
+ adjustmentStep?: number;
1052
+ /** Smoothing factor for FPS averaging (0-1). Default: 0.3 */
1053
+ smoothingFactor?: number;
1054
+ /** Minimum time between adjustments in ms. Default: 1000 */
1055
+ adjustmentCooldown?: number;
1056
+ }
1057
+ /**
1058
+ * Current state of dynamic LOD thresholds
1059
+ */
1060
+ interface DynamicLODState {
1061
+ /** Current adjusted thresholds */
1062
+ thresholds: {
1063
+ groupMaxZoom: number;
1064
+ subGroupMaxZoom: number;
1065
+ };
1066
+ /** Current smoothed FPS */
1067
+ averageFps: number;
1068
+ /** Current adjustment level */
1069
+ adjustment: number;
1070
+ /** Whether thresholds are currently elevated */
1071
+ isAdjusted: boolean;
1072
+ }
1073
+ /**
1074
+ * Create a dynamic LOD threshold manager
1075
+ *
1076
+ * Automatically adjusts LOD zoom thresholds based on FPS to maintain
1077
+ * smooth performance. When FPS drops, thresholds are raised to show
1078
+ * aggregated views longer.
1079
+ *
1080
+ * @example
1081
+ * ```tsx
1082
+ * const lodManager = createDynamicLODManager({
1083
+ * baseThresholds: { groupMaxZoom: 12, subGroupMaxZoom: 14 },
1084
+ * targetFps: 50,
1085
+ * });
1086
+ *
1087
+ * // In render loop or animation frame:
1088
+ * useEffect(() => {
1089
+ * let frameCount = 0;
1090
+ * let lastTime = performance.now();
1091
+ *
1092
+ * const measure = () => {
1093
+ * frameCount++;
1094
+ * const now = performance.now();
1095
+ * if (now - lastTime >= 1000) {
1096
+ * const fps = frameCount;
1097
+ * const state = lodManager.update(fps);
1098
+ * setThresholds(state.thresholds);
1099
+ * frameCount = 0;
1100
+ * lastTime = now;
1101
+ * }
1102
+ * requestAnimationFrame(measure);
1103
+ * };
1104
+ *
1105
+ * const id = requestAnimationFrame(measure);
1106
+ * return () => cancelAnimationFrame(id);
1107
+ * }, []);
1108
+ * ```
1109
+ */
1110
+ declare function createDynamicLODManager(options: DynamicLODOptions): {
1111
+ /** Update with current FPS and get adjusted thresholds */
1112
+ update: (currentFps: number) => DynamicLODState;
1113
+ /** Force reset to base thresholds */
1114
+ reset: () => DynamicLODState;
1115
+ /** Get current state without updating */
1116
+ getState: () => DynamicLODState;
1117
+ };
1118
+ /**
1119
+ * Get recommended simplification tolerance for a zoom level
1120
+ *
1121
+ * Returns an appropriate tolerance value for polygon simplification
1122
+ * based on the current zoom level. Lower zoom = more simplification.
1123
+ *
1124
+ * @param zoom Current zoom level
1125
+ * @param baseToleranceAtZoom14 Base tolerance to use at zoom 14. Default: 0.00002
1126
+ * @returns Tolerance value in degrees
1127
+ */
1128
+ declare function getSimplificationToleranceForZoom(zoom: number, baseToleranceAtZoom14?: number): number;
1129
+ /**
1130
+ * Suggested default simplification thresholds
1131
+ */
1132
+ declare const DEFAULT_SIMPLIFICATION_THRESHOLDS: SimplificationThreshold[];
1133
+
1134
+ /**
1135
+ * Fast O(1) fingerprinting utilities for GeoJSON data equality checking.
1136
+ *
1137
+ * Instead of deep comparing potentially 100k+ features, we compare:
1138
+ * - Feature count
1139
+ * - First feature ID
1140
+ * - Last feature ID
1141
+ *
1142
+ * This provides a fast, reliable check for most data update scenarios.
1143
+ */
1144
+
1145
+ /**
1146
+ * Fingerprint structure for quick GeoJSON comparison
1147
+ */
1148
+ interface GeoJSONFingerprint {
1149
+ /** Total number of features */
1150
+ count: number;
1151
+ /** ID of the first feature (undefined if no features or no ID) */
1152
+ firstId: string | number | undefined;
1153
+ /** ID of the last feature (undefined if no features or no ID) */
1154
+ lastId: string | number | undefined;
1155
+ }
1156
+ /**
1157
+ * Creates a fast O(1) fingerprint for a GeoJSON FeatureCollection.
1158
+ *
1159
+ * @param data - GeoJSON data to fingerprint
1160
+ * @returns Fingerprint object or null if data is not a FeatureCollection
1161
+ */
1162
+ declare function createGeoJSONFingerprint(data: GeoJSONFeatureCollection | GeoJSON.GeoJSON | string | null | undefined): GeoJSONFingerprint | null;
1163
+ /**
1164
+ * Compares two GeoJSON fingerprints for equality.
1165
+ *
1166
+ * @param a - First fingerprint
1167
+ * @param b - Second fingerprint
1168
+ * @returns true if fingerprints match (data likely unchanged)
1169
+ */
1170
+ declare function fingerprintEqual(a: GeoJSONFingerprint | null, b: GeoJSONFingerprint | null): boolean;
1171
+ /**
1172
+ * Checks if two GeoJSON data objects are equal based on their fingerprints.
1173
+ * This is a fast O(1) check that works for most practical scenarios.
1174
+ *
1175
+ * @param a - First GeoJSON data
1176
+ * @param b - Second GeoJSON data
1177
+ * @returns true if data is likely unchanged based on fingerprints
1178
+ */
1179
+ declare function geoJSONEqual(a: GeoJSONFeatureCollection | GeoJSON.GeoJSON | string | null | undefined, b: GeoJSONFeatureCollection | GeoJSON.GeoJSON | string | null | undefined): boolean;
1180
+
1181
+ /**
1182
+ * Equality and delta detection utilities for MapLibre properties.
1183
+ *
1184
+ * These utilities help prevent redundant MapLibre API calls by:
1185
+ * - Detecting which paint properties actually changed
1186
+ * - Comparing filter expressions efficiently
1187
+ * - Tracking visibility state changes
1188
+ */
1189
+ /**
1190
+ * Deep equality check for simple values (primitives, arrays, objects).
1191
+ * Works for MapLibre expressions and paint property values.
1192
+ */
1193
+ declare function deepEqual(a: unknown, b: unknown): boolean;
1194
+ /**
1195
+ * Paint property object type
1196
+ */
1197
+ type PaintProps = Record<string, unknown>;
1198
+ /**
1199
+ * Checks if two paint property objects are equal.
1200
+ *
1201
+ * @param prev - Previous paint properties
1202
+ * @param next - Next paint properties
1203
+ * @returns true if all properties are equal
1204
+ */
1205
+ declare function paintPropsEqual(prev: PaintProps | undefined, next: PaintProps | undefined): boolean;
1206
+ /**
1207
+ * Result of paint property diff
1208
+ */
1209
+ interface PaintPropsDiff {
1210
+ /** Properties that were added or changed */
1211
+ changed: PaintProps;
1212
+ /** Property names that were removed */
1213
+ removed: string[];
1214
+ /** Whether there are any changes */
1215
+ hasChanges: boolean;
1216
+ }
1217
+ /**
1218
+ * Gets only the paint properties that changed between two states.
1219
+ * This allows for targeted setPaintProperty calls instead of updating everything.
1220
+ *
1221
+ * @param prev - Previous paint properties
1222
+ * @param next - Next paint properties
1223
+ * @returns Object containing only changed properties
1224
+ */
1225
+ declare function getChangedPaintProps(prev: PaintProps | undefined, next: PaintProps | undefined): PaintPropsDiff;
1226
+ /**
1227
+ * Filter expression type (MapLibre filter)
1228
+ */
1229
+ type FilterExpression = unknown[] | undefined | null;
1230
+ /**
1231
+ * Checks if two filter expressions are equal.
1232
+ *
1233
+ * @param prev - Previous filter
1234
+ * @param next - Next filter
1235
+ * @returns true if filters are equal
1236
+ */
1237
+ declare function filterEqual(prev: FilterExpression, next: FilterExpression): boolean;
1238
+ /**
1239
+ * Serializes a filter expression for comparison.
1240
+ * Useful for storing last-applied filter state.
1241
+ *
1242
+ * @param filter - Filter expression
1243
+ * @returns JSON string or empty string if no filter
1244
+ */
1245
+ declare function serializeFilter(filter: FilterExpression): string;
1246
+
1247
+ export { BASE_OFFSET, BoundsArray, type ClusterExpandOptions, type ClusterExpansionResult, type ClusterFeatureProperties, type ColorExpression, ControlPosition, DEFAULT_SIMPLIFICATION_THRESHOLDS, type DynamicLODOptions, type DynamicLODState, type ExtrusionHeightOptions, type FeatureGroup, type FilterExpression, type GenerateLODOptions, GeoJSONFeature, GeoJSONFeatureCollection, type GeoJSONFingerprint, GeoJSONPolygon, type GroupFeaturesOptions, KEYBOARD_CONTROLS, type LODData, type LODDataWithSimplification, LngLat, type LoadGeoJSONOptions, type LoadGeoJSONResult, type LotFillStyleOptions, type LotOutlineStyleOptions, MapBounds, MapTheme, MarkerData, type NumberExpression, OFFSET_CLASSES, POSITION_CLASSES, type PaintProps, type PaintPropsDiff, type SimplificationStats, type SimplificationThreshold, type ValidationResult, boundsToPolygon, calculateBounds, calculateCentroid, calculateZoomThresholds, combineBounds, computePositionClasses, computeVerticalOffsetStyle, countFeaturesByType, createCategoricalColorExpression, createCircleStyle, createContinuousColorExpression, createDynamicLODManager, createExtrusionHeightExpression, createExtrusionStyle, createFillStyle, createGeoJSONFingerprint, createHeatmapStyle, createHoverExpression, createInteractiveExpression, createInteractiveStatusColorExpression, createLineStyle, createLotFillStyle, createLotOutlineStyle, createSelectionExpression, createStatusColorExpression, createZoomExpression, decimalToDMS, deepEqual, expandCluster, expandClusterToBounds, extendBounds, filterByGeometryType, filterEqual, fingerprintEqual, formatArea, formatBearing, formatBounds, formatCoordinates, formatDistance, formatFeatureProperties, formatLabel, formatPitch, formatPropertyValue, formatScale, formatZoom, generateBoundingPolygon, generateConvexHull, generateFeatureCollectionDescription, generateFeatureTable, generateKeyboardControlsDescription, generateLODData, generateLODDataWithSimplification, generateMapDescription, generateMarkerList, generateMarkersDescription, generateMoveAnnouncement, geoJSONEqual, getChangedPaintProps, getClusterBounds, getClusterChildren, getClusterExpansionZoom, getClusterLeaves, getHighlightStyle, getSelectionStyle, getSimplificationToleranceForZoom, getSimplifiedFeaturesForZoom, groupFeaturesByProperty, isClusterFeature, isValidBounds, loadGeoJSON, paintPropsEqual, serializeFilter, simplifyFeature, simplifyFeatureCollection, simplifyFeatureCollectionWithStats, simplifyPolygon, validateGeoJSON, zoomToScale };