@guardian/interactive-component-library 0.3.0 → 0.3.2-rc1

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 (284) hide show
  1. package/dist/components/index.d.ts +3 -0
  2. package/dist/components/molecules/canvas-map/Map.d.ts +8 -0
  3. package/dist/components/molecules/canvas-map/Map.js +90 -0
  4. package/dist/components/molecules/canvas-map/context/MapContext.d.ts +19 -0
  5. package/dist/components/molecules/canvas-map/context/MapContext.js +20 -0
  6. package/dist/components/molecules/canvas-map/controls/ZoomControl.d.ts +6 -0
  7. package/dist/components/molecules/canvas-map/controls/ZoomControl.js +40 -0
  8. package/dist/components/molecules/canvas-map/controls/icons/index.d.ts +3 -0
  9. package/dist/components/molecules/canvas-map/controls/icons/minus.d.ts +1 -0
  10. package/dist/components/molecules/canvas-map/controls/icons/minus.js +25 -0
  11. package/dist/components/molecules/canvas-map/controls/icons/plus.d.ts +1 -0
  12. package/dist/components/molecules/canvas-map/controls/icons/plus.js +25 -0
  13. package/dist/components/molecules/canvas-map/controls/icons/reset.d.ts +3 -0
  14. package/dist/components/molecules/canvas-map/controls/icons/reset.js +25 -0
  15. package/dist/components/molecules/canvas-map/controls/index.d.ts +1 -0
  16. package/dist/components/molecules/canvas-map/controls/style.module.css.js +11 -0
  17. package/dist/components/molecules/canvas-map/index.d.ts +12 -0
  18. package/dist/components/molecules/canvas-map/lib/Feature.d.ts +44 -0
  19. package/dist/components/molecules/canvas-map/lib/Feature.js +113 -0
  20. package/dist/components/molecules/canvas-map/lib/FeatureCollection.d.ts +21 -0
  21. package/dist/components/molecules/canvas-map/lib/FeatureCollection.js +24 -0
  22. package/dist/components/molecules/canvas-map/lib/Map.d.ts +82 -0
  23. package/dist/components/molecules/canvas-map/lib/Map.js +267 -0
  24. package/dist/components/molecules/canvas-map/lib/View.d.ts +222 -0
  25. package/dist/components/molecules/canvas-map/lib/View.js +208 -0
  26. package/dist/components/molecules/canvas-map/lib/events/Dispatcher.d.ts +8 -0
  27. package/dist/components/molecules/canvas-map/lib/events/Dispatcher.js +35 -0
  28. package/dist/components/molecules/canvas-map/lib/events/MapEvent.d.ts +6 -0
  29. package/dist/components/molecules/canvas-map/lib/events/MapEvent.js +9 -0
  30. package/dist/components/molecules/canvas-map/lib/events/index.d.ts +2 -0
  31. package/dist/components/molecules/canvas-map/lib/formats/GeoJSON.d.ts +63 -0
  32. package/dist/components/molecules/canvas-map/lib/formats/GeoJSON.js +122 -0
  33. package/dist/components/molecules/canvas-map/lib/geometry/Geometry.d.ts +32 -0
  34. package/dist/components/molecules/canvas-map/lib/geometry/Geometry.js +41 -0
  35. package/dist/components/molecules/canvas-map/lib/geometry/LineString.d.ts +12 -0
  36. package/dist/components/molecules/canvas-map/lib/geometry/LineString.js +19 -0
  37. package/dist/components/molecules/canvas-map/lib/geometry/Point.d.ts +11 -0
  38. package/dist/components/molecules/canvas-map/lib/geometry/Point.js +22 -0
  39. package/dist/components/molecules/canvas-map/lib/geometry/Polygon.d.ts +16 -0
  40. package/dist/components/molecules/canvas-map/lib/geometry/Polygon.js +46 -0
  41. package/dist/components/molecules/canvas-map/lib/geometry/index.d.ts +4 -0
  42. package/dist/components/molecules/canvas-map/lib/interpolators/index.d.ts +2 -0
  43. package/dist/components/molecules/canvas-map/lib/interpolators/interpolateFeatures.d.ts +5 -0
  44. package/dist/components/molecules/canvas-map/lib/interpolators/interpolateFeatures.js +95 -0
  45. package/dist/components/molecules/canvas-map/lib/interpolators/interpolateStyles.d.ts +4 -0
  46. package/dist/components/molecules/canvas-map/lib/interpolators/interpolateStyles.js +65 -0
  47. package/dist/components/molecules/canvas-map/lib/layers/TextLayer.d.ts +52 -0
  48. package/dist/components/molecules/canvas-map/lib/layers/TextLayer.js +118 -0
  49. package/dist/components/molecules/canvas-map/lib/layers/VectorLayer.d.ts +57 -0
  50. package/dist/components/molecules/canvas-map/lib/layers/VectorLayer.js +136 -0
  51. package/dist/components/molecules/canvas-map/lib/layers/index.d.ts +3 -0
  52. package/dist/components/molecules/canvas-map/lib/projection/index.d.ts +27 -0
  53. package/dist/components/molecules/canvas-map/lib/projection/index.js +12 -0
  54. package/dist/components/molecules/canvas-map/lib/renderers/FeatureRenderer.d.ts +16 -0
  55. package/dist/components/molecules/canvas-map/lib/renderers/FeatureRenderer.js +90 -0
  56. package/dist/components/molecules/canvas-map/lib/renderers/MapRenderer.d.ts +6 -0
  57. package/dist/components/molecules/canvas-map/lib/renderers/MapRenderer.js +53 -0
  58. package/dist/components/molecules/canvas-map/lib/renderers/TextLayerRenderer.d.ts +21 -0
  59. package/dist/components/molecules/canvas-map/lib/renderers/TextLayerRenderer.js +133 -0
  60. package/dist/components/molecules/canvas-map/lib/renderers/VectorLayerRenderer.d.ts +10 -0
  61. package/dist/components/molecules/canvas-map/lib/renderers/VectorLayerRenderer.js +79 -0
  62. package/dist/components/molecules/canvas-map/lib/sources/VectorSource.d.ts +15 -0
  63. package/dist/components/molecules/canvas-map/lib/sources/VectorSource.js +53 -0
  64. package/dist/components/molecules/canvas-map/lib/styles/Fill.d.ts +7 -0
  65. package/dist/components/molecules/canvas-map/lib/styles/Fill.js +15 -0
  66. package/dist/components/molecules/canvas-map/lib/styles/Stroke.d.ts +24 -0
  67. package/dist/components/molecules/canvas-map/lib/styles/Stroke.js +22 -0
  68. package/dist/components/molecules/canvas-map/lib/styles/Style.d.ts +24 -0
  69. package/dist/components/molecules/canvas-map/lib/styles/Style.js +17 -0
  70. package/dist/components/molecules/canvas-map/lib/styles/Text.d.ts +146 -0
  71. package/dist/components/molecules/canvas-map/lib/styles/Text.js +116 -0
  72. package/dist/components/molecules/canvas-map/lib/styles/index.d.ts +4 -0
  73. package/dist/components/molecules/canvas-map/lib/util/array.d.ts +6 -0
  74. package/dist/components/molecules/canvas-map/lib/util/array.js +15 -0
  75. package/dist/components/molecules/canvas-map/lib/util/bboxFeature.d.ts +8 -0
  76. package/dist/components/molecules/canvas-map/lib/util/bboxFeature.js +24 -0
  77. package/dist/components/molecules/canvas-map/lib/util/bounds.d.ts +47 -0
  78. package/dist/components/molecules/canvas-map/lib/util/bounds.js +61 -0
  79. package/dist/components/molecules/canvas-map/lib/util/coordinate.d.ts +26 -0
  80. package/dist/components/molecules/canvas-map/lib/util/coordinate.js +35 -0
  81. package/dist/components/molecules/canvas-map/lib/util/debug.d.ts +11 -0
  82. package/dist/components/molecules/canvas-map/lib/util/debug.js +27 -0
  83. package/dist/components/molecules/canvas-map/lib/util/deflate.d.ts +36 -0
  84. package/dist/components/molecules/canvas-map/lib/util/distance.d.ts +1 -0
  85. package/dist/components/molecules/canvas-map/lib/util/distance.js +12 -0
  86. package/dist/components/molecules/canvas-map/lib/util/dom.d.ts +9 -0
  87. package/dist/components/molecules/canvas-map/lib/util/dom.js +28 -0
  88. package/dist/components/molecules/canvas-map/lib/util/extent.d.ts +98 -0
  89. package/dist/components/molecules/canvas-map/lib/util/extent.js +118 -0
  90. package/dist/components/molecules/canvas-map/lib/util/index.d.ts +6 -0
  91. package/dist/components/molecules/canvas-map/lib/util/memoise.d.ts +10 -0
  92. package/dist/components/molecules/canvas-map/lib/util/memoise.js +20 -0
  93. package/dist/components/molecules/canvas-map/lib/util/resolution.d.ts +9 -0
  94. package/dist/components/molecules/canvas-map/lib/util/resolution.js +11 -0
  95. package/dist/components/molecules/canvas-map/lib/util/simplify.d.ts +114 -0
  96. package/dist/components/molecules/canvas-map/lib/util/size.d.ts +32 -0
  97. package/dist/components/molecules/canvas-map/lib/util/size.js +53 -0
  98. package/dist/components/molecules/canvas-map/lib/util/toRgba.d.ts +1 -0
  99. package/dist/components/molecules/canvas-map/lib/util/toRgba.js +25 -0
  100. package/dist/components/molecules/canvas-map/lib/util/uid.d.ts +5 -0
  101. package/dist/components/molecules/canvas-map/lib/util/uid.js +7 -0
  102. package/dist/components/molecules/canvas-map/lib/util/zoomLevel.d.ts +2 -0
  103. package/dist/components/molecules/canvas-map/lib/util/zoomLevel.js +14 -0
  104. package/dist/components/molecules/canvas-map/style.module.scss.js +20 -0
  105. package/dist/components/molecules/column-chart/column-chart-example.d.ts +35 -0
  106. package/dist/components/molecules/column-chart/column-chart-util.d.ts +1 -0
  107. package/dist/components/molecules/column-chart/index.d.ts +11 -0
  108. package/dist/components/molecules/column-chart/index.js +63 -0
  109. package/dist/components/molecules/column-chart/style.module.css.js +14 -0
  110. package/dist/components/molecules/control-change/index.d.ts +6 -0
  111. package/dist/components/molecules/control-change/index.js +29 -0
  112. package/dist/components/molecules/control-change/style.module.css.js +11 -0
  113. package/dist/components/molecules/dropdown/index.d.ts +11 -0
  114. package/dist/components/molecules/dropdown/index.js +191 -0
  115. package/dist/components/molecules/dropdown/style.module.css.js +50 -0
  116. package/dist/components/molecules/first-past-the-post-waffle/index.d.ts +5 -0
  117. package/dist/components/molecules/first-past-the-post-waffle/index.js +14 -0
  118. package/dist/components/molecules/first-past-the-post-waffle/style.module.css.js +14 -0
  119. package/dist/components/molecules/index.d.ts +18 -0
  120. package/dist/components/molecules/modal/index.d.ts +8 -0
  121. package/dist/components/molecules/modal/index.js +59 -0
  122. package/dist/components/molecules/modal/style.module.css.js +26 -0
  123. package/dist/components/molecules/option-picker/index.d.ts +26 -0
  124. package/dist/components/molecules/option-picker/index.js +94 -0
  125. package/dist/components/molecules/option-picker/style.module.css.js +35 -0
  126. package/dist/components/molecules/page-section/index.d.ts +8 -0
  127. package/dist/components/molecules/page-section/index.js +52 -0
  128. package/dist/components/molecules/page-section/style.module.scss.js +20 -0
  129. package/dist/components/molecules/party-profile/index.d.ts +10 -0
  130. package/dist/components/molecules/party-profile/index.js +29 -0
  131. package/dist/components/molecules/party-profile/style.module.css.js +26 -0
  132. package/dist/components/molecules/refresh-indicator/index.d.ts +4 -0
  133. package/dist/components/molecules/refresh-indicator/index.js +18 -0
  134. package/dist/components/molecules/refresh-indicator/style.module.scss.js +17 -0
  135. package/dist/components/molecules/responsive-grid/index.d.ts +10 -0
  136. package/dist/components/molecules/responsive-grid/index.js +19 -0
  137. package/dist/components/molecules/responsive-grid/style.module.scss.js +8 -0
  138. package/dist/components/molecules/result-summary/index.d.ts +8 -0
  139. package/dist/components/molecules/result-summary/index.js +40 -0
  140. package/dist/components/molecules/result-summary/style.module.css.js +11 -0
  141. package/dist/components/molecules/search-input/icons/search.d.ts +1 -0
  142. package/dist/components/molecules/search-input/icons/search.js +24 -0
  143. package/dist/components/molecules/search-input/icons/search.module.css.js +11 -0
  144. package/dist/components/molecules/search-input/index.d.ts +11 -0
  145. package/dist/components/molecules/search-input/index.js +165 -0
  146. package/dist/components/molecules/search-input/style.module.css.js +32 -0
  147. package/dist/components/molecules/slope-chart/index.d.ts +16 -0
  148. package/dist/components/molecules/slope-chart/index.js +139 -0
  149. package/dist/components/molecules/slope-chart/style.module.css.js +35 -0
  150. package/dist/components/molecules/svg-map/context/MapContext.d.ts +1 -0
  151. package/dist/components/molecules/svg-map/context/MapContext.js +5 -0
  152. package/dist/components/molecules/svg-map/context/SVGMapProvider.d.ts +10 -0
  153. package/dist/components/molecules/svg-map/context/SVGMapProvider.js +88 -0
  154. package/dist/components/molecules/svg-map/helpers/bboxFeature.d.ts +8 -0
  155. package/dist/components/molecules/svg-map/helpers/bboxFeature.js +26 -0
  156. package/dist/components/molecules/svg-map/helpers/dynamicPropValue.d.ts +1 -0
  157. package/dist/components/molecules/svg-map/helpers/dynamicPropValue.js +9 -0
  158. package/dist/components/molecules/svg-map/helpers/geoMath.d.ts +4 -0
  159. package/dist/components/molecules/svg-map/helpers/saveSVG.d.ts +1 -0
  160. package/dist/components/molecules/svg-map/hooks/useCamera.d.ts +0 -0
  161. package/dist/components/molecules/svg-map/hooks/useThrowIfNonLayerChildren.d.ts +4 -0
  162. package/dist/components/molecules/svg-map/hooks/useThrowIfNonLayerChildren.js +19 -0
  163. package/dist/components/molecules/svg-map/index.d.ts +38 -0
  164. package/dist/components/molecules/svg-map/index.js +121 -0
  165. package/dist/components/molecules/svg-map/layers/CompositionBorders.d.ts +3 -0
  166. package/dist/components/molecules/svg-map/layers/CompositionBorders.js +14 -0
  167. package/dist/components/molecules/svg-map/layers/Line.d.ts +7 -0
  168. package/dist/components/molecules/svg-map/layers/Line.js +48 -0
  169. package/dist/components/molecules/svg-map/layers/Point.d.ts +10 -0
  170. package/dist/components/molecules/svg-map/layers/Point.js +59 -0
  171. package/dist/components/molecules/svg-map/layers/Polygon.d.ts +9 -0
  172. package/dist/components/molecules/svg-map/layers/Polygon.js +75 -0
  173. package/dist/components/molecules/svg-map/layers/Prerendered.d.ts +3 -0
  174. package/dist/components/molecules/svg-map/layers/Prerendered.js +11 -0
  175. package/dist/components/molecules/svg-map/layers/compositionBorders.module.scss.js +8 -0
  176. package/dist/components/molecules/svg-map/layers/index.d.ts +5 -0
  177. package/dist/components/molecules/svg-map/layers/index.js +12 -0
  178. package/dist/components/molecules/svg-map/renderers/SVGRenderer.d.ts +3 -0
  179. package/dist/components/molecules/svg-map/renderers/SVGRenderer.js +32 -0
  180. package/dist/components/molecules/svg-map/style.module.css.js +11 -0
  181. package/dist/components/molecules/table/index.d.ts +7 -0
  182. package/dist/components/molecules/table/index.js +90 -0
  183. package/dist/components/molecules/table/style.module.scss.js +29 -0
  184. package/dist/components/molecules/table/useTable.d.ts +8 -0
  185. package/dist/components/molecules/table/useTable.js +128 -0
  186. package/dist/components/molecules/tooltip/index.d.ts +82 -0
  187. package/dist/components/molecules/tooltip/index.js +117 -0
  188. package/dist/components/molecules/tooltip/style.module.css.js +8 -0
  189. package/dist/components/molecules/topline-result/index.d.ts +3 -0
  190. package/dist/components/molecules/topline-result/index.js +61 -0
  191. package/dist/components/molecules/topline-result/style.module.scss.js +38 -0
  192. package/dist/components/organisms/coalitions-tracker/index.d.ts +16 -0
  193. package/dist/components/organisms/coalitions-tracker/index.js +151 -0
  194. package/dist/components/organisms/coalitions-tracker/style.module.scss.js +32 -0
  195. package/dist/components/organisms/index.d.ts +2 -0
  196. package/dist/components/organisms/ticker/gradient/index.d.ts +1 -0
  197. package/dist/components/organisms/ticker/gradient/index.js +35 -0
  198. package/dist/components/organisms/ticker/gradient/style.module.scss.js +14 -0
  199. package/dist/components/organisms/ticker/index.d.ts +5 -0
  200. package/dist/components/organisms/ticker/index.js +102 -0
  201. package/dist/components/organisms/ticker/style.module.scss.js +32 -0
  202. package/dist/components/particles/ad-slot/index.d.ts +40 -0
  203. package/dist/components/particles/ad-slot/index.js +34 -0
  204. package/dist/components/particles/ad-slot/style.module.css.js +11 -0
  205. package/dist/components/particles/arrow-button/index.d.ts +6 -0
  206. package/dist/components/particles/arrow-button/index.js +32 -0
  207. package/dist/components/particles/arrow-button/style.module.css.js +11 -0
  208. package/dist/components/particles/aspect-ratio-box/index.d.ts +4 -0
  209. package/dist/components/particles/aspect-ratio-box/index.js +15 -0
  210. package/dist/components/particles/aspect-ratio-box/style.module.css.js +6 -0
  211. package/dist/components/particles/button/index.d.ts +6 -0
  212. package/dist/components/particles/button/index.js +10 -0
  213. package/dist/components/particles/button/style.module.css.js +11 -0
  214. package/dist/components/particles/change-bar/index.d.ts +8 -0
  215. package/dist/components/particles/change-bar/index.js +27 -0
  216. package/dist/components/particles/change-bar/style.module.scss.js +14 -0
  217. package/dist/components/particles/chevron/index.d.ts +6 -0
  218. package/dist/components/particles/chevron/index.js +78 -0
  219. package/dist/components/particles/chevron/style.module.css.js +20 -0
  220. package/dist/components/particles/circle-icon/index.d.ts +6 -0
  221. package/dist/components/particles/circle-icon/index.js +32 -0
  222. package/dist/components/particles/circle-icon/style.module.css.js +14 -0
  223. package/dist/components/particles/close-button/index.d.ts +5 -0
  224. package/dist/components/particles/close-button/index.js +35 -0
  225. package/dist/components/particles/close-button/style.module.css.js +17 -0
  226. package/dist/components/particles/container/index.d.ts +5 -0
  227. package/dist/components/particles/container/index.js +13 -0
  228. package/dist/components/particles/container/style.module.scss.js +11 -0
  229. package/dist/components/particles/gradient-icon/index.d.ts +1 -0
  230. package/dist/components/particles/gradient-icon/index.js +46 -0
  231. package/dist/components/particles/gradient-icon/style.module.css.js +14 -0
  232. package/dist/components/particles/index.d.ts +18 -0
  233. package/dist/components/particles/info-button/index.d.ts +3 -0
  234. package/dist/components/particles/info-button/index.js +19 -0
  235. package/dist/components/particles/info-button/style.module.css.js +11 -0
  236. package/dist/components/particles/legend-item/index.d.ts +6 -0
  237. package/dist/components/particles/legend-item/index.js +26 -0
  238. package/dist/components/particles/legend-item/style.module.css.js +17 -0
  239. package/dist/components/particles/relative-time-sentence/index.d.ts +4 -0
  240. package/dist/components/particles/relative-time-sentence/index.js +14 -0
  241. package/dist/components/particles/relative-time-sentence/style.module.css.js +8 -0
  242. package/dist/components/particles/square-cut-corner-icon/index.d.ts +6 -0
  243. package/dist/components/particles/square-cut-corner-icon/index.js +56 -0
  244. package/dist/components/particles/square-cut-corner-icon/style.module.scss.js +17 -0
  245. package/dist/components/particles/square-icon/index.d.ts +5 -0
  246. package/dist/components/particles/square-icon/index.js +28 -0
  247. package/dist/components/particles/square-icon/style.module.scss.js +11 -0
  248. package/dist/components/particles/stacked-bar/index.d.ts +23 -0
  249. package/dist/components/particles/stacked-bar/index.js +140 -0
  250. package/dist/components/particles/stacked-bar/style.module.css.js +17 -0
  251. package/dist/components/particles/stacked-grid/index.d.ts +6 -0
  252. package/dist/components/particles/stacked-grid/index.js +35 -0
  253. package/dist/components/particles/stacked-grid/style.module.css.js +20 -0
  254. package/dist/components/particles/waffle/index.d.ts +14 -0
  255. package/dist/components/particles/waffle/index.js +76 -0
  256. package/dist/components/particles/waffle/style.module.css.js +11 -0
  257. package/dist/index.d.ts +2 -0
  258. package/dist/index.js +147 -0
  259. package/dist/shared/colors/index.d.ts +2 -0
  260. package/dist/shared/helpers/createStore.d.ts +1 -0
  261. package/dist/shared/helpers/geometry.d.ts +3 -0
  262. package/dist/shared/helpers/geometry.js +16 -0
  263. package/dist/shared/helpers/geometry.test.d.ts +1 -0
  264. package/dist/shared/helpers/labelsUtil.d.ts +54 -0
  265. package/dist/shared/helpers/labelsUtil.js +58 -0
  266. package/dist/shared/helpers/labelsUtils.test.d.ts +1 -0
  267. package/dist/shared/helpers/shouldUpdate.d.ts +7 -0
  268. package/dist/shared/hooks/index.d.ts +3 -0
  269. package/dist/shared/hooks/useContainerSize.d.ts +1 -0
  270. package/dist/shared/hooks/useContainerSize.js +24 -0
  271. package/dist/shared/hooks/useTouchOrHover.d.ts +7 -0
  272. package/dist/shared/hooks/useTouchOrHover.js +103 -0
  273. package/dist/shared/hooks/useWindowSize.d.ts +4 -0
  274. package/dist/shared/hooks/useWindowSize.js +27 -0
  275. package/dist/style.css +74 -74
  276. package/dist/styles/helpers/mergeStyles.d.ts +1 -0
  277. package/dist/styles/helpers/mergeStyles.js +22 -0
  278. package/dist/styles/helpers/mergeStyles.test.d.ts +1 -0
  279. package/dist/styles/theme.config.d.ts +124 -0
  280. package/package.json +19 -10
  281. package/dist/interactive-component-library.js +0 -8365
  282. package/dist/interactive-component-library.js.map +0 -1
  283. package/dist/interactive-component-library.umd.cjs +0 -8360
  284. package/dist/interactive-component-library.umd.cjs.map +0 -1
@@ -0,0 +1,133 @@
1
+ import { FeatureRenderer } from "./FeatureRenderer.js";
2
+ import { replaceChildren } from "../util/dom.js";
3
+ class TextLayerRenderer {
4
+ constructor(layer) {
5
+ this.layer = layer;
6
+ this.featureRenderer = new FeatureRenderer();
7
+ this._element = document.createElement("div");
8
+ this._element.className = "gv-text-layer";
9
+ const style = this._element.style;
10
+ style.position = "absolute";
11
+ style.width = "100%";
12
+ style.height = "100%";
13
+ style.pointerEvents = "none";
14
+ style.overflow = "hidden";
15
+ }
16
+ renderFrame(frameState, targetElement) {
17
+ if (this.layer.opacity === 0) return targetElement;
18
+ const { declutterTree } = frameState;
19
+ const { projection, viewPortSize, sizeInPixels, visibleExtent, transform } = frameState.viewState;
20
+ this._element.style.opacity = this.layer.opacity;
21
+ const source = this.layer.source;
22
+ const features = source.getFeaturesInExtent(visibleExtent);
23
+ const textElements = [];
24
+ for (const feature of features) {
25
+ const geometries = feature.getProjectedGeometries(projection);
26
+ const point = geometries.find((d) => d.type === "Point");
27
+ if (!point) {
28
+ throw new Error(
29
+ `Expected Point geometry for feature in TextLayer: ${feature}`
30
+ );
31
+ }
32
+ const styleFunction = feature.getStyleFunction() || this.layer.getStyleFunction();
33
+ const featureStyle = styleFunction(feature);
34
+ const textElement = this.getTextElementWithID(feature.uid);
35
+ textElement.innerText = featureStyle.text.content;
36
+ const [relativeX, relativeY] = transform.apply(point.coordinates).map((d, i) => d / sizeInPixels[i]);
37
+ const position = {
38
+ left: `${relativeX * 100}%`,
39
+ top: `${relativeY * 100}%`
40
+ };
41
+ this.styleTextElement(textElement, featureStyle.text, position);
42
+ const bbox = this.getElementBBox(textElement, featureStyle.text, {
43
+ x: relativeX * viewPortSize[0],
44
+ y: relativeY * viewPortSize[1]
45
+ });
46
+ if (declutterTree.collides(bbox)) {
47
+ continue;
48
+ }
49
+ declutterTree.insert(bbox);
50
+ if (this.layer.drawCollisionBoxes) {
51
+ const collisionBoxDebugElement = this.getCollisionBoxElement(bbox);
52
+ textElements.push(collisionBoxDebugElement);
53
+ }
54
+ textElements.push(textElement);
55
+ }
56
+ replaceChildren(this._element, textElements);
57
+ return this._element;
58
+ }
59
+ getTextElementWithID(id) {
60
+ const elementId = `text-feature-${id}`;
61
+ let textElement = this._element.querySelector(`#${elementId}`);
62
+ if (!textElement) {
63
+ textElement = document.createElement("div");
64
+ textElement.id = elementId;
65
+ }
66
+ return textElement;
67
+ }
68
+ styleTextElement(element, textStyle, position) {
69
+ const style = element.style;
70
+ style.position = "absolute";
71
+ style.left = position.left;
72
+ style.top = position.top;
73
+ style.textAlign = "center";
74
+ style.whiteSpace = "nowrap";
75
+ style.fontFamily = textStyle.fontFamily;
76
+ style.fontSize = textStyle.fontSize;
77
+ style.fontWeight = textStyle.fontWeight;
78
+ style.lineHeight = textStyle.lineHeight;
79
+ style.color = textStyle.color;
80
+ style.textShadow = textStyle.textShadow;
81
+ const { width, height } = this.getElementSize(element);
82
+ style.transform = textStyle.getTransform(width, height);
83
+ }
84
+ getElementSize(element) {
85
+ if (!element.parentElement) {
86
+ document.body.appendChild(element);
87
+ }
88
+ const { width, height } = element.getBoundingClientRect();
89
+ if (element.parentElement !== this._element) {
90
+ element.remove();
91
+ }
92
+ return { width, height };
93
+ }
94
+ getElementBBox(element, textStyle, position) {
95
+ const collissionPadding = {
96
+ top: 2,
97
+ right: 2,
98
+ bottom: 2,
99
+ left: 2
100
+ };
101
+ const { width, height } = this.getElementSize(element);
102
+ const { x: translateX, y: translateY } = textStyle.getTranslation(
103
+ width,
104
+ height
105
+ );
106
+ const minX = Math.floor(position.x + translateX - collissionPadding.left);
107
+ const minY = Math.floor(position.y + translateY - collissionPadding.top);
108
+ return {
109
+ minX,
110
+ minY,
111
+ maxX: Math.ceil(
112
+ minX + width + collissionPadding.left + collissionPadding.right
113
+ ),
114
+ maxY: Math.ceil(
115
+ minY + height + collissionPadding.top + collissionPadding.bottom
116
+ )
117
+ };
118
+ }
119
+ getCollisionBoxElement(bbox) {
120
+ const element = document.createElement("div");
121
+ const style = element.style;
122
+ style.position = "absolute";
123
+ style.left = `${bbox.minX}px`;
124
+ style.top = `${bbox.minY}px`;
125
+ style.width = `${bbox.maxX - bbox.minX}px`;
126
+ style.height = `${bbox.maxY - bbox.minY}px`;
127
+ style.border = "1px solid red";
128
+ return element;
129
+ }
130
+ }
131
+ export {
132
+ TextLayerRenderer
133
+ };
@@ -0,0 +1,10 @@
1
+ import { FeatureRenderer } from './FeatureRenderer';
2
+ export class VectorLayerRenderer {
3
+ constructor(layer: any);
4
+ layer: any;
5
+ featureRenderer: FeatureRenderer;
6
+ renderFrame(frameState: any, targetElement: any): any;
7
+ getOrCreateContainer(targetElement: any, sizeInPixels: any): any;
8
+ _container: any;
9
+ createContainer(): HTMLDivElement;
10
+ }
@@ -0,0 +1,79 @@
1
+ import { FeatureRenderer } from "./FeatureRenderer.js";
2
+ class VectorLayerRenderer {
3
+ constructor(layer) {
4
+ this.layer = layer;
5
+ this.featureRenderer = new FeatureRenderer();
6
+ }
7
+ renderFrame(frameState, targetElement) {
8
+ if (this.layer.opacity === 0) return targetElement;
9
+ const { projection, sizeInPixels, visibleExtent, transform } = frameState.viewState;
10
+ const container = this.getOrCreateContainer(targetElement, sizeInPixels);
11
+ const context = container.firstElementChild.getContext("2d");
12
+ context.save();
13
+ context.translate(transform.x, transform.y);
14
+ context.scale(transform.k, transform.k);
15
+ context.lineJoin = "round";
16
+ context.lineCap = "round";
17
+ context.globalAlpha = this.layer.opacity;
18
+ const source = this.layer.source;
19
+ const features = source.getFeaturesInExtent(visibleExtent);
20
+ for (const feature of features) {
21
+ const styleFunction = feature.getStyleFunction() || this.layer.getStyleFunction();
22
+ const featureStyle = styleFunction(feature);
23
+ if ((featureStyle == null ? void 0 : featureStyle.stroke) || (featureStyle == null ? void 0 : featureStyle.fill)) {
24
+ context.save();
25
+ this.featureRenderer.setStyle(featureStyle);
26
+ this.featureRenderer.setFeature(feature);
27
+ this.featureRenderer.render(frameState, context);
28
+ context.restore();
29
+ }
30
+ }
31
+ if (Object.prototype.hasOwnProperty.call(projection, "getCompositionBorders")) {
32
+ context.beginPath();
33
+ context.lineWidth = 1 / transform.k;
34
+ context.strokeStyle = "#999";
35
+ projection.drawCompositionBorders(context);
36
+ context.stroke();
37
+ }
38
+ context.restore();
39
+ return container;
40
+ }
41
+ getOrCreateContainer(targetElement, sizeInPixels) {
42
+ let container = null;
43
+ let containerReused = false;
44
+ let canvas = targetElement && targetElement.firstElementChild;
45
+ if (canvas instanceof HTMLCanvasElement) {
46
+ container = targetElement;
47
+ containerReused = true;
48
+ } else if (this._container) {
49
+ container = this._container;
50
+ } else {
51
+ container = this.createContainer();
52
+ }
53
+ if (!containerReused) {
54
+ const canvas2 = container.firstElementChild;
55
+ canvas2.width = sizeInPixels[0];
56
+ canvas2.height = sizeInPixels[1];
57
+ }
58
+ this._container = container;
59
+ return container;
60
+ }
61
+ createContainer() {
62
+ const container = document.createElement("div");
63
+ container.className = "gv-map-layer";
64
+ let style = container.style;
65
+ style.position = "absolute";
66
+ style.width = "100%";
67
+ style.height = "100%";
68
+ const canvas = document.createElement("canvas");
69
+ style = canvas.style;
70
+ style.position = "absolute";
71
+ style.width = "100%";
72
+ style.height = "100%";
73
+ container.appendChild(canvas);
74
+ return container;
75
+ }
76
+ }
77
+ export {
78
+ VectorLayerRenderer
79
+ };
@@ -0,0 +1,15 @@
1
+ import { Dispatcher } from '../events';
2
+ import { default as RBush } from 'rbush';
3
+ export class VectorSource {
4
+ constructor({ features }: {
5
+ features: any;
6
+ });
7
+ dispatcher: Dispatcher;
8
+ _featuresRtree: RBush;
9
+ tearDown(): void;
10
+ getFeatures(): any;
11
+ getFeaturesAtCoordinate(coordinate: any): any[];
12
+ getFeaturesInExtent(extent: any): any[];
13
+ setFeatures(features: any): void;
14
+ _features: any;
15
+ }
@@ -0,0 +1,53 @@
1
+ import RBush from "rbush";
2
+ import knn from "rbush-knn";
3
+ import { Dispatcher } from "../events/Dispatcher.js";
4
+ import { MapEvent } from "../events/MapEvent.js";
5
+ class VectorSource {
6
+ constructor({ features }) {
7
+ this.dispatcher = new Dispatcher(this);
8
+ this._featuresRtree = new RBush();
9
+ this.setFeatures(features);
10
+ }
11
+ tearDown() {
12
+ this.dispatcher = null;
13
+ }
14
+ getFeatures() {
15
+ return this._features;
16
+ }
17
+ getFeaturesAtCoordinate(coordinate) {
18
+ const [x, y] = coordinate;
19
+ const items = knn(this._featuresRtree, x, y, 10, (d) => {
20
+ return d.feature.containsCoordinate(coordinate);
21
+ }).map((d) => {
22
+ const midX = d.minX + (d.minX + d.maxX) / 2;
23
+ const midY = d.minY + (d.minY + d.maxY) / 2;
24
+ d.distance = Math.hypot(midX - x, midY - y);
25
+ return d;
26
+ });
27
+ items.sort((a, b) => a.distance - b.distance);
28
+ return items.map((d) => d.feature);
29
+ }
30
+ getFeaturesInExtent(extent) {
31
+ const [minX, minY, maxX, maxY] = extent;
32
+ const features = this._featuresRtree.search({ minX, minY, maxX, maxY }).map((d) => d.feature);
33
+ return features;
34
+ }
35
+ setFeatures(features) {
36
+ this._featuresRtree.clear();
37
+ for (const feature of features) {
38
+ const { minX, minY, maxX, maxY } = feature.getExtent();
39
+ this._featuresRtree.insert({
40
+ minX: Math.floor(minX),
41
+ minY: Math.floor(minY),
42
+ maxX: Math.ceil(maxX),
43
+ maxY: Math.ceil(maxY),
44
+ feature
45
+ });
46
+ }
47
+ this._features = features;
48
+ this.dispatcher.dispatch(MapEvent.CHANGE);
49
+ }
50
+ }
51
+ export {
52
+ VectorSource
53
+ };
@@ -0,0 +1,7 @@
1
+ export class Fill {
2
+ constructor(options: any);
3
+ color: any;
4
+ opacity: any;
5
+ _getRgba: (...arg0: any[]) => string;
6
+ getRgba(): string;
7
+ }
@@ -0,0 +1,15 @@
1
+ import { memoise } from "../util/memoise.js";
2
+ import { toRgba } from "../util/toRgba.js";
3
+ class Fill {
4
+ constructor(options) {
5
+ this.color = (options == null ? void 0 : options.color) || "#CCC";
6
+ this.opacity = (options == null ? void 0 : options.opacity) || 1;
7
+ this._getRgba = memoise(toRgba);
8
+ }
9
+ getRgba() {
10
+ return this._getRgba(this.color, this.opacity);
11
+ }
12
+ }
13
+ export {
14
+ Fill
15
+ };
@@ -0,0 +1,24 @@
1
+ /**
2
+ * *
3
+ */
4
+ export type StrokePosition = string;
5
+ export namespace StrokePosition {
6
+ let CENTER: string;
7
+ let INSIDE: string;
8
+ }
9
+ /**
10
+ * @class Stroke
11
+ * @property {string} [color="#121212"] - The stroke color
12
+ * @property {number} [width=0.5] - The stroke width
13
+ * @property {number} [opacity=1] - The stroke opacity
14
+ * @property {StrokePosition} [position="center"] - Where the shape's stroke is rendered (ignored if geometry is not a Polygon)
15
+ */
16
+ export class Stroke {
17
+ constructor(options: any);
18
+ color: any;
19
+ width: any;
20
+ opacity: any;
21
+ position: any;
22
+ _getRgba: (...arg0: any[]) => string;
23
+ getRgba(): string;
24
+ }
@@ -0,0 +1,22 @@
1
+ import { memoise } from "../util/memoise.js";
2
+ import { toRgba } from "../util/toRgba.js";
3
+ const StrokePosition = {
4
+ CENTER: "center",
5
+ INSIDE: "inside"
6
+ };
7
+ class Stroke {
8
+ constructor(options) {
9
+ this.color = (options == null ? void 0 : options.color) || "#121212";
10
+ this.width = (options == null ? void 0 : options.width) || 0.5;
11
+ this.opacity = (options == null ? void 0 : options.opacity) || 1;
12
+ this.position = (options == null ? void 0 : options.position) || StrokePosition.CENTER;
13
+ this._getRgba = memoise(toRgba);
14
+ }
15
+ getRgba() {
16
+ return this._getRgba(this.color, this.opacity);
17
+ }
18
+ }
19
+ export {
20
+ Stroke,
21
+ StrokePosition
22
+ };
@@ -0,0 +1,24 @@
1
+ /**
2
+ * A function that takes a {@link import("../Feature").Feature} and returns a {@link Style}
3
+ *
4
+ * @typedef {function(import("../Feature").Feature):(Style)} StyleFunction
5
+ */
6
+ /**
7
+ * Class representing a style.
8
+ * @class
9
+ * @property {Object} properties - The properties of the style
10
+ * @property {Object} properties.stroke - The stroke color of the style
11
+ * @property {Object} properties.fill - The fill color of the style
12
+ * @property {Object} properties.text - The text color of the style
13
+ */
14
+ export class Style {
15
+ constructor(properties: any);
16
+ stroke: any;
17
+ fill: any;
18
+ text: any;
19
+ clone(): Style;
20
+ }
21
+ /**
22
+ * A function that takes a {@link import ("../Feature").Feature} and returns a {@link Style}
23
+ */
24
+ export type StyleFunction = (arg0: import('../Feature').Feature) => (Style);
@@ -0,0 +1,17 @@
1
+ class Style {
2
+ constructor(properties) {
3
+ this.stroke = properties == null ? void 0 : properties.stroke;
4
+ this.fill = properties == null ? void 0 : properties.fill;
5
+ this.text = properties == null ? void 0 : properties.text;
6
+ }
7
+ clone() {
8
+ return new Style({
9
+ stroke: this.stroke,
10
+ fill: this.fill,
11
+ text: this.text
12
+ });
13
+ }
14
+ }
15
+ export {
16
+ Style
17
+ };
@@ -0,0 +1,146 @@
1
+ /**
2
+ * @typedef TextStyle
3
+ * @property {string} content - The text to render
4
+ * @property {string} [id] - The id of the text element
5
+ * @property {TextAnchor} [anchor="center"] - The anchor point of the text}
6
+ * @property {number} [lineHeight=1.3] - The line height of the text
7
+ * @property {string} [color="#121212"] - The color of the text
8
+ * @property {string} [textShadow="1px 1px 0px #f6f6f6, -1px -1px 0px #f6f6f6, -1px 1px 0px #f6f6f6, 1px -1px #f6f6f6"] - The text shadow of the text
9
+ * @property {string} [fontFamily="var(--text-sans)"] - The font family of the text
10
+ * @property {string} [fontSize="17px"] - The font size of the text
11
+ * @property {string} [fontWeight="400"] - The font weight of the text
12
+ * @property {number} [radialOffset=0] - The radial offset of the text in ems
13
+ */
14
+ /**
15
+ * Class that represents a text style
16
+ * @type Text
17
+ * @implements {TextStyle}
18
+ */
19
+ export class Text implements TextStyle {
20
+ /**
21
+ * Create a text element style
22
+ * @constructor
23
+ * @param {TextStyle} [options] - Style options
24
+ */
25
+ constructor(options?: TextStyle);
26
+ content: any;
27
+ anchor: any;
28
+ fontFamily: any;
29
+ fontSize: any;
30
+ fontWeight: any;
31
+ lineHeight: any;
32
+ color: any;
33
+ textShadow: any;
34
+ radialOffset: any;
35
+ /**
36
+ * Get the relative translation for the text element based on its anchor. The translation does not take `radialOffset` into account
37
+ * @private
38
+ * @return {{x: number, y: number}} - The x and y translation in percentage points
39
+ */
40
+ private _getRelativeTranslation;
41
+ /**
42
+ * Get the translation for the text element in pixels
43
+ * @param {number} elementWidth - The width of the element
44
+ * @param {number} elementHeight - The height of the element
45
+ * @return {{x: number, y: number}} - The x and y translation in pixels
46
+ */
47
+ getTranslation(elementWidth: number, elementHeight: number): {
48
+ x: number;
49
+ y: number;
50
+ };
51
+ /**
52
+ * Get the transform for the text element
53
+ * @param {number} elementWidth - The width of the element
54
+ * @param {number} elementHeight - The height of the element
55
+ * @return {string} - The transform for the text element
56
+ */
57
+ getTransform(elementWidth: number, elementHeight: number): string;
58
+ }
59
+ export type TextStyle = {
60
+ /**
61
+ * - The text to render
62
+ */
63
+ /**
64
+ * - The text to render
65
+ */
66
+ content: string;
67
+ /**
68
+ * - The id of the text element
69
+ */
70
+ /**
71
+ * - The id of the text element
72
+ */
73
+ id?: string;
74
+ /**
75
+ * - The anchor point of the text}
76
+ */
77
+ /**
78
+ * - The anchor point of the text}
79
+ */
80
+ anchor?: TextAnchor;
81
+ /**
82
+ * - The line height of the text
83
+ */
84
+ /**
85
+ * - The line height of the text
86
+ */
87
+ lineHeight?: number;
88
+ /**
89
+ * - The color of the text
90
+ */
91
+ /**
92
+ * - The color of the text
93
+ */
94
+ color?: string;
95
+ /**
96
+ * - The text shadow of the text
97
+ */
98
+ /**
99
+ * - The text shadow of the text
100
+ */
101
+ textShadow?: string;
102
+ /**
103
+ * - The font family of the text
104
+ */
105
+ /**
106
+ * - The font family of the text
107
+ */
108
+ fontFamily?: string;
109
+ /**
110
+ * - The font size of the text
111
+ */
112
+ /**
113
+ * - The font size of the text
114
+ */
115
+ fontSize?: string;
116
+ /**
117
+ * - The font weight of the text
118
+ */
119
+ /**
120
+ * - The font weight of the text
121
+ */
122
+ fontWeight?: string;
123
+ /**
124
+ * - The radial offset of the text in ems
125
+ */
126
+ /**
127
+ * - The radial offset of the text in ems
128
+ */
129
+ radialOffset?: number;
130
+ };
131
+ /**
132
+ * *
133
+ */
134
+ type TextAnchor = string;
135
+ declare namespace TextAnchor {
136
+ let TOP: string;
137
+ let BOTTOM: string;
138
+ let LEFT: string;
139
+ let RIGHT: string;
140
+ let CENTER: string;
141
+ let TOP_LEFT: string;
142
+ let TOP_RIGHT: string;
143
+ let BOTTOM_LEFT: string;
144
+ let BOTTOM_RIGHT: string;
145
+ }
146
+ export {};
@@ -0,0 +1,116 @@
1
+ const TextAnchor = {
2
+ TOP: "top",
3
+ BOTTOM: "bottom",
4
+ LEFT: "left",
5
+ RIGHT: "right",
6
+ CENTER: "center",
7
+ TOP_LEFT: "top-left",
8
+ TOP_RIGHT: "top-right",
9
+ BOTTOM_LEFT: "bottom-left",
10
+ BOTTOM_RIGHT: "bottom-right"
11
+ };
12
+ class Text {
13
+ /**
14
+ * Create a text element style
15
+ * @constructor
16
+ * @param {TextStyle} [options] - Style options
17
+ */
18
+ constructor(options) {
19
+ this.content = options == null ? void 0 : options.content;
20
+ this.anchor = (options == null ? void 0 : options.anchor) || TextAnchor.CENTER;
21
+ this.fontFamily = (options == null ? void 0 : options.fontFamily) || "var(--text-sans)";
22
+ this.fontSize = (options == null ? void 0 : options.fontSize) || "17px";
23
+ this.fontWeight = (options == null ? void 0 : options.fontWeight) || "400";
24
+ this.lineHeight = (options == null ? void 0 : options.lineHeight) || 1.3;
25
+ this.color = (options == null ? void 0 : options.color) || "#121212";
26
+ this.textShadow = (options == null ? void 0 : options.textShadow) || "1px 1px 0px #f6f6f6, -1px -1px 0px #f6f6f6, -1px 1px 0px #f6f6f6, 1px -1px #f6f6f6";
27
+ this.radialOffset = (options == null ? void 0 : options.radialOffset) || 0;
28
+ }
29
+ /**
30
+ * Get the relative translation for the text element based on its anchor. The translation does not take `radialOffset` into account
31
+ * @private
32
+ * @return {{x: number, y: number}} - The x and y translation in percentage points
33
+ */
34
+ _getRelativeTranslation() {
35
+ switch (this.anchor) {
36
+ case TextAnchor.TOP:
37
+ return { x: -50, y: 0 };
38
+ case TextAnchor.BOTTOM:
39
+ return { x: -50, y: -100 };
40
+ case TextAnchor.LEFT:
41
+ return { x: 0, y: -50 };
42
+ case TextAnchor.RIGHT:
43
+ return { x: -100, y: -50 };
44
+ case TextAnchor.CENTER:
45
+ return { x: -50, y: -50 };
46
+ case TextAnchor.TOP_LEFT:
47
+ return { x: 0, y: 0 };
48
+ case TextAnchor.TOP_RIGHT:
49
+ return { x: -100, y: 0 };
50
+ case TextAnchor.BOTTOM_LEFT:
51
+ return { x: 0, y: -100 };
52
+ case TextAnchor.BOTTOM_RIGHT:
53
+ return { x: -100, y: -100 };
54
+ default:
55
+ return { x: 0, y: 0 };
56
+ }
57
+ }
58
+ /**
59
+ * Get the translation for the text element in pixels
60
+ * @param {number} elementWidth - The width of the element
61
+ * @param {number} elementHeight - The height of the element
62
+ * @return {{x: number, y: number}} - The x and y translation in pixels
63
+ */
64
+ getTranslation(elementWidth, elementHeight) {
65
+ const translate = this._getRelativeTranslation();
66
+ let x = translate.x / 100 * elementWidth;
67
+ let y = translate.y / 100 * elementHeight;
68
+ const radialOffsetInPixels = this.radialOffset * this.fontSize.replace("px", "");
69
+ switch (this.anchor) {
70
+ case TextAnchor.TOP:
71
+ y += radialOffsetInPixels;
72
+ break;
73
+ case TextAnchor.BOTTOM:
74
+ y -= radialOffsetInPixels;
75
+ break;
76
+ case TextAnchor.LEFT:
77
+ x += radialOffsetInPixels;
78
+ break;
79
+ case TextAnchor.RIGHT:
80
+ x -= radialOffsetInPixels;
81
+ break;
82
+ case TextAnchor.CENTER:
83
+ break;
84
+ case TextAnchor.TOP_LEFT:
85
+ x += radialOffsetInPixels;
86
+ y += radialOffsetInPixels;
87
+ break;
88
+ case TextAnchor.TOP_RIGHT:
89
+ x -= radialOffsetInPixels;
90
+ y += radialOffsetInPixels;
91
+ break;
92
+ case TextAnchor.BOTTOM_LEFT:
93
+ x += radialOffsetInPixels;
94
+ y -= radialOffsetInPixels;
95
+ break;
96
+ case TextAnchor.BOTTOM_RIGHT:
97
+ x -= radialOffsetInPixels;
98
+ y -= radialOffsetInPixels;
99
+ break;
100
+ }
101
+ return { x, y };
102
+ }
103
+ /**
104
+ * Get the transform for the text element
105
+ * @param {number} elementWidth - The width of the element
106
+ * @param {number} elementHeight - The height of the element
107
+ * @return {string} - The transform for the text element
108
+ */
109
+ getTransform(elementWidth, elementHeight) {
110
+ const { x, y } = this.getTranslation(elementWidth, elementHeight);
111
+ return `translate(${x}px, ${y}px)`;
112
+ }
113
+ }
114
+ export {
115
+ Text
116
+ };
@@ -0,0 +1,4 @@
1
+ export * from './Style';
2
+ export * from './Stroke';
3
+ export * from './Fill';
4
+ export * from './Text';
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @param {Array<any>|Uint8ClampedArray} arr1 The first array to compare.
3
+ * @param {Array<any>|Uint8ClampedArray} arr2 The second array to compare.
4
+ * @return {boolean} Whether the two arrays are equal.
5
+ */
6
+ export function arrayEquals(arr1: Array<any> | Uint8ClampedArray, arr2: Array<any> | Uint8ClampedArray): boolean;