@classic-homes/maps-core 0.2.6 → 0.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{data-DDS6ok7I.d.cts → data-CICLgvT6.d.cts} +6 -2
- package/dist/{data-DDS6ok7I.d.ts → data-CICLgvT6.d.ts} +6 -2
- package/dist/index.cjs +190 -7
- package/dist/index.d.cts +300 -53
- package/dist/index.d.ts +300 -53
- package/dist/index.js +181 -8
- package/dist/{spatial-VV-zd88V.d.ts → spatial-D4ZJ4Ul7.d.ts} +1 -1
- package/dist/{spatial-J48Btm8f.d.cts → spatial-D9o4mvDO.d.cts} +1 -1
- package/dist/theme/index.d.cts +13 -3
- package/dist/theme/index.d.ts +13 -3
- package/dist/types/index.d.cts +93 -6
- package/dist/types/index.d.ts +93 -6
- package/dist/workers/index.d.cts +2 -2
- package/dist/workers/index.d.ts +2 -2
- package/dist/workers/spatial.worker.js +9 -5
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { MapTheme } from './theme/index.js';
|
|
2
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.js';
|
|
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-
|
|
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-
|
|
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-CICLgvT6.js';
|
|
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-CICLgvT6.js';
|
|
5
5
|
import { BasemapDefinition, BasemapApiKeys, MapStyleSpec } from './types/index.js';
|
|
6
|
-
export { BaseControlProps, BaseLayerProps, BaseMapEventParams, BaseMapProps, BasemapCategory, BasemapProvider, BasemapSwitcherProps, CircleLayerProps, ControlPosition, 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.js';
|
|
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-
|
|
6
|
+
export { BaseControlProps, BaseLayerProps, BaseMapEventParams, BaseMapProps, BasemapCategory, BasemapProvider, BasemapSwitcherProps, CircleLayerProps, ControlPosition, CoordinateDisplayProps, FeatureClickEventParams, FeatureHoverEventParams, FillExtrusionLayerProps, FillLayerProps, GeolocateControlProps, GradientStop, HeatmapLayerProps, LegendConfig, LegendGroupProps, LegendItem, LegendProps, LineLayerProps, MapClickEventParams, MapErrorEventParams, MapHoverEventParams, MapLayerSpecBase, MapLoadEventParams, MapMoveEventParams, MapProps, MapSourceSpec, MarkerClickEventParams, MarkerDragEventParams, MarkerProps, NavigationControlProps, PopupEventParams, PopupProps, RasterLayerProps, ScaleControlProps, SourceProps, SymbolLayerProps } from './types/index.js';
|
|
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-D4ZJ4Ul7.js';
|
|
8
8
|
import 'rbush';
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -438,6 +438,83 @@ declare function formatFeatureProperties(properties: Record<string, unknown>, op
|
|
|
438
438
|
* Format a property key as a human-readable label
|
|
439
439
|
*/
|
|
440
440
|
declare function formatLabel(key: string): string;
|
|
441
|
+
/**
|
|
442
|
+
* Result of coordinate validation
|
|
443
|
+
*/
|
|
444
|
+
interface CoordinateValidationResult {
|
|
445
|
+
/** Whether the coordinate is valid */
|
|
446
|
+
valid: boolean;
|
|
447
|
+
/** Error message if invalid */
|
|
448
|
+
error?: string;
|
|
449
|
+
/** Normalized coordinate if valid */
|
|
450
|
+
normalized?: LngLat;
|
|
451
|
+
}
|
|
452
|
+
/**
|
|
453
|
+
* Validate a longitude value
|
|
454
|
+
*
|
|
455
|
+
* @param lng - Longitude value to validate
|
|
456
|
+
* @returns true if valid longitude (-180 to 180)
|
|
457
|
+
*/
|
|
458
|
+
declare function isValidLongitude(lng: unknown): lng is number;
|
|
459
|
+
/**
|
|
460
|
+
* Validate a latitude value
|
|
461
|
+
*
|
|
462
|
+
* @param lat - Latitude value to validate
|
|
463
|
+
* @returns true if valid latitude (-90 to 90)
|
|
464
|
+
*/
|
|
465
|
+
declare function isValidLatitude(lat: unknown): lat is number;
|
|
466
|
+
/**
|
|
467
|
+
* Validate a coordinate pair [lng, lat]
|
|
468
|
+
*
|
|
469
|
+
* @param coordinates - Coordinate pair to validate
|
|
470
|
+
* @returns Validation result with error details
|
|
471
|
+
*
|
|
472
|
+
* @example
|
|
473
|
+
* ```typescript
|
|
474
|
+
* const result = validateCoordinates([-122.4194, 37.7749]);
|
|
475
|
+
* if (result.valid) {
|
|
476
|
+
* console.log('Valid:', result.normalized);
|
|
477
|
+
* } else {
|
|
478
|
+
* console.error('Invalid:', result.error);
|
|
479
|
+
* }
|
|
480
|
+
* ```
|
|
481
|
+
*/
|
|
482
|
+
declare function validateCoordinates(coordinates: unknown): CoordinateValidationResult;
|
|
483
|
+
/**
|
|
484
|
+
* Validate and normalize coordinates, throwing on invalid input
|
|
485
|
+
*
|
|
486
|
+
* @param coordinates - Coordinate pair to validate
|
|
487
|
+
* @returns Normalized [lng, lat] array
|
|
488
|
+
* @throws Error if coordinates are invalid
|
|
489
|
+
*/
|
|
490
|
+
declare function ensureValidCoordinates(coordinates: unknown): LngLat;
|
|
491
|
+
/**
|
|
492
|
+
* Normalize longitude to [-180, 180] range
|
|
493
|
+
*
|
|
494
|
+
* Handles values that wrap around the antimeridian.
|
|
495
|
+
*
|
|
496
|
+
* @param lng - Longitude value (can be outside -180 to 180)
|
|
497
|
+
* @returns Normalized longitude in [-180, 180]
|
|
498
|
+
*/
|
|
499
|
+
declare function normalizeLongitude(lng: number): number;
|
|
500
|
+
/**
|
|
501
|
+
* Clamp latitude to [-90, 90] range
|
|
502
|
+
*
|
|
503
|
+
* @param lat - Latitude value
|
|
504
|
+
* @returns Clamped latitude in [-90, 90]
|
|
505
|
+
*/
|
|
506
|
+
declare function clampLatitude(lat: number): number;
|
|
507
|
+
/**
|
|
508
|
+
* Validate a bounds array [[sw_lng, sw_lat], [ne_lng, ne_lat]]
|
|
509
|
+
*
|
|
510
|
+
* @param bounds - Bounds array to validate
|
|
511
|
+
* @returns Validation result with error details
|
|
512
|
+
*/
|
|
513
|
+
declare function validateBoundsArray(bounds: unknown): {
|
|
514
|
+
valid: boolean;
|
|
515
|
+
error?: string;
|
|
516
|
+
normalized?: BoundsArray;
|
|
517
|
+
};
|
|
441
518
|
|
|
442
519
|
/**
|
|
443
520
|
* Bounds calculation utilities for GeoJSON data
|
|
@@ -549,6 +626,53 @@ declare function filterByGeometryType(geojson: GeoJSONFeatureCollection, types:
|
|
|
549
626
|
* expanding clusters on click and getting cluster information.
|
|
550
627
|
*/
|
|
551
628
|
|
|
629
|
+
/**
|
|
630
|
+
* Minimal map interface for cluster read operations
|
|
631
|
+
*
|
|
632
|
+
* Note: getSource returns unknown to be compatible with MapLibre's Source type.
|
|
633
|
+
* The actual clustering methods are validated at runtime.
|
|
634
|
+
*/
|
|
635
|
+
interface ClusterMapReader {
|
|
636
|
+
/** Get a source by ID - returns unknown for compatibility with MapLibre types */
|
|
637
|
+
getSource: (id: string) => unknown;
|
|
638
|
+
}
|
|
639
|
+
/**
|
|
640
|
+
* Map interface for cluster expansion with easeTo
|
|
641
|
+
*/
|
|
642
|
+
interface ClusterMapExpander extends ClusterMapReader {
|
|
643
|
+
/** Animate the map to a new center/zoom */
|
|
644
|
+
easeTo: (options: {
|
|
645
|
+
center: [number, number];
|
|
646
|
+
zoom: number;
|
|
647
|
+
duration?: number;
|
|
648
|
+
animate?: boolean;
|
|
649
|
+
padding?: number | {
|
|
650
|
+
top: number;
|
|
651
|
+
bottom: number;
|
|
652
|
+
left: number;
|
|
653
|
+
right: number;
|
|
654
|
+
};
|
|
655
|
+
}) => void;
|
|
656
|
+
/** Get current zoom level */
|
|
657
|
+
getZoom: () => number;
|
|
658
|
+
}
|
|
659
|
+
/**
|
|
660
|
+
* Map interface for cluster expansion with fitBounds
|
|
661
|
+
*/
|
|
662
|
+
interface ClusterMapBoundsExpander extends ClusterMapReader {
|
|
663
|
+
/** Fit the map to bounds */
|
|
664
|
+
fitBounds: (bounds: BoundsArray, options?: {
|
|
665
|
+
padding?: number | {
|
|
666
|
+
top: number;
|
|
667
|
+
bottom: number;
|
|
668
|
+
left: number;
|
|
669
|
+
right: number;
|
|
670
|
+
};
|
|
671
|
+
duration?: number;
|
|
672
|
+
animate?: boolean;
|
|
673
|
+
maxZoom?: number;
|
|
674
|
+
}) => void;
|
|
675
|
+
}
|
|
552
676
|
/**
|
|
553
677
|
* Properties automatically added to cluster features by MapLibre GL
|
|
554
678
|
*/
|
|
@@ -603,7 +727,7 @@ interface ClusterExpansionResult {
|
|
|
603
727
|
* This is a wrapper around MapLibre GL's getClusterExpansionZoom method
|
|
604
728
|
* that provides a cleaner async interface.
|
|
605
729
|
*
|
|
606
|
-
* @param map - MapLibre GL map instance
|
|
730
|
+
* @param map - MapLibre GL map instance (or any object with getSource method)
|
|
607
731
|
* @param sourceId - ID of the GeoJSON source with clustering enabled
|
|
608
732
|
* @param clusterId - The cluster_id from the cluster feature properties
|
|
609
733
|
* @returns Promise resolving to the expansion zoom level
|
|
@@ -614,39 +738,33 @@ interface ClusterExpansionResult {
|
|
|
614
738
|
* map.easeTo({ center: clusterCoords, zoom });
|
|
615
739
|
* ```
|
|
616
740
|
*/
|
|
617
|
-
declare function getClusterExpansionZoom(map:
|
|
618
|
-
getSource: (id: string) => unknown;
|
|
619
|
-
}, sourceId: string, clusterId: number): Promise<number>;
|
|
741
|
+
declare function getClusterExpansionZoom(map: ClusterMapReader, sourceId: string, clusterId: number): Promise<number>;
|
|
620
742
|
/**
|
|
621
743
|
* Get the children features of a cluster
|
|
622
744
|
*
|
|
623
745
|
* Returns the immediate children of a cluster, which may be
|
|
624
746
|
* individual points or other clusters.
|
|
625
747
|
*
|
|
626
|
-
* @param map - MapLibre GL map instance
|
|
748
|
+
* @param map - MapLibre GL map instance (or any object with getSource method)
|
|
627
749
|
* @param sourceId - ID of the GeoJSON source with clustering enabled
|
|
628
750
|
* @param clusterId - The cluster_id from the cluster feature properties
|
|
629
751
|
* @returns Promise resolving to an array of child features
|
|
630
752
|
*/
|
|
631
|
-
declare function getClusterChildren(map:
|
|
632
|
-
getSource: (id: string) => unknown;
|
|
633
|
-
}, sourceId: string, clusterId: number): Promise<GeoJSONFeature[]>;
|
|
753
|
+
declare function getClusterChildren(map: ClusterMapReader, sourceId: string, clusterId: number): Promise<GeoJSONFeature[]>;
|
|
634
754
|
/**
|
|
635
755
|
* Get all leaf features (individual points) of a cluster
|
|
636
756
|
*
|
|
637
757
|
* Returns all individual points contained within a cluster,
|
|
638
758
|
* regardless of nesting level.
|
|
639
759
|
*
|
|
640
|
-
* @param map - MapLibre GL map instance
|
|
760
|
+
* @param map - MapLibre GL map instance (or any object with getSource method)
|
|
641
761
|
* @param sourceId - ID of the GeoJSON source with clustering enabled
|
|
642
762
|
* @param clusterId - The cluster_id from the cluster feature properties
|
|
643
763
|
* @param limit - Maximum number of features to return (default: 100)
|
|
644
764
|
* @param offset - Offset for pagination (default: 0)
|
|
645
765
|
* @returns Promise resolving to an array of leaf features
|
|
646
766
|
*/
|
|
647
|
-
declare function getClusterLeaves(map:
|
|
648
|
-
getSource: (id: string) => unknown;
|
|
649
|
-
}, sourceId: string, clusterId: number, limit?: number, offset?: number): Promise<GeoJSONFeature[]>;
|
|
767
|
+
declare function getClusterLeaves(map: ClusterMapReader, sourceId: string, clusterId: number, limit?: number, offset?: number): Promise<GeoJSONFeature[]>;
|
|
650
768
|
/**
|
|
651
769
|
* Expand a cluster by zooming in to show its contents
|
|
652
770
|
*
|
|
@@ -669,36 +787,19 @@ declare function getClusterLeaves(map: {
|
|
|
669
787
|
* }
|
|
670
788
|
* ```
|
|
671
789
|
*/
|
|
672
|
-
declare function expandCluster(map:
|
|
673
|
-
getSource: (id: string) => unknown;
|
|
674
|
-
easeTo: (options: {
|
|
675
|
-
center: [number, number];
|
|
676
|
-
zoom: number;
|
|
677
|
-
duration?: number;
|
|
678
|
-
animate?: boolean;
|
|
679
|
-
padding?: number | {
|
|
680
|
-
top: number;
|
|
681
|
-
bottom: number;
|
|
682
|
-
left: number;
|
|
683
|
-
right: number;
|
|
684
|
-
};
|
|
685
|
-
}) => void;
|
|
686
|
-
getZoom: () => number;
|
|
687
|
-
}, sourceId: string, clusterId: number, center: LngLat, options?: ClusterExpandOptions): Promise<void>;
|
|
790
|
+
declare function expandCluster(map: ClusterMapExpander, sourceId: string, clusterId: number, center: LngLat, options?: ClusterExpandOptions): Promise<void>;
|
|
688
791
|
/**
|
|
689
792
|
* Calculate bounds that encompass all leaves of a cluster
|
|
690
793
|
*
|
|
691
794
|
* Useful for fitting the map to show all points in a cluster.
|
|
692
795
|
*
|
|
693
|
-
* @param map - MapLibre GL map instance
|
|
796
|
+
* @param map - MapLibre GL map instance (or any object with getSource method)
|
|
694
797
|
* @param sourceId - ID of the GeoJSON source with clustering enabled
|
|
695
798
|
* @param clusterId - The cluster_id from the cluster feature properties
|
|
696
799
|
* @param limit - Maximum number of leaves to consider (default: 1000)
|
|
697
800
|
* @returns Promise resolving to bounds array [[sw_lng, sw_lat], [ne_lng, ne_lat]]
|
|
698
801
|
*/
|
|
699
|
-
declare function getClusterBounds(map:
|
|
700
|
-
getSource: (id: string) => unknown;
|
|
701
|
-
}, sourceId: string, clusterId: number, limit?: number): Promise<BoundsArray>;
|
|
802
|
+
declare function getClusterBounds(map: ClusterMapReader, sourceId: string, clusterId: number, limit?: number): Promise<BoundsArray>;
|
|
702
803
|
/**
|
|
703
804
|
* Expand a cluster by fitting to the bounds of its leaves
|
|
704
805
|
*
|
|
@@ -710,20 +811,142 @@ declare function getClusterBounds(map: {
|
|
|
710
811
|
* @param clusterId - The cluster_id from the cluster feature properties
|
|
711
812
|
* @param options - Animation and padding options
|
|
712
813
|
*/
|
|
713
|
-
declare function expandClusterToBounds(map:
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
814
|
+
declare function expandClusterToBounds(map: ClusterMapBoundsExpander, sourceId: string, clusterId: number, options?: ClusterExpandOptions): Promise<void>;
|
|
815
|
+
/**
|
|
816
|
+
* Options for cluster circle layer style
|
|
817
|
+
*/
|
|
818
|
+
interface ClusterCircleStyleOptions {
|
|
819
|
+
/** Base color for small clusters (default: '#51bbd6') */
|
|
820
|
+
smallColor?: string;
|
|
821
|
+
/** Color for medium clusters (default: '#f1f075') */
|
|
822
|
+
mediumColor?: string;
|
|
823
|
+
/** Color for large clusters (default: '#f28cb1') */
|
|
824
|
+
largeColor?: string;
|
|
825
|
+
/** Point count threshold for medium size (default: 100) */
|
|
826
|
+
mediumThreshold?: number;
|
|
827
|
+
/** Point count threshold for large size (default: 750) */
|
|
828
|
+
largeThreshold?: number;
|
|
829
|
+
/** Base radius for small clusters (default: 20) */
|
|
830
|
+
smallRadius?: number;
|
|
831
|
+
/** Radius for medium clusters (default: 30) */
|
|
832
|
+
mediumRadius?: number;
|
|
833
|
+
/** Radius for large clusters (default: 40) */
|
|
834
|
+
largeRadius?: number;
|
|
835
|
+
/** Circle stroke color (default: '#fff') */
|
|
836
|
+
strokeColor?: string;
|
|
837
|
+
/** Circle stroke width (default: 2) */
|
|
838
|
+
strokeWidth?: number;
|
|
839
|
+
/** Circle opacity (default: 0.85) */
|
|
840
|
+
opacity?: number;
|
|
841
|
+
}
|
|
842
|
+
/**
|
|
843
|
+
* Options for cluster text layer style
|
|
844
|
+
*/
|
|
845
|
+
interface ClusterTextStyleOptions {
|
|
846
|
+
/** Text color (default: '#333') */
|
|
847
|
+
textColor?: string;
|
|
848
|
+
/** Text size (default: 12) */
|
|
849
|
+
textSize?: number;
|
|
850
|
+
/** Font stack (default: ['Open Sans Bold', 'Arial Unicode MS Bold']) */
|
|
851
|
+
fontStack?: string[];
|
|
852
|
+
/** Whether to use abbreviated count (e.g., "1.2k") (default: false) */
|
|
853
|
+
abbreviated?: boolean;
|
|
854
|
+
}
|
|
855
|
+
/**
|
|
856
|
+
* Options for unclustered point layer style
|
|
857
|
+
*/
|
|
858
|
+
interface UnclusteredPointStyleOptions {
|
|
859
|
+
/** Point color (default: '#11b4da') */
|
|
860
|
+
color?: string;
|
|
861
|
+
/** Point radius (default: 8) */
|
|
862
|
+
radius?: number;
|
|
863
|
+
/** Stroke color (default: '#fff') */
|
|
864
|
+
strokeColor?: string;
|
|
865
|
+
/** Stroke width (default: 1) */
|
|
866
|
+
strokeWidth?: number;
|
|
867
|
+
}
|
|
868
|
+
/**
|
|
869
|
+
* Complete cluster layer styles returned by createClusterStyles
|
|
870
|
+
*/
|
|
871
|
+
interface ClusterLayerStyles {
|
|
872
|
+
/** Paint properties for the cluster circle layer */
|
|
873
|
+
clusterCirclePaint: Record<string, unknown>;
|
|
874
|
+
/** Paint properties for the cluster text layer */
|
|
875
|
+
clusterTextPaint: Record<string, unknown>;
|
|
876
|
+
/** Layout properties for the cluster text layer */
|
|
877
|
+
clusterTextLayout: Record<string, unknown>;
|
|
878
|
+
/** Paint properties for the unclustered point layer */
|
|
879
|
+
unclusteredPointPaint: Record<string, unknown>;
|
|
880
|
+
/** Filter for cluster layers (only clusters) */
|
|
881
|
+
clusterFilter: unknown[];
|
|
882
|
+
/** Filter for unclustered point layer (only non-clusters) */
|
|
883
|
+
unclusteredFilter: unknown[];
|
|
884
|
+
}
|
|
885
|
+
/**
|
|
886
|
+
* Creates complete layer styles for rendering clusters
|
|
887
|
+
*
|
|
888
|
+
* Returns paint/layout properties and filters that can be used with
|
|
889
|
+
* CircleLayer and SymbolLayer components.
|
|
890
|
+
*
|
|
891
|
+
* @param options - Customization options for colors, sizes, etc.
|
|
892
|
+
* @returns Object containing all necessary styles and filters
|
|
893
|
+
*
|
|
894
|
+
* @example
|
|
895
|
+
* ```tsx
|
|
896
|
+
* const styles = createClusterStyles({
|
|
897
|
+
* smallColor: '#3b82f6',
|
|
898
|
+
* mediumColor: '#f59e0b',
|
|
899
|
+
* largeColor: '#ef4444',
|
|
900
|
+
* });
|
|
901
|
+
*
|
|
902
|
+
* <Source id="points" type="geojson" data={data} cluster={true}>
|
|
903
|
+
* <CircleLayer
|
|
904
|
+
* id="clusters"
|
|
905
|
+
* filter={styles.clusterFilter}
|
|
906
|
+
* paint={styles.clusterCirclePaint}
|
|
907
|
+
* />
|
|
908
|
+
* <SymbolLayer
|
|
909
|
+
* id="cluster-count"
|
|
910
|
+
* filter={styles.clusterFilter}
|
|
911
|
+
* paint={styles.clusterTextPaint}
|
|
912
|
+
* layout={styles.clusterTextLayout}
|
|
913
|
+
* />
|
|
914
|
+
* <CircleLayer
|
|
915
|
+
* id="unclustered-point"
|
|
916
|
+
* filter={styles.unclusteredFilter}
|
|
917
|
+
* paint={styles.unclusteredPointPaint}
|
|
918
|
+
* />
|
|
919
|
+
* </Source>
|
|
920
|
+
* ```
|
|
921
|
+
*/
|
|
922
|
+
declare function createClusterStyles(options?: {
|
|
923
|
+
circle?: ClusterCircleStyleOptions;
|
|
924
|
+
text?: ClusterTextStyleOptions;
|
|
925
|
+
unclusteredPoint?: UnclusteredPointStyleOptions;
|
|
926
|
+
}): ClusterLayerStyles;
|
|
927
|
+
/**
|
|
928
|
+
* Creates a simple cluster circle paint style with stepped colors and sizes
|
|
929
|
+
*
|
|
930
|
+
* @param options - Customization options
|
|
931
|
+
* @returns Paint properties for a circle layer
|
|
932
|
+
*
|
|
933
|
+
* @example
|
|
934
|
+
* ```tsx
|
|
935
|
+
* <CircleLayer
|
|
936
|
+
* id="clusters"
|
|
937
|
+
* filter={['has', 'point_count']}
|
|
938
|
+
* paint={createClusterCirclePaint({ smallColor: '#3b82f6' })}
|
|
939
|
+
* />
|
|
940
|
+
* ```
|
|
941
|
+
*/
|
|
942
|
+
declare function createClusterCirclePaint(options?: ClusterCircleStyleOptions): Record<string, unknown>;
|
|
943
|
+
/**
|
|
944
|
+
* Creates cluster count text layout properties
|
|
945
|
+
*
|
|
946
|
+
* @param options - Customization options
|
|
947
|
+
* @returns Layout properties for a symbol layer
|
|
948
|
+
*/
|
|
949
|
+
declare function createClusterTextLayout(options?: ClusterTextStyleOptions): Record<string, unknown>;
|
|
727
950
|
|
|
728
951
|
/**
|
|
729
952
|
* Level-of-Detail (LOD) utilities for efficient rendering of large polygon datasets
|
|
@@ -1181,9 +1404,33 @@ interface PaintPropsDiff {
|
|
|
1181
1404
|
*/
|
|
1182
1405
|
declare function getChangedPaintProps(prev: PaintProps | undefined, next: PaintProps | undefined): PaintPropsDiff;
|
|
1183
1406
|
/**
|
|
1184
|
-
*
|
|
1407
|
+
* MapLibre filter expression operators
|
|
1408
|
+
*/
|
|
1409
|
+
type FilterOperator = 'has' | '!has' | '==' | '!=' | '>' | '>=' | '<' | '<=' | 'in' | '!in' | 'all' | 'any' | 'none' | 'geometry-type' | 'case' | 'match' | 'coalesce' | 'step' | 'interpolate' | 'let' | 'var' | 'literal' | 'get' | 'at' | 'length' | 'boolean' | 'number' | 'string' | 'to-boolean' | 'to-number' | 'to-string' | 'typeof' | '!' | 'within' | 'distance';
|
|
1410
|
+
/**
|
|
1411
|
+
* Filter expression value types
|
|
1412
|
+
*/
|
|
1413
|
+
type FilterValue = string | number | boolean | null;
|
|
1414
|
+
/**
|
|
1415
|
+
* MapLibre filter expression type
|
|
1416
|
+
*
|
|
1417
|
+
* Filters are arrays where the first element is an operator string,
|
|
1418
|
+
* followed by arguments that can be property names, values, or nested expressions.
|
|
1419
|
+
*
|
|
1420
|
+
* Note: We use `unknown[]` for the array type to avoid circular reference issues
|
|
1421
|
+
* while still providing the FilterOperator type for documentation and discoverability.
|
|
1422
|
+
*
|
|
1423
|
+
* @example
|
|
1424
|
+
* // Simple equality filter
|
|
1425
|
+
* ['==', 'type', 'residential']
|
|
1426
|
+
*
|
|
1427
|
+
* // Combining filters
|
|
1428
|
+
* ['all', ['==', 'type', 'residential'], ['>', 'area', 1000]]
|
|
1429
|
+
*
|
|
1430
|
+
* // Expression-based filter
|
|
1431
|
+
* ['case', ['has', 'name'], true, false]
|
|
1185
1432
|
*/
|
|
1186
|
-
type FilterExpression = unknown[] | undefined | null;
|
|
1433
|
+
type FilterExpression = [FilterOperator, ...unknown[]] | unknown[] | undefined | null;
|
|
1187
1434
|
/**
|
|
1188
1435
|
* Checks if two filter expressions are equal.
|
|
1189
1436
|
*
|
|
@@ -1969,4 +2216,4 @@ declare const clusterColorExpression: unknown[];
|
|
|
1969
2216
|
*/
|
|
1970
2217
|
declare function createMatchedColorExpression(baseColorExpression: unknown[], matchedProperty?: string): unknown[];
|
|
1971
2218
|
|
|
1972
|
-
export { BIKE_LANES, BUILTIN_BASEMAPS, BUILTIN_OVERLAY_LAYERS, BasemapApiKeys, BasemapDefinition, BoundsArray, CATEGORY_META, CITY_LIMITS, CLASSIC_DARK, CLASSIC_LIGHT, type ClusterExpandOptions, type ClusterExpansionResult, type ClusterFeatureProperties, type ColorExpression, type ControlBoundingBox, type ControlDimensions, type ControlOffset, type ControlPriority, type ControlRegistration, type ControlType, type ControlUpdateOptions, type CoordinatorEvent, type CoordinatorEventType, type CoordinatorListener, DEFAULT_BASEMAP, DEFAULT_SIMPLIFICATION_THRESHOLDS, type DynamicLODOptions, type DynamicLODState, EDGE_MARGIN, type ExtendedControlPosition, type ExtrusionHeightOptions, FLOOD_ZONES, FREE_BASEMAPS, type FeatureGroup, type FilterExpression, type GenerateLODOptions, GeoJSONFeature, GeoJSONFeatureCollection, type GeoJSONFingerprint, GeoJSONPolygon, type GroupFeaturesOptions, type InventoryStatus, KEYBOARD_CONTROLS, type LODData, type LODDataWithSimplification, type LayerManagerProps, LngLat, type LoadGeoJSONOptions, type LoadGeoJSONResult, type LotAvailability, type LotFillStyleOptions, type LotOutlineStyleOptions, type LotSize, MAPTILER_BASIC, MAPTILER_OUTDOOR, MAPTILER_SATELLITE, MAPTILER_STREETS, MARKER_PROTECTION_CLASS, MapBounds, type MapDimensions, MapTheme, MarkerData, type NumberExpression, OSM_STANDARD, type OverlayApiKeys, type OverlayDataSource, type OverlayLayerCategory, type OverlayLayerCategoryMeta, type OverlayLayerDefinition, type OverlayLayerLegend, type OverlayLayerState, type OverlayLayerStyle, type OverlayLegendItem, PARKS, PRIMARY_BASEMAPS, PRIORITY_ORDER, type PaintProps, type PaintPropsDiff, type PositionConfig, PositioningCoordinator, SATELLITE_BASEMAP, SCHOOL_DISTRICTS, SPORTS_FACILITIES, STACK_GAP, STADIA_ALIDADE_DARK, STADIA_ALIDADE_SMOOTH, STADIA_STAMEN_TERRAIN, STADIA_STAMEN_TONER, STADIA_STAMEN_WATERCOLOR, type SimplificationStats, type SimplificationThreshold, TOPO_BASEMAP, TRAILS, TRANSIT_ROUTES, type ValidationResult, WATERSHEDS, type ZIndexLayer, ZONING_DISTRICTS, Z_INDEX_LAYERS, applyMarkerChildProtection, applyMarkerProtection, boundaryColors, boundsToPolygon, calculateBounds, calculateCentroid, calculateZoomThresholds, clusterColorExpression, clusterColors, combineBounds, countFeaturesByType, createCategoricalColorExpression, createCircleStyle, createContinuousColorExpression, createDynamicLODManager, createExtrusionHeightExpression, createExtrusionStyle, createFillStyle, createGeoJSONFingerprint, createHeatmapStyle, createHoverExpression, createInitialLayerStates, createInteractiveExpression, createInteractiveStatusColorExpression, createLineStyle, createLotFillStyle, createLotOutlineStyle, createMatchedColorExpression, createPositioningCoordinator, 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, getAvailabilityColor, getAvailableBasemaps, getChangedPaintProps, getClusterBounds, getClusterChildren, getClusterExpansionZoom, getClusterLeaves, getContrastTextColor, getHighlightStyle, getLayerCategories, getLayerStatesArray, getLayerStyleForTheme, getLayersByCategory, getLayersWithErrors, getSelectionStyle, getSimplificationToleranceForZoom, getSimplifiedFeaturesForZoom, getSizeColor, getVisibleLayerIds, groupFeaturesByProperty, groupLayersByCategory, hideAllLayers, inventoryStatusColorExpression, inventoryStatusColors, isAnyLayerLoading, isClusterFeature, isValidBounds, loadGeoJSON, lotAvailabilityColorExpression, lotAvailabilityColors, lotSizeColorExpression, lotSizeColors, nonMatchedColor, paintPropsEqual, removeMarkerProtection, reorderLayers, resolveBasemapStyle, resolveBasemapThumbnail, resolveLayerSourceUrl, salesOfficeColor, searchLayers, serializeFilter, setLayerError, setLayerLoading, setLayerOpacity, showAllLayers, simplifyFeature, simplifyFeatureCollection, simplifyFeatureCollectionWithStats, simplifyPolygon, toggleLayerVisibility, updateLayerState, validateGeoJSON, zoomToScale };
|
|
2219
|
+
export { BIKE_LANES, BUILTIN_BASEMAPS, BUILTIN_OVERLAY_LAYERS, BasemapApiKeys, BasemapDefinition, BoundsArray, CATEGORY_META, CITY_LIMITS, CLASSIC_DARK, CLASSIC_LIGHT, type ClusterCircleStyleOptions, type ClusterExpandOptions, type ClusterExpansionResult, type ClusterFeatureProperties, type ClusterLayerStyles, type ClusterTextStyleOptions, type ColorExpression, type ControlBoundingBox, type ControlDimensions, type ControlOffset, type ControlPriority, type ControlRegistration, type ControlType, type ControlUpdateOptions, type CoordinateValidationResult, type CoordinatorEvent, type CoordinatorEventType, type CoordinatorListener, DEFAULT_BASEMAP, DEFAULT_SIMPLIFICATION_THRESHOLDS, type DynamicLODOptions, type DynamicLODState, EDGE_MARGIN, type ExtendedControlPosition, type ExtrusionHeightOptions, FLOOD_ZONES, FREE_BASEMAPS, type FeatureGroup, type FilterExpression, type FilterOperator, type FilterValue, type GenerateLODOptions, GeoJSONFeature, GeoJSONFeatureCollection, type GeoJSONFingerprint, GeoJSONPolygon, type GroupFeaturesOptions, type InventoryStatus, KEYBOARD_CONTROLS, type LODData, type LODDataWithSimplification, type LayerManagerProps, LngLat, type LoadGeoJSONOptions, type LoadGeoJSONResult, type LotAvailability, type LotFillStyleOptions, type LotOutlineStyleOptions, type LotSize, MAPTILER_BASIC, MAPTILER_OUTDOOR, MAPTILER_SATELLITE, MAPTILER_STREETS, MARKER_PROTECTION_CLASS, MapBounds, type MapDimensions, MapTheme, MarkerData, type NumberExpression, OSM_STANDARD, type OverlayApiKeys, type OverlayDataSource, type OverlayLayerCategory, type OverlayLayerCategoryMeta, type OverlayLayerDefinition, type OverlayLayerLegend, type OverlayLayerState, type OverlayLayerStyle, type OverlayLegendItem, PARKS, PRIMARY_BASEMAPS, PRIORITY_ORDER, type PaintProps, type PaintPropsDiff, type PositionConfig, PositioningCoordinator, SATELLITE_BASEMAP, SCHOOL_DISTRICTS, SPORTS_FACILITIES, STACK_GAP, STADIA_ALIDADE_DARK, STADIA_ALIDADE_SMOOTH, STADIA_STAMEN_TERRAIN, STADIA_STAMEN_TONER, STADIA_STAMEN_WATERCOLOR, type SimplificationStats, type SimplificationThreshold, TOPO_BASEMAP, TRAILS, TRANSIT_ROUTES, type UnclusteredPointStyleOptions, type ValidationResult, WATERSHEDS, type ZIndexLayer, ZONING_DISTRICTS, Z_INDEX_LAYERS, applyMarkerChildProtection, applyMarkerProtection, boundaryColors, boundsToPolygon, calculateBounds, calculateCentroid, calculateZoomThresholds, clampLatitude, clusterColorExpression, clusterColors, combineBounds, countFeaturesByType, createCategoricalColorExpression, createCircleStyle, createClusterCirclePaint, createClusterStyles, createClusterTextLayout, createContinuousColorExpression, createDynamicLODManager, createExtrusionHeightExpression, createExtrusionStyle, createFillStyle, createGeoJSONFingerprint, createHeatmapStyle, createHoverExpression, createInitialLayerStates, createInteractiveExpression, createInteractiveStatusColorExpression, createLineStyle, createLotFillStyle, createLotOutlineStyle, createMatchedColorExpression, createPositioningCoordinator, createSelectionExpression, createStatusColorExpression, createZoomExpression, decimalToDMS, deepEqual, ensureValidCoordinates, 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, getAvailabilityColor, getAvailableBasemaps, getChangedPaintProps, getClusterBounds, getClusterChildren, getClusterExpansionZoom, getClusterLeaves, getContrastTextColor, getHighlightStyle, getLayerCategories, getLayerStatesArray, getLayerStyleForTheme, getLayersByCategory, getLayersWithErrors, getSelectionStyle, getSimplificationToleranceForZoom, getSimplifiedFeaturesForZoom, getSizeColor, getVisibleLayerIds, groupFeaturesByProperty, groupLayersByCategory, hideAllLayers, inventoryStatusColorExpression, inventoryStatusColors, isAnyLayerLoading, isClusterFeature, isValidBounds, isValidLatitude, isValidLongitude, loadGeoJSON, lotAvailabilityColorExpression, lotAvailabilityColors, lotSizeColorExpression, lotSizeColors, nonMatchedColor, normalizeLongitude, paintPropsEqual, removeMarkerProtection, reorderLayers, resolveBasemapStyle, resolveBasemapThumbnail, resolveLayerSourceUrl, salesOfficeColor, searchLayers, serializeFilter, setLayerError, setLayerLoading, setLayerOpacity, showAllLayers, simplifyFeature, simplifyFeatureCollection, simplifyFeatureCollectionWithStats, simplifyPolygon, toggleLayerVisibility, updateLayerState, validateBoundsArray, validateCoordinates, validateGeoJSON, zoomToScale };
|