@carto/api-client 0.5.1 → 0.5.2-alpha.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.
Files changed (65) hide show
  1. package/build/api-client.cjs +194 -84
  2. package/build/api-client.cjs.map +1 -1
  3. package/build/api-client.d.cts +28 -1
  4. package/build/api-client.d.ts +28 -1
  5. package/build/api-client.js +186 -83
  6. package/build/api-client.js.map +1 -1
  7. package/build/worker.js +30 -19
  8. package/build/worker.js.map +1 -1
  9. package/package.json +5 -3
  10. package/src/api/carto-api-error.ts +1 -1
  11. package/src/api/endpoints.ts +1 -1
  12. package/src/api/index.ts +2 -2
  13. package/src/api/query.ts +1 -1
  14. package/src/api/request-with-parameters.ts +2 -2
  15. package/src/deck/get-data-filter-extension-props.ts +3 -3
  16. package/src/fetch-map/basemap-styles.ts +2 -2
  17. package/src/fetch-map/basemap.ts +2 -2
  18. package/src/fetch-map/fetch-map.ts +3 -3
  19. package/src/fetch-map/layer-map.ts +81 -5
  20. package/src/fetch-map/parse-map.ts +71 -7
  21. package/src/fetch-map/source.ts +10 -10
  22. package/src/fetch-map/types.ts +7 -3
  23. package/src/filters/Filter.ts +4 -4
  24. package/src/filters/FilterTypes.ts +1 -1
  25. package/src/filters/geosjonFeatures.ts +3 -3
  26. package/src/filters/tileFeatures.ts +8 -3
  27. package/src/filters/tileFeaturesGeometries.ts +5 -5
  28. package/src/filters/tileFeaturesRaster.ts +3 -3
  29. package/src/filters/tileFeaturesSpatialIndex.ts +4 -4
  30. package/src/filters.ts +38 -3
  31. package/src/geo.ts +1 -1
  32. package/src/index.ts +3 -3
  33. package/src/models/model.ts +6 -3
  34. package/src/operations/aggregation.ts +14 -4
  35. package/src/operations/applySorting.ts +2 -2
  36. package/src/operations/groupBy.ts +2 -2
  37. package/src/operations/groupByDate.ts +2 -2
  38. package/src/operations/histogram.ts +2 -2
  39. package/src/operations/scatterPlot.ts +2 -2
  40. package/src/sources/base-source.ts +2 -2
  41. package/src/sources/boundary-query-source.ts +1 -1
  42. package/src/sources/h3-query-source.ts +1 -1
  43. package/src/sources/h3-table-source.ts +1 -1
  44. package/src/sources/h3-tileset-source.ts +1 -1
  45. package/src/sources/quadbin-query-source.ts +1 -1
  46. package/src/sources/quadbin-table-source.ts +1 -1
  47. package/src/sources/quadbin-tileset-source.ts +1 -1
  48. package/src/sources/raster-source.ts +1 -1
  49. package/src/sources/types.ts +2 -2
  50. package/src/sources/vector-query-source.ts +1 -1
  51. package/src/sources/vector-table-source.ts +1 -1
  52. package/src/sources/vector-tileset-source.ts +1 -1
  53. package/src/utils/getTileFormat.ts +1 -1
  54. package/src/utils/makeIntervalComplete.ts +1 -1
  55. package/src/utils/transformTileCoordsToWGS84.ts +1 -1
  56. package/src/utils/transformToTileCoords.ts +1 -1
  57. package/src/utils.ts +1 -1
  58. package/src/widget-sources/types.ts +5 -2
  59. package/src/widget-sources/widget-query-source.ts +4 -4
  60. package/src/widget-sources/widget-raster-source.ts +2 -2
  61. package/src/widget-sources/widget-remote-source.ts +6 -5
  62. package/src/widget-sources/widget-source.ts +3 -3
  63. package/src/widget-sources/widget-table-source.ts +4 -4
  64. package/src/widget-sources/widget-tileset-source-impl.ts +8 -11
  65. package/src/widget-sources/widget-tileset-source.ts +7 -7
@@ -662,6 +662,11 @@ declare const SCALE_FUNCS: Record<string, () => any>;
662
662
  type SCALE_TYPE = keyof typeof SCALE_FUNCS;
663
663
  declare const AGGREGATION: Record<string, string>;
664
664
  declare const OPACITY_MAP: Record<string, string>;
665
+ /** @privateRemarks Source: Builder */
666
+ declare const TEXT_LABEL_INDEX = 0;
667
+ /** @privateRemarks Source: Builder */
668
+ declare const TEXT_OUTLINE_OPACITY = 64;
669
+ declare const TEXT_NUMBER_FORMATTER: Intl.NumberFormat;
665
670
  declare function getLayerProps(type: LayerType, config: MapLayerConfig, dataset: Dataset): {
666
671
  propMap: any;
667
672
  defaultProps: any;
@@ -684,6 +689,18 @@ declare function negateAccessor(accessor: Accessor): Accessor;
684
689
  declare function getSizeAccessor({ name }: VisualChannelField, scaleType: SCALE_TYPE | undefined, aggregation: string | null | undefined, range: Iterable<Range> | null | undefined, data: any): any;
685
690
  declare function getTextAccessor({ name, type }: VisualChannelField, data: any): any;
686
691
 
692
+ /** @privateRemarks Source: Builder */
693
+ declare function calculateClusterRadius(properties: {
694
+ [column: string]: number;
695
+ }, stats: Record<string, {
696
+ min: number;
697
+ max: number;
698
+ }>, radiusRange: [number, number], column: string): number;
699
+ /** @privateRemarks Source: Builder */
700
+ declare function getDefaultAggregationExpColumnAliasForLayerType(layerType: LayerType, provider: ProviderType, columns: string[]): string;
701
+ /** @privateRemarks Source: Builder */
702
+ declare function calculateClusterTextFontSize(radius: number): number;
703
+
687
704
  type VisualChannelField = {
688
705
  name: string;
689
706
  type: string;
@@ -739,6 +756,8 @@ type VisConfig = {
739
756
  heightRange?: any;
740
757
  heightAggregation?: any;
741
758
  weightAggregation?: any;
759
+ clusterLevel?: number;
760
+ isTextVisible?: boolean;
742
761
  };
743
762
  type TextLabel = {
744
763
  field: VisualChannelField | null | undefined;
@@ -1019,6 +1038,14 @@ type GetFilterOptions<T extends FilterType> = {
1019
1038
  owner?: string;
1020
1039
  };
1021
1040
  declare function getFilter<T extends FilterType>(filters: Record<string, Filter>, { column, type, owner }: GetFilterOptions<T>): Filter[T] | null;
1041
+ /**
1042
+ * Given all filters for a dataset, returns the subset of filters that are not
1043
+ * attributable to the given owner. Typically used to allow filterable widgets
1044
+ * to affect other widgets *without* filtering themselves.
1045
+ *
1046
+ * @privateRemarks Source: @carto/react-widgets
1047
+ */
1048
+ declare function getApplicableFilters(owner?: string, filters?: Record<string, Filter>): Record<string, Filter>;
1022
1049
 
1023
1050
  /**
1024
1051
  * Returns a {@link SpatialFilter} for a given viewport, typically obtained
@@ -1760,4 +1787,4 @@ declare function getColumnNameFromGeoColumn(geoColumn: string | null | undefined
1760
1787
  */
1761
1788
  declare function getSpatialIndexFromGeoColumn(geoColumn: string): SpatialIndex | null;
1762
1789
 
1763
- export { AGGREGATION, type APIErrorContext, type APIRequestType, type AddFilterOptions, type AggregationFunction, type AggregationType, ApiVersion, type Attribute, _default as BASEMAP, type BaseRequestOptions, type Basemap, type BoundaryQuerySourceOptions, type BoundaryQuerySourceResponse, type BoundaryTableSourceOptions, type BoundaryTableSourceResponse, CartoAPIError, type CategoryRequestOptions, type CategoryResponse, type ColumnsOption, DEFAULT_API_BASE_URL, FEATURE_GEOM_PROPERTY, type FeaturesRequestOptions, type FeaturesResponse, type FetchMapOptions, type FetchMapResult, type Filter, type FilterFunction, type FilterInterval, type FilterIntervalComplete, type FilterIntervalExtremum, type FilterLogicalOperator, type FilterOptions, FilterType, type Filters, type Format, type FormulaRequestOptions, type FormulaResponse, type GetFilterOptions, type GoogleBasemap, type GroupByFeature, type GroupDateType, type H3QuerySourceOptions, type H3QuerySourceResponse, type H3TableSourceOptions, type H3TableSourceResponse, type H3TilesetSourceOptions, type H3TilesetSourceResponse, type HasFilterOptions, type HistogramRequestOptions, type HistogramResponse, type KeplerMapConfig, type Layer, type LayerDescriptor, type LayerType, type MapLibreBasemap, type MapType, type NamedQueryParameter, OPACITY_MAP, type ParseMapResult, type PositionalQueryParameter, Provider, type ProviderType, type QuadbinQuerySourceOptions, type QuadbinQuerySourceResponse, type QuadbinTableSourceOptions, type QuadbinTableSourceResponse, type QuadbinTilesetSourceOptions, type QuadbinTilesetSourceResponse, type QueryOptions, type QueryParameterValue, type QueryParameters, type QueryResult, type QuerySourceOptions, type RangeRequestOptions, type RangeResponse, type Raster, RasterBandColorinterp, type RasterBandType, type RasterMetadata, type RasterMetadataBand, type RasterMetadataBandStats, type RasterSourceOptions, type RasterTile, type RemoveFilterOptions, type SCALE_TYPE, SOURCE_DEFAULTS, type ScatterPlotFeature, type ScatterRequestOptions, type ScatterResponse, type SortColumnType, type SortDirection, type SourceOptionalOptions, type SourceOptions, type SourceRequiredOptions, type SpatialDataType, type SpatialFilter, type SpatialFilterPolyfillMode, SpatialIndex, SpatialIndexColumn, type SpatialIndexTile, type StringSearchOptions, type TableRequestOptions, type TableResponse, type TableSourceOptions, type Tile, type TileFeatureExtractOptions, type TileFeatures, type TileFeaturesSpatialIndexOptions, TileFormat, type TileResolution, type Tilejson, type TilejsonResult, type TilesetSourceOptions, type Tilestats, type TimeSeriesRequestOptions, type TimeSeriesResponse, type VectorLayer, type VectorQuerySourceOptions, type VectorQuerySourceResponse, type VectorTableSourceOptions, type VectorTableSourceResponse, type VectorTilesetSourceOptions, type VectorTilesetSourceResponse, type ViewState, type Viewport, WidgetQuerySource, type WidgetQuerySourceResult, WidgetRasterSource, type WidgetRasterSourceProps, type WidgetRasterSourceResult, WidgetRemoteSource, type WidgetRemoteSourceProps, WidgetSource, type WidgetSourceProps, WidgetTableSource, type WidgetTableSourceResult, WidgetTilesetSource, type WidgetTilesetSourceProps, type WidgetTilesetSourceResult, type _DataFilterExtensionProps, _buildFeatureFilter, domainFromValues as _domainFromValues, _getHexagonResolution, addFilter, aggregate, aggregationFunctions, applyFilters, applySorting, boundaryQuerySource, boundaryTableSource, buildBinaryFeatureFilter, buildPublicMapUrl, buildStatsUrl, clearFilters, configureSource, createPolygonSpatialFilter, createViewportSpatialFilter, fetchBasemapProps, fetchMap, filterFunctions, geojsonFeatures, getClient, getColorAccessor, getColorValueAccessor, getColumnNameFromGeoColumn, getDataFilterExtensionProps, getFilter, getIconUrlAccessor, getLayerProps, getMaxMarkerSize, getSizeAccessor, getSpatialIndexFromGeoColumn, getTextAccessor, groupValuesByColumn, groupValuesByDateColumn, h3QuerySource, h3TableSource, h3TilesetSource, hasFilter, histogram, makeIntervalComplete, negateAccessor, opacityToAlpha, parseMap, quadbinQuerySource, quadbinTableSource, quadbinTilesetSource, query, rasterSource, removeFilter, requestWithParameters, scaleAggregationResLevel, scatterPlot, setClient, tileFeatures, tileFeaturesGeometries, tileFeaturesSpatialIndex, transformToTileCoords, vectorQuerySource, vectorTableSource, vectorTilesetSource };
1790
+ export { AGGREGATION, type APIErrorContext, type APIRequestType, type AddFilterOptions, type AggregationFunction, type AggregationType, ApiVersion, type Attribute, _default as BASEMAP, type BaseRequestOptions, type Basemap, type BoundaryQuerySourceOptions, type BoundaryQuerySourceResponse, type BoundaryTableSourceOptions, type BoundaryTableSourceResponse, CartoAPIError, type CategoryRequestOptions, type CategoryResponse, type ColumnsOption, DEFAULT_API_BASE_URL, FEATURE_GEOM_PROPERTY, type FeaturesRequestOptions, type FeaturesResponse, type FetchMapOptions, type FetchMapResult, type Filter, type FilterFunction, type FilterInterval, type FilterIntervalComplete, type FilterIntervalExtremum, type FilterLogicalOperator, type FilterOptions, FilterType, type Filters, type Format, type FormulaRequestOptions, type FormulaResponse, type GetFilterOptions, type GoogleBasemap, type GroupByFeature, type GroupDateType, type H3QuerySourceOptions, type H3QuerySourceResponse, type H3TableSourceOptions, type H3TableSourceResponse, type H3TilesetSourceOptions, type H3TilesetSourceResponse, type HasFilterOptions, type HistogramRequestOptions, type HistogramResponse, type KeplerMapConfig, type Layer, type LayerDescriptor, type LayerType, type MapLibreBasemap, type MapType, type NamedQueryParameter, OPACITY_MAP, type ParseMapResult, type PositionalQueryParameter, Provider, type ProviderType, type QuadbinQuerySourceOptions, type QuadbinQuerySourceResponse, type QuadbinTableSourceOptions, type QuadbinTableSourceResponse, type QuadbinTilesetSourceOptions, type QuadbinTilesetSourceResponse, type QueryOptions, type QueryParameterValue, type QueryParameters, type QueryResult, type QuerySourceOptions, type RangeRequestOptions, type RangeResponse, type Raster, RasterBandColorinterp, type RasterBandType, type RasterMetadata, type RasterMetadataBand, type RasterMetadataBandStats, type RasterSourceOptions, type RasterTile, type RemoveFilterOptions, type SCALE_TYPE, SOURCE_DEFAULTS, type ScatterPlotFeature, type ScatterRequestOptions, type ScatterResponse, type SortColumnType, type SortDirection, type SourceOptionalOptions, type SourceOptions, type SourceRequiredOptions, type SpatialDataType, type SpatialFilter, type SpatialFilterPolyfillMode, SpatialIndex, SpatialIndexColumn, type SpatialIndexTile, type StringSearchOptions, TEXT_LABEL_INDEX, TEXT_NUMBER_FORMATTER, TEXT_OUTLINE_OPACITY, type TableRequestOptions, type TableResponse, type TableSourceOptions, type Tile, type TileFeatureExtractOptions, type TileFeatures, type TileFeaturesSpatialIndexOptions, TileFormat, type TileResolution, type Tilejson, type TilejsonResult, type TilesetSourceOptions, type Tilestats, type TimeSeriesRequestOptions, type TimeSeriesResponse, type VectorLayer, type VectorQuerySourceOptions, type VectorQuerySourceResponse, type VectorTableSourceOptions, type VectorTableSourceResponse, type VectorTilesetSourceOptions, type VectorTilesetSourceResponse, type ViewState, type Viewport, WidgetQuerySource, type WidgetQuerySourceResult, WidgetRasterSource, type WidgetRasterSourceProps, type WidgetRasterSourceResult, WidgetRemoteSource, type WidgetRemoteSourceProps, WidgetSource, type WidgetSourceProps, WidgetTableSource, type WidgetTableSourceResult, WidgetTilesetSource, type WidgetTilesetSourceProps, type WidgetTilesetSourceResult, type _DataFilterExtensionProps, _buildFeatureFilter, domainFromValues as _domainFromValues, _getHexagonResolution, addFilter, aggregate, aggregationFunctions, applyFilters, applySorting, boundaryQuerySource, boundaryTableSource, buildBinaryFeatureFilter, buildPublicMapUrl, buildStatsUrl, calculateClusterRadius, calculateClusterTextFontSize, clearFilters, configureSource, createPolygonSpatialFilter, createViewportSpatialFilter, fetchBasemapProps, fetchMap, filterFunctions, geojsonFeatures, getApplicableFilters, getClient, getColorAccessor, getColorValueAccessor, getColumnNameFromGeoColumn, getDataFilterExtensionProps, getDefaultAggregationExpColumnAliasForLayerType, getFilter, getIconUrlAccessor, getLayerProps, getMaxMarkerSize, getSizeAccessor, getSpatialIndexFromGeoColumn, getTextAccessor, groupValuesByColumn, groupValuesByDateColumn, h3QuerySource, h3TableSource, h3TilesetSource, hasFilter, histogram, makeIntervalComplete, negateAccessor, opacityToAlpha, parseMap, quadbinQuerySource, quadbinTableSource, quadbinTilesetSource, query, rasterSource, removeFilter, requestWithParameters, scaleAggregationResLevel, scatterPlot, setClient, tileFeatures, tileFeaturesGeometries, tileFeaturesSpatialIndex, transformToTileCoords, vectorQuerySource, vectorTableSource, vectorTilesetSource };
@@ -662,6 +662,11 @@ declare const SCALE_FUNCS: Record<string, () => any>;
662
662
  type SCALE_TYPE = keyof typeof SCALE_FUNCS;
663
663
  declare const AGGREGATION: Record<string, string>;
664
664
  declare const OPACITY_MAP: Record<string, string>;
665
+ /** @privateRemarks Source: Builder */
666
+ declare const TEXT_LABEL_INDEX = 0;
667
+ /** @privateRemarks Source: Builder */
668
+ declare const TEXT_OUTLINE_OPACITY = 64;
669
+ declare const TEXT_NUMBER_FORMATTER: Intl.NumberFormat;
665
670
  declare function getLayerProps(type: LayerType, config: MapLayerConfig, dataset: Dataset): {
666
671
  propMap: any;
667
672
  defaultProps: any;
@@ -684,6 +689,18 @@ declare function negateAccessor(accessor: Accessor): Accessor;
684
689
  declare function getSizeAccessor({ name }: VisualChannelField, scaleType: SCALE_TYPE | undefined, aggregation: string | null | undefined, range: Iterable<Range> | null | undefined, data: any): any;
685
690
  declare function getTextAccessor({ name, type }: VisualChannelField, data: any): any;
686
691
 
692
+ /** @privateRemarks Source: Builder */
693
+ declare function calculateClusterRadius(properties: {
694
+ [column: string]: number;
695
+ }, stats: Record<string, {
696
+ min: number;
697
+ max: number;
698
+ }>, radiusRange: [number, number], column: string): number;
699
+ /** @privateRemarks Source: Builder */
700
+ declare function getDefaultAggregationExpColumnAliasForLayerType(layerType: LayerType, provider: ProviderType, columns: string[]): string;
701
+ /** @privateRemarks Source: Builder */
702
+ declare function calculateClusterTextFontSize(radius: number): number;
703
+
687
704
  type VisualChannelField = {
688
705
  name: string;
689
706
  type: string;
@@ -739,6 +756,8 @@ type VisConfig = {
739
756
  heightRange?: any;
740
757
  heightAggregation?: any;
741
758
  weightAggregation?: any;
759
+ clusterLevel?: number;
760
+ isTextVisible?: boolean;
742
761
  };
743
762
  type TextLabel = {
744
763
  field: VisualChannelField | null | undefined;
@@ -1019,6 +1038,14 @@ type GetFilterOptions<T extends FilterType> = {
1019
1038
  owner?: string;
1020
1039
  };
1021
1040
  declare function getFilter<T extends FilterType>(filters: Record<string, Filter>, { column, type, owner }: GetFilterOptions<T>): Filter[T] | null;
1041
+ /**
1042
+ * Given all filters for a dataset, returns the subset of filters that are not
1043
+ * attributable to the given owner. Typically used to allow filterable widgets
1044
+ * to affect other widgets *without* filtering themselves.
1045
+ *
1046
+ * @privateRemarks Source: @carto/react-widgets
1047
+ */
1048
+ declare function getApplicableFilters(owner?: string, filters?: Record<string, Filter>): Record<string, Filter>;
1022
1049
 
1023
1050
  /**
1024
1051
  * Returns a {@link SpatialFilter} for a given viewport, typically obtained
@@ -1760,4 +1787,4 @@ declare function getColumnNameFromGeoColumn(geoColumn: string | null | undefined
1760
1787
  */
1761
1788
  declare function getSpatialIndexFromGeoColumn(geoColumn: string): SpatialIndex | null;
1762
1789
 
1763
- export { AGGREGATION, type APIErrorContext, type APIRequestType, type AddFilterOptions, type AggregationFunction, type AggregationType, ApiVersion, type Attribute, _default as BASEMAP, type BaseRequestOptions, type Basemap, type BoundaryQuerySourceOptions, type BoundaryQuerySourceResponse, type BoundaryTableSourceOptions, type BoundaryTableSourceResponse, CartoAPIError, type CategoryRequestOptions, type CategoryResponse, type ColumnsOption, DEFAULT_API_BASE_URL, FEATURE_GEOM_PROPERTY, type FeaturesRequestOptions, type FeaturesResponse, type FetchMapOptions, type FetchMapResult, type Filter, type FilterFunction, type FilterInterval, type FilterIntervalComplete, type FilterIntervalExtremum, type FilterLogicalOperator, type FilterOptions, FilterType, type Filters, type Format, type FormulaRequestOptions, type FormulaResponse, type GetFilterOptions, type GoogleBasemap, type GroupByFeature, type GroupDateType, type H3QuerySourceOptions, type H3QuerySourceResponse, type H3TableSourceOptions, type H3TableSourceResponse, type H3TilesetSourceOptions, type H3TilesetSourceResponse, type HasFilterOptions, type HistogramRequestOptions, type HistogramResponse, type KeplerMapConfig, type Layer, type LayerDescriptor, type LayerType, type MapLibreBasemap, type MapType, type NamedQueryParameter, OPACITY_MAP, type ParseMapResult, type PositionalQueryParameter, Provider, type ProviderType, type QuadbinQuerySourceOptions, type QuadbinQuerySourceResponse, type QuadbinTableSourceOptions, type QuadbinTableSourceResponse, type QuadbinTilesetSourceOptions, type QuadbinTilesetSourceResponse, type QueryOptions, type QueryParameterValue, type QueryParameters, type QueryResult, type QuerySourceOptions, type RangeRequestOptions, type RangeResponse, type Raster, RasterBandColorinterp, type RasterBandType, type RasterMetadata, type RasterMetadataBand, type RasterMetadataBandStats, type RasterSourceOptions, type RasterTile, type RemoveFilterOptions, type SCALE_TYPE, SOURCE_DEFAULTS, type ScatterPlotFeature, type ScatterRequestOptions, type ScatterResponse, type SortColumnType, type SortDirection, type SourceOptionalOptions, type SourceOptions, type SourceRequiredOptions, type SpatialDataType, type SpatialFilter, type SpatialFilterPolyfillMode, SpatialIndex, SpatialIndexColumn, type SpatialIndexTile, type StringSearchOptions, type TableRequestOptions, type TableResponse, type TableSourceOptions, type Tile, type TileFeatureExtractOptions, type TileFeatures, type TileFeaturesSpatialIndexOptions, TileFormat, type TileResolution, type Tilejson, type TilejsonResult, type TilesetSourceOptions, type Tilestats, type TimeSeriesRequestOptions, type TimeSeriesResponse, type VectorLayer, type VectorQuerySourceOptions, type VectorQuerySourceResponse, type VectorTableSourceOptions, type VectorTableSourceResponse, type VectorTilesetSourceOptions, type VectorTilesetSourceResponse, type ViewState, type Viewport, WidgetQuerySource, type WidgetQuerySourceResult, WidgetRasterSource, type WidgetRasterSourceProps, type WidgetRasterSourceResult, WidgetRemoteSource, type WidgetRemoteSourceProps, WidgetSource, type WidgetSourceProps, WidgetTableSource, type WidgetTableSourceResult, WidgetTilesetSource, type WidgetTilesetSourceProps, type WidgetTilesetSourceResult, type _DataFilterExtensionProps, _buildFeatureFilter, domainFromValues as _domainFromValues, _getHexagonResolution, addFilter, aggregate, aggregationFunctions, applyFilters, applySorting, boundaryQuerySource, boundaryTableSource, buildBinaryFeatureFilter, buildPublicMapUrl, buildStatsUrl, clearFilters, configureSource, createPolygonSpatialFilter, createViewportSpatialFilter, fetchBasemapProps, fetchMap, filterFunctions, geojsonFeatures, getClient, getColorAccessor, getColorValueAccessor, getColumnNameFromGeoColumn, getDataFilterExtensionProps, getFilter, getIconUrlAccessor, getLayerProps, getMaxMarkerSize, getSizeAccessor, getSpatialIndexFromGeoColumn, getTextAccessor, groupValuesByColumn, groupValuesByDateColumn, h3QuerySource, h3TableSource, h3TilesetSource, hasFilter, histogram, makeIntervalComplete, negateAccessor, opacityToAlpha, parseMap, quadbinQuerySource, quadbinTableSource, quadbinTilesetSource, query, rasterSource, removeFilter, requestWithParameters, scaleAggregationResLevel, scatterPlot, setClient, tileFeatures, tileFeaturesGeometries, tileFeaturesSpatialIndex, transformToTileCoords, vectorQuerySource, vectorTableSource, vectorTilesetSource };
1790
+ export { AGGREGATION, type APIErrorContext, type APIRequestType, type AddFilterOptions, type AggregationFunction, type AggregationType, ApiVersion, type Attribute, _default as BASEMAP, type BaseRequestOptions, type Basemap, type BoundaryQuerySourceOptions, type BoundaryQuerySourceResponse, type BoundaryTableSourceOptions, type BoundaryTableSourceResponse, CartoAPIError, type CategoryRequestOptions, type CategoryResponse, type ColumnsOption, DEFAULT_API_BASE_URL, FEATURE_GEOM_PROPERTY, type FeaturesRequestOptions, type FeaturesResponse, type FetchMapOptions, type FetchMapResult, type Filter, type FilterFunction, type FilterInterval, type FilterIntervalComplete, type FilterIntervalExtremum, type FilterLogicalOperator, type FilterOptions, FilterType, type Filters, type Format, type FormulaRequestOptions, type FormulaResponse, type GetFilterOptions, type GoogleBasemap, type GroupByFeature, type GroupDateType, type H3QuerySourceOptions, type H3QuerySourceResponse, type H3TableSourceOptions, type H3TableSourceResponse, type H3TilesetSourceOptions, type H3TilesetSourceResponse, type HasFilterOptions, type HistogramRequestOptions, type HistogramResponse, type KeplerMapConfig, type Layer, type LayerDescriptor, type LayerType, type MapLibreBasemap, type MapType, type NamedQueryParameter, OPACITY_MAP, type ParseMapResult, type PositionalQueryParameter, Provider, type ProviderType, type QuadbinQuerySourceOptions, type QuadbinQuerySourceResponse, type QuadbinTableSourceOptions, type QuadbinTableSourceResponse, type QuadbinTilesetSourceOptions, type QuadbinTilesetSourceResponse, type QueryOptions, type QueryParameterValue, type QueryParameters, type QueryResult, type QuerySourceOptions, type RangeRequestOptions, type RangeResponse, type Raster, RasterBandColorinterp, type RasterBandType, type RasterMetadata, type RasterMetadataBand, type RasterMetadataBandStats, type RasterSourceOptions, type RasterTile, type RemoveFilterOptions, type SCALE_TYPE, SOURCE_DEFAULTS, type ScatterPlotFeature, type ScatterRequestOptions, type ScatterResponse, type SortColumnType, type SortDirection, type SourceOptionalOptions, type SourceOptions, type SourceRequiredOptions, type SpatialDataType, type SpatialFilter, type SpatialFilterPolyfillMode, SpatialIndex, SpatialIndexColumn, type SpatialIndexTile, type StringSearchOptions, TEXT_LABEL_INDEX, TEXT_NUMBER_FORMATTER, TEXT_OUTLINE_OPACITY, type TableRequestOptions, type TableResponse, type TableSourceOptions, type Tile, type TileFeatureExtractOptions, type TileFeatures, type TileFeaturesSpatialIndexOptions, TileFormat, type TileResolution, type Tilejson, type TilejsonResult, type TilesetSourceOptions, type Tilestats, type TimeSeriesRequestOptions, type TimeSeriesResponse, type VectorLayer, type VectorQuerySourceOptions, type VectorQuerySourceResponse, type VectorTableSourceOptions, type VectorTableSourceResponse, type VectorTilesetSourceOptions, type VectorTilesetSourceResponse, type ViewState, type Viewport, WidgetQuerySource, type WidgetQuerySourceResult, WidgetRasterSource, type WidgetRasterSourceProps, type WidgetRasterSourceResult, WidgetRemoteSource, type WidgetRemoteSourceProps, WidgetSource, type WidgetSourceProps, WidgetTableSource, type WidgetTableSourceResult, WidgetTilesetSource, type WidgetTilesetSourceProps, type WidgetTilesetSourceResult, type _DataFilterExtensionProps, _buildFeatureFilter, domainFromValues as _domainFromValues, _getHexagonResolution, addFilter, aggregate, aggregationFunctions, applyFilters, applySorting, boundaryQuerySource, boundaryTableSource, buildBinaryFeatureFilter, buildPublicMapUrl, buildStatsUrl, calculateClusterRadius, calculateClusterTextFontSize, clearFilters, configureSource, createPolygonSpatialFilter, createViewportSpatialFilter, fetchBasemapProps, fetchMap, filterFunctions, geojsonFeatures, getApplicableFilters, getClient, getColorAccessor, getColorValueAccessor, getColumnNameFromGeoColumn, getDataFilterExtensionProps, getDefaultAggregationExpColumnAliasForLayerType, getFilter, getIconUrlAccessor, getLayerProps, getMaxMarkerSize, getSizeAccessor, getSpatialIndexFromGeoColumn, getTextAccessor, groupValuesByColumn, groupValuesByDateColumn, h3QuerySource, h3TableSource, h3TilesetSource, hasFilter, histogram, makeIntervalComplete, negateAccessor, opacityToAlpha, parseMap, quadbinQuerySource, quadbinTableSource, quadbinTilesetSource, query, rasterSource, removeFilter, requestWithParameters, scaleAggregationResLevel, scatterPlot, setClient, tileFeatures, tileFeaturesGeometries, tileFeaturesSpatialIndex, transformToTileCoords, vectorQuerySource, vectorTableSource, vectorTilesetSource };
@@ -10895,23 +10895,6 @@ function isValidBandValue(value, nodata) {
10895
10895
 
10896
10896
  // src/utils.ts
10897
10897
  var FILTER_TYPES = new Set(Object.values(FilterType));
10898
- var isFilterType = (type) => FILTER_TYPES.has(type);
10899
- function getApplicableFilters(owner, filters) {
10900
- if (!filters) return {};
10901
- const applicableFilters = {};
10902
- for (const column in filters) {
10903
- for (const type in filters[column]) {
10904
- if (!isFilterType(type)) continue;
10905
- const filter = filters[column][type];
10906
- const isApplicable = !owner || !filter?.owner || filter?.owner !== owner;
10907
- if (filter && isApplicable) {
10908
- applicableFilters[column] || (applicableFilters[column] = {});
10909
- applicableFilters[column][type] = filter;
10910
- }
10911
- }
10912
- }
10913
- return applicableFilters;
10914
- }
10915
10898
  function normalizeObjectKeys(el) {
10916
10899
  if (Array.isArray(el)) {
10917
10900
  return el.map((value) => normalizeObjectKeys(value));
@@ -11558,6 +11541,82 @@ function objectToURLSearchParams(object) {
11558
11541
  return params;
11559
11542
  }
11560
11543
 
11544
+ // src/filters.ts
11545
+ var FILTER_TYPES2 = new Set(Object.values(FilterType));
11546
+ var isFilterType = (type) => FILTER_TYPES2.has(type);
11547
+ function addFilter(filters, { column, type, values, owner }) {
11548
+ if (!filters[column]) {
11549
+ filters[column] = {};
11550
+ }
11551
+ const filter = { values, owner };
11552
+ filters[column][type] = filter;
11553
+ return filters;
11554
+ }
11555
+ function removeFilter(filters, { column, owner }) {
11556
+ const filter = filters[column];
11557
+ if (!filter) {
11558
+ return filters;
11559
+ }
11560
+ if (owner) {
11561
+ for (const type of FILTER_TYPES2) {
11562
+ if (owner === filter[type]?.owner) {
11563
+ delete filter[type];
11564
+ }
11565
+ }
11566
+ }
11567
+ if (!owner || isEmptyObject(filter)) {
11568
+ delete filters[column];
11569
+ }
11570
+ return filters;
11571
+ }
11572
+ function clearFilters(filters) {
11573
+ for (const column of Object.keys(filters)) {
11574
+ delete filters[column];
11575
+ }
11576
+ return filters;
11577
+ }
11578
+ function hasFilter(filters, { column, owner }) {
11579
+ const filter = filters[column];
11580
+ if (!filter) {
11581
+ return false;
11582
+ }
11583
+ if (!owner) {
11584
+ return true;
11585
+ }
11586
+ for (const type of FILTER_TYPES2) {
11587
+ if (owner === filter[type]?.owner) {
11588
+ return true;
11589
+ }
11590
+ }
11591
+ return false;
11592
+ }
11593
+ function getFilter(filters, { column, type, owner }) {
11594
+ const filter = filters[column];
11595
+ if (!filter) {
11596
+ return null;
11597
+ }
11598
+ if (!owner || owner === filter[type]?.owner) {
11599
+ return filter[type] || null;
11600
+ }
11601
+ return null;
11602
+ }
11603
+ function getApplicableFilters(owner, filters) {
11604
+ if (!filters) return {};
11605
+ const applicableFilters = {};
11606
+ for (const column in filters) {
11607
+ for (const type in filters[column]) {
11608
+ if (!isFilterType(type)) continue;
11609
+ const filter = filters[column][type];
11610
+ const isApplicable = !owner || !filter?.owner || filter?.owner !== owner;
11611
+ if (filter && isApplicable) {
11612
+ applicableFilters[column] || (applicableFilters[column] = {});
11613
+ applicableFilters[column][type] = filter;
11614
+ }
11615
+ }
11616
+ }
11617
+ return applicableFilters;
11618
+ }
11619
+
11561
11620
  // src/widget-sources/widget-remote-source.ts
11562
11621
  var WidgetRemoteSource = class extends WidgetSource {
11563
11622
  _getModelSource(filters, filterOwner) {
@@ -11883,7 +11942,11 @@ function min(values, keys, joinOperation) {
11883
11942
  Infinity
11884
11943
  );
11885
11944
  }
11886
- return Math.min(...values);
11945
+ let min3 = Number.POSITIVE_INFINITY;
11946
+ for (const value of values) {
11947
+ min3 = Math.min(min3, value);
11948
+ }
11949
+ return min3;
11887
11950
  }
11888
11951
  function max(values, keys, joinOperation) {
11889
11952
  const normalizedKeys = normalizeKeys(keys);
@@ -11893,7 +11956,11 @@ function max(values, keys, joinOperation) {
11893
11956
  -Infinity
11894
11957
  );
11895
11958
  }
11896
- return Math.max(...values);
11959
+ let max3 = Number.NEGATIVE_INFINITY;
11960
+ for (const value of values) {
11961
+ max3 = Math.max(max3, value);
11962
+ }
11963
+ return max3;
11897
11964
  }
11898
11965
  function normalizeKeys(keys) {
11899
11966
  return Array.isArray(keys) ? keys : typeof keys === "string" ? [keys] : void 0;
@@ -14182,7 +14249,8 @@ var customMarkersPropsMap = {
14182
14249
  var heatmapTilePropsMap = {
14183
14250
  visConfig: {
14184
14251
  colorRange: (x) => ({ colorRange: x.colors.map(hexToRGBA) }),
14185
- radius: "radiusPixels"
14252
+ radius: (radius) => ({ radiusPixels: 20 + radius }),
14253
+ opacity: "opacity"
14186
14254
  }
14187
14255
  };
14188
14256
  var defaultProps = {
@@ -14203,6 +14271,12 @@ var deprecatedLayerTypes = [
14203
14271
  "hexagonId",
14204
14272
  "point"
14205
14273
  ];
14274
+ var TEXT_LABEL_INDEX = 0;
14275
+ var TEXT_OUTLINE_OPACITY = 64;
14276
+ var TEXT_NUMBER_FORMATTER = new Intl.NumberFormat("en-US", {
14277
+ maximumFractionDigits: 2,
14278
+ notation: "compact"
14279
+ });
14206
14280
  function getLayerProps(type, config2, dataset) {
14207
14281
  if (deprecatedLayerTypes.includes(type)) {
14208
14282
  throw new Error(
@@ -14294,9 +14368,7 @@ function findAccessorKey(keys, properties) {
14294
14368
  return [key];
14295
14369
  }
14296
14370
  }
14297
- throw new Error(
14298
- `Could not find property for any accessor key: ${keys.join(", ")}`
14299
- );
14371
+ return keys;
14300
14372
  }
14301
14373
  function getColorValueAccessor({ name }, colorAggregation, data) {
14302
14374
  const aggregator = AGGREGATION_FUNC[colorAggregation];
@@ -14423,6 +14495,40 @@ function getTextAccessor({ name, type }, data) {
14423
14495
  };
14424
14496
  return normalizeAccessor(accessor, data);
14425
14497
  }
14498
+ function calculateClusterRadius(properties, stats, radiusRange, column) {
14499
+ const { min: min3, max: max3 } = stats[column];
14500
+ const value = properties[column];
14501
+ if (min3 === max3) return radiusRange[1];
14502
+ const normalizedValue = (value - min3) / (max3 - min3);
14503
+ return radiusRange[0] + normalizedValue * (radiusRange[1] - radiusRange[0]);
14504
+ }
14505
+ function getDefaultAggregationExpColumnAliasForLayerType(layerType, provider, columns) {
14506
+ if (columns && layerType === "clusterTile") {
14507
+ return getColumnAliasForAggregationExp(
14508
+ getDefaultColumnFromSchemaForAggregationExp(columns),
14509
+ "count",
14510
+ provider
14511
+ );
14512
+ } else {
14513
+ return DEFAULT_AGGREGATION_EXP_ALIAS;
14514
+ }
14515
+ }
14516
+ function getColumnAliasForAggregationExp(name, aggregation, provider) {
14517
+ const columnAlias = `${name}_${aggregation}`;
14518
+ return provider === "snowflake" ? columnAlias.toUpperCase() : columnAlias;
14519
+ }
14520
+ function getDefaultColumnFromSchemaForAggregationExp(columns) {
14521
+ return columns ? columns[0] : "";
14522
+ }
14523
+ function calculateClusterTextFontSize(radius) {
14524
+ if (radius >= 80) return 24;
14525
+ if (radius >= 72) return 24;
14526
+ if (radius >= 56) return 20;
14527
+ if (radius >= 40) return 16;
14528
+ if (radius >= 24) return 13;
14529
+ if (radius >= 8) return 11;
14530
+ return 11;
14531
+ }
14426
14532
 
14427
14533
  // src/fetch-map/parse-map.ts
14428
14534
  function parseMap(json) {
@@ -14463,7 +14569,14 @@ function parseMap(json) {
14463
14569
  ...defaultProps2,
14464
14570
  ...createInteractionProps(interactionConfig),
14465
14571
  ...styleProps,
14466
- ...createChannelProps(id, type, config3, visualChannels, data),
14572
+ ...createChannelProps(
14573
+ id,
14574
+ type,
14575
+ config3,
14576
+ visualChannels,
14577
+ data,
14578
+ dataset
14579
+ ),
14467
14580
  // Must come after style
14468
14581
  ...createParametersProp(
14469
14582
  layerBlending,
@@ -14538,7 +14651,7 @@ function createStyleProps(config2, mapping) {
14538
14651
  result.highlightColor = config2.visConfig.enable3d ? [255, 255, 255, 60] : [252, 242, 26, 255];
14539
14652
  return result;
14540
14653
  }
14541
- function createChannelProps(id, type, config2, visualChannels, data) {
14654
+ function createChannelProps(id, type, config2, visualChannels, data, dataset) {
14542
14655
  const {
14543
14656
  colorField,
14544
14657
  colorScale,
@@ -14598,6 +14711,47 @@ function createChannelProps(id, type, config2, visualChannels, data) {
14598
14711
  };
14599
14712
  }
14600
14713
  }
14714
+ if (type === "clusterTile") {
14715
+ const aggregationExpAlias = getDefaultAggregationExpColumnAliasForLayerType(
14716
+ type,
14717
+ dataset.providerId,
14718
+ dataset.columns
14719
+ );
14720
+ result.pointType = visConfig.isTextVisible ? "circle+text" : "circle";
14721
+ result.clusterLevel = visConfig.clusterLevel;
14722
+ result.getWeight = (d) => {
14723
+ return d.properties[aggregationExpAlias];
14724
+ };
14725
+ result.getPointRadius = (d, info) => {
14726
+ return calculateClusterRadius(
14727
+ d.properties,
14728
+ info.data.attributes.stats,
14729
+ visConfig.radiusRange,
14730
+ aggregationExpAlias
14731
+ );
14732
+ };
14733
+ result.textCharacterSet = "auto";
14734
+ result.textFontFamily = "Inter, sans";
14735
+ result.textFontSettings = { sdf: true };
14736
+ result.textFontWeight = 600;
14737
+ result.getText = (d) => TEXT_NUMBER_FORMATTER.format(d.properties[aggregationExpAlias]);
14738
+ result.getTextColor = config2.textLabel[TEXT_LABEL_INDEX].color;
14739
+ result.textOutlineColor = [
14740
+ ...config2.textLabel[TEXT_LABEL_INDEX].outlineColor,
14741
+ TEXT_OUTLINE_OPACITY
14742
+ ];
14743
+ result.textOutlineWidth = 5;
14744
+ result.textSizeUnits = "pixels";
14745
+ result.getTextSize = (d, info) => {
14746
+ const radius = calculateClusterRadius(
14747
+ d.properties,
14748
+ info.data.attributes.stats,
14749
+ visConfig.radiusRange,
14750
+ aggregationExpAlias
14751
+ );
14752
+ return calculateClusterTextFontSize(radius);
14753
+ };
14754
+ }
14601
14755
  if (radiusField || sizeField) {
14602
14756
  result.getPointRadius = getSizeAccessor(
14603
14757
  // @ts-ignore
@@ -15160,64 +15314,6 @@ async function fetchMap({
15160
15314
  return out;
15161
15315
  }
15162
15316
 
15163
- // src/filters.ts
15164
- function addFilter(filters, { column, type, values, owner }) {
15165
- if (!filters[column]) {
15166
- filters[column] = {};
15167
- }
15168
- const filter = { values, owner };
15169
- filters[column][type] = filter;
15170
- return filters;
15171
- }
15172
- function removeFilter(filters, { column, owner }) {
15173
- const filter = filters[column];
15174
- if (!filter) {
15175
- return filters;
15176
- }
15177
- if (owner) {
15178
- for (const type of Object.values(FilterType)) {
15179
- if (owner === filter[type]?.owner) {
15180
- delete filter[type];
15181
- }
15182
- }
15183
- }
15184
- if (!owner || isEmptyObject(filter)) {
15185
- delete filters[column];
15186
- }
15187
- return filters;
15188
- }
15189
- function clearFilters(filters) {
15190
- for (const column of Object.keys(filters)) {
15191
- delete filters[column];
15192
- }
15193
- return filters;
15194
- }
15195
- function hasFilter(filters, { column, owner }) {
15196
- const filter = filters[column];
15197
- if (!filter) {
15198
- return false;
15199
- }
15200
- if (!owner) {
15201
- return true;
15202
- }
15203
- for (const type of Object.values(FilterType)) {
15204
- if (owner === filter[type]?.owner) {
15205
- return true;
15206
- }
15207
- }
15208
- return false;
15209
- }
15210
- function getFilter(filters, { column, type, owner }) {
15211
- const filter = filters[column];
15212
- if (!filter) {
15213
- return null;
15214
- }
15215
- if (!owner || owner === filter[type]?.owner) {
15216
- return filter[type] || null;
15217
- }
15218
- return null;
15219
- }
15220
-
15221
15317
  // node_modules/@turf/union/dist/esm/index.js
15222
15318
  function union2(features, options = {}) {
15223
15319
  const geoms = [];
@@ -15366,6 +15462,9 @@ export {
15366
15462
  SOURCE_DEFAULTS,
15367
15463
  SpatialIndex,
15368
15464
  SpatialIndexColumn,
15465
+ TEXT_LABEL_INDEX,
15466
+ TEXT_NUMBER_FORMATTER,
15467
+ TEXT_OUTLINE_OPACITY,
15369
15468
  TileFormat,
15370
15469
  WidgetQuerySource,
15371
15470
  WidgetRasterSource,
@@ -15386,6 +15485,8 @@ export {
15386
15485
  buildBinaryFeatureFilter,
15387
15486
  buildPublicMapUrl,
15388
15487
  buildStatsUrl,
15488
+ calculateClusterRadius,
15489
+ calculateClusterTextFontSize,
15389
15490
  clearFilters,
15390
15491
  configureSource,
15391
15492
  createPolygonSpatialFilter,
@@ -15394,11 +15495,13 @@ export {
15394
15495
  fetchMap,
15395
15496
  filterFunctions,
15396
15497
  geojsonFeatures,
15498
+ getApplicableFilters,
15397
15499
  getClient,
15398
15500
  getColorAccessor,
15399
15501
  getColorValueAccessor,
15400
15502
  getColumnNameFromGeoColumn,
15401
15503
  getDataFilterExtensionProps,
15504
+ getDefaultAggregationExpColumnAliasForLayerType,
15402
15505
  getFilter,
15403
15506
  getIconUrlAccessor,
15404
15507
  getLayerProps,