@carto/api-client 0.5.2-alpha.0 → 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 +120 -12
  2. package/build/api-client.cjs.map +1 -1
  3. package/build/api-client.d.cts +20 -1
  4. package/build/api-client.d.ts +20 -1
  5. package/build/api-client.js +114 -12
  6. package/build/api-client.js.map +1 -1
  7. package/build/worker.js +28 -19
  8. package/build/worker.js.map +1 -1
  9. package/package.json +3 -2
  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 +1 -1
  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 +35 -0
  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 +4 -4
  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 +6 -5
  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;
@@ -1768,4 +1787,4 @@ declare function getColumnNameFromGeoColumn(geoColumn: string | null | undefined
1768
1787
  */
1769
1788
  declare function getSpatialIndexFromGeoColumn(geoColumn: string): SpatialIndex | null;
1770
1789
 
1771
- 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, getApplicableFilters, 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;
@@ -1768,4 +1787,4 @@ declare function getColumnNameFromGeoColumn(geoColumn: string | null | undefined
1768
1787
  */
1769
1788
  declare function getSpatialIndexFromGeoColumn(geoColumn: string): SpatialIndex | null;
1770
1789
 
1771
- 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, getApplicableFilters, 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 };
@@ -10894,6 +10894,7 @@ function isValidBandValue(value, nodata) {
10894
10894
  }
10895
10895
 
10896
10896
  // src/utils.ts
10897
+ var FILTER_TYPES = new Set(Object.values(FilterType));
10897
10898
  function normalizeObjectKeys(el) {
10898
10899
  if (Array.isArray(el)) {
10899
10900
  return el.map((value) => normalizeObjectKeys(value));
@@ -11541,8 +11542,8 @@ function objectToURLSearchParams(object) {
11541
11542
  }
11542
11543
 
11543
11544
  // src/filters.ts
11544
- var FILTER_TYPES = new Set(Object.values(FilterType));
11545
- var isFilterType = (type) => FILTER_TYPES.has(type);
11545
+ var FILTER_TYPES2 = new Set(Object.values(FilterType));
11546
+ var isFilterType = (type) => FILTER_TYPES2.has(type);
11546
11547
  function addFilter(filters, { column, type, values, owner }) {
11547
11548
  if (!filters[column]) {
11548
11549
  filters[column] = {};
@@ -11557,7 +11558,7 @@ function removeFilter(filters, { column, owner }) {
11557
11558
  return filters;
11558
11559
  }
11559
11560
  if (owner) {
11560
- for (const type of FILTER_TYPES) {
11561
+ for (const type of FILTER_TYPES2) {
11561
11562
  if (owner === filter[type]?.owner) {
11562
11563
  delete filter[type];
11563
11564
  }
@@ -11582,7 +11583,7 @@ function hasFilter(filters, { column, owner }) {
11582
11583
  if (!owner) {
11583
11584
  return true;
11584
11585
  }
11585
- for (const type of FILTER_TYPES) {
11586
+ for (const type of FILTER_TYPES2) {
11586
11587
  if (owner === filter[type]?.owner) {
11587
11588
  return true;
11588
11589
  }
@@ -11941,7 +11942,11 @@ function min(values, keys, joinOperation) {
11941
11942
  Infinity
11942
11943
  );
11943
11944
  }
11944
- 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;
11945
11950
  }
11946
11951
  function max(values, keys, joinOperation) {
11947
11952
  const normalizedKeys = normalizeKeys(keys);
@@ -11951,7 +11956,11 @@ function max(values, keys, joinOperation) {
11951
11956
  -Infinity
11952
11957
  );
11953
11958
  }
11954
- 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;
11955
11964
  }
11956
11965
  function normalizeKeys(keys) {
11957
11966
  return Array.isArray(keys) ? keys : typeof keys === "string" ? [keys] : void 0;
@@ -14240,7 +14249,8 @@ var customMarkersPropsMap = {
14240
14249
  var heatmapTilePropsMap = {
14241
14250
  visConfig: {
14242
14251
  colorRange: (x) => ({ colorRange: x.colors.map(hexToRGBA) }),
14243
- radius: "radiusPixels"
14252
+ radius: (radius) => ({ radiusPixels: 20 + radius }),
14253
+ opacity: "opacity"
14244
14254
  }
14245
14255
  };
14246
14256
  var defaultProps = {
@@ -14261,6 +14271,12 @@ var deprecatedLayerTypes = [
14261
14271
  "hexagonId",
14262
14272
  "point"
14263
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
+ });
14264
14280
  function getLayerProps(type, config2, dataset) {
14265
14281
  if (deprecatedLayerTypes.includes(type)) {
14266
14282
  throw new Error(
@@ -14352,9 +14368,7 @@ function findAccessorKey(keys, properties) {
14352
14368
  return [key];
14353
14369
  }
14354
14370
  }
14355
- throw new Error(
14356
- `Could not find property for any accessor key: ${keys.join(", ")}`
14357
- );
14371
+ return keys;
14358
14372
  }
14359
14373
  function getColorValueAccessor({ name }, colorAggregation, data) {
14360
14374
  const aggregator = AGGREGATION_FUNC[colorAggregation];
@@ -14481,6 +14495,40 @@ function getTextAccessor({ name, type }, data) {
14481
14495
  };
14482
14496
  return normalizeAccessor(accessor, data);
14483
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
+ }
14484
14532
 
14485
14533
  // src/fetch-map/parse-map.ts
14486
14534
  function parseMap(json) {
@@ -14521,7 +14569,14 @@ function parseMap(json) {
14521
14569
  ...defaultProps2,
14522
14570
  ...createInteractionProps(interactionConfig),
14523
14571
  ...styleProps,
14524
- ...createChannelProps(id, type, config3, visualChannels, data),
14572
+ ...createChannelProps(
14573
+ id,
14574
+ type,
14575
+ config3,
14576
+ visualChannels,
14577
+ data,
14578
+ dataset
14579
+ ),
14525
14580
  // Must come after style
14526
14581
  ...createParametersProp(
14527
14582
  layerBlending,
@@ -14596,7 +14651,7 @@ function createStyleProps(config2, mapping) {
14596
14651
  result.highlightColor = config2.visConfig.enable3d ? [255, 255, 255, 60] : [252, 242, 26, 255];
14597
14652
  return result;
14598
14653
  }
14599
- function createChannelProps(id, type, config2, visualChannels, data) {
14654
+ function createChannelProps(id, type, config2, visualChannels, data, dataset) {
14600
14655
  const {
14601
14656
  colorField,
14602
14657
  colorScale,
@@ -14656,6 +14711,47 @@ function createChannelProps(id, type, config2, visualChannels, data) {
14656
14711
  };
14657
14712
  }
14658
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
+ }
14659
14755
  if (radiusField || sizeField) {
14660
14756
  result.getPointRadius = getSizeAccessor(
14661
14757
  // @ts-ignore
@@ -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,
@@ -15400,6 +15501,7 @@ export {
15400
15501
  getColorValueAccessor,
15401
15502
  getColumnNameFromGeoColumn,
15402
15503
  getDataFilterExtensionProps,
15504
+ getDefaultAggregationExpColumnAliasForLayerType,
15403
15505
  getFilter,
15404
15506
  getIconUrlAccessor,
15405
15507
  getLayerProps,