@deck.gl/carto 8.9.0-beta.4 → 8.9.0-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dist.dev.js +62 -112
- package/dist.min.js +30 -23
- package/package.json +2 -2
- package/LICENSE +0 -19
package/dist/dist.dev.js
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
|
+
(function webpackUniversalModuleDefinition(root, factory) {
|
|
2
|
+
if (typeof exports === 'object' && typeof module === 'object')
|
|
3
|
+
module.exports = factory();
|
|
4
|
+
else if (typeof define === 'function' && define.amd) define([], factory);
|
|
5
|
+
else if (typeof exports === 'object') exports['deck'] = factory();
|
|
6
|
+
else root['deck'] = factory();})(globalThis, function () {
|
|
1
7
|
"use strict";
|
|
2
|
-
var
|
|
8
|
+
var __exports__ = (() => {
|
|
3
9
|
var __create = Object.create;
|
|
4
10
|
var __defProp = Object.defineProperty;
|
|
5
11
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -43,14 +49,14 @@ var deck = (() => {
|
|
|
43
49
|
// external-global-plugin:@deck.gl/core
|
|
44
50
|
var require_core = __commonJS({
|
|
45
51
|
"external-global-plugin:@deck.gl/core"(exports, module) {
|
|
46
|
-
module.exports =
|
|
52
|
+
module.exports = typeof __require === "function" ? require_core() : null;
|
|
47
53
|
}
|
|
48
54
|
});
|
|
49
55
|
|
|
50
56
|
// external-global-plugin:@deck.gl/geo-layers
|
|
51
57
|
var require_geo_layers = __commonJS({
|
|
52
58
|
"external-global-plugin:@deck.gl/geo-layers"(exports, module) {
|
|
53
|
-
module.exports =
|
|
59
|
+
module.exports = typeof __require === "function" ? require_geo_layers() : null;
|
|
54
60
|
}
|
|
55
61
|
});
|
|
56
62
|
|
|
@@ -5318,14 +5324,21 @@ var deck = (() => {
|
|
|
5318
5324
|
// external-global-plugin:@deck.gl/aggregation-layers
|
|
5319
5325
|
var require_aggregation_layers = __commonJS({
|
|
5320
5326
|
"external-global-plugin:@deck.gl/aggregation-layers"(exports, module) {
|
|
5321
|
-
module.exports =
|
|
5327
|
+
module.exports = typeof __require === "function" ? require_aggregation_layers() : null;
|
|
5322
5328
|
}
|
|
5323
5329
|
});
|
|
5324
5330
|
|
|
5325
5331
|
// external-global-plugin:@deck.gl/layers
|
|
5326
5332
|
var require_layers = __commonJS({
|
|
5327
5333
|
"external-global-plugin:@deck.gl/layers"(exports, module) {
|
|
5328
|
-
module.exports =
|
|
5334
|
+
module.exports = typeof __require === "function" ? require_layers() : null;
|
|
5335
|
+
}
|
|
5336
|
+
});
|
|
5337
|
+
|
|
5338
|
+
// external-global-plugin:@loaders.gl/core
|
|
5339
|
+
var require_core2 = __commonJS({
|
|
5340
|
+
"external-global-plugin:@loaders.gl/core"(exports, module) {
|
|
5341
|
+
module.exports = typeof __require === "function" ? require_core2() : null;
|
|
5329
5342
|
}
|
|
5330
5343
|
});
|
|
5331
5344
|
|
|
@@ -6068,14 +6081,14 @@ var deck = (() => {
|
|
|
6068
6081
|
// external-global-plugin:@deck.gl/extensions
|
|
6069
6082
|
var require_extensions = __commonJS({
|
|
6070
6083
|
"external-global-plugin:@deck.gl/extensions"(exports, module) {
|
|
6071
|
-
module.exports =
|
|
6084
|
+
module.exports = typeof __require === "function" ? require_extensions() : null;
|
|
6072
6085
|
}
|
|
6073
6086
|
});
|
|
6074
6087
|
|
|
6075
6088
|
// external-global-plugin:h3-js
|
|
6076
6089
|
var require_h3_js = __commonJS({
|
|
6077
6090
|
"external-global-plugin:h3-js"(exports, module) {
|
|
6078
|
-
module.exports =
|
|
6091
|
+
module.exports = typeof __require === "function" ? require_h3_js() : null;
|
|
6079
6092
|
}
|
|
6080
6093
|
});
|
|
6081
6094
|
|
|
@@ -11111,76 +11124,8 @@ ${formatErrorKey(key)}: ${errorContext[key]}`;
|
|
|
11111
11124
|
var import_layers2 = __toESM(require_layers());
|
|
11112
11125
|
var import_geo_layers7 = __toESM(require_geo_layers());
|
|
11113
11126
|
|
|
11114
|
-
//
|
|
11115
|
-
|
|
11116
|
-
if (!condition) {
|
|
11117
|
-
throw new Error(message || "loader assertion failed.");
|
|
11118
|
-
}
|
|
11119
|
-
}
|
|
11120
|
-
|
|
11121
|
-
// ../../node_modules/@loaders.gl/core/dist/esm/lib/loader-utils/option-utils.js
|
|
11122
|
-
function getGlobalLoaderState() {
|
|
11123
|
-
globalThis.loaders = globalThis.loaders || {};
|
|
11124
|
-
const {
|
|
11125
|
-
loaders
|
|
11126
|
-
} = globalThis;
|
|
11127
|
-
loaders._state = loaders._state || {};
|
|
11128
|
-
return loaders._state;
|
|
11129
|
-
}
|
|
11130
|
-
|
|
11131
|
-
// ../../node_modules/@loaders.gl/core/dist/esm/lib/loader-utils/normalize-loader.js
|
|
11132
|
-
function isLoaderObject(loader) {
|
|
11133
|
-
var _loader;
|
|
11134
|
-
if (!loader) {
|
|
11135
|
-
return false;
|
|
11136
|
-
}
|
|
11137
|
-
if (Array.isArray(loader)) {
|
|
11138
|
-
loader = loader[0];
|
|
11139
|
-
}
|
|
11140
|
-
const hasExtensions = Array.isArray((_loader = loader) === null || _loader === void 0 ? void 0 : _loader.extensions);
|
|
11141
|
-
return hasExtensions;
|
|
11142
|
-
}
|
|
11143
|
-
function normalizeLoader(loader) {
|
|
11144
|
-
var _loader2, _loader3;
|
|
11145
|
-
assert(loader, "null loader");
|
|
11146
|
-
assert(isLoaderObject(loader), "invalid loader");
|
|
11147
|
-
let options;
|
|
11148
|
-
if (Array.isArray(loader)) {
|
|
11149
|
-
options = loader[1];
|
|
11150
|
-
loader = loader[0];
|
|
11151
|
-
loader = {
|
|
11152
|
-
...loader,
|
|
11153
|
-
options: {
|
|
11154
|
-
...loader.options,
|
|
11155
|
-
...options
|
|
11156
|
-
}
|
|
11157
|
-
};
|
|
11158
|
-
}
|
|
11159
|
-
if ((_loader2 = loader) !== null && _loader2 !== void 0 && _loader2.parseTextSync || (_loader3 = loader) !== null && _loader3 !== void 0 && _loader3.parseText) {
|
|
11160
|
-
loader.text = true;
|
|
11161
|
-
}
|
|
11162
|
-
if (!loader.text) {
|
|
11163
|
-
loader.binary = true;
|
|
11164
|
-
}
|
|
11165
|
-
return loader;
|
|
11166
|
-
}
|
|
11167
|
-
|
|
11168
|
-
// ../../node_modules/@loaders.gl/core/dist/esm/lib/api/register-loaders.js
|
|
11169
|
-
var getGlobalLoaderRegistry = () => {
|
|
11170
|
-
const state = getGlobalLoaderState();
|
|
11171
|
-
state.loaderRegistry = state.loaderRegistry || [];
|
|
11172
|
-
return state.loaderRegistry;
|
|
11173
|
-
};
|
|
11174
|
-
function registerLoaders(loaders) {
|
|
11175
|
-
const loaderRegistry = getGlobalLoaderRegistry();
|
|
11176
|
-
loaders = Array.isArray(loaders) ? loaders : [loaders];
|
|
11177
|
-
for (const loader of loaders) {
|
|
11178
|
-
const normalizedLoader = normalizeLoader(loader);
|
|
11179
|
-
if (!loaderRegistry.find((registeredLoader) => normalizedLoader === registeredLoader)) {
|
|
11180
|
-
loaderRegistry.unshift(normalizedLoader);
|
|
11181
|
-
}
|
|
11182
|
-
}
|
|
11183
|
-
}
|
|
11127
|
+
// src/layers/carto-tile-layer.ts
|
|
11128
|
+
var import_core = __toESM(require_core2());
|
|
11184
11129
|
|
|
11185
11130
|
// src/layers/schema/carto-tile.ts
|
|
11186
11131
|
var KeyValueObjectReader = class {
|
|
@@ -11680,7 +11625,7 @@ ${formatErrorKey(key)}: ${errorContext[key]}`;
|
|
|
11680
11625
|
}
|
|
11681
11626
|
|
|
11682
11627
|
// src/layers/carto-tile-layer.ts
|
|
11683
|
-
registerLoaders([carto_vector_tile_loader_default]);
|
|
11628
|
+
(0, import_core.registerLoaders)([carto_vector_tile_loader_default]);
|
|
11684
11629
|
var defaultTileFormat = TILE_FORMATS.BINARY;
|
|
11685
11630
|
var defaultProps = {
|
|
11686
11631
|
...import_geo_layers.MVTLayer.defaultProps,
|
|
@@ -11864,6 +11809,9 @@ ${formatErrorKey(key)}: ${errorContext[key]}`;
|
|
|
11864
11809
|
}
|
|
11865
11810
|
};
|
|
11866
11811
|
|
|
11812
|
+
// src/layers/spatial-index-tile-layer.ts
|
|
11813
|
+
var import_core2 = __toESM(require_core2());
|
|
11814
|
+
|
|
11867
11815
|
// src/layers/schema/carto-spatial-tile.ts
|
|
11868
11816
|
var IndicesReader = class {
|
|
11869
11817
|
static read(pbf, end) {
|
|
@@ -12057,7 +12005,7 @@ ${formatErrorKey(key)}: ${errorContext[key]}`;
|
|
|
12057
12005
|
|
|
12058
12006
|
// src/layers/spatial-index-tile-layer.ts
|
|
12059
12007
|
var import_geo_layers3 = __toESM(require_geo_layers());
|
|
12060
|
-
registerLoaders([carto_spatial_tile_loader_default]);
|
|
12008
|
+
(0, import_core2.registerLoaders)([carto_spatial_tile_loader_default]);
|
|
12061
12009
|
function isFeatureIdDefined(value) {
|
|
12062
12010
|
return value !== void 0 && value !== null && value !== "";
|
|
12063
12011
|
}
|
|
@@ -12397,7 +12345,7 @@ ${formatErrorKey(key)}: ${errorContext[key]}`;
|
|
|
12397
12345
|
|
|
12398
12346
|
// src/utils.ts
|
|
12399
12347
|
var import_core5 = __toESM(require_core());
|
|
12400
|
-
function
|
|
12348
|
+
function assert2(condition, message) {
|
|
12401
12349
|
import_core5.log.assert(condition, message);
|
|
12402
12350
|
}
|
|
12403
12351
|
|
|
@@ -12582,7 +12530,7 @@ ${formatErrorKey(key)}: ${errorContext[key]}`;
|
|
|
12582
12530
|
}
|
|
12583
12531
|
};
|
|
12584
12532
|
const layer = layerTypeDefs[type];
|
|
12585
|
-
|
|
12533
|
+
assert2(layer, `Unsupported layer type: ${type}`);
|
|
12586
12534
|
return {
|
|
12587
12535
|
...layer,
|
|
12588
12536
|
propMap: mergePropMaps(basePropMap, layer.propMap),
|
|
@@ -12863,7 +12811,7 @@ ${formatErrorKey(key)}: ${errorContext[key]}`;
|
|
|
12863
12811
|
datasets,
|
|
12864
12812
|
token
|
|
12865
12813
|
} = json;
|
|
12866
|
-
|
|
12814
|
+
assert2(keplerMapConfig.version === "v1", "Only support Kepler v1");
|
|
12867
12815
|
const {
|
|
12868
12816
|
mapState,
|
|
12869
12817
|
mapStyle
|
|
@@ -12893,11 +12841,11 @@ ${formatErrorKey(key)}: ${errorContext[key]}`;
|
|
|
12893
12841
|
dataId
|
|
12894
12842
|
} = config;
|
|
12895
12843
|
const dataset = datasets.find((d) => d.id === dataId);
|
|
12896
|
-
|
|
12844
|
+
assert2(dataset, `No dataset matching dataId: ${dataId}`);
|
|
12897
12845
|
const {
|
|
12898
12846
|
data
|
|
12899
12847
|
} = dataset;
|
|
12900
|
-
|
|
12848
|
+
assert2(data, `No data loaded for dataId: ${dataId}`);
|
|
12901
12849
|
const {
|
|
12902
12850
|
Layer,
|
|
12903
12851
|
propMap,
|
|
@@ -13372,20 +13320,20 @@ ${formatErrorKey(key)}: ${errorContext[key]}`;
|
|
|
13372
13320
|
aggregationExp,
|
|
13373
13321
|
aggregationResLevel
|
|
13374
13322
|
}) {
|
|
13375
|
-
|
|
13376
|
-
|
|
13377
|
-
|
|
13378
|
-
|
|
13379
|
-
|
|
13380
|
-
|
|
13323
|
+
assert2(connection, "Must define connection");
|
|
13324
|
+
assert2(type, "Must define a type");
|
|
13325
|
+
assert2(source, "Must define a source");
|
|
13326
|
+
assert2(credentials2.apiVersion === API_VERSIONS.V3, "Method only available for v3");
|
|
13327
|
+
assert2(credentials2.apiBaseUrl, "Must define apiBaseUrl");
|
|
13328
|
+
assert2(credentials2.accessToken, "Must define an accessToken");
|
|
13381
13329
|
if (columns) {
|
|
13382
|
-
|
|
13330
|
+
assert2(COLUMNS_SUPPORT.includes(type), `The columns parameter is not supported by type ${type}`);
|
|
13383
13331
|
}
|
|
13384
13332
|
if (geoColumn) {
|
|
13385
|
-
|
|
13333
|
+
assert2(GEO_COLUMN_SUPPORT.includes(type), `The geoColumn parameter is not supported by type ${type}`);
|
|
13386
13334
|
} else {
|
|
13387
|
-
|
|
13388
|
-
|
|
13335
|
+
assert2(!aggregationExp, "Have aggregationExp, but geoColumn parameter is missing");
|
|
13336
|
+
assert2(!aggregationResLevel, "Have aggregationResLevel, but geoColumn parameter is missing");
|
|
13389
13337
|
}
|
|
13390
13338
|
}
|
|
13391
13339
|
async function fetchLayerData({
|
|
@@ -13493,7 +13441,7 @@ ${formatErrorKey(key)}: ${errorContext[key]}`;
|
|
|
13493
13441
|
if (format2) {
|
|
13494
13442
|
mapFormat = format2;
|
|
13495
13443
|
url = getUrlFromMetadata(metadata, format2);
|
|
13496
|
-
|
|
13444
|
+
assert2(url, `Format ${format2} not available`);
|
|
13497
13445
|
} else {
|
|
13498
13446
|
const prioritizedFormats = [FORMATS.GEOJSON, FORMATS.JSON, FORMATS.NDJSON, FORMATS.TILEJSON];
|
|
13499
13447
|
for (const f of prioritizedFormats) {
|
|
@@ -13503,7 +13451,7 @@ ${formatErrorKey(key)}: ${errorContext[key]}`;
|
|
|
13503
13451
|
break;
|
|
13504
13452
|
}
|
|
13505
13453
|
}
|
|
13506
|
-
|
|
13454
|
+
assert2(url && mapFormat, "Unsupported data formats received from backend.");
|
|
13507
13455
|
}
|
|
13508
13456
|
if (format2 === FORMATS.TILEJSON && formatTiles) {
|
|
13509
13457
|
import_core7.log.assert(Object.values(TILE_FORMATS).includes(formatTiles), `Invalid value for formatTiles: ${formatTiles}. Use value from TILE_FORMATS`);
|
|
@@ -13663,16 +13611,16 @@ ${formatErrorKey(key)}: ${errorContext[key]}`;
|
|
|
13663
13611
|
const {
|
|
13664
13612
|
accessToken
|
|
13665
13613
|
} = localCreds;
|
|
13666
|
-
|
|
13667
|
-
|
|
13668
|
-
|
|
13614
|
+
assert2(cartoMapId, 'Must define CARTO map id: fetchMap({cartoMapId: "XXXX-XXXX-XXXX"})');
|
|
13615
|
+
assert2(localCreds.apiVersion === API_VERSIONS.V3, "Method only available for v3");
|
|
13616
|
+
assert2(localCreds.apiBaseUrl, "Must define apiBaseUrl");
|
|
13669
13617
|
if (!localCreds.mapsUrl) {
|
|
13670
13618
|
localCreds.mapsUrl = buildMapsUrlFromBase(localCreds.apiBaseUrl);
|
|
13671
13619
|
}
|
|
13672
13620
|
if (autoRefresh || onNewData) {
|
|
13673
|
-
|
|
13674
|
-
|
|
13675
|
-
|
|
13621
|
+
assert2(onNewData, "Must define `onNewData` when using autoRefresh");
|
|
13622
|
+
assert2(typeof onNewData === "function", "`onNewData` must be a function");
|
|
13623
|
+
assert2(typeof autoRefresh === "number" && autoRefresh > 0, "`autoRefresh` must be a positive number");
|
|
13676
13624
|
}
|
|
13677
13625
|
const url = `${localCreds.mapsUrl}/public/${cartoMapId}`;
|
|
13678
13626
|
const errorContext = {
|
|
@@ -13872,7 +13820,7 @@ ${formatErrorKey(key)}: ${errorContext[key]}`;
|
|
|
13872
13820
|
}
|
|
13873
13821
|
}
|
|
13874
13822
|
_getSubLayerAndProps() {
|
|
13875
|
-
|
|
13823
|
+
assert2(this.state);
|
|
13876
13824
|
const {
|
|
13877
13825
|
data,
|
|
13878
13826
|
apiVersion
|
|
@@ -13896,7 +13844,7 @@ ${formatErrorKey(key)}: ${errorContext[key]}`;
|
|
|
13896
13844
|
return [layerFromTileDataset(props.formatTiles, data.scheme), props];
|
|
13897
13845
|
}
|
|
13898
13846
|
renderLayers() {
|
|
13899
|
-
|
|
13847
|
+
assert2(this.state);
|
|
13900
13848
|
const {
|
|
13901
13849
|
apiVersion,
|
|
13902
13850
|
data
|
|
@@ -13951,14 +13899,14 @@ ${formatErrorKey(key)}: ${errorContext[key]}`;
|
|
|
13951
13899
|
// src/style/utils.ts
|
|
13952
13900
|
var ALLOWED_ATTR_TYPES = Object.freeze(["function", "string"]);
|
|
13953
13901
|
function getAttrValue(attr, d) {
|
|
13954
|
-
|
|
13955
|
-
|
|
13902
|
+
assert3(typeof d === "object", 'Expected "data" to be an object');
|
|
13903
|
+
assert3(ALLOWED_ATTR_TYPES.includes(typeof attr), 'Expected "attr" to be a function or string');
|
|
13956
13904
|
if (typeof attr === "function") {
|
|
13957
13905
|
return attr(d);
|
|
13958
13906
|
}
|
|
13959
13907
|
return d?.properties?.[attr];
|
|
13960
13908
|
}
|
|
13961
|
-
function
|
|
13909
|
+
function assert3(condition, message = "") {
|
|
13962
13910
|
if (!condition) {
|
|
13963
13911
|
throw new Error(`CARTO style error: ${message}`);
|
|
13964
13912
|
}
|
|
@@ -13971,7 +13919,7 @@ ${formatErrorKey(key)}: ${errorContext[key]}`;
|
|
|
13971
13919
|
function getPalette(name, numCategories) {
|
|
13972
13920
|
const palette = cartoColors[name];
|
|
13973
13921
|
let paletteIndex = numCategories;
|
|
13974
|
-
|
|
13922
|
+
assert3(palette, `Palette "${name}" not found. Expected a CARTOColors string`);
|
|
13975
13923
|
const palettesColorVariants = Object.keys(palette).filter((p) => p !== "tags").map(Number);
|
|
13976
13924
|
const longestPaletteIndex = Math.max(...palettesColorVariants);
|
|
13977
13925
|
const smallestPaletteIndex = Math.min(...palettesColorVariants);
|
|
@@ -14000,7 +13948,7 @@ ${formatErrorKey(key)}: ${errorContext[key]}`;
|
|
|
14000
13948
|
return [parseInt(result[1], 16), parseInt(result[2], 16), parseInt(result[3], 16), 255];
|
|
14001
13949
|
}
|
|
14002
13950
|
result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex2);
|
|
14003
|
-
|
|
13951
|
+
assert3(result, `Hexadecimal color "${hex2}" was not parsed correctly`);
|
|
14004
13952
|
return [parseInt(result[1], 16), parseInt(result[2], 16), parseInt(result[3], 16), parseInt(result[4], 16)];
|
|
14005
13953
|
}
|
|
14006
13954
|
|
|
@@ -14011,7 +13959,7 @@ ${formatErrorKey(key)}: ${errorContext[key]}`;
|
|
|
14011
13959
|
colors = DEFAULT_PALETTE,
|
|
14012
13960
|
nullColor = NULL_COLOR
|
|
14013
13961
|
}) {
|
|
14014
|
-
|
|
13962
|
+
assert3(Array.isArray(domain), 'Expected "domain" to be an array of numbers');
|
|
14015
13963
|
const palette = typeof colors === "string" ? getPalette(colors, domain.length + 1) : colors;
|
|
14016
13964
|
const color2 = threshold().domain(domain).range(palette);
|
|
14017
13965
|
return (d) => {
|
|
@@ -14028,7 +13976,7 @@ ${formatErrorKey(key)}: ${errorContext[key]}`;
|
|
|
14028
13976
|
nullColor = NULL_COLOR,
|
|
14029
13977
|
othersColor = OTHERS_COLOR
|
|
14030
13978
|
}) {
|
|
14031
|
-
|
|
13979
|
+
assert3(Array.isArray(domain), 'Expected "domain" to be an array of numbers or strings');
|
|
14032
13980
|
const colorsByCategory = {};
|
|
14033
13981
|
const palette = typeof colors === "string" ? getPalette(colors, domain.length) : colors;
|
|
14034
13982
|
for (const [i, c] of domain.entries()) {
|
|
@@ -14047,7 +13995,7 @@ ${formatErrorKey(key)}: ${errorContext[key]}`;
|
|
|
14047
13995
|
colors = DEFAULT_PALETTE,
|
|
14048
13996
|
nullColor = NULL_COLOR
|
|
14049
13997
|
}) {
|
|
14050
|
-
|
|
13998
|
+
assert3(Array.isArray(domain), 'Expected "domain" to be an array of numbers');
|
|
14051
13999
|
const palette = typeof colors === "string" ? getPalette(colors, domain.length) : colors;
|
|
14052
14000
|
const color2 = linear2().domain(domain).range(palette);
|
|
14053
14001
|
return (d) => {
|
|
@@ -14069,3 +14017,5 @@ ${formatErrorKey(key)}: ${errorContext[key]}`;
|
|
|
14069
14017
|
var carto = src_exports;
|
|
14070
14018
|
return __toCommonJS(bundle_exports);
|
|
14071
14019
|
})();
|
|
14020
|
+
return __exports__;
|
|
14021
|
+
});
|