@kepler.gl/utils 3.3.0-alpha.15 → 3.3.0-alpha.16

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.
@@ -33,9 +33,17 @@ export declare function downloadFile(fileBlob: Blob, fileName: string): void;
33
33
  */
34
34
  export declare function exportImage(uiStateExportImage: ExportImage, filename?: string): void;
35
35
  export declare function exportToJsonString(data: any): any;
36
- export declare function getMapJSON(state: any, options?: {
36
+ /**
37
+ * Remove access tokens stored on layer datasets. The tileset URL and the rest
38
+ * of the metadata stay so the map can be reopened and a new key entered.
39
+ */
40
+ export declare function omitLayerApiKeys<T>(mapToSave: T): T;
41
+ type MapJsonOptions = {
37
42
  hasData?: boolean;
38
- }): any;
43
+ /** When false, access tokens stored on layer datasets are removed. */
44
+ includeLayerApiKeys?: boolean;
45
+ };
46
+ export declare function getMapJSON(state: any, options?: MapJsonOptions): any;
39
47
  export declare function exportJson(state: any, options?: any): void;
40
48
  export declare function exportHtml(state: any, options: any): void;
41
49
  export declare function exportMap(state: any, options?: {
@@ -51,6 +51,7 @@ export type ExtractResult = ExtractedTable | ExtractedGeojson;
51
51
  */
52
52
  export declare function isExtractableDataset(dataset?: ExtractableDataset | null): boolean;
53
53
  export declare function isVectorTileExtractLayer(layer?: ExtractableLayer | null): boolean;
54
+ export declare function isRasterTileExtractLayer(layer?: ExtractableLayer | null): boolean;
54
55
  export declare function isExtractableLayer(layer: ExtractableLayer, datasets: Record<string, ExtractableDataset | undefined>): boolean;
55
56
  /**
56
57
  * Copy GeoJSON features from currently loaded vector tiles that intersect a drawing.
@@ -60,11 +61,16 @@ export declare function extractVectorTileFeaturesInsideFeature({ layer, feature
60
61
  layer: ExtractableLayer;
61
62
  feature: Feature | null;
62
63
  }): ExtractedGeojson | null;
64
+ export declare function extractRasterInsideFeature({ layer, feature }: {
65
+ layer: ExtractableLayer;
66
+ feature: Feature | null;
67
+ }): ExtractedGeojson | null;
63
68
  /**
64
69
  * Copy in-memory rows whose geometry falls inside a drawn polygon.
65
70
  * Existing table filters (range/select/time), including GPU-backed ones via
66
71
  * `filteredIdxCPU`, are applied; the polygon clip is extra.
67
72
  * Vector tiles use currently loaded viewport tiles instead of dataset.rows.
73
+ * Raster tiles report whether any loaded pixels fall inside the drawing.
68
74
  */
69
75
  export declare function extractRowsInsideFeature({ layer, dataset, feature }: {
70
76
  layer: ExtractableLayer;
package/dist/index.d.ts CHANGED
@@ -6,7 +6,7 @@ export { default as domtoimage } from './dom-to-image';
6
6
  export { getFrequency, getMode, aggregate } from './aggregation';
7
7
  export { ColumnStatsType, NUMERIC_BIN_COUNT, collectColumnValues, computeColumnStats, getColumnStatistics } from './column-statistics';
8
8
  export type { ColumnStats, NumericColumnStats, CategoricalColumnStats, TimeColumnStats, Quantile } from './column-statistics';
9
- export { adjustValueToAnimationWindow, getBinThresholds, histogramFromThreshold, histogramFromValues, histogramFromDomain, histogramFromOrdinal, histogramFromTimeIntervals, mergePolygonLayerIndexes, runGpuFilterForPlot, updateTimeFilterPlotType } from './plot';
9
+ export { adjustValueToAnimationWindow, getBinThresholds, intervalBinFromMarks, histogramFromThreshold, histogramFromValues, histogramFromDomain, histogramFromOrdinal, histogramFromTimeIntervals, mergePolygonLayerIndexes, runGpuFilterForPlot, updateTimeFilterPlotType, getLineChart, mergePlotGroupBy, lineChartSeriesLegend, defaultPlotGroupColorRange, PLOT_GROUP_OTHERS_NAME, PLOT_NUM_GROUPS_ALL, PLOT_NUM_GROUPS_OPTIONS, DEFAULT_PLOT_NUM_GROUPS, MAX_PLOT_NUM_GROUPS } from './plot';
10
10
  export * from './data-utils';
11
11
  export type { FieldFormatter } from './data-utils';
12
12
  export * from './strings';
@@ -14,7 +14,7 @@ export { SAMPLE_TIMELINE, TIMELINE_MODES, TIME_INTERVALS_ORDERED, LayerToFilterT
14
14
  export { maybeHexToGeo, getPositionFromHexValue } from './position-utils';
15
15
  export { datasetColorMaker, findDefaultColorField, getFieldFormatLabels, getFormatLabels, validateInputData } from './dataset-utils';
16
16
  export { exportMapToHTML } from './export-map-html';
17
- export { calculateExportImageSize, convertToPng, dataURItoBlob, downloadFile, exportHtml, exportImage, exportJson, exportMap, exportToJsonString, default as exporters, getExportFileName, getExportFileNameBase, getMapJSON, getScaleFromImageSize, isMSEdge } from './export-utils';
17
+ export { calculateExportImageSize, convertToPng, dataURItoBlob, downloadFile, exportHtml, exportImage, exportJson, exportMap, exportToJsonString, default as exporters, getExportFileName, getExportFileNameBase, getMapJSON, getScaleFromImageSize, isMSEdge, omitLayerApiKeys } from './export-utils';
18
18
  export { getFormatValue, getDefaultTimeFormat } from './format';
19
19
  export { getLayerBlendingParameters, patchDeckRendererForPostProcessing } from './gl-utils';
20
20
  export { flattenMessages, mergeMessages } from './locale-utils';
@@ -38,7 +38,7 @@ export * from './filter-utils';
38
38
  export type { FilterChanged, FilterResult, dataValueAccessor } from './filter-utils';
39
39
  export * from './editor-feature-utils';
40
40
  export type { EditorFeatureCollection } from './editor-feature-utils';
41
- export { extractRowsInsideFeature, extractVectorTileFeaturesInsideFeature, isExtractableDataset, isExtractableLayer, isVectorTileExtractLayer } from './extract-dataset-utils';
41
+ export { extractRowsInsideFeature, extractVectorTileFeaturesInsideFeature, extractRasterInsideFeature, isExtractableDataset, isExtractableLayer, isRasterTileExtractLayer, isVectorTileExtractLayer } from './extract-dataset-utils';
42
42
  export type { ExtractableDataset, ExtractableLayer, ExtractedGeojson, ExtractedTable, ExtractResult } from './extract-dataset-utils';
43
43
  export { colorMapToColorBreaks, colorBreaksToColorMap, getLayerColorScale, getLegendOfScale, getJenksDomain, getLinearDomain, getLogDomain, getOrdinalDomain, getQuantileDomain, getScaleFunction, getVisualChannelScaleByZoom, initializeLayerColorMap, isNumericColorBreaks, isDomainStops, isDomainQuantile, getDomainStepsbyZoom, getThresholdsFromQuantiles, getQuantLabelFormat, getHistogramDomain, getQuantLegends, getCategoricalColorMap, getCategoricalColorScale, initCustomPaletteByCustomScale, colorMapToCategoricalColorBreaks, resetCategoricalColorMapByIndex, selectRestCategoricalColorMapByIndex, removeCategoricalValueFromColorMap, addCategoricalValuesToColorMap } from './data-scale-utils';
44
44
  export type { ColorBreak, ColorBreakOrdinal, DomainQuantiles, DomainStops } from './data-scale-utils';
package/dist/plot.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Bin, TimeBins, Millisecond, TimeRangeFilter, RangeFilter, PlotType, Filter, LineChart, Field, ValueOf } from '@kepler.gl/types';
1
+ import { Bin, TimeBins, Millisecond, TimeRangeFilter, RangeFilter, PlotType, PlotGroupBy, Filter, LineChart, Field, ValueOf, ColorRange } from '@kepler.gl/types';
2
2
  import { AggregationTypes } from '@kepler.gl/constants';
3
3
  import { DataContainerInterface } from '.';
4
4
  import { KeplerTableModel } from './types';
@@ -57,11 +57,12 @@ export declare function runGpuFilterForPlot<K extends KeplerTableModel<K, L>, L>
57
57
  export declare function getFilterDataFunc(filterRange: any, getFilterValue: any, dataContainer: DataContainerInterface, skips: any): (index: any) => any;
58
58
  export declare function validBin(b: any): boolean;
59
59
  /**
60
- * Use in slider, given a number and an array of numbers, return the nears number from the array.
61
- * Takes a value, timesteps and return the actual step.
62
- * @param value
63
- * @param marks
60
+ * Turn a histogram brush or slider position into one bin.
61
+ * Interval playback steps by bin, and the filter comparison is inclusive, so
62
+ * the window is [binStart, nextBinStart - 1]. The last threshold is the end
63
+ * of the domain, not the start of another bin.
64
64
  */
65
+ export declare function intervalBinFromMarks(marks: number[], value: number): [number, number];
65
66
  export declare function snapToMarks(value: number, marks: number[]): number;
66
67
  export declare function normalizeValue(val: any, minValue: any, step: any, marks: any): number;
67
68
  export declare function isPercentField(field: any): any;
@@ -69,6 +70,23 @@ export declare function updateAggregationByField(field: Field, aggregation: Valu
69
70
  export declare const getValueAggrFunc: (field: Field | string | null, aggregation: string, dataset: KeplerTableModel<any, any>) => ((bin: Bin) => number);
70
71
  export declare const getAggregationOptiosnBasedOnField: (field: any) => import("@kepler.gl/constants").TimeAggregation[];
71
72
  export declare function getPctChange(y: unknown, y0: unknown): number | null;
73
+ export declare const PLOT_GROUP_OTHERS_NAME = "Others";
74
+ export declare const PLOT_NUM_GROUPS_ALL: "ALL";
75
+ export declare const DEFAULT_PLOT_NUM_GROUPS = 10;
76
+ /** Qualitative palettes stop at 20. All uses this cap instead of one series per value. */
77
+ export declare const MAX_PLOT_NUM_GROUPS = 20;
78
+ export declare const PLOT_NUM_GROUPS_OPTIONS: number[];
79
+ export declare function plotGroupColorSteps(numGroups: number | typeof PLOT_NUM_GROUPS_ALL | undefined): number;
80
+ export declare function defaultPlotGroupColorRange(numGroups?: number | typeof PLOT_NUM_GROUPS_ALL): ColorRange;
81
+ /**
82
+ * Merge a partial timeline group-by onto the previous one.
83
+ * `null` clears grouping. Missing fields keep the previous value, then defaults.
84
+ */
85
+ export declare function mergePlotGroupBy(prev: PlotGroupBy | null | undefined, next: Partial<PlotGroupBy> | null | undefined): PlotGroupBy | null;
86
+ export declare function lineChartSeriesLegend(lineChart?: LineChart | null): {
87
+ name: string;
88
+ color: string;
89
+ }[];
72
90
  /**
73
91
  *
74
92
  * @param datasets
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kepler.gl/utils",
3
3
  "author": "Shan He <shan@uber.com>",
4
- "version": "3.3.0-alpha.15",
4
+ "version": "3.3.0-alpha.16",
5
5
  "description": "kepler.gl constants used by kepler.gl components, actions and reducers",
6
6
  "license": "MIT",
7
7
  "main": "dist/cjs/index.js",
@@ -29,9 +29,9 @@
29
29
  ],
30
30
  "dependencies": {
31
31
  "@deck.gl/core": "^9.3.1",
32
- "@kepler.gl/common-utils": "3.3.0-alpha.15",
33
- "@kepler.gl/constants": "3.3.0-alpha.15",
34
- "@kepler.gl/types": "3.3.0-alpha.15",
32
+ "@kepler.gl/common-utils": "3.3.0-alpha.16",
33
+ "@kepler.gl/constants": "3.3.0-alpha.16",
34
+ "@kepler.gl/types": "3.3.0-alpha.16",
35
35
  "@loaders.gl/gis": "^4.4.1",
36
36
  "@luma.gl/constants": "^9.3.2",
37
37
  "@luma.gl/core": "^9.3.2",