@longline/aqua-ui 1.0.0

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 (410) hide show
  1. package/README.md +7 -0
  2. package/Types.d.ts +6 -0
  3. package/Types.js +5 -0
  4. package/containers/Anchor/Anchor.d.ts +63 -0
  5. package/containers/Anchor/Anchor.js +113 -0
  6. package/containers/Anchor/index.d.ts +1 -0
  7. package/containers/Anchor/index.js +1 -0
  8. package/containers/Dock/Dock.d.ts +45 -0
  9. package/containers/Dock/Dock.js +61 -0
  10. package/containers/Dock/Dockable.d.ts +60 -0
  11. package/containers/Dock/Dockable.js +98 -0
  12. package/containers/Dock/index.d.ts +2 -0
  13. package/containers/Dock/index.js +2 -0
  14. package/containers/Form/Field.d.ts +104 -0
  15. package/containers/Form/Field.js +168 -0
  16. package/containers/Form/Form.d.ts +51 -0
  17. package/containers/Form/Form.js +89 -0
  18. package/containers/Form/Validation.d.ts +212 -0
  19. package/containers/Form/Validation.js +232 -0
  20. package/containers/Form/context/FormContext.d.ts +10 -0
  21. package/containers/Form/context/FormContext.js +3 -0
  22. package/containers/Form/context/useForm.d.ts +5 -0
  23. package/containers/Form/context/useForm.js +9 -0
  24. package/containers/Form/elements/BoxWrapper.d.ts +15 -0
  25. package/containers/Form/elements/BoxWrapper.js +35 -0
  26. package/containers/Form/elements/Hint.d.ts +21 -0
  27. package/containers/Form/elements/Hint.js +15 -0
  28. package/containers/Form/elements/Label.d.ts +22 -0
  29. package/containers/Form/elements/Label.js +15 -0
  30. package/containers/Form/elements/SimpleWrapper.d.ts +15 -0
  31. package/containers/Form/elements/SimpleWrapper.js +17 -0
  32. package/containers/GlassPane/GlassPane.d.ts +36 -0
  33. package/containers/GlassPane/GlassPane.js +66 -0
  34. package/containers/GlassPane/index.d.ts +1 -0
  35. package/containers/GlassPane/index.js +1 -0
  36. package/containers/InfoBox/InfoBox.d.ts +34 -0
  37. package/containers/InfoBox/InfoBox.js +45 -0
  38. package/containers/InfoBox/elements/Content.d.ts +23 -0
  39. package/containers/InfoBox/elements/Content.js +37 -0
  40. package/containers/InfoBox/elements/Footer.d.ts +9 -0
  41. package/containers/InfoBox/elements/Footer.js +24 -0
  42. package/containers/InfoBox/elements/Header.d.ts +9 -0
  43. package/containers/InfoBox/elements/Header.js +24 -0
  44. package/containers/List/List.d.ts +45 -0
  45. package/containers/List/List.js +47 -0
  46. package/containers/List/ListCell.d.ts +13 -0
  47. package/containers/List/ListCell.js +24 -0
  48. package/containers/List/ListRow.d.ts +15 -0
  49. package/containers/List/ListRow.js +24 -0
  50. package/containers/List/index.d.ts +3 -0
  51. package/containers/List/index.js +3 -0
  52. package/containers/Tabs/Pane.d.ts +29 -0
  53. package/containers/Tabs/Pane.js +45 -0
  54. package/containers/Tabs/Tabs.d.ts +66 -0
  55. package/containers/Tabs/Tabs.js +144 -0
  56. package/controls/Chip/Chip.d.ts +35 -0
  57. package/controls/Chip/Chip.js +83 -0
  58. package/controls/Fab/Fab.d.ts +73 -0
  59. package/controls/Fab/Fab.js +94 -0
  60. package/controls/Icon/Icon.d.ts +98 -0
  61. package/controls/Icon/Icon.js +79 -0
  62. package/controls/Icon/index.d.ts +1 -0
  63. package/controls/Icon/index.js +1 -0
  64. package/controls/Key/Key.d.ts +22 -0
  65. package/controls/Key/Key.js +74 -0
  66. package/controls/Key/index.d.ts +1 -0
  67. package/controls/Key/index.js +1 -0
  68. package/controls/LinearChart/LinearChart.d.ts +31 -0
  69. package/controls/LinearChart/LinearChart.js +58 -0
  70. package/controls/ListView/Body.d.ts +8 -0
  71. package/controls/ListView/Body.js +24 -0
  72. package/controls/ListView/Column.d.ts +55 -0
  73. package/controls/ListView/Column.js +8 -0
  74. package/controls/ListView/ColumnsManager/ColumnDraggable.d.ts +11 -0
  75. package/controls/ListView/ColumnsManager/ColumnDraggable.js +83 -0
  76. package/controls/ListView/ColumnsManager/ColumnsManager.d.ts +12 -0
  77. package/controls/ListView/ColumnsManager/ColumnsManager.js +63 -0
  78. package/controls/ListView/ColumnsManager/OrderColumns.d.ts +11 -0
  79. package/controls/ListView/ColumnsManager/OrderColumns.js +62 -0
  80. package/controls/ListView/ColumnsManager/SourceColumns.d.ts +10 -0
  81. package/controls/ListView/ColumnsManager/SourceColumns.js +45 -0
  82. package/controls/ListView/Ghost.d.ts +9 -0
  83. package/controls/ListView/Ghost.js +52 -0
  84. package/controls/ListView/Header.d.ts +12 -0
  85. package/controls/ListView/Header.js +35 -0
  86. package/controls/ListView/HeaderButton.d.ts +8 -0
  87. package/controls/ListView/HeaderButton.js +8 -0
  88. package/controls/ListView/HeaderCell.d.ts +20 -0
  89. package/controls/ListView/HeaderCell.js +47 -0
  90. package/controls/ListView/IListViewProps.d.ts +105 -0
  91. package/controls/ListView/IListViewProps.js +1 -0
  92. package/controls/ListView/ListView.d.ts +20 -0
  93. package/controls/ListView/ListView.js +97 -0
  94. package/controls/ListView/NoData.d.ts +19 -0
  95. package/controls/ListView/NoData.js +30 -0
  96. package/controls/ListView/SortButton.d.ts +16 -0
  97. package/controls/ListView/SortButton.js +26 -0
  98. package/controls/ListView/Table.d.ts +18 -0
  99. package/controls/ListView/Table.js +99 -0
  100. package/controls/ListView/Total.d.ts +9 -0
  101. package/controls/ListView/Total.js +28 -0
  102. package/controls/ListView/sortItems.d.ts +6 -0
  103. package/controls/ListView/sortItems.js +35 -0
  104. package/controls/Mouse/Mouse.d.ts +38 -0
  105. package/controls/Mouse/Mouse.js +51 -0
  106. package/controls/Mouse/index.d.ts +1 -0
  107. package/controls/Mouse/index.js +1 -0
  108. package/controls/PrimaryButton/PrimaryButton.d.ts +63 -0
  109. package/controls/PrimaryButton/PrimaryButton.js +83 -0
  110. package/controls/PrimaryButton/index.d.ts +1 -0
  111. package/controls/PrimaryButton/index.js +1 -0
  112. package/controls/Progress/Progress.d.ts +35 -0
  113. package/controls/Progress/Progress.js +49 -0
  114. package/controls/SecondaryButton/SecondaryButton.d.ts +58 -0
  115. package/controls/SecondaryButton/SecondaryButton.js +73 -0
  116. package/controls/SecondaryButton/index.d.ts +1 -0
  117. package/controls/SecondaryButton/index.js +1 -0
  118. package/controls/TabBar/Tab.d.ts +21 -0
  119. package/controls/TabBar/Tab.js +25 -0
  120. package/controls/TabBar/TabBar.d.ts +34 -0
  121. package/controls/TabBar/TabBar.js +134 -0
  122. package/controls/TabBar/Underliner.d.ts +7 -0
  123. package/controls/TabBar/Underliner.js +27 -0
  124. package/controls/TabBar/index.d.ts +1 -0
  125. package/controls/TabBar/index.js +1 -0
  126. package/controls/TertiaryButton/TertiaryButton.d.ts +28 -0
  127. package/controls/TertiaryButton/TertiaryButton.js +65 -0
  128. package/controls/TertiaryButton/index.d.ts +1 -0
  129. package/controls/TertiaryButton/index.js +1 -0
  130. package/controls/View/View.d.ts +35 -0
  131. package/controls/View/View.js +58 -0
  132. package/formatters/Date/DateTime.d.ts +45 -0
  133. package/formatters/Date/DateTime.js +64 -0
  134. package/formatters/Date/elements/Custom.d.ts +18 -0
  135. package/formatters/Date/elements/Custom.js +22 -0
  136. package/formatters/Date/elements/Distance.d.ts +24 -0
  137. package/formatters/Date/elements/Distance.js +45 -0
  138. package/formatters/Date/elements/LongDate.d.ts +17 -0
  139. package/formatters/Date/elements/LongDate.js +11 -0
  140. package/formatters/Date/elements/LongDateTime.d.ts +14 -0
  141. package/formatters/Date/elements/LongDateTime.js +10 -0
  142. package/formatters/Date/elements/LongTime.d.ts +14 -0
  143. package/formatters/Date/elements/LongTime.js +10 -0
  144. package/formatters/Date/elements/ShortDate.d.ts +14 -0
  145. package/formatters/Date/elements/ShortDate.js +10 -0
  146. package/formatters/Date/elements/ShortDateTime.d.ts +14 -0
  147. package/formatters/Date/elements/ShortDateTime.js +10 -0
  148. package/formatters/Date/elements/ShortTime.d.ts +18 -0
  149. package/formatters/Date/elements/ShortTime.js +10 -0
  150. package/formatters/Date/elements/toDate.d.ts +2 -0
  151. package/formatters/Date/elements/toDate.js +13 -0
  152. package/formatters/Filesize/Filesize.d.ts +29 -0
  153. package/formatters/Filesize/Filesize.js +54 -0
  154. package/formatters/GIS/Latitude.d.ts +23 -0
  155. package/formatters/GIS/Latitude.js +13 -0
  156. package/formatters/GIS/Longitude.d.ts +23 -0
  157. package/formatters/GIS/Longitude.js +13 -0
  158. package/formatters/GIS/index.d.ts +2 -0
  159. package/formatters/GIS/index.js +2 -0
  160. package/formatters/GIS/toDMS.d.ts +2 -0
  161. package/formatters/GIS/toDMS.js +16 -0
  162. package/formatters/Highlight/Highlight.d.ts +22 -0
  163. package/formatters/Highlight/Highlight.js +32 -0
  164. package/formatters/Highlight/index.d.ts +1 -0
  165. package/formatters/Highlight/index.js +1 -0
  166. package/formatters/Human/Human.d.ts +18 -0
  167. package/formatters/Human/Human.js +34 -0
  168. package/formatters/Human/index.d.ts +1 -0
  169. package/formatters/Human/index.js +1 -0
  170. package/formatters/Number/Number.d.ts +24 -0
  171. package/formatters/Number/Number.js +36 -0
  172. package/formatters/Number/index.d.ts +1 -0
  173. package/formatters/Number/index.js +1 -0
  174. package/helper/DMS.d.ts +22 -0
  175. package/helper/DMS.js +46 -0
  176. package/helper/HslColor.d.ts +11 -0
  177. package/helper/HslColor.js +47 -0
  178. package/helper/RgbColor.d.ts +43 -0
  179. package/helper/RgbColor.js +162 -0
  180. package/helper/SizeHelper.d.ts +10 -0
  181. package/helper/SizeHelper.js +56 -0
  182. package/helper/darken.d.ts +8 -0
  183. package/helper/darken.js +18 -0
  184. package/helper/guard.d.ts +5 -0
  185. package/helper/guard.js +7 -0
  186. package/helper/lighten.d.ts +8 -0
  187. package/helper/lighten.js +11 -0
  188. package/helper/nameToHex.d.ts +6 -0
  189. package/helper/nameToHex.js +163 -0
  190. package/inputs/DateInput/Body.d.ts +34 -0
  191. package/inputs/DateInput/Body.js +50 -0
  192. package/inputs/DateInput/Calendar.d.ts +15 -0
  193. package/inputs/DateInput/Calendar.js +60 -0
  194. package/inputs/DateInput/DateInput.d.ts +73 -0
  195. package/inputs/DateInput/DateInput.js +143 -0
  196. package/inputs/DateInput/Day.d.ts +32 -0
  197. package/inputs/DateInput/Day.js +33 -0
  198. package/inputs/DateInput/InfiniteList.d.ts +26 -0
  199. package/inputs/DateInput/InfiniteList.js +87 -0
  200. package/inputs/DateInput/Nav.d.ts +11 -0
  201. package/inputs/DateInput/Nav.js +24 -0
  202. package/inputs/DateInput/Navbar.d.ts +16 -0
  203. package/inputs/DateInput/Navbar.js +33 -0
  204. package/inputs/DateInput/NumericInput.d.ts +14 -0
  205. package/inputs/DateInput/NumericInput.js +48 -0
  206. package/inputs/DateInput/Selector.d.ts +47 -0
  207. package/inputs/DateInput/Selector.js +55 -0
  208. package/inputs/DateInput/SimpleList.d.ts +19 -0
  209. package/inputs/DateInput/SimpleList.js +31 -0
  210. package/inputs/Dropdown/Body.d.ts +25 -0
  211. package/inputs/Dropdown/Body.js +14 -0
  212. package/inputs/Dropdown/Column.d.ts +21 -0
  213. package/inputs/Dropdown/Column.js +6 -0
  214. package/inputs/Dropdown/Dropdown.d.ts +136 -0
  215. package/inputs/Dropdown/Dropdown.js +446 -0
  216. package/inputs/Dropdown/Selection.d.ts +11 -0
  217. package/inputs/Dropdown/Selection.js +23 -0
  218. package/inputs/Dropdown/Selector.d.ts +29 -0
  219. package/inputs/Dropdown/Selector.js +16 -0
  220. package/inputs/Editor/Editor.d.ts +45 -0
  221. package/inputs/Editor/Editor.js +60 -0
  222. package/inputs/Editor/buttons/BoldButton.d.ts +7 -0
  223. package/inputs/Editor/buttons/BoldButton.js +7 -0
  224. package/inputs/Editor/buttons/BulletListButton.d.ts +7 -0
  225. package/inputs/Editor/buttons/BulletListButton.js +7 -0
  226. package/inputs/Editor/buttons/CodeBlockButton.d.ts +7 -0
  227. package/inputs/Editor/buttons/CodeBlockButton.js +7 -0
  228. package/inputs/Editor/buttons/CodeButton.d.ts +7 -0
  229. package/inputs/Editor/buttons/CodeButton.js +7 -0
  230. package/inputs/Editor/buttons/ItalicButton.d.ts +7 -0
  231. package/inputs/Editor/buttons/ItalicButton.js +7 -0
  232. package/inputs/Editor/buttons/OrderedListButton.d.ts +7 -0
  233. package/inputs/Editor/buttons/OrderedListButton.js +7 -0
  234. package/inputs/Editor/buttons/StrikethroughButton.d.ts +7 -0
  235. package/inputs/Editor/buttons/StrikethroughButton.js +7 -0
  236. package/inputs/Editor/menu/MenuBar.d.ts +9 -0
  237. package/inputs/Editor/menu/MenuBar.js +44 -0
  238. package/inputs/Editor/menu/MenuButton.d.ts +35 -0
  239. package/inputs/Editor/menu/MenuButton.js +34 -0
  240. package/inputs/Editor/menu/MenuSeparator.d.ts +7 -0
  241. package/inputs/Editor/menu/MenuSeparator.js +24 -0
  242. package/inputs/Input/Clear.d.ts +7 -0
  243. package/inputs/Input/Clear.js +14 -0
  244. package/inputs/Input/Input.d.ts +133 -0
  245. package/inputs/Input/Input.js +64 -0
  246. package/inputs/Input/InputWrapper.d.ts +23 -0
  247. package/inputs/Input/InputWrapper.js +57 -0
  248. package/inputs/Input/index.d.ts +1 -0
  249. package/inputs/Input/index.js +1 -0
  250. package/inputs/Selector/ISelectorProps.d.ts +29 -0
  251. package/inputs/Selector/ISelectorProps.js +1 -0
  252. package/inputs/Selector/Selector.d.ts +29 -0
  253. package/inputs/Selector/Selector.js +77 -0
  254. package/inputs/Selector/index.d.ts +1 -0
  255. package/inputs/Selector/index.js +1 -0
  256. package/inputs/Selector/widgets/Checkbox.d.ts +6 -0
  257. package/inputs/Selector/widgets/Checkbox.js +29 -0
  258. package/inputs/Selector/widgets/Toggle.d.ts +6 -0
  259. package/inputs/Selector/widgets/Toggle.js +24 -0
  260. package/inputs/Slider/Slider.d.ts +63 -0
  261. package/inputs/Slider/Slider.js +198 -0
  262. package/inputs/Textarea/Textarea.d.ts +79 -0
  263. package/inputs/Textarea/Textarea.js +65 -0
  264. package/main.js +32 -0
  265. package/map/Map/Map.d.ts +47 -0
  266. package/map/Map/Map.js +221 -0
  267. package/map/Map/index.d.ts +1 -0
  268. package/map/Map/index.js +1 -0
  269. package/map/PositionsManager/PositionBox.d.ts +14 -0
  270. package/map/PositionsManager/PositionBox.js +86 -0
  271. package/map/PositionsManager/PositionsManager.d.ts +27 -0
  272. package/map/PositionsManager/PositionsManager.js +99 -0
  273. package/map/controls/CompassButton/CompassButton.d.ts +33 -0
  274. package/map/controls/CompassButton/CompassButton.js +88 -0
  275. package/map/controls/FullscreenButton/FullscreenButton.d.ts +21 -0
  276. package/map/controls/FullscreenButton/FullscreenButton.js +62 -0
  277. package/map/controls/Geocoder/Geocoder.d.ts +49 -0
  278. package/map/controls/Geocoder/Geocoder.js +179 -0
  279. package/map/controls/Geocoder/GeocoderApi.d.ts +59 -0
  280. package/map/controls/Geocoder/GeocoderApi.js +68 -0
  281. package/map/controls/Geocoder/GeocoderEntry.d.ts +15 -0
  282. package/map/controls/Geocoder/GeocoderEntry.js +18 -0
  283. package/map/controls/Geocoder/GeocoderList.d.ts +10 -0
  284. package/map/controls/Geocoder/GeocoderList.js +18 -0
  285. package/map/controls/Geocoder/GeocoderSelector.d.ts +16 -0
  286. package/map/controls/Geocoder/GeocoderSelector.js +25 -0
  287. package/map/controls/Graticule/Graticule.d.ts +35 -0
  288. package/map/controls/Graticule/Graticule.js +142 -0
  289. package/map/controls/MapLoader/MapLoader.d.ts +33 -0
  290. package/map/controls/MapLoader/MapLoader.js +73 -0
  291. package/map/controls/ScaleControl/ScaleControl.d.ts +24 -0
  292. package/map/controls/ScaleControl/ScaleControl.js +107 -0
  293. package/map/controls/ZoomInButton/ZoomInButton.d.ts +19 -0
  294. package/map/controls/ZoomInButton/ZoomInButton.js +56 -0
  295. package/map/controls/ZoomOutButton/ZoomOutButton.d.ts +19 -0
  296. package/map/controls/ZoomOutButton/ZoomOutButton.js +56 -0
  297. package/map/controls/base/MapButton/Hint.d.ts +17 -0
  298. package/map/controls/base/MapButton/Hint.js +34 -0
  299. package/map/controls/base/MapButton/MapButton.d.ts +46 -0
  300. package/map/controls/base/MapButton/MapButton.js +71 -0
  301. package/map/controls/base/MapButton/index.d.ts +1 -0
  302. package/map/controls/base/MapButton/index.js +1 -0
  303. package/map/controls/base/MapButtonGroup/MapButtonGroup.d.ts +17 -0
  304. package/map/controls/base/MapButtonGroup/MapButtonGroup.js +24 -0
  305. package/map/controls/base/MapControl/MapControl.d.ts +36 -0
  306. package/map/controls/base/MapControl/MapControl.js +77 -0
  307. package/map/controls/base/MapControl/index.d.ts +1 -0
  308. package/map/controls/base/MapControl/index.js +1 -0
  309. package/map/layers/ClusterLayer/ClusterLayer.d.ts +79 -0
  310. package/map/layers/ClusterLayer/ClusterLayer.js +118 -0
  311. package/map/layers/HtmlMarkerLayer/HtmlMarkerLayer.d.ts +51 -0
  312. package/map/layers/HtmlMarkerLayer/HtmlMarkerLayer.js +151 -0
  313. package/map/layers/InterpolationLayer/ContoursFragmentShader.d.ts +2 -0
  314. package/map/layers/InterpolationLayer/ContoursFragmentShader.js +2 -0
  315. package/map/layers/InterpolationLayer/ContoursVertexShader.d.ts +2 -0
  316. package/map/layers/InterpolationLayer/ContoursVertexShader.js +2 -0
  317. package/map/layers/InterpolationLayer/IGradientStop.d.ts +5 -0
  318. package/map/layers/InterpolationLayer/IGradientStop.js +1 -0
  319. package/map/layers/InterpolationLayer/InterpolationLayer.d.ts +35 -0
  320. package/map/layers/InterpolationLayer/InterpolationLayer.js +256 -0
  321. package/map/layers/InterpolationLayer/LevelsFragmentShader.d.ts +2 -0
  322. package/map/layers/InterpolationLayer/LevelsFragmentShader.js +2 -0
  323. package/map/layers/InterpolationLayer/LevelsVertexShader.d.ts +2 -0
  324. package/map/layers/InterpolationLayer/LevelsVertexShader.js +2 -0
  325. package/map/layers/ParticlesLayer/ParticlesFragmentShader.d.ts +2 -0
  326. package/map/layers/ParticlesLayer/ParticlesFragmentShader.js +2 -0
  327. package/map/layers/ParticlesLayer/ParticlesLayer.d.ts +40 -0
  328. package/map/layers/ParticlesLayer/ParticlesLayer.js +337 -0
  329. package/map/layers/ParticlesLayer/ParticlesVertexShader.d.ts +2 -0
  330. package/map/layers/ParticlesLayer/ParticlesVertexShader.js +2 -0
  331. package/map/layers/ParticlesLayer/UVFragmentShader.d.ts +2 -0
  332. package/map/layers/ParticlesLayer/UVFragmentShader.js +2 -0
  333. package/map/layers/ParticlesLayer/UVVertexShader.d.ts +2 -0
  334. package/map/layers/ParticlesLayer/UVVertexShader.js +2 -0
  335. package/map/markers/ClusterMarker/ClusterMarker.d.ts +36 -0
  336. package/map/markers/ClusterMarker/ClusterMarker.js +99 -0
  337. package/map/markers/ClusterMarker/index.d.ts +1 -0
  338. package/map/markers/ClusterMarker/index.js +1 -0
  339. package/map/markers/RiskMarker/RiskMarker.d.ts +22 -0
  340. package/map/markers/RiskMarker/RiskMarker.js +61 -0
  341. package/modules/MainMenu/Item.d.ts +42 -0
  342. package/modules/MainMenu/Item.js +94 -0
  343. package/modules/MainMenu/MainMenu.d.ts +20 -0
  344. package/modules/MainMenu/MainMenu.js +41 -0
  345. package/modules/MainMenu/index.d.ts +1 -0
  346. package/modules/MainMenu/index.js +1 -0
  347. package/modules/Root/Content.d.ts +16 -0
  348. package/modules/Root/Content.js +25 -0
  349. package/modules/Root/Overlay.d.ts +23 -0
  350. package/modules/Root/Overlay.js +33 -0
  351. package/modules/Root/Root.d.ts +7 -0
  352. package/modules/Root/Root.js +45 -0
  353. package/modules/Root/Shader.d.ts +15 -0
  354. package/modules/Root/Shader.js +24 -0
  355. package/modules/Root/Sidebar.d.ts +13 -0
  356. package/modules/Root/Sidebar.js +24 -0
  357. package/modules/Root/stories/SampleContent.d.ts +7 -0
  358. package/modules/Root/stories/SampleContent.js +44 -0
  359. package/package.json +64 -0
  360. package/services/Dialog/AlertDialog.d.ts +31 -0
  361. package/services/Dialog/AlertDialog.js +29 -0
  362. package/services/Dialog/ConfirmDialog.d.ts +34 -0
  363. package/services/Dialog/ConfirmDialog.js +30 -0
  364. package/services/Dialog/Dialog.d.ts +91 -0
  365. package/services/Dialog/Dialog.js +92 -0
  366. package/services/Dialog/DialogBackground.d.ts +7 -0
  367. package/services/Dialog/DialogBackground.js +12 -0
  368. package/services/Dialog/DialogContent.d.ts +25 -0
  369. package/services/Dialog/DialogContent.js +38 -0
  370. package/services/Dialog/DialogFooter.d.ts +24 -0
  371. package/services/Dialog/DialogFooter.js +50 -0
  372. package/services/Dialog/DialogHeader.d.ts +18 -0
  373. package/services/Dialog/DialogHeader.js +36 -0
  374. package/services/Dialog/DialogWindow.d.ts +13 -0
  375. package/services/Dialog/DialogWindow.js +12 -0
  376. package/services/Dialog/XhrDialog.d.ts +34 -0
  377. package/services/Dialog/XhrDialog.js +321 -0
  378. package/services/Toast/IToastMessage.d.ts +10 -0
  379. package/services/Toast/IToastMessage.js +1 -0
  380. package/services/Toast/IToastProps.d.ts +23 -0
  381. package/services/Toast/IToastProps.js +1 -0
  382. package/services/Toast/Toast.d.ts +21 -0
  383. package/services/Toast/Toast.js +79 -0
  384. package/services/Toast/ToastContainer.d.ts +40 -0
  385. package/services/Toast/ToastContainer.js +65 -0
  386. package/services/Toast/ToastContext.d.ts +22 -0
  387. package/services/Toast/ToastContext.js +7 -0
  388. package/services/Toast/ToastProvider.d.ts +19 -0
  389. package/services/Toast/ToastProvider.js +67 -0
  390. package/services/Toast/index.d.ts +2 -0
  391. package/services/Toast/index.js +2 -0
  392. package/services/Toast/useToast.d.ts +5 -0
  393. package/services/Toast/useToast.js +9 -0
  394. package/spritemap.svg +1 -0
  395. package/styles/NormalTheme.d.ts +3 -0
  396. package/styles/NormalTheme.js +65 -0
  397. package/styles/StyleBase.d.ts +2 -0
  398. package/styles/StyleBase.js +8 -0
  399. package/styles/StyleReset.d.ts +2 -0
  400. package/styles/StyleReset.js +8 -0
  401. package/svg/editor/index.d.ts +10 -0
  402. package/svg/editor/index.js +11 -0
  403. package/svg/file/index.d.ts +5 -0
  404. package/svg/file/index.js +6 -0
  405. package/svg/icons/index.d.ts +36 -0
  406. package/svg/icons/index.js +37 -0
  407. package/svg/index.d.ts +11 -0
  408. package/svg/index.js +5 -0
  409. package/svg/menu/index.d.ts +8 -0
  410. package/svg/menu/index.js +9 -0
@@ -0,0 +1,151 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import * as React from 'react';
13
+ import * as ReactDOM from 'react-dom/client';
14
+ import { Layer, useMap } from 'react-map-gl';
15
+ import { Marker } from 'mapbox-gl';
16
+ /**
17
+ * The `HtmlMarkerLayer` manages HTML markers on a map. HTML markers are far slower
18
+ * than OpenGL layers, but much more flexible: with SVG, any shape of marker can
19
+ * be designed, and the markers can easily be made responsive to hover.
20
+ *
21
+ * The `HtmlMarkerLayer` keeps an internal cache, creating and rendering markers only
22
+ * when they are visible in the map viewport. This is a suitable solution for clusters
23
+ * (where by definition there are never very many icons in the viewport), or when
24
+ * there are simply not _that_ many markers: up to a few hundred in the viewport is the
25
+ * upper limit.
26
+ *
27
+ * The `HtmlMarkerLayer` must be placed inside a GeoJSON `Source`. In that source,
28
+ * each feature must have a unique ID (passed to this layer as the `idField`), which
29
+ * is used to tell features apart. When features are refreshed, it is imported that
30
+ * they all get new IDs so that old markers get removed correctly.
31
+ *
32
+ * The `HtmlMarkerLayer` component takes a _function child_. This function accepts
33
+ * a `props` object, which will be the properties from each GeoJSON feature for which
34
+ * a marker is rendered.
35
+ *
36
+ * ```tsx
37
+ * // featureCollection has a property "id" with unique values
38
+ * <Source id="mysource" type="geojson" data={featureCollection}>
39
+ * <HtmlMarkerLayer sourceId="mysource" idField="id">
40
+ * {(markerProps) => <MyMarkerComponent color="gold" radius={45} {...markerProps}/>
41
+ * </HtmlMarkerLayer>
42
+ * </Source>
43
+ * ```
44
+ */
45
+ var HtmlMarkerLayer = function (props) {
46
+ var map = useMap().current;
47
+ // Can't call props.children directly from map render event handler.
48
+ // Make a ref copy:
49
+ var children = React.useRef(props.children);
50
+ var markers = React.useRef({});
51
+ var markersOnScreen = React.useRef({});
52
+ // Add render event to map, and remove it when this component
53
+ // is unmounted. Whenever the map renders, we must refresh
54
+ // all markers.
55
+ React.useEffect(function () {
56
+ map.on('render', updateMarkers);
57
+ return function () { map.off('render', updateMarkers); };
58
+ }, []);
59
+ // If the child function changes, then update the children ref copy.
60
+ // Also clear map and repaint it, because child component props may
61
+ // have changed.
62
+ React.useEffect(function () {
63
+ children.current = props.children;
64
+ for (var id in markersOnScreen.current) {
65
+ markersOnScreen.current[id].remove();
66
+ }
67
+ markers.current = {};
68
+ markersOnScreen.current = {};
69
+ map.triggerRepaint();
70
+ }, [props.children]);
71
+ // When component is unmounted, remove all its markers from the map.
72
+ React.useEffect(function () {
73
+ return function () {
74
+ for (var id in markersOnScreen.current) {
75
+ markersOnScreen.current[id].remove();
76
+ }
77
+ map.triggerRepaint();
78
+ };
79
+ }, []);
80
+ //
81
+ // Given a native or React component and props, turn it into an
82
+ // HTML element. Return this element.
83
+ //
84
+ var createHtmlElementFromReactNode = function (latlngfeatureProps) {
85
+ // Don't render anything if there is no child.
86
+ if (!children.current)
87
+ return null;
88
+ // Get the first child.
89
+ var elem = children.current(latlngfeatureProps);
90
+ // Render child.
91
+ var el = document.createElement('div');
92
+ var root = ReactDOM.createRoot(el);
93
+ root.render(elem);
94
+ return el;
95
+ };
96
+ //
97
+ // Calculate which markers are offscreen, and remove them.
98
+ // Add new markers for markers which are now onscreen.
99
+ var updateMarkers = function () {
100
+ // Only run after GeoJSON is loaded:
101
+ if (!map.getSource(props.sourceId))
102
+ return;
103
+ if (!map.isSourceLoaded(props.sourceId))
104
+ return;
105
+ // Retrieve all features that are currently rendered on a visible map tile,
106
+ // thus excluding everything that's off-screen, for speed. The use of
107
+ // querySourceFeatures requires that at least one Layer exists, which is
108
+ // why we have layer that renders only invisible circles.
109
+ // querySourceFeatures often results duplicates due to buffering.
110
+ // Remove these duplicates by looking at each feature's unique ID.
111
+ var seen = {};
112
+ var features = map.querySourceFeatures(props.sourceId).filter(function (f) {
113
+ var id = f.properties[props.idField];
114
+ return seen.hasOwnProperty(id) ? false : (seen[id] = true);
115
+ });
116
+ // For every marker on the screen, create an HTML marker (if we didn't yet),
117
+ // and add it to the map if it's not there already
118
+ var newMarkers = {};
119
+ for (var _i = 0, features_1 = features; _i < features_1.length; _i++) {
120
+ var feature = features_1[_i];
121
+ var coords = feature.geometry.coordinates;
122
+ var fprops = feature.properties;
123
+ // if (!props.cluster) continue;
124
+ var id = fprops[props.idField];
125
+ // Is there a marker for this feature?
126
+ var marker = markers.current[id];
127
+ // If not, create one:
128
+ if (!marker) {
129
+ var el = createHtmlElementFromReactNode(__assign({ longitude: coords[0], latitude: coords[1] }, fprops));
130
+ marker = markers.current[id] = new Marker({
131
+ element: el
132
+ });
133
+ marker.setLngLat(coords);
134
+ }
135
+ newMarkers[id] = marker;
136
+ if (!markersOnScreen.current[id])
137
+ marker.addTo(map.getMap());
138
+ }
139
+ // for every marker we've added previously, remove those
140
+ // that are no longer visible:
141
+ for (var id in markersOnScreen.current) {
142
+ if (!newMarkers[id])
143
+ markersOnScreen.current[id].remove();
144
+ }
145
+ markersOnScreen.current = newMarkers;
146
+ };
147
+ // querySourceFeatures will only work if we have a layer, even
148
+ // though it's empty.
149
+ return (React.createElement(Layer, { source: props.sourceId, type: "circle", paint: { "circle-radius": 0 } }));
150
+ };
151
+ export { HtmlMarkerLayer };
@@ -0,0 +1,2 @@
1
+ declare const ContoursFragmentShader = " \n #ifdef GL_ES\n precision mediump float;\n #endif\n\n // Screen resolution is needed to convert gl_FragCoord to texture coordinate.\n uniform vec2 u_resolution;\n uniform sampler2D dataTexture;\n uniform int levels;\n uniform vec4 u_contourColor;\n uniform float u_gradientStops[12];\n uniform vec4 u_gradientColors[12];\n\n //\n // Given a value, find its corresponding color in the gradient stops.\n //\n vec4 getGradientColor(float position) {\n // Find left and right stop:\n float left = -1.0;\n float right = 99.0;\n vec4 leftColor;\n vec4 rightColor;\n\n for(int i = 0; i < 12; i++) {\n if (u_gradientStops[i] <= position) {\n left = u_gradientStops[i]; \n leftColor = u_gradientColors[i];\n } else break;\n }\n\n for(int i = 12 - 1; i >= 0; i--) {\n if (u_gradientStops[i] >= position) {\n right = u_gradientStops[i]; \n rightColor = u_gradientColors[i];\n } else break;\n }\n\n // Distance between stops:\n float width = right - left;\n // Distance from left stop:\n float dist = position - left;\n // Right stop weight:\n float weight;\n if(dist == 0.0) {\n weight = dist;\n } else {\n weight = dist / width;\n }\n\n float r = leftColor.x + (rightColor.x - leftColor.x) * weight;\n float g = leftColor.y + (rightColor.y - leftColor.y) * weight;\n float b = leftColor.z + (rightColor.z - leftColor.z) * weight;\n float a = leftColor.w + (rightColor.w - leftColor.w) * weight;\n return vec4(r, g, b, a); \n } \n\n //\n // Returns texture color at pixelCoord.\n //\n vec4 texelFetch(sampler2D tex, vec2 pixelCoord) {\n return texture2D(tex, pixelCoord / u_resolution);\n }\n\n //\n // Returns texture pixel shade, in a number of levels:\n int getShade(sampler2D tex, vec2 pixelCoord, float levels) {\n vec4 color = texelFetch(tex, pixelCoord);\n // If the color is transparent, return -1, so that there's always a contour line.\n if(color.w == 0.0) return -1;\n // Return greyscale shade in levels:\n return int(color.x * levels);\n }\n\n bool hasDifferentShade() {\n float dist = float(levels);\n\n // Get shades of input color and surrounding pixels:\n int shade = getShade(dataTexture, gl_FragCoord.xy, dist);\n int up = getShade(dataTexture, vec2(gl_FragCoord.x, gl_FragCoord.y - 1.0), dist);\n int down = getShade(dataTexture, vec2(gl_FragCoord.x, gl_FragCoord.y + 1.0), dist);\n int left = getShade(dataTexture, vec2(gl_FragCoord.x - 1.0, gl_FragCoord.y), dist);\n int right = getShade(dataTexture, vec2(gl_FragCoord.x + 1.0, gl_FragCoord.y), dist);\n return (up != shade || down != shade || left != shade || right != shade);\n }\n\n void main() {\n // Get input color:\n vec4 color = texelFetch(dataTexture, gl_FragCoord.xy);\n\n // If input is transparent, draw nothing.\n if(color.w == 0.0) return;\n\n // If the shade of the current pixel is different from any of its surrounding\n // pixels by at least a shade, then draw contour line color.\n if(levels != 0 && hasDifferentShade()) {\n gl_FragColor = u_contourColor;\n } \n // Otherwise draw the input color.\n else {\n gl_FragColor = getGradientColor(color.x);\n }\n }\n";
2
+ export { ContoursFragmentShader };
@@ -0,0 +1,2 @@
1
+ var ContoursFragmentShader = /*glsl*/ " \n #ifdef GL_ES\n precision mediump float;\n #endif\n\n // Screen resolution is needed to convert gl_FragCoord to texture coordinate.\n uniform vec2 u_resolution;\n uniform sampler2D dataTexture;\n uniform int levels;\n uniform vec4 u_contourColor;\n uniform float u_gradientStops[12];\n uniform vec4 u_gradientColors[12];\n\n //\n // Given a value, find its corresponding color in the gradient stops.\n //\n vec4 getGradientColor(float position) {\n // Find left and right stop:\n float left = -1.0;\n float right = 99.0;\n vec4 leftColor;\n vec4 rightColor;\n\n for(int i = 0; i < 12; i++) {\n if (u_gradientStops[i] <= position) {\n left = u_gradientStops[i]; \n leftColor = u_gradientColors[i];\n } else break;\n }\n\n for(int i = 12 - 1; i >= 0; i--) {\n if (u_gradientStops[i] >= position) {\n right = u_gradientStops[i]; \n rightColor = u_gradientColors[i];\n } else break;\n }\n\n // Distance between stops:\n float width = right - left;\n // Distance from left stop:\n float dist = position - left;\n // Right stop weight:\n float weight;\n if(dist == 0.0) {\n weight = dist;\n } else {\n weight = dist / width;\n }\n\n float r = leftColor.x + (rightColor.x - leftColor.x) * weight;\n float g = leftColor.y + (rightColor.y - leftColor.y) * weight;\n float b = leftColor.z + (rightColor.z - leftColor.z) * weight;\n float a = leftColor.w + (rightColor.w - leftColor.w) * weight;\n return vec4(r, g, b, a); \n } \n\n //\n // Returns texture color at pixelCoord.\n //\n vec4 texelFetch(sampler2D tex, vec2 pixelCoord) {\n return texture2D(tex, pixelCoord / u_resolution);\n }\n\n //\n // Returns texture pixel shade, in a number of levels:\n int getShade(sampler2D tex, vec2 pixelCoord, float levels) {\n vec4 color = texelFetch(tex, pixelCoord);\n // If the color is transparent, return -1, so that there's always a contour line.\n if(color.w == 0.0) return -1;\n // Return greyscale shade in levels:\n return int(color.x * levels);\n }\n\n bool hasDifferentShade() {\n float dist = float(levels);\n\n // Get shades of input color and surrounding pixels:\n int shade = getShade(dataTexture, gl_FragCoord.xy, dist);\n int up = getShade(dataTexture, vec2(gl_FragCoord.x, gl_FragCoord.y - 1.0), dist);\n int down = getShade(dataTexture, vec2(gl_FragCoord.x, gl_FragCoord.y + 1.0), dist);\n int left = getShade(dataTexture, vec2(gl_FragCoord.x - 1.0, gl_FragCoord.y), dist);\n int right = getShade(dataTexture, vec2(gl_FragCoord.x + 1.0, gl_FragCoord.y), dist);\n return (up != shade || down != shade || left != shade || right != shade);\n }\n\n void main() {\n // Get input color:\n vec4 color = texelFetch(dataTexture, gl_FragCoord.xy);\n\n // If input is transparent, draw nothing.\n if(color.w == 0.0) return;\n\n // If the shade of the current pixel is different from any of its surrounding\n // pixels by at least a shade, then draw contour line color.\n if(levels != 0 && hasDifferentShade()) {\n gl_FragColor = u_contourColor;\n } \n // Otherwise draw the input color.\n else {\n gl_FragColor = getGradientColor(color.x);\n }\n }\n";
2
+ export { ContoursFragmentShader };
@@ -0,0 +1,2 @@
1
+ declare const ContoursVertexShader = "\n uniform mat4 u_matrix;\n attribute vec2 a_pos;\n\n // Vertex shader merely sets vertex position. Fragment shader \n // does all the work.\n void main() {\n gl_Position = u_matrix * vec4(a_pos, 0.0, 1.0);\n }\n";
2
+ export { ContoursVertexShader };
@@ -0,0 +1,2 @@
1
+ var ContoursVertexShader = /*glsl*/ "\n uniform mat4 u_matrix;\n attribute vec2 a_pos;\n\n // Vertex shader merely sets vertex position. Fragment shader \n // does all the work.\n void main() {\n gl_Position = u_matrix * vec4(a_pos, 0.0, 1.0);\n }\n";
2
+ export { ContoursVertexShader };
@@ -0,0 +1,5 @@
1
+ interface IGradientStop {
2
+ pos: number;
3
+ color: string;
4
+ }
5
+ export { IGradientStop };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,35 @@
1
+ import * as React from 'react';
2
+ import { IGradientStop } from './IGradientStop';
3
+ interface IPoint {
4
+ latitude: number;
5
+ longitude: number;
6
+ value: number;
7
+ }
8
+ interface IProps {
9
+ /**
10
+ * Input data.
11
+ */
12
+ data: IPoint[];
13
+ /**
14
+ * Gradient stops. A default gradient is preset.
15
+ */
16
+ gradientStops?: IGradientStop[];
17
+ /**
18
+ * Number of contour lines. This is a power of 2, between 2 and 256.
19
+ * If 0, then no contour lines are drawn.
20
+ * @default 0
21
+ */
22
+ levels?: number;
23
+ /**
24
+ * Optional color of contour lines.
25
+ * @default #35ABE2
26
+ */
27
+ contourColor?: string;
28
+ }
29
+ /**
30
+ * An `InterpolationLayer` takes a data array of the form `{ latitude, longitude, value }`. It performs triangulation
31
+ * and draws the data in an OpenGL layer. Optionally, a number of contour `levels` can be set to draw contour lines.
32
+ * Gradient colors are configurable using `gradientStops`.
33
+ */
34
+ declare const InterpolationLayer: ({ levels, contourColor, gradientStops, ...props }: IProps) => React.JSX.Element;
35
+ export { InterpolationLayer };
@@ -0,0 +1,256 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
23
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
24
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
25
+ if (ar || !(i in from)) {
26
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
27
+ ar[i] = from[i];
28
+ }
29
+ }
30
+ return to.concat(ar || Array.prototype.slice.call(from));
31
+ };
32
+ import * as React from 'react';
33
+ import { featureCollection, point } from '@turf/helpers';
34
+ import { MercatorCoordinate } from 'mapbox-gl';
35
+ import { Layer, useMap } from 'react-map-gl';
36
+ import tin from '@turf/tin';
37
+ import { RgbColor } from '../../../helper/RgbColor';
38
+ import { LevelsVertexShader } from './LevelsVertexShader';
39
+ import { LevelsFragmentShader } from './LevelsFragmentShader';
40
+ import { ContoursVertexShader } from './ContoursVertexShader';
41
+ import { ContoursFragmentShader } from './ContoursFragmentShader';
42
+ var TEXTURE_WIDTH = 1024;
43
+ var TEXTURE_HEIGHT = 1024;
44
+ var InterpolationLayerBase = function (props) {
45
+ var map = useMap();
46
+ var levelsProgram = React.useRef(null);
47
+ var contoursProgram = React.useRef(null);
48
+ var levelsBuffer = React.useRef(null);
49
+ var contoursBuffer = React.useRef(null);
50
+ var fbo = React.useRef(null);
51
+ var numTriangles = React.useRef(0);
52
+ var texture = React.useRef(null);
53
+ var _a = React.useState(0), time = _a[0], setTime = _a[1];
54
+ // When properties change, make sure that layer is redrawn.
55
+ // Do this by varying its `key` with the current time.
56
+ React.useEffect(function () {
57
+ setTime(Date.now());
58
+ }, [props.levels, props.data, props.contourColor, props.gradientStops]);
59
+ //
60
+ // Convert IPoint array to polygons.
61
+ //
62
+ var getGeometry = function () {
63
+ var _a;
64
+ // Each poly (triangle) gets a,b,c properties: one depth value for each point.
65
+ // Convert dataset points to Turf feature collection:
66
+ var points = featureCollection(((_a = props.data) !== null && _a !== void 0 ? _a : [])
67
+ .filter(function (dp) { return !isNaN(dp.value); }) // Filter out any NaN values.
68
+ .map(function (dp) {
69
+ return point([dp.longitude, dp.latitude], { 'v': dp.value });
70
+ }));
71
+ var polys = tin(points, 'v');
72
+ return polys;
73
+ };
74
+ //
75
+ // Convert a hex color (e.g. #ff0022) to an [r,g,b,a] array,
76
+ // where r,g,b,a are in the 0.0-1.0 range.
77
+ //
78
+ var colorToRGBA = function (color) {
79
+ var rgb = RgbColor.FromString(color);
80
+ return [rgb.red / 255.0, rgb.green / 255.0, rgb.blue / 255.0, rgb.alpha];
81
+ };
82
+ var createTexture = function (gl) {
83
+ texture.current = gl.createTexture();
84
+ gl.bindTexture(gl.TEXTURE_2D, texture.current);
85
+ // Define size and format of level 0:
86
+ var level = 0;
87
+ var internalFormat = gl.RGBA;
88
+ var border = 0;
89
+ var format = gl.RGBA;
90
+ var type = gl.UNSIGNED_BYTE;
91
+ gl.texImage2D(gl.TEXTURE_2D, level, internalFormat, TEXTURE_WIDTH, TEXTURE_HEIGHT, border, format, type, null);
92
+ // Set filtering to NEAREST so there's no interpolation:
93
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
94
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
95
+ };
96
+ var createFrameBuffer = function (gl) {
97
+ // Create and bind the framebuffer:
98
+ fbo.current = gl.createFramebuffer();
99
+ gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.current);
100
+ // Attach the texture as the first color attachment:
101
+ var attachmentPoint = gl.COLOR_ATTACHMENT0;
102
+ gl.framebufferTexture2D(gl.FRAMEBUFFER, attachmentPoint, gl.TEXTURE_2D, texture.current, 0);
103
+ };
104
+ var createLevelsProgram = function (gl) {
105
+ // create a vertex shader
106
+ var vertexShader = gl.createShader(gl.VERTEX_SHADER);
107
+ gl.shaderSource(vertexShader, LevelsVertexShader);
108
+ gl.compileShader(vertexShader);
109
+ // create a fragment shader
110
+ var fragmentShader = gl.createShader(gl.FRAGMENT_SHADER);
111
+ gl.shaderSource(fragmentShader, LevelsFragmentShader);
112
+ gl.compileShader(fragmentShader);
113
+ // link the two shaders into a WebGL program
114
+ levelsProgram.current = gl.createProgram();
115
+ gl.attachShader(levelsProgram.current, vertexShader);
116
+ gl.attachShader(levelsProgram.current, fragmentShader);
117
+ gl.linkProgram(levelsProgram.current);
118
+ };
119
+ var createContoursProgram = function (gl) {
120
+ // create a vertex shader
121
+ var vertexShader = gl.createShader(gl.VERTEX_SHADER);
122
+ gl.shaderSource(vertexShader, ContoursVertexShader);
123
+ gl.compileShader(vertexShader);
124
+ // create a fragment shader
125
+ var fragmentShader = gl.createShader(gl.FRAGMENT_SHADER);
126
+ gl.shaderSource(fragmentShader, ContoursFragmentShader);
127
+ gl.compileShader(fragmentShader);
128
+ // link the two shaders into a WebGL program
129
+ contoursProgram.current = gl.createProgram();
130
+ gl.attachShader(contoursProgram.current, vertexShader);
131
+ gl.attachShader(contoursProgram.current, fragmentShader);
132
+ gl.linkProgram(contoursProgram.current);
133
+ };
134
+ var onAddLayer = function (map, gl) {
135
+ // AddLayer is only called once.
136
+ if (!gl)
137
+ return;
138
+ var geometry = getGeometry();
139
+ var minValue = Math.min.apply(Math, geometry.features.map(function (f) { return f.properties['a']; }));
140
+ var maxValue = Math.max.apply(Math, geometry.features.map(function (f) { return f.properties['a']; }));
141
+ createLevelsProgram(gl);
142
+ createContoursProgram(gl);
143
+ createTexture(gl);
144
+ createFrameBuffer(gl);
145
+ // Convert dataset to triangle geometry.
146
+ // Result is a list of v1,v2,v3, v1,v2,v3, ...
147
+ // where each vector has (x,y,value).
148
+ var points = [];
149
+ var LAT = 1;
150
+ var LON = 0;
151
+ numTriangles.current = geometry.features.length;
152
+ var deltaValue = maxValue - minValue;
153
+ geometry.features.map(function (feature) {
154
+ var coord = MercatorCoordinate.fromLngLat({ lng: feature.geometry.coordinates[0][0][LON], lat: feature.geometry.coordinates[0][0][LAT] });
155
+ points.push(coord.x, coord.y, (feature.properties['a'] - minValue) / deltaValue);
156
+ coord = MercatorCoordinate.fromLngLat({ lng: feature.geometry.coordinates[0][1][LON], lat: feature.geometry.coordinates[0][1][LAT] });
157
+ points.push(coord.x, coord.y, (feature.properties['b'] - minValue) / deltaValue);
158
+ coord = MercatorCoordinate.fromLngLat({ lng: feature.geometry.coordinates[0][2][LON], lat: feature.geometry.coordinates[0][2][LAT] });
159
+ points.push(coord.x, coord.y, (feature.properties['c'] - minValue) / deltaValue);
160
+ });
161
+ // Create and initialize a WebGLBuffer to store vertex data.
162
+ // Each element will have 3 components (x,y,value).
163
+ levelsBuffer.current = gl.createBuffer();
164
+ gl.bindBuffer(gl.ARRAY_BUFFER, levelsBuffer.current);
165
+ gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(points), gl.STATIC_DRAW);
166
+ // Create a vertex buffer with only two triangles in it, which
167
+ // cover the viewport. TODO: the world, it seems
168
+ contoursBuffer.current = gl.createBuffer();
169
+ gl.bindBuffer(gl.ARRAY_BUFFER, contoursBuffer.current);
170
+ gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([
171
+ 0.0, 0.0, 1.0, 0.0, 1.0, 1.0,
172
+ 0.0, 0.0, 1.0, 1.0, 0.0, 1.0
173
+ ]), gl.STATIC_DRAW);
174
+ };
175
+ var renderLevels = function (gl, matrix) {
176
+ gl.useProgram(levelsProgram.current);
177
+ // Pass a matrix uniform in:
178
+ gl.uniformMatrix4fv(gl.getUniformLocation(levelsProgram.current, 'u_matrix'), false, matrix);
179
+ var aPos = gl.getAttribLocation(levelsProgram.current, 'a_pos');
180
+ var aValue = gl.getAttribLocation(levelsProgram.current, 'a_value');
181
+ gl.bindBuffer(gl.ARRAY_BUFFER, levelsBuffer.current);
182
+ gl.enableVertexAttribArray(aPos);
183
+ gl.enableVertexAttribArray(aValue);
184
+ gl.vertexAttribPointer(aPos, 2, gl.FLOAT, false, 12, 0);
185
+ gl.vertexAttribPointer(aValue, 1, gl.FLOAT, false, 12, 8);
186
+ gl.enable(gl.BLEND);
187
+ gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA);
188
+ gl.drawArrays(gl.TRIANGLES, 0, numTriangles.current * 3);
189
+ };
190
+ var renderContours = function (gl, matrix, width, height) {
191
+ gl.useProgram(contoursProgram.current);
192
+ // Pass a matrix uniform in:
193
+ gl.uniformMatrix4fv(gl.getUniformLocation(contoursProgram.current, 'u_matrix'), false, matrix);
194
+ // Pass in levels for contours:
195
+ gl.uniform1i(gl.getUniformLocation(contoursProgram.current, 'levels'), props.levels);
196
+ // Pass in contours color:
197
+ var clr = colorToRGBA(props.contourColor);
198
+ gl.uniform4f(gl.getUniformLocation(contoursProgram.current, 'u_contourColor'), clr[0], clr[1], clr[2], clr[3]);
199
+ // Stops - fill up to 12 stops by using values > 1 for filler stops.
200
+ // e.g. [0.0, 0.5, 1.0, 2.0....] means that only the first 3 stops are used.
201
+ var stops = __spreadArray([], props.gradientStops.map(function (s) { return s.pos; }), true);
202
+ while (stops.length < 12)
203
+ stops.push(2.0);
204
+ gl.uniform1fv(gl.getUniformLocation(contoursProgram.current, 'u_gradientStops'), new Float32Array(stops));
205
+ var colors = props.gradientStops.map(function (s) { return colorToRGBA(s.color); }).flat();
206
+ gl.uniform4fv(gl.getUniformLocation(contoursProgram.current, 'u_gradientColors'), new Float32Array(colors));
207
+ gl.activeTexture(gl.TEXTURE0);
208
+ gl.bindTexture(gl.TEXTURE_2D, texture.current);
209
+ // Pass data texture in (use texture unit 0):
210
+ gl.uniform1i(gl.getUniformLocation(contoursProgram.current, "dataTexture"), 0);
211
+ // Pass a screen resolution uniform in:
212
+ gl.uniform2f(gl.getUniformLocation(contoursProgram.current, 'u_resolution'), width * window.devicePixelRatio, height * window.devicePixelRatio);
213
+ var aPos = gl.getAttribLocation(contoursProgram.current, 'a_pos');
214
+ gl.bindBuffer(gl.ARRAY_BUFFER, contoursBuffer.current);
215
+ gl.enableVertexAttribArray(aPos);
216
+ gl.vertexAttribPointer(aPos, 2, gl.FLOAT, false, 0, 0);
217
+ gl.enable(gl.BLEND);
218
+ gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA);
219
+ gl.drawArrays(gl.TRIANGLES, 0, 6);
220
+ };
221
+ var onRender = function (gl, matrix, width, height) {
222
+ // Render is called many times while the map is panned/zoomed.
223
+ // You cannot have access to the map though.
224
+ // Bind & clear framebuffer, then render levels into it:
225
+ // It is crucial to set the viewport size to match the resolution of the
226
+ // texture we're rendering into.
227
+ gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.current);
228
+ gl.viewport(0, 0, TEXTURE_WIDTH, TEXTURE_HEIGHT);
229
+ gl.clearColor(0, 0, 0, 0); // clear to transparent
230
+ gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
231
+ renderLevels(gl, matrix);
232
+ // Unbind framebuffer so we're rendering to the screen:
233
+ gl.bindFramebuffer(gl.FRAMEBUFFER, null);
234
+ // Reset the viewport size to equal the map size:
235
+ gl.viewport(0, 0, width * window.devicePixelRatio, height * window.devicePixelRatio);
236
+ renderContours(gl, matrix, width, height);
237
+ };
238
+ return (React.createElement(Layer
239
+ // @ts-ignore
240
+ , {
241
+ // @ts-ignore
242
+ type: "custom", beforeId: "overlay", key: time, onAdd: onAddLayer, render: function (gl, matrix) { return onRender(gl, matrix, map.current.getContainer().clientWidth, map.current.getContainer().clientHeight); } }));
243
+ };
244
+ /**
245
+ * An `InterpolationLayer` takes a data array of the form `{ latitude, longitude, value }`. It performs triangulation
246
+ * and draws the data in an OpenGL layer. Optionally, a number of contour `levels` can be set to draw contour lines.
247
+ * Gradient colors are configurable using `gradientStops`.
248
+ */
249
+ var InterpolationLayer = function (_a) {
250
+ var _b = _a.levels, levels = _b === void 0 ? 0 : _b, _c = _a.contourColor, contourColor = _c === void 0 ? '#35ABE2' : _c, _d = _a.gradientStops, gradientStops = _d === void 0 ? [
251
+ { pos: 0.0, color: '#0000ffff' },
252
+ { pos: 1.0, color: '#000000ff' }
253
+ ] : _d, props = __rest(_a, ["levels", "contourColor", "gradientStops"]);
254
+ return React.createElement(InterpolationLayerBase, __assign({ levels: levels, contourColor: contourColor, gradientStops: gradientStops }, props));
255
+ };
256
+ export { InterpolationLayer };
@@ -0,0 +1,2 @@
1
+ declare const LevelsFragmentShader = " \n #ifdef GL_ES\n precision mediump float;\n #endif\n\n varying vec4 vColor;\n\n // Fragment shader merely copies vertex color.\n void main() {\n gl_FragColor = vColor;\n }\n";
2
+ export { LevelsFragmentShader };
@@ -0,0 +1,2 @@
1
+ var LevelsFragmentShader = /*glsl*/ " \n #ifdef GL_ES\n precision mediump float;\n #endif\n\n varying vec4 vColor;\n\n // Fragment shader merely copies vertex color.\n void main() {\n gl_FragColor = vColor;\n }\n";
2
+ export { LevelsFragmentShader };
@@ -0,0 +1,2 @@
1
+ declare const LevelsVertexShader = "\n uniform mat4 u_matrix;\n attribute vec2 a_pos;\n attribute float a_value;\n varying vec4 vColor;\n\n // For each vertex, create a greyscale color equal to its value.\n void main() {\n gl_Position = u_matrix * vec4(a_pos, 0.0, 1.0);\n vColor = vec4(a_value, a_value, a_value, 1.0);\n }\n";
2
+ export { LevelsVertexShader };
@@ -0,0 +1,2 @@
1
+ var LevelsVertexShader = /*glsl*/ "\n uniform mat4 u_matrix;\n attribute vec2 a_pos;\n attribute float a_value;\n varying vec4 vColor;\n\n // For each vertex, create a greyscale color equal to its value.\n void main() {\n gl_Position = u_matrix * vec4(a_pos, 0.0, 1.0);\n vColor = vec4(a_value, a_value, a_value, 1.0);\n }\n";
2
+ export { LevelsVertexShader };
@@ -0,0 +1,2 @@
1
+ declare const ParticlesFragmentShader = " \n #ifdef GL_ES\n precision mediump float;\n #endif\n\n uniform sampler2D uTexture;\n uniform sampler2D vTexture;\n varying vec4 v_color;\n\n //\n // Returns texture color at pixelCoord.\n //\n /* vec4 texelFetch(sampler2D tex, vec2 pixelCoord) {\n return texture2D(tex, pixelCoord / u_resolution);\n }\n\n vec4 getSpeed(vec2 pixelCoord) {\n vec4 colorU = texture2D(uTexture, pixelCoord / u_resolution);\n vec4 colorV = texture2D(vTexture, pixelCoord / u_resolution);\n if(colorU.w == 0.0 || colorV.w == 0.0) return vec4(0.0, 0.0, 0.0, 0.0);\n float uRange = maxU - minU;\n float vRange = maxV - minV;\n float u = uRange * colorU.x + minU;\n float v = vRange * colorV.x + minV;\n float ratio = sqrt(u * u + v * v) / maxUV;\n \n return vec4(1.0, 1.0, 1.0, 1.0);\n return vec4(ratio, 0.0, 0.0, 1.0);\n } */\n\n /* void oldmain() {\n float xMod20 = mod(float(gl_FragCoord.x), 20.0);\n if(!(xMod20 >= shift && xMod20 <= shift + 1.0)) return;\n if(mod(float(gl_FragCoord.y), 20.0) >= 3.0) return;\n // Get input color:\n //vec4 color = texelFetch(uTexture, gl_FragCoord.xy);\n\n vec2 pos = gl_FragCoord.xy;\n vec4 color = getSpeed(pos);\n\n gl_FragColor = color;\n } */\n\n // Half size of box\n #define SIZE 15\n\n /* void main() {\n // Draw box around point.\n int x = int(gl_PointCoord.x * float(SIZE*2));\n int y = int(gl_PointCoord.y * float(SIZE*2)); \n if(x == 0 || y == 0 || x == SIZE*2-1 || y == SIZE*2-1) {\n gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);\n return;\n }\n\n // Get texture color of point at its center.\n vec4 color = texelFetch(uTexture, gl_FragCoord.xy - vec2(x, -y));\n gl_FragColor = color;\n } */\n\n void main() {\n gl_FragColor = v_color;\n }\n";
2
+ export { ParticlesFragmentShader };
@@ -0,0 +1,2 @@
1
+ var ParticlesFragmentShader = /*glsl*/ " \n #ifdef GL_ES\n precision mediump float;\n #endif\n\n uniform sampler2D uTexture;\n uniform sampler2D vTexture;\n varying vec4 v_color;\n\n //\n // Returns texture color at pixelCoord.\n //\n /* vec4 texelFetch(sampler2D tex, vec2 pixelCoord) {\n return texture2D(tex, pixelCoord / u_resolution);\n }\n\n vec4 getSpeed(vec2 pixelCoord) {\n vec4 colorU = texture2D(uTexture, pixelCoord / u_resolution);\n vec4 colorV = texture2D(vTexture, pixelCoord / u_resolution);\n if(colorU.w == 0.0 || colorV.w == 0.0) return vec4(0.0, 0.0, 0.0, 0.0);\n float uRange = maxU - minU;\n float vRange = maxV - minV;\n float u = uRange * colorU.x + minU;\n float v = vRange * colorV.x + minV;\n float ratio = sqrt(u * u + v * v) / maxUV;\n \n return vec4(1.0, 1.0, 1.0, 1.0);\n return vec4(ratio, 0.0, 0.0, 1.0);\n } */\n\n /* void oldmain() {\n float xMod20 = mod(float(gl_FragCoord.x), 20.0);\n if(!(xMod20 >= shift && xMod20 <= shift + 1.0)) return;\n if(mod(float(gl_FragCoord.y), 20.0) >= 3.0) return;\n // Get input color:\n //vec4 color = texelFetch(uTexture, gl_FragCoord.xy);\n\n vec2 pos = gl_FragCoord.xy;\n vec4 color = getSpeed(pos);\n\n gl_FragColor = color;\n } */\n\n // Half size of box\n #define SIZE 15\n\n /* void main() {\n // Draw box around point.\n int x = int(gl_PointCoord.x * float(SIZE*2));\n int y = int(gl_PointCoord.y * float(SIZE*2)); \n if(x == 0 || y == 0 || x == SIZE*2-1 || y == SIZE*2-1) {\n gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);\n return;\n }\n\n // Get texture color of point at its center.\n vec4 color = texelFetch(uTexture, gl_FragCoord.xy - vec2(x, -y));\n gl_FragColor = color;\n } */\n\n void main() {\n gl_FragColor = v_color;\n }\n";
2
+ export { ParticlesFragmentShader };
@@ -0,0 +1,40 @@
1
+ import * as React from 'react';
2
+ import { IGradientStop } from '../InterpolationLayer/IGradientStop';
3
+ interface IPoint {
4
+ latitude: number;
5
+ longitude: number;
6
+ u: number;
7
+ v: number;
8
+ }
9
+ interface IProps {
10
+ /**
11
+ * Input data.
12
+ */
13
+ data: IPoint[];
14
+ /**
15
+ * Gradient stops. A default gradient is preset.
16
+ */
17
+ gradientStops?: IGradientStop[];
18
+ /**
19
+ * Number of particles per curve.
20
+ * @default 80
21
+ */
22
+ particles?: number;
23
+ /**
24
+ * Number or points horizontally (and vertically).
25
+ * @default 40
26
+ */
27
+ density?: number;
28
+ /**
29
+ * Animation delay factor.
30
+ * @default 1
31
+ */
32
+ delay?: number;
33
+ /**
34
+ * Number of pixels in a point.
35
+ * @default 1.0
36
+ */
37
+ pointSize?: number;
38
+ }
39
+ declare const ParticlesLayer: ({ particles, density, delay, gradientStops, ...props }: IProps) => React.JSX.Element;
40
+ export { ParticlesLayer };