@deck.gl/aggregation-layers 8.8.0-alpha.4 → 8.8.0-beta.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 (266) hide show
  1. package/dist/dist.dev.js +766 -649
  2. package/dist/es5/aggregation-layer.js +19 -7
  3. package/dist/es5/aggregation-layer.js.map +1 -1
  4. package/dist/es5/contour-layer/contour-layer.js +5 -5
  5. package/dist/es5/contour-layer/contour-layer.js.map +1 -1
  6. package/dist/es5/contour-layer/contour-utils.js +1 -1
  7. package/dist/es5/contour-layer/contour-utils.js.map +1 -1
  8. package/dist/es5/contour-layer/marching-squares-codes.js.map +1 -1
  9. package/dist/es5/contour-layer/marching-squares.js.map +1 -1
  10. package/dist/es5/cpu-grid-layer/cpu-grid-layer.js +5 -3
  11. package/dist/es5/cpu-grid-layer/cpu-grid-layer.js.map +1 -1
  12. package/dist/es5/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.js +1 -1
  13. package/dist/es5/gpu-grid-layer/gpu-grid-cell-layer.js +8 -8
  14. package/dist/es5/gpu-grid-layer/gpu-grid-cell-layer.js.map +1 -1
  15. package/dist/es5/gpu-grid-layer/gpu-grid-layer.js +12 -12
  16. package/dist/es5/gpu-grid-layer/gpu-grid-layer.js.map +1 -1
  17. package/dist/es5/grid-aggregation-layer.js +25 -12
  18. package/dist/es5/grid-aggregation-layer.js.map +1 -1
  19. package/dist/es5/grid-layer/grid-layer.js +18 -9
  20. package/dist/es5/grid-layer/grid-layer.js.map +1 -1
  21. package/dist/es5/heatmap-layer/heatmap-layer-utils.js +5 -2
  22. package/dist/es5/heatmap-layer/heatmap-layer-utils.js.map +1 -1
  23. package/dist/es5/heatmap-layer/heatmap-layer.js +19 -7
  24. package/dist/es5/heatmap-layer/heatmap-layer.js.map +1 -1
  25. package/dist/es5/heatmap-layer/max-vs.glsl.js +1 -1
  26. package/dist/es5/heatmap-layer/triangle-layer-fragment.glsl.js +1 -1
  27. package/dist/es5/heatmap-layer/triangle-layer-vertex.glsl.js +1 -1
  28. package/dist/es5/heatmap-layer/triangle-layer.js +7 -7
  29. package/dist/es5/heatmap-layer/triangle-layer.js.map +1 -1
  30. package/dist/es5/heatmap-layer/weights-fs.glsl.js +1 -1
  31. package/dist/es5/heatmap-layer/weights-vs.glsl.js +1 -1
  32. package/dist/es5/hexagon-layer/hexagon-layer.js +16 -5
  33. package/dist/es5/hexagon-layer/hexagon-layer.js.map +1 -1
  34. package/dist/es5/index.js.map +1 -1
  35. package/dist/es5/screen-grid-layer/screen-grid-cell-layer.js +26 -19
  36. package/dist/es5/screen-grid-layer/screen-grid-cell-layer.js.map +1 -1
  37. package/dist/es5/screen-grid-layer/screen-grid-layer-vertex.glsl.js +1 -1
  38. package/dist/es5/screen-grid-layer/screen-grid-layer.js +18 -8
  39. package/dist/es5/screen-grid-layer/screen-grid-layer.js.map +1 -1
  40. package/dist/es5/types.js +2 -0
  41. package/dist/es5/types.js.map +1 -0
  42. package/dist/es5/utils/bin-sorter.js +9 -0
  43. package/dist/es5/utils/bin-sorter.js.map +1 -1
  44. package/dist/esm/aggregation-layer.js +12 -5
  45. package/dist/esm/aggregation-layer.js.map +1 -1
  46. package/dist/esm/contour-layer/contour-layer.js +6 -3
  47. package/dist/esm/contour-layer/contour-layer.js.map +1 -1
  48. package/dist/esm/contour-layer/contour-utils.js +1 -1
  49. package/dist/esm/contour-layer/contour-utils.js.map +1 -1
  50. package/dist/esm/contour-layer/marching-squares-codes.js.map +1 -1
  51. package/dist/esm/contour-layer/marching-squares.js.map +1 -1
  52. package/dist/esm/cpu-grid-layer/cpu-grid-layer.js +6 -3
  53. package/dist/esm/cpu-grid-layer/cpu-grid-layer.js.map +1 -1
  54. package/dist/esm/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.js.map +1 -1
  55. package/dist/esm/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.js +1 -1
  56. package/dist/esm/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.js.map +1 -1
  57. package/dist/esm/gpu-grid-layer/gpu-grid-cell-layer.js +8 -6
  58. package/dist/esm/gpu-grid-layer/gpu-grid-cell-layer.js.map +1 -1
  59. package/dist/esm/gpu-grid-layer/gpu-grid-layer.js +11 -9
  60. package/dist/esm/gpu-grid-layer/gpu-grid-layer.js.map +1 -1
  61. package/dist/esm/grid-aggregation-layer.js +13 -5
  62. package/dist/esm/grid-aggregation-layer.js.map +1 -1
  63. package/dist/esm/grid-layer/grid-layer.js +15 -8
  64. package/dist/esm/grid-layer/grid-layer.js.map +1 -1
  65. package/dist/esm/heatmap-layer/heatmap-layer-utils.js +5 -2
  66. package/dist/esm/heatmap-layer/heatmap-layer-utils.js.map +1 -1
  67. package/dist/esm/heatmap-layer/heatmap-layer.js +24 -14
  68. package/dist/esm/heatmap-layer/heatmap-layer.js.map +1 -1
  69. package/dist/esm/heatmap-layer/max-fs.glsl.js.map +1 -1
  70. package/dist/esm/heatmap-layer/max-vs.glsl.js +1 -1
  71. package/dist/esm/heatmap-layer/max-vs.glsl.js.map +1 -1
  72. package/dist/esm/heatmap-layer/triangle-layer-fragment.glsl.js +1 -1
  73. package/dist/esm/heatmap-layer/triangle-layer-fragment.glsl.js.map +1 -1
  74. package/dist/esm/heatmap-layer/triangle-layer-vertex.glsl.js +1 -1
  75. package/dist/esm/heatmap-layer/triangle-layer-vertex.glsl.js.map +1 -1
  76. package/dist/esm/heatmap-layer/triangle-layer.js +6 -5
  77. package/dist/esm/heatmap-layer/triangle-layer.js.map +1 -1
  78. package/dist/esm/heatmap-layer/weights-fs.glsl.js +1 -1
  79. package/dist/esm/heatmap-layer/weights-fs.glsl.js.map +1 -1
  80. package/dist/esm/heatmap-layer/weights-vs.glsl.js +1 -1
  81. package/dist/esm/heatmap-layer/weights-vs.glsl.js.map +1 -1
  82. package/dist/esm/hexagon-layer/hexagon-layer.js +11 -2
  83. package/dist/esm/hexagon-layer/hexagon-layer.js.map +1 -1
  84. package/dist/esm/index.js.map +1 -1
  85. package/dist/esm/screen-grid-layer/screen-grid-cell-layer.js +16 -10
  86. package/dist/esm/screen-grid-layer/screen-grid-cell-layer.js.map +1 -1
  87. package/dist/esm/screen-grid-layer/screen-grid-layer-fragment.glsl.js.map +1 -1
  88. package/dist/esm/screen-grid-layer/screen-grid-layer-vertex.glsl.js +1 -1
  89. package/dist/esm/screen-grid-layer/screen-grid-layer-vertex.glsl.js.map +1 -1
  90. package/dist/esm/screen-grid-layer/screen-grid-layer.js +15 -7
  91. package/dist/esm/screen-grid-layer/screen-grid-layer.js.map +1 -1
  92. package/dist/esm/types.js +2 -0
  93. package/dist/esm/types.js.map +1 -0
  94. package/dist/esm/utils/bin-sorter.js +16 -0
  95. package/dist/esm/utils/bin-sorter.js.map +1 -1
  96. package/dist.min.js +1 -1
  97. package/package.json +7 -4
  98. package/src/{aggregation-layer.js → aggregation-layer.ts} +32 -15
  99. package/src/contour-layer/{contour-layer.js → contour-layer.ts} +95 -15
  100. package/src/contour-layer/{contour-utils.js → contour-utils.ts} +11 -5
  101. package/src/contour-layer/{marching-squares-codes.js → marching-squares-codes.ts} +0 -0
  102. package/src/contour-layer/{marching-squares.js → marching-squares.ts} +6 -6
  103. package/src/cpu-grid-layer/cpu-grid-layer.ts +310 -0
  104. package/src/gpu-grid-layer/{gpu-grid-cell-layer-fragment.glsl.js → gpu-grid-cell-layer-fragment.glsl.ts} +0 -0
  105. package/src/gpu-grid-layer/{gpu-grid-cell-layer-vertex.glsl.js → gpu-grid-cell-layer-vertex.glsl.ts} +0 -0
  106. package/src/gpu-grid-layer/{gpu-grid-cell-layer.js → gpu-grid-cell-layer.ts} +22 -14
  107. package/src/gpu-grid-layer/{gpu-grid-layer.js → gpu-grid-layer.ts} +122 -17
  108. package/src/{grid-aggregation-layer.js → grid-aggregation-layer.ts} +25 -13
  109. package/src/grid-layer/{grid-layer.js → grid-layer.ts} +38 -13
  110. package/src/heatmap-layer/{heatmap-layer-utils.js → heatmap-layer-utils.ts} +15 -10
  111. package/src/heatmap-layer/{heatmap-layer.js → heatmap-layer.ts} +144 -31
  112. package/src/heatmap-layer/{max-fs.glsl.js → max-fs.glsl.ts} +0 -0
  113. package/src/heatmap-layer/{max-vs.glsl.js → max-vs.glsl.ts} +0 -0
  114. package/src/heatmap-layer/{triangle-layer-fragment.glsl.js → triangle-layer-fragment.glsl.ts} +0 -0
  115. package/src/heatmap-layer/{triangle-layer-vertex.glsl.js → triangle-layer-vertex.glsl.ts} +0 -0
  116. package/src/heatmap-layer/{triangle-layer.js → triangle-layer.ts} +20 -10
  117. package/src/heatmap-layer/{weights-fs.glsl.js → weights-fs.glsl.ts} +0 -0
  118. package/src/heatmap-layer/{weights-vs.glsl.js → weights-vs.glsl.ts} +0 -0
  119. package/src/hexagon-layer/{hexagon-layer.js → hexagon-layer.ts} +174 -9
  120. package/src/index.ts +9 -0
  121. package/src/screen-grid-layer/{screen-grid-cell-layer.js → screen-grid-cell-layer.ts} +31 -14
  122. package/src/screen-grid-layer/{screen-grid-layer-fragment.glsl.js → screen-grid-layer-fragment.glsl.ts} +0 -0
  123. package/src/screen-grid-layer/{screen-grid-layer-vertex.glsl.js → screen-grid-layer-vertex.glsl.ts} +0 -0
  124. package/src/screen-grid-layer/{screen-grid-layer.js → screen-grid-layer.ts} +117 -15
  125. package/src/types.ts +10 -0
  126. package/src/utils/{bin-sorter.js → bin-sorter.ts} +26 -11
  127. package/typed/aggregation-layer.d.ts +38 -0
  128. package/typed/aggregation-layer.d.ts.map +1 -0
  129. package/typed/aggregation-layer.js +151 -0
  130. package/typed/contour-layer/contour-layer.d.ts +95 -0
  131. package/typed/contour-layer/contour-layer.d.ts.map +1 -0
  132. package/typed/contour-layer/contour-layer.js +234 -0
  133. package/typed/contour-layer/contour-utils.d.ts +18 -0
  134. package/typed/contour-layer/contour-utils.d.ts.map +1 -0
  135. package/typed/contour-layer/contour-utils.js +64 -0
  136. package/typed/contour-layer/marching-squares-codes.d.ts +32 -0
  137. package/typed/contour-layer/marching-squares-codes.d.ts.map +1 -0
  138. package/typed/contour-layer/marching-squares-codes.js +337 -0
  139. package/typed/contour-layer/marching-squares.d.ts +10 -0
  140. package/typed/contour-layer/marching-squares.d.ts.map +1 -0
  141. package/typed/contour-layer/marching-squares.js +147 -0
  142. package/typed/cpu-grid-layer/cpu-grid-layer.d.ts +226 -0
  143. package/typed/cpu-grid-layer/cpu-grid-layer.d.ts.map +1 -0
  144. package/typed/cpu-grid-layer/cpu-grid-layer.js +129 -0
  145. package/typed/cpu-grid-layer/grid-aggregator.d.ts +23 -0
  146. package/typed/cpu-grid-layer/grid-aggregator.d.ts.map +1 -0
  147. package/typed/cpu-grid-layer/grid-aggregator.js +141 -0
  148. package/typed/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.d.ts +3 -0
  149. package/typed/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.d.ts.map +1 -0
  150. package/typed/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.js +34 -0
  151. package/typed/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.d.ts +3 -0
  152. package/typed/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.d.ts.map +1 -0
  153. package/typed/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.js +141 -0
  154. package/typed/gpu-grid-layer/gpu-grid-cell-layer.d.ts +71 -0
  155. package/typed/gpu-grid-layer/gpu-grid-cell-layer.d.ts.map +1 -0
  156. package/typed/gpu-grid-layer/gpu-grid-cell-layer.js +143 -0
  157. package/typed/gpu-grid-layer/gpu-grid-layer.d.ts +134 -0
  158. package/typed/gpu-grid-layer/gpu-grid-layer.d.ts.map +1 -0
  159. package/typed/gpu-grid-layer/gpu-grid-layer.js +289 -0
  160. package/typed/grid-aggregation-layer.d.ts +32 -0
  161. package/typed/grid-aggregation-layer.d.ts.map +1 -0
  162. package/typed/grid-aggregation-layer.js +172 -0
  163. package/typed/grid-layer/grid-layer.d.ts +112 -0
  164. package/typed/grid-layer/grid-layer.d.ts.map +1 -0
  165. package/typed/grid-layer/grid-layer.js +60 -0
  166. package/typed/heatmap-layer/heatmap-layer-utils.d.ts +13 -0
  167. package/typed/heatmap-layer/heatmap-layer-utils.d.ts.map +1 -0
  168. package/typed/heatmap-layer/heatmap-layer-utils.js +78 -0
  169. package/typed/heatmap-layer/heatmap-layer.d.ts +161 -0
  170. package/typed/heatmap-layer/heatmap-layer.d.ts.map +1 -0
  171. package/typed/heatmap-layer/heatmap-layer.js +478 -0
  172. package/typed/heatmap-layer/max-fs.glsl.d.ts +3 -0
  173. package/typed/heatmap-layer/max-fs.glsl.d.ts.map +1 -0
  174. package/typed/heatmap-layer/max-fs.glsl.js +7 -0
  175. package/typed/heatmap-layer/max-vs.glsl.d.ts +3 -0
  176. package/typed/heatmap-layer/max-vs.glsl.d.ts.map +1 -0
  177. package/typed/heatmap-layer/max-vs.glsl.js +12 -0
  178. package/typed/heatmap-layer/triangle-layer-fragment.glsl.d.ts +3 -0
  179. package/typed/heatmap-layer/triangle-layer-fragment.glsl.d.ts.map +1 -0
  180. package/typed/heatmap-layer/triangle-layer-fragment.glsl.js +58 -0
  181. package/typed/heatmap-layer/triangle-layer-vertex.glsl.d.ts +3 -0
  182. package/typed/heatmap-layer/triangle-layer-vertex.glsl.d.ts.map +1 -0
  183. package/typed/heatmap-layer/triangle-layer-vertex.glsl.js +51 -0
  184. package/typed/heatmap-layer/triangle-layer.d.ts +27 -0
  185. package/typed/heatmap-layer/triangle-layer.d.ts.map +1 -0
  186. package/typed/heatmap-layer/triangle-layer.js +67 -0
  187. package/typed/heatmap-layer/weights-fs.glsl.d.ts +3 -0
  188. package/typed/heatmap-layer/weights-fs.glsl.d.ts.map +1 -0
  189. package/typed/heatmap-layer/weights-fs.glsl.js +19 -0
  190. package/typed/heatmap-layer/weights-vs.glsl.d.ts +3 -0
  191. package/typed/heatmap-layer/weights-vs.glsl.d.ts.map +1 -0
  192. package/typed/heatmap-layer/weights-vs.glsl.js +23 -0
  193. package/typed/hexagon-layer/hexagon-aggregator.d.ts +24 -0
  194. package/typed/hexagon-layer/hexagon-aggregator.d.ts.map +1 -0
  195. package/typed/hexagon-layer/hexagon-aggregator.js +112 -0
  196. package/typed/hexagon-layer/hexagon-layer.d.ts +237 -0
  197. package/typed/hexagon-layer/hexagon-layer.d.ts.map +1 -0
  198. package/typed/hexagon-layer/hexagon-layer.js +171 -0
  199. package/typed/index.d.ts +20 -0
  200. package/typed/index.d.ts.map +1 -0
  201. package/typed/index.js +33 -0
  202. package/typed/package.json +6 -0
  203. package/typed/screen-grid-layer/screen-grid-cell-layer.d.ts +54 -0
  204. package/typed/screen-grid-layer/screen-grid-cell-layer.d.ts.map +1 -0
  205. package/typed/screen-grid-layer/screen-grid-cell-layer.js +159 -0
  206. package/typed/screen-grid-layer/screen-grid-layer-fragment.glsl.d.ts +3 -0
  207. package/typed/screen-grid-layer/screen-grid-layer-fragment.glsl.d.ts.map +1 -0
  208. package/typed/screen-grid-layer/screen-grid-layer-fragment.glsl.js +37 -0
  209. package/typed/screen-grid-layer/screen-grid-layer-vertex.glsl.d.ts +3 -0
  210. package/typed/screen-grid-layer/screen-grid-layer-vertex.glsl.d.ts.map +1 -0
  211. package/typed/screen-grid-layer/screen-grid-layer-vertex.glsl.js +83 -0
  212. package/typed/screen-grid-layer/screen-grid-layer.d.ts +117 -0
  213. package/typed/screen-grid-layer/screen-grid-layer.d.ts.map +1 -0
  214. package/typed/screen-grid-layer/screen-grid-layer.js +216 -0
  215. package/typed/types.d.ts +11 -0
  216. package/typed/types.d.ts.map +1 -0
  217. package/typed/types.js +1 -0
  218. package/typed/utils/aggregation-operation-utils.d.ts +13 -0
  219. package/typed/utils/aggregation-operation-utils.d.ts.map +1 -0
  220. package/typed/utils/aggregation-operation-utils.js +94 -0
  221. package/typed/utils/bin-sorter.d.ts +52 -0
  222. package/typed/utils/bin-sorter.d.ts.map +1 -0
  223. package/typed/utils/bin-sorter.js +167 -0
  224. package/typed/utils/color-utils.d.ts +3 -0
  225. package/typed/utils/color-utils.d.ts.map +1 -0
  226. package/typed/utils/color-utils.js +53 -0
  227. package/typed/utils/cpu-aggregator.d.ts +155 -0
  228. package/typed/utils/cpu-aggregator.d.ts.map +1 -0
  229. package/typed/utils/cpu-aggregator.js +417 -0
  230. package/typed/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.d.ts +3 -0
  231. package/typed/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.d.ts.map +1 -0
  232. package/typed/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.js +39 -0
  233. package/typed/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.d.ts +3 -0
  234. package/typed/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.d.ts.map +1 -0
  235. package/typed/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.js +53 -0
  236. package/typed/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.d.ts +3 -0
  237. package/typed/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.d.ts.map +1 -0
  238. package/typed/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.js +31 -0
  239. package/typed/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.d.ts +3 -0
  240. package/typed/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.d.ts.map +1 -0
  241. package/typed/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.js +77 -0
  242. package/typed/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.d.ts +36 -0
  243. package/typed/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.d.ts.map +1 -0
  244. package/typed/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js +41 -0
  245. package/typed/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.d.ts +1 -0
  246. package/typed/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.d.ts.map +1 -0
  247. package/typed/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.js +1 -0
  248. package/typed/utils/gpu-grid-aggregation/gpu-grid-aggregator.d.ts +66 -0
  249. package/typed/utils/gpu-grid-aggregation/gpu-grid-aggregator.d.ts.map +1 -0
  250. package/typed/utils/gpu-grid-aggregation/gpu-grid-aggregator.js +562 -0
  251. package/typed/utils/gpu-grid-aggregation/transform-mean-vs.glsl.d.ts +3 -0
  252. package/typed/utils/gpu-grid-aggregation/transform-mean-vs.glsl.d.ts.map +1 -0
  253. package/typed/utils/gpu-grid-aggregation/transform-mean-vs.glsl.js +36 -0
  254. package/typed/utils/grid-aggregation-utils.d.ts +24 -0
  255. package/typed/utils/grid-aggregation-utils.d.ts.map +1 -0
  256. package/typed/utils/grid-aggregation-utils.js +114 -0
  257. package/typed/utils/prop-utils.d.ts +2 -0
  258. package/typed/utils/prop-utils.d.ts.map +1 -0
  259. package/typed/utils/prop-utils.js +28 -0
  260. package/typed/utils/resource-utils.d.ts +4 -0
  261. package/typed/utils/resource-utils.d.ts.map +1 -0
  262. package/typed/utils/resource-utils.js +40 -0
  263. package/typed/utils/scale-utils.d.ts +15 -0
  264. package/typed/utils/scale-utils.d.ts.map +1 -0
  265. package/typed/utils/scale-utils.js +184 -0
  266. package/src/cpu-grid-layer/cpu-grid-layer.js +0 -153
@@ -18,17 +18,19 @@
18
18
  // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
19
  // THE SOFTWARE.
20
20
 
21
- import {log} from '@deck.gl/core';
22
- import {ColumnLayer} from '@deck.gl/layers';
21
+ import {Accessor, AccessorFunction, Color, log, Position, UpdateParameters} from '@deck.gl/core';
22
+ import {ColumnLayer, _MaterialProps as MaterialProps} from '@deck.gl/layers';
23
23
 
24
24
  import {defaultColorRange} from '../utils/color-utils';
25
25
 
26
26
  import {pointToHexbin} from './hexagon-aggregator';
27
27
  import CPUAggregator from '../utils/cpu-aggregator';
28
- import AggregationLayer from '../aggregation-layer';
28
+ import AggregationLayer, {AggregationLayerProps} from '../aggregation-layer';
29
29
 
30
30
  import GL from '@luma.gl/constants';
31
+ import {AggregateAccessor} from '../types';
31
32
 
33
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
32
34
  function nop() {}
33
35
 
34
36
  const defaultProps = {
@@ -67,7 +69,173 @@ const defaultProps = {
67
69
  _filterData: {type: 'function', value: null, optional: true}
68
70
  };
69
71
 
70
- export default class HexagonLayer extends AggregationLayer {
72
+ /** All properties supported by by HexagonLayer. */
73
+ export type HexagonLayerProps<DataT = any> = _HexagonLayerProps<DataT> &
74
+ AggregationLayerProps<DataT>;
75
+
76
+ /** Properties added by HexagonLayer. */
77
+ type _HexagonLayerProps<DataT = any> = {
78
+ /**
79
+ * Radius of hexagon bin in meters. The hexagons are pointy-topped (rather than flat-topped).
80
+ * @default 1000
81
+ */
82
+ radius?: number;
83
+
84
+ /**
85
+ * Function to aggregate data into hexagonal bins.
86
+ * @default d3-hexbin
87
+ */
88
+ hexagonAggregator?: () => any;
89
+
90
+ /**
91
+ * Color scale input domain.
92
+ * @default [min(colorWeight), max(colorWeight)]
93
+ */
94
+ colorDomain?: number[];
95
+
96
+ /**
97
+ * Specified as an array of colors [color1, color2, ...].
98
+ * @default `6-class YlOrRd` - [colorbrewer](http://colorbrewer2.org/#type=sequential&scheme=YlOrRd&n=6)
99
+ */
100
+ colorRange?: Color[];
101
+
102
+ /**
103
+ * Hexagon radius multiplier, clamped between 0 - 1.
104
+ * @default 1
105
+ */
106
+ coverage?: number;
107
+
108
+ /**
109
+ * Elevation scale input domain. The elevation scale is a linear scale that maps number of counts to elevation.
110
+ * @default [0, max(elevationWeight)]
111
+ */
112
+ elevationDomain?: number[];
113
+
114
+ /**
115
+ * Elevation scale output range.
116
+ * @default [0, 1000]
117
+ */
118
+ elevationRange?: number[];
119
+
120
+ /**
121
+ * Hexagon elevation multiplier.
122
+ * @default 1
123
+ */
124
+ elevationScale?: number;
125
+
126
+ /**
127
+ * Whether to enable cell elevation. If set to false, all cell will be flat.
128
+ * @default false
129
+ */
130
+ extruded?: boolean;
131
+
132
+ /**
133
+ * Filter bins and re-calculate color by `upperPercentile`.
134
+ * Hexagons with color value larger than the `upperPercentile` will be hidden.
135
+ * @default 100
136
+ */
137
+ upperPercentile?: number;
138
+
139
+ /**
140
+ * Filter bins and re-calculate color by `lowerPercentile`.
141
+ * Hexagons with color value smaller than the `lowerPercentile` will be hidden.
142
+ * @default 0
143
+ */
144
+ lowerPercentile?: number;
145
+
146
+ /**
147
+ * Filter bins and re-calculate elevation by `elevationUpperPercentile`.
148
+ * Hexagons with elevation value larger than the `elevationUpperPercentile` will be hidden.
149
+ * @default 100
150
+ */
151
+ elevationUpperPercentile?: number;
152
+
153
+ /**
154
+ * Filter bins and re-calculate elevation by `elevationLowerPercentile`.
155
+ * Hexagons with elevation value larger than the `elevationLowerPercentile` will be hidden.
156
+ * @default 0
157
+ */
158
+ elevationLowerPercentile?: number;
159
+
160
+ /**
161
+ * Scaling function used to determine the color of the grid cell, default value is 'quantize'.
162
+ * Supported Values are 'quantize', 'quantile' and 'ordinal'.
163
+ * @default 'quantize'
164
+ */
165
+ colorScaleType?: 'quantize' | 'quantile' | 'ordinal';
166
+
167
+ /**
168
+ * This is an object that contains material props
169
+ * for [lighting effect](/docs/api-reference/core/lighting-effect.md) applied on extruded polygons.
170
+ * @default true
171
+ */
172
+ material?: MaterialProps | boolean;
173
+
174
+ /**
175
+ * Defines the operation used to aggregate all data object weights to calculate a cell's color value.
176
+ * @default 'SUM'
177
+ */
178
+ colorAggregation?: 'SUM' | 'MEAN' | 'MIN' | 'MAX';
179
+
180
+ /**
181
+ * Defines the operation used to aggregate all data object weights to calculate a cell's elevation value.
182
+ * @default 'SUM'
183
+ */
184
+ elevationAggregation?: 'SUM' | 'MEAN' | 'MIN' | 'MAX';
185
+
186
+ /**
187
+ * Method called to retrieve the position of each object.
188
+ * @default object => object.position
189
+ */
190
+ getPosition?: AccessorFunction<DataT, Position>;
191
+
192
+ /**
193
+ * The weight of a data object used to calculate the color value for a bin.
194
+ * @default 1
195
+ */
196
+ getColorWeight?: Accessor<DataT, number>;
197
+
198
+ /**
199
+ * After data objects are aggregated into bins, this accessor is called on each cell to get the value that its color is based on.
200
+ * @default null
201
+ */
202
+ getColorValue?: AggregateAccessor<DataT> | null;
203
+
204
+ /**
205
+ * The weight of a data object used to calculate the elevation value for a bin.
206
+ * @default 1
207
+ */
208
+ getElevationWeight?: Accessor<DataT, number>;
209
+
210
+ /**
211
+ * After data objects are aggregated into bins, this accessor is called on each cell to get the value that its elevation is based on.
212
+ * @default null
213
+ */
214
+ getElevationValue?: AggregateAccessor<DataT> | null;
215
+
216
+ /**
217
+ * This callback will be called when cell color domain has been calculated.
218
+ * @default () => {}
219
+ */
220
+ onSetColorDomain?: (minMax: [number, number]) => void;
221
+
222
+ /**
223
+ * This callback will be called when cell elevation domain has been calculated.
224
+ * @default () => {}
225
+ */
226
+ onSetElevationDomain?: (minMax: [number, number]) => void;
227
+ };
228
+
229
+ export default class HexagonLayer<ExtraPropsT = {}> extends AggregationLayer<
230
+ ExtraPropsT & Required<_HexagonLayerProps>
231
+ > {
232
+ static layerName = 'HexagonLayer';
233
+ static defaultProps = defaultProps;
234
+
235
+ state!: AggregationLayer['state'] & {
236
+ cpuAggregator: CPUAggregator;
237
+ aggregatorState: any;
238
+ };
71
239
  initializeState() {
72
240
  const cpuAggregator = new CPUAggregator({
73
241
  getAggregator: props => props.hexagonAggregator,
@@ -79,7 +247,7 @@ export default class HexagonLayer extends AggregationLayer {
79
247
  aggregatorState: cpuAggregator.state,
80
248
  vertices: null
81
249
  };
82
- const attributeManager = this.getAttributeManager();
250
+ const attributeManager = this.getAttributeManager()!;
83
251
  attributeManager.add({
84
252
  positions: {size: 3, type: GL.DOUBLE, accessor: 'getPosition'}
85
253
  });
@@ -87,7 +255,7 @@ export default class HexagonLayer extends AggregationLayer {
87
255
  // they are calculated using 'getValue' accessor that takes an array of pints.
88
256
  }
89
257
 
90
- updateState(opts) {
258
+ updateState(opts: UpdateParameters<this>) {
91
259
  super.updateState(opts);
92
260
 
93
261
  if (opts.changeFlags.propsOrDataChanged) {
@@ -199,6 +367,3 @@ export default class HexagonLayer extends AggregationLayer {
199
367
  );
200
368
  }
201
369
  }
202
-
203
- HexagonLayer.layerName = 'HexagonLayer';
204
- HexagonLayer.defaultProps = defaultProps;
package/src/index.ts CHANGED
@@ -33,3 +33,12 @@ export {default as _GPUGridAggregator} from './utils/gpu-grid-aggregation/gpu-gr
33
33
  export {default as _CPUAggregator} from './utils/cpu-aggregator';
34
34
  export {default as _AggregationLayer} from './aggregation-layer';
35
35
  export {default as _BinSorter} from './utils/bin-sorter';
36
+
37
+ // types
38
+ export type {ContourLayerProps} from './contour-layer/contour-layer';
39
+ export type {HeatmapLayerProps} from './heatmap-layer/heatmap-layer';
40
+ export type {HexagonLayerProps} from './hexagon-layer/hexagon-layer';
41
+ export type {CPUGridLayerProps} from './cpu-grid-layer/cpu-grid-layer';
42
+ export type {GridLayerProps} from './grid-layer/grid-layer';
43
+ export type {GPUGridLayerProps} from './gpu-grid-layer/gpu-grid-layer';
44
+ export type {ScreenGridLayerProps} from './screen-grid-layer/screen-grid-layer';
@@ -19,15 +19,16 @@
19
19
  // THE SOFTWARE.
20
20
 
21
21
  import GL from '@luma.gl/constants';
22
- import {Model, Geometry, FEATURES, hasFeatures} from '@luma.gl/core';
23
- import {Layer, log, picking} from '@deck.gl/core';
22
+ import {Model, Geometry, FEATURES, hasFeatures, Texture2D} from '@luma.gl/core';
23
+ import {Layer, LayerProps, log, picking, UpdateParameters} from '@deck.gl/core';
24
24
  import {defaultColorRange, colorRangeToFlatArray} from '../utils/color-utils';
25
25
  import vs from './screen-grid-layer-vertex.glsl';
26
26
  import fs from './screen-grid-layer-fragment.glsl';
27
+ import type {_ScreenGridLayerProps} from './screen-grid-layer';
27
28
 
28
29
  const DEFAULT_MINCOLOR = [0, 0, 0, 0];
29
30
  const DEFAULT_MAXCOLOR = [0, 255, 0, 255];
30
- const COLOR_PROPS = [`minColor`, `maxColor`, `colorRange`, `colorDomain`];
31
+ const COLOR_PROPS = ['minColor', 'maxColor', 'colorRange', 'colorDomain'];
31
32
 
32
33
  const defaultProps = {
33
34
  cellSizePixels: {value: 100, min: 1},
@@ -37,19 +38,36 @@ const defaultProps = {
37
38
  colorRange: defaultColorRange
38
39
  };
39
40
 
40
- export default class ScreenGridCellLayer extends Layer {
41
+ /** All properties supported by ScreenGridCellLayer. */
42
+ export type ScreenGridCellLayerProps<DataT> = _ScreenGridCellLayerProps<DataT> & LayerProps<DataT>;
43
+
44
+ /** Proprties added by ScreenGridCellLayer. */
45
+ export type _ScreenGridCellLayerProps<DataT> = _ScreenGridLayerProps<DataT> & {
46
+ maxTexture: Texture2D;
47
+ };
48
+
49
+ export default class ScreenGridCellLayer<DataT = any, ExtraPropsT = {}> extends Layer<
50
+ ExtraPropsT & Required<_ScreenGridCellLayerProps<DataT>>
51
+ > {
52
+ static layerName = 'ScreenGridCellLayer';
53
+ static defaultProps = defaultProps;
54
+
41
55
  static isSupported(gl) {
42
56
  return hasFeatures(gl, [FEATURES.TEXTURE_FLOAT]);
43
57
  }
44
58
 
59
+ state!: Layer['state'] & {
60
+ model: Model;
61
+ };
45
62
  getShaders() {
46
63
  return {vs, fs, modules: [picking]};
47
64
  }
48
65
 
49
66
  initializeState() {
50
67
  const {gl} = this.context;
51
- const attributeManager = this.getAttributeManager();
68
+ const attributeManager = this.getAttributeManager()!;
52
69
  attributeManager.addInstanced({
70
+ // eslint-disable-next-line @typescript-eslint/unbound-method
53
71
  instancePositions: {size: 3, update: this.calculateInstancePositions},
54
72
  instanceCounts: {size: 4, noAlloc: true}
55
73
  });
@@ -63,10 +81,12 @@ export default class ScreenGridCellLayer extends Layer {
63
81
  return changeFlags.somethingChanged;
64
82
  }
65
83
 
66
- updateState({oldProps, props, changeFlags}) {
67
- super.updateState({oldProps, props, changeFlags});
84
+ updateState(params: UpdateParameters<this>) {
85
+ super.updateState(params);
86
+
87
+ const {oldProps, props, changeFlags} = params;
68
88
 
69
- const attributeManager = this.getAttributeManager();
89
+ const attributeManager = this.getAttributeManager()!;
70
90
  if (props.numInstances !== oldProps.numInstances) {
71
91
  attributeManager.invalidateAll();
72
92
  } else if (oldProps.cellSizePixels !== props.cellSizePixels) {
@@ -120,7 +140,7 @@ export default class ScreenGridCellLayer extends Layer {
120
140
 
121
141
  // Private Methods
122
142
 
123
- _getModel(gl) {
143
+ _getModel(gl: WebGLRenderingContext): Model {
124
144
  return new Model(gl, {
125
145
  ...this.getShaders(),
126
146
  id: this.props.id,
@@ -134,7 +154,7 @@ export default class ScreenGridCellLayer extends Layer {
134
154
  });
135
155
  }
136
156
 
137
- _shouldUseMinMax() {
157
+ _shouldUseMinMax(): boolean {
138
158
  const {minColor, maxColor, colorDomain, colorRange} = this.props;
139
159
  if (minColor || maxColor) {
140
160
  log.deprecated('ScreenGridLayer props: minColor and maxColor', 'colorRange, colorDomain')();
@@ -149,7 +169,7 @@ export default class ScreenGridCellLayer extends Layer {
149
169
  return true;
150
170
  }
151
171
 
152
- _updateUniforms(oldProps, props, changeFlags) {
172
+ _updateUniforms(oldProps, props, changeFlags): void {
153
173
  const {model} = this.state;
154
174
  if (COLOR_PROPS.some(key => oldProps[key] !== props[key])) {
155
175
  model.setUniforms({shouldUseMinMax: this._shouldUseMinMax()});
@@ -177,6 +197,3 @@ export default class ScreenGridCellLayer extends Layer {
177
197
  }
178
198
  }
179
199
  }
180
-
181
- ScreenGridCellLayer.layerName = 'ScreenGridCellLayer';
182
- ScreenGridCellLayer.defaultProps = defaultProps;
@@ -18,12 +18,24 @@
18
18
  // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
19
  // THE SOFTWARE.
20
20
 
21
- import {log} from '@deck.gl/core';
21
+ import {
22
+ Accessor,
23
+ Color,
24
+ GetPickingInfoParams,
25
+ Layer,
26
+ LayerContext,
27
+ LayersList,
28
+ log,
29
+ PickingInfo,
30
+ Position,
31
+ UpdateParameters
32
+ } from '@deck.gl/core';
22
33
  import GL from '@luma.gl/constants';
34
+ import type {Texture2D} from '@luma.gl/core';
23
35
  import GPUGridAggregator from '../utils/gpu-grid-aggregation/gpu-grid-aggregator';
24
36
  import {AGGREGATION_OPERATION, getValueFunc} from '../utils/aggregation-operation-utils';
25
37
  import ScreenGridCellLayer from './screen-grid-cell-layer';
26
- import GridAggregationLayer from '../grid-aggregation-layer';
38
+ import GridAggregationLayer, {GridAggregationLayerProps} from '../grid-aggregation-layer';
27
39
  import {getFloatTexture} from '../utils/resource-utils.js';
28
40
 
29
41
  const defaultProps = {
@@ -46,7 +58,99 @@ const DIMENSIONS = {
46
58
  }
47
59
  };
48
60
 
49
- export default class ScreenGridLayer extends GridAggregationLayer {
61
+ /** All properties supported by ScreenGridLayer. */
62
+ export type ScreenGridLayerProps<DataT> = _ScreenGridLayerProps<DataT> &
63
+ GridAggregationLayerProps<DataT>;
64
+
65
+ /** Properties added by ScreenGridLayer. */
66
+ export type _ScreenGridLayerProps<DataT = any> = {
67
+ /**
68
+ * Unit width/height of the bins.
69
+ * @default 100
70
+ */
71
+ cellSizePixels?: number;
72
+
73
+ /**
74
+ * Cell margin size in pixels.
75
+ * @default 2
76
+ */
77
+ cellMarginPixels?: number;
78
+
79
+ /**
80
+ * Expressed as an rgba array, minimal color that could be rendered by a tile.
81
+ * @default [0, 0, 0, 255]
82
+ * @deprecated Deprecated in version 5.2.0, use `colorRange` and `colorDomain` instead.
83
+ */
84
+ minColor?: Color | null;
85
+
86
+ /**
87
+ * Expressed as an rgba array, maximal color that could be rendered by a tile.
88
+ * @default [0, 255, 0, 255]
89
+ * @deprecated Deprecated in version 5.2.0, use `colorRange` and `colorDomain` instead.
90
+ */
91
+ maxColor?: Color | null;
92
+
93
+ /**
94
+ * Color scale input domain. The color scale maps continues numeric domain into discrete color range.
95
+ * @default [1, max(weight)]
96
+ */
97
+ colorDomain?: [number, number] | null;
98
+
99
+ /**
100
+ * Specified as an array of colors [color1, color2, ...].
101
+ *
102
+ * @default `6-class YlOrRd` - [colorbrewer](http://colorbrewer2.org/#type=sequential&scheme=YlOrRd&n=6)
103
+ */
104
+ colorRange?: Color[];
105
+
106
+ /**
107
+ * Method called to retrieve the position of each object.
108
+ *
109
+ * @default d => d.position
110
+ */
111
+ getPosition?: Accessor<DataT, Position>;
112
+
113
+ /**
114
+ * The weight of each object.
115
+ *
116
+ * @default 1
117
+ */
118
+ getWeight?: Accessor<DataT, number>;
119
+
120
+ /**
121
+ * Perform aggregation is performed on GPU.
122
+ *
123
+ * NOTE: GPU Aggregation requires WebGL2 support by the browser.
124
+ * When `gpuAggregation` is set to true and browser doesn't support WebGL2, aggregation falls back to CPU.
125
+ *
126
+ * @default true
127
+ */
128
+ gpuAggregation?: boolean;
129
+
130
+ /**
131
+ * Defines the type of aggregation operation
132
+ *
133
+ * V valid values are 'SUM', 'MEAN', 'MIN' and 'MAX'.
134
+ *
135
+ * @default 'SUM'
136
+ */
137
+ aggregation?: 'SUM' | 'MEAN' | 'MIN' | 'MAX';
138
+ };
139
+
140
+ export default class ScreenGridLayer<DataT = any, ExtraProps = {}> extends GridAggregationLayer<
141
+ ExtraProps & Required<_ScreenGridLayerProps<DataT>>
142
+ > {
143
+ static layerName = 'ScreenGridLayer';
144
+ static defaultProps = defaultProps;
145
+
146
+ state!: GridAggregationLayer['state'] & {
147
+ supported: boolean;
148
+ gpuGridAggregator?: any;
149
+ gpuAggregation?: any;
150
+ weights?: any;
151
+ maxTexture?: Texture2D;
152
+ };
153
+
50
154
  initializeState() {
51
155
  const {gl} = this.context;
52
156
  if (!ScreenGridCellLayer.isSupported(gl)) {
@@ -55,9 +159,10 @@ export default class ScreenGridLayer extends GridAggregationLayer {
55
159
  log.error(`ScreenGridLayer: ${this.id} is not supported on this browser`)();
56
160
  return;
57
161
  }
58
- super.initializeState({
162
+ super.initializeAggregationLayer({
59
163
  dimensions: DIMENSIONS,
60
- getCellSize: props => props.cellSizePixels
164
+ // @ts-expect-error
165
+ getCellSize: props => props.cellSizePixels // TODO
61
166
  });
62
167
  const weights = {
63
168
  count: {
@@ -77,7 +182,7 @@ export default class ScreenGridLayer extends GridAggregationLayer {
77
182
  posOffset: [0, 0],
78
183
  translation: [1, -1]
79
184
  });
80
- const attributeManager = this.getAttributeManager();
185
+ const attributeManager = this.getAttributeManager()!;
81
186
  attributeManager.add({
82
187
  [POSITION_ATTRIBUTE_NAME]: {
83
188
  size: 3,
@@ -90,15 +195,15 @@ export default class ScreenGridLayer extends GridAggregationLayer {
90
195
  });
91
196
  }
92
197
 
93
- shouldUpdateState({changeFlags}) {
198
+ shouldUpdateState({changeFlags}: UpdateParameters<this>) {
94
199
  return this.state.supported && changeFlags.somethingChanged;
95
200
  }
96
201
 
97
- updateState(opts) {
202
+ updateState(opts: UpdateParameters<this>) {
98
203
  super.updateState(opts);
99
204
  }
100
205
 
101
- renderLayers() {
206
+ renderLayers(): LayersList | Layer {
102
207
  if (!this.state.supported) {
103
208
  return [];
104
209
  }
@@ -121,8 +226,8 @@ export default class ScreenGridLayer extends GridAggregationLayer {
121
226
  );
122
227
  }
123
228
 
124
- finalizeState() {
125
- super.finalizeState();
229
+ finalizeState(context: LayerContext): void {
230
+ super.finalizeState(context);
126
231
 
127
232
  const {aggregationBuffer, maxBuffer, maxTexture} = this.state;
128
233
 
@@ -131,7 +236,7 @@ export default class ScreenGridLayer extends GridAggregationLayer {
131
236
  maxTexture?.delete();
132
237
  }
133
238
 
134
- getPickingInfo({info, mode}) {
239
+ getPickingInfo({info}: GetPickingInfoParams): PickingInfo {
135
240
  const {index} = info;
136
241
  if (index >= 0) {
137
242
  const {gpuGridAggregator, gpuAggregation, weights} = this.state;
@@ -244,6 +349,3 @@ export default class ScreenGridLayer extends GridAggregationLayer {
244
349
  }
245
350
  }
246
351
  }
247
-
248
- ScreenGridLayer.layerName = 'ScreenGridLayer';
249
- ScreenGridLayer.defaultProps = defaultProps;
package/src/types.ts ADDED
@@ -0,0 +1,10 @@
1
+ export type AggregateAccessor<DataT = any> = {
2
+ /** a list of objects whose positions fall inside this cell. */
3
+ objects: DataT[];
4
+ objectInfo: {
5
+ /** the indices of `objects` in the original data. */
6
+ indices: number[];
7
+ /** the value of the `data` prop */
8
+ data: any;
9
+ };
10
+ };
@@ -43,8 +43,23 @@ const defaultProps = {
43
43
  filterData: null
44
44
  };
45
45
 
46
+ export type AggregatedBin = {
47
+ i: number;
48
+ value: any;
49
+ counts: number;
50
+ };
51
+
46
52
  export default class BinSorter {
47
- constructor(bins = [], props = defaultProps) {
53
+ maxCount!: number;
54
+ maxValue!: number;
55
+ minValue!: number;
56
+ totalCount!: number;
57
+
58
+ aggregatedBins: AggregatedBin[];
59
+ sortedBins!: AggregatedBin[];
60
+ binMap: Record<number, AggregatedBin>;
61
+
62
+ constructor(bins = [], props: Partial<typeof defaultProps> = defaultProps) {
48
63
  this.aggregatedBins = this.getAggregatedBins(bins, props);
49
64
  this._updateMinMaxValues();
50
65
  this.binMap = this.getBinMap();
@@ -57,7 +72,7 @@ export default class BinSorter {
57
72
  * @param {Function} getValue
58
73
  * @return {Array} array of values and index lookup
59
74
  */
60
- getAggregatedBins(bins, props) {
75
+ getAggregatedBins(bins, props): AggregatedBin[] {
61
76
  const {
62
77
  getValue = defaultGetValue,
63
78
  getPoints = defaultGetPoints,
@@ -67,7 +82,7 @@ export default class BinSorter {
67
82
 
68
83
  const hasFilter = typeof filterData === 'function';
69
84
  const binCount = bins.length;
70
- const aggregatedBins = [];
85
+ const aggregatedBins: AggregatedBin[] = [];
71
86
  let index = 0;
72
87
 
73
88
  for (let binIndex = 0; binIndex < binCount; binIndex++) {
@@ -94,7 +109,7 @@ export default class BinSorter {
94
109
  return aggregatedBins;
95
110
  }
96
111
 
97
- _percentileToIndex(percentileRange) {
112
+ _percentileToIndex(percentileRange): [number, number] {
98
113
  const len = this.sortedBins.length;
99
114
  if (len < 2) {
100
115
  return [0, 0];
@@ -113,7 +128,7 @@ export default class BinSorter {
113
128
  * This is used to retrieve bin value for color calculation
114
129
  * @return {Object} bin index to aggregatedBins
115
130
  */
116
- getBinMap() {
131
+ getBinMap(): Record<number, AggregatedBin> {
117
132
  const binMap = {};
118
133
  for (const bin of this.aggregatedBins) {
119
134
  binMap[bin.i] = bin;
@@ -125,9 +140,8 @@ export default class BinSorter {
125
140
 
126
141
  /**
127
142
  * Get ths max count of all bins
128
- * @return {Number | Boolean} max count
129
143
  */
130
- _updateMinMaxValues() {
144
+ _updateMinMaxValues(): void {
131
145
  let maxCount = 0;
132
146
  let maxValue = 0;
133
147
  let minValue = MAX_32_BIT_FLOAT;
@@ -151,11 +165,12 @@ export default class BinSorter {
151
165
  * @param {Number} range[1] - upper bound
152
166
  * @return {Array} array of new value range
153
167
  */
154
- getValueRange(percentileRange) {
168
+ getValueRange(percentileRange: [number, number]): [number, number] {
155
169
  if (!this.sortedBins) {
156
170
  this.sortedBins = this.aggregatedBins.sort((a, b) => ascending(a.value, b.value));
157
171
  }
158
172
  if (!this.sortedBins.length) {
173
+ // @ts-expect-error
159
174
  return [];
160
175
  }
161
176
  let lowerIdx = 0;
@@ -170,7 +185,7 @@ export default class BinSorter {
170
185
  return [this.sortedBins[lowerIdx].value, this.sortedBins[upperIdx].value];
171
186
  }
172
187
 
173
- getValueDomainByScale(scale, [lower = 0, upper = 100] = []) {
188
+ getValueDomainByScale(scale: string, [lower = 0, upper = 100] = []) {
174
189
  if (!this.sortedBins) {
175
190
  this.sortedBins = this.aggregatedBins.sort((a, b) => ascending(a.value, b.value));
176
191
  }
@@ -182,7 +197,7 @@ export default class BinSorter {
182
197
  return this._getScaleDomain(scale, indexEdge);
183
198
  }
184
199
 
185
- _getScaleDomain(scaleType, [lowerIdx, upperIdx]) {
200
+ _getScaleDomain(scaleType: string, [lowerIdx, upperIdx]: [number, number]): [number, number] {
186
201
  const bins = this.sortedBins;
187
202
 
188
203
  switch (scaleType) {
@@ -194,7 +209,7 @@ export default class BinSorter {
194
209
  return getQuantileDomain(bins.slice(lowerIdx, upperIdx + 1), d => d.value);
195
210
 
196
211
  case 'ordinal':
197
- return getOrdinalDomain(bins, d => d.value);
212
+ return getOrdinalDomain(bins, d => d.value) as [number, number];
198
213
 
199
214
  default:
200
215
  return [bins[lowerIdx].value, bins[upperIdx].value];