@carto/api-client 0.5.27 → 0.5.28
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/CHANGELOG.md +7 -0
- package/build/api-client.cjs +35 -3
- package/build/api-client.cjs.map +1 -1
- package/build/api-client.d.cts +5 -0
- package/build/api-client.d.ts +5 -0
- package/build/api-client.js +35 -3
- package/build/api-client.js.map +1 -1
- package/package.json +1 -1
- package/src/fetch-map/layer-map.ts +3 -2
- package/src/fetch-map/parse-map.ts +51 -1
- package/src/fetch-map/types.ts +6 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
+
## Unreleased
|
|
4
|
+
|
|
5
|
+
### 0.5.28
|
|
6
|
+
|
|
7
|
+
- feat(fetchMap): Support zoom-dependent point styling (#287)
|
|
8
|
+
- feat(fetchMap): Support autoLabels (#288)
|
|
9
|
+
|
|
3
10
|
### 0.5.27
|
|
4
11
|
|
|
5
12
|
- feat(parseMap): custom aggregation support on spatial-index and geometry-aggregated layers. Adds `compileCustomAggregation(expression, { provider })` helper, `VisualChannelField.accessorKey`, and `{channel}AggregationExp` / `{channel}AggregationDomain` on `VisConfig` for all 6 channels.
|
package/build/api-client.cjs
CHANGED
|
@@ -10047,10 +10047,11 @@ function getIconUrlAccessor(field, range, {
|
|
|
10047
10047
|
return normalizeAccessor(accessor, data);
|
|
10048
10048
|
}
|
|
10049
10049
|
function getMaxMarkerSize(visConfig, visualChannels) {
|
|
10050
|
-
const { radiusRange, radius } = visConfig;
|
|
10050
|
+
const { radiusRange, radius, sizeMaxPixels } = visConfig;
|
|
10051
10051
|
const { radiusField, sizeField } = visualChannels;
|
|
10052
10052
|
const field = radiusField || sizeField;
|
|
10053
|
-
|
|
10053
|
+
const baseSize = radiusRange && field ? radiusRange[1] : radius;
|
|
10054
|
+
return Math.ceil(sizeMaxPixels ?? baseSize);
|
|
10054
10055
|
}
|
|
10055
10056
|
function negateAccessor(accessor) {
|
|
10056
10057
|
if (typeof accessor === "function") {
|
|
@@ -10565,6 +10566,7 @@ function getLayerDescriptor({
|
|
|
10565
10566
|
...createInteractionProps(interactionConfig),
|
|
10566
10567
|
...styleProps,
|
|
10567
10568
|
...channelProps,
|
|
10569
|
+
...createZoomScaleProps(config2, visualChannels),
|
|
10568
10570
|
...createParametersProp(layerBlending, styleProps.parameters || {}),
|
|
10569
10571
|
// Must come after style
|
|
10570
10572
|
...createLoadOptions(data.accessToken)
|
|
@@ -10634,6 +10636,28 @@ function createInteractionProps(interactionConfig) {
|
|
|
10634
10636
|
pickable
|
|
10635
10637
|
};
|
|
10636
10638
|
}
|
|
10639
|
+
function createZoomScaleProps(config2, visualChannels) {
|
|
10640
|
+
const { visConfig } = config2;
|
|
10641
|
+
if (!visConfig.radiusScaleWithZoom || visualChannels.radiusField || visualChannels.sizeField) {
|
|
10642
|
+
return {};
|
|
10643
|
+
}
|
|
10644
|
+
const scale2 = Math.pow(2, -visConfig.radiusReferenceZoom);
|
|
10645
|
+
const result = {
|
|
10646
|
+
pointRadiusUnits: "common",
|
|
10647
|
+
pointRadiusScale: scale2,
|
|
10648
|
+
iconSizeUnits: "common",
|
|
10649
|
+
iconSizeScale: scale2
|
|
10650
|
+
};
|
|
10651
|
+
if (visConfig.sizeMinPixels !== void 0) {
|
|
10652
|
+
result.pointRadiusMinPixels = visConfig.sizeMinPixels;
|
|
10653
|
+
result.iconSizeMinPixels = visConfig.sizeMinPixels;
|
|
10654
|
+
}
|
|
10655
|
+
if (visConfig.sizeMaxPixels !== void 0) {
|
|
10656
|
+
result.pointRadiusMaxPixels = visConfig.sizeMaxPixels;
|
|
10657
|
+
result.iconSizeMaxPixels = visConfig.sizeMaxPixels;
|
|
10658
|
+
}
|
|
10659
|
+
return result;
|
|
10660
|
+
}
|
|
10637
10661
|
function mapProps(source, target, mapping) {
|
|
10638
10662
|
for (const sourceKey in mapping) {
|
|
10639
10663
|
const sourceValue = source[sourceKey];
|
|
@@ -11023,7 +11047,15 @@ function createChannelProps(id, layerType, config2, visualChannels, data, datase
|
|
|
11023
11047
|
} = secondaryLabel || {};
|
|
11024
11048
|
result.getText = mainLabel.field && getTextAccessor(mainLabel.field, data);
|
|
11025
11049
|
const getSecondaryText = secondaryField && getTextAccessor(secondaryField, data);
|
|
11026
|
-
|
|
11050
|
+
const geometry = data.tilestats?.layers?.[0]?.geometry;
|
|
11051
|
+
const isLineOrPolygon = geometry === "Polygon" || geometry === "MultiPolygon" || geometry === "Line" || geometry === "LineString" || geometry === "MultiLineString";
|
|
11052
|
+
if (isLineOrPolygon && (layerType === "tileset" || layerType === "mvt")) {
|
|
11053
|
+
const uniqueIdProperty = visConfig.textLabelUniqueIdField;
|
|
11054
|
+
result.autoLabels = uniqueIdProperty ? { uniqueIdProperty } : true;
|
|
11055
|
+
result.pointType = "text";
|
|
11056
|
+
} else {
|
|
11057
|
+
result.pointType = `${result.pointType}+text`;
|
|
11058
|
+
}
|
|
11027
11059
|
result.textCharacterSet = "auto";
|
|
11028
11060
|
result.textFontFamily = "Inter, sans";
|
|
11029
11061
|
result.textFontSettings = { sdf: true };
|