@flowmap.gl/data 8.0.0-alpha.9 → 8.0.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 (70) hide show
  1. package/.turbo/turbo-build.log +3 -0
  2. package/.turbo/turbo-dev.log +6 -0
  3. package/LICENSE +2 -2
  4. package/dist/FlowmapAggregateAccessors.d.ts +4 -4
  5. package/dist/FlowmapAggregateAccessors.d.ts.map +1 -1
  6. package/dist/FlowmapAggregateAccessors.js +16 -9
  7. package/dist/FlowmapSelectors.d.ts +41 -87
  8. package/dist/FlowmapSelectors.d.ts.map +1 -1
  9. package/dist/FlowmapSelectors.js +174 -161
  10. package/dist/FlowmapState.d.ts +7 -5
  11. package/dist/FlowmapState.d.ts.map +1 -1
  12. package/dist/FlowmapState.js +6 -1
  13. package/dist/cluster/ClusterIndex.d.ts +4 -4
  14. package/dist/cluster/ClusterIndex.d.ts.map +1 -1
  15. package/dist/cluster/ClusterIndex.js +5 -17
  16. package/dist/cluster/cluster.d.ts +25 -5
  17. package/dist/cluster/cluster.d.ts.map +1 -1
  18. package/dist/cluster/cluster.js +115 -57
  19. package/dist/colors.d.ts +3 -3
  20. package/dist/colors.d.ts.map +1 -1
  21. package/dist/colors.js +19 -8
  22. package/dist/getViewStateForLocations.d.ts +3 -3
  23. package/dist/getViewStateForLocations.d.ts.map +1 -1
  24. package/dist/getViewStateForLocations.js +33 -12
  25. package/dist/index.d.ts +3 -3
  26. package/dist/index.d.ts.map +1 -1
  27. package/dist/index.js +9 -4
  28. package/dist/provider/FlowmapDataProvider.d.ts +7 -2
  29. package/dist/provider/FlowmapDataProvider.d.ts.map +1 -1
  30. package/dist/provider/FlowmapDataProvider.js +11 -6
  31. package/dist/provider/LocalFlowmapDataProvider.d.ts +15 -4
  32. package/dist/provider/LocalFlowmapDataProvider.d.ts.map +1 -1
  33. package/dist/provider/LocalFlowmapDataProvider.js +98 -81
  34. package/dist/selector-functions.d.ts +10 -0
  35. package/dist/selector-functions.d.ts.map +1 -0
  36. package/dist/selector-functions.js +65 -0
  37. package/dist/time.d.ts.map +1 -1
  38. package/dist/time.js +6 -1
  39. package/dist/types.d.ts +20 -18
  40. package/dist/types.d.ts.map +1 -1
  41. package/dist/types.js +9 -4
  42. package/dist/util.d.ts.map +1 -1
  43. package/dist/util.js +6 -1
  44. package/package.json +22 -27
  45. package/src/FlowmapAggregateAccessors.ts +21 -10
  46. package/src/FlowmapSelectors.ts +304 -280
  47. package/src/FlowmapState.ts +13 -5
  48. package/src/cluster/ClusterIndex.ts +23 -28
  49. package/src/cluster/cluster.ts +165 -73
  50. package/src/colors.ts +13 -9
  51. package/src/getViewStateForLocations.ts +23 -7
  52. package/src/index.ts +9 -3
  53. package/src/provider/FlowmapDataProvider.ts +23 -7
  54. package/src/provider/LocalFlowmapDataProvider.ts +68 -5
  55. package/src/selector-functions.ts +93 -0
  56. package/src/time.ts +6 -0
  57. package/src/types.ts +23 -15
  58. package/src/util.ts +6 -0
  59. package/dist/provider/WorkerFlowmapDataProvider.d.ts +0 -42
  60. package/dist/provider/WorkerFlowmapDataProvider.d.ts.map +0 -1
  61. package/dist/provider/WorkerFlowmapDataProvider.js +0 -80
  62. package/dist/provider/WorkerFlowmapDataProviderWorker.d.ts +0 -2
  63. package/dist/provider/WorkerFlowmapDataProviderWorker.d.ts.map +0 -1
  64. package/dist/provider/WorkerFlowmapDataProviderWorker.js +0 -4
  65. package/dist/provider/createWorkerDataProvider.d.ts +0 -3
  66. package/dist/provider/createWorkerDataProvider.d.ts.map +0 -1
  67. package/dist/provider/createWorkerDataProvider.js +0 -21
  68. package/src/provider/WorkerFlowmapDataProvider.ts +0 -121
  69. package/src/provider/WorkerFlowmapDataProviderWorker.ts +0 -4
  70. package/src/provider/createWorkerDataProvider.ts +0 -18
package/package.json CHANGED
@@ -1,53 +1,48 @@
1
1
  {
2
2
  "name": "@flowmap.gl/data",
3
- "version": "8.0.0-alpha.9",
3
+ "version": "8.0.1",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
- "repository": "git@github.com:FlowmapBlue/flowmap.gl.git",
7
+ "repository": "git@github.com:visgl/flowmap.gl.git",
8
8
  "author": "Ilya Boyandin <ilya@boyandin.me>",
9
9
  "license": "Apache-2.0",
10
+ "type": "module",
10
11
  "scripts": {
11
12
  "dev": "tsc --watch",
12
13
  "build": "rm -rf dist && tsc",
13
14
  "prepare": "yarn build"
14
15
  },
15
16
  "dependencies": {
16
- "comlink": "^4.3.1",
17
- "d3-array": "^3.0.2",
18
- "d3-collection": "^1.0.7",
19
- "d3-color": "^3.0.1",
20
- "d3-geo": "^3.0.1",
21
- "d3-interpolate": "^3.0.1",
22
- "d3-scale": "^4.0.0",
23
- "d3-scale-chromatic": "^3.0.0",
24
- "d3-time": "^3.0.0",
25
- "d3-time-format": "^4.0.0",
26
- "kdbush": "^3.0.0",
27
- "reselect": "^4.0.0",
17
+ "d3-array": "^3.2.4",
18
+ "d3-color": "2 - 3",
19
+ "d3-geo": "^3.1.0",
20
+ "d3-interpolate": "2 - 3",
21
+ "d3-scale": "3 - 4",
22
+ "d3-scale-chromatic": "2 - 3",
23
+ "d3-time": "^3.1.0",
24
+ "d3-time-format": "3 - 4",
25
+ "kdbush": "^4.0.2",
26
+ "reselect": "^4.1.6",
28
27
  "seedrandom": "^3.0.5"
29
28
  },
30
29
  "devDependencies": {
31
- "@types/d3-array": "^3.0.1",
30
+ "@types/d3-array": "^3.0.7",
32
31
  "@types/d3-collection": "^1.0.10",
33
- "@types/d3-color": "^3.0.2",
34
- "@types/d3-geo": "^3.0.2",
32
+ "@types/d3-color": "^3.1.0",
33
+ "@types/d3-geo": "^3.0.4",
35
34
  "@types/d3-interpolate": "^3.0.1",
36
- "@types/d3-scale": "^4.0.1",
35
+ "@types/d3-scale": "^4.0.4",
37
36
  "@types/d3-scale-chromatic": "^3.0.0",
38
37
  "@types/d3-time": "^3.0.0",
39
38
  "@types/d3-time-format": "^4.0.0",
40
- "@types/geojson": "^7946.0.7",
41
- "@types/kdbush": "^3.0.0",
42
- "@types/mapbox__geo-viewport": "^0.4.1",
43
- "@types/seedrandom": "^3.0.1"
39
+ "@types/geojson": "^7946.0.10",
40
+ "@types/kdbush": "^3.0.3",
41
+ "@types/mapbox__geo-viewport": "^0.5.0",
42
+ "@types/seedrandom": "^3.0.5"
44
43
  },
45
- "gitHead": "ad8c99695027f4dca3e5cc4672e07bf6dcd89580",
44
+ "gitHead": "45737cc29a887341f0e4df3642c7501156d9fa44",
46
45
  "publishConfig": {
47
46
  "access": "public"
48
- },
49
- "peerDependencies": {
50
- "@loaders.gl/core": "^3.1.4",
51
- "@loaders.gl/csv": "^3.1.4"
52
47
  }
53
48
  }
@@ -1,3 +1,9 @@
1
+ /*
2
+ * Copyright (c) Flowmap.gl contributors
3
+ * Copyright (c) 2018-2020 Teralytics
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+
1
7
  import {
2
8
  AggregateFlow,
3
9
  ClusterNode,
@@ -7,7 +13,10 @@ import {
7
13
  isLocationClusterNode,
8
14
  } from './types';
9
15
 
10
- export default class FlowmapAggregateAccessors<L, F> {
16
+ export default class FlowmapAggregateAccessors<
17
+ L extends Record<string, any>,
18
+ F extends Record<string, any>,
19
+ > {
11
20
  private accessors: FlowmapDataAccessors<L, F>;
12
21
  constructor(accessors: FlowmapDataAccessors<L, F>) {
13
22
  this.accessors = accessors;
@@ -21,19 +30,21 @@ export default class FlowmapAggregateAccessors<L, F> {
21
30
  return this.accessors;
22
31
  }
23
32
 
24
- getLocationId = (location: L | ClusterNode): string =>
33
+ getLocationId = (location: L | ClusterNode): string | number =>
25
34
  isLocationClusterNode(location)
26
35
  ? location.id
27
36
  : this.accessors.getLocationId(location);
28
37
 
29
- getLocationName = (location: L | ClusterNode): string =>
30
- (isLocationClusterNode(location) && isCluster(location)
31
- ? location.name
32
- : undefined) ?? this.getLocationId(location);
33
- // ? location.name // TODO getLocationName for locations and clusters
34
- // : this.accessors.getLocationName
35
- // ? this.accessors.getLocationName(location)
36
- // : this.getLocationId(location);
38
+ getLocationName = (location: L | ClusterNode): string => {
39
+ let name;
40
+ if (isLocationClusterNode(location) && isCluster(location)) {
41
+ name = location.name;
42
+ } else if (this.accessors.getLocationName) {
43
+ name = this.accessors.getLocationName(location as L);
44
+ }
45
+ if (!name) name = `${this.getLocationId(location)}`;
46
+ return name;
47
+ };
37
48
 
38
49
  getLocationLat = (location: L | ClusterNode): number =>
39
50
  isLocationClusterNode(location)