@unovis/ts 1.1.1-beta.5 → 1.1.1-beta.7

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 (710) hide show
  1. package/declaration.d.ts +1 -0
  2. package/index.ts +1 -0
  3. package/licences.txt +43 -0
  4. package/maps.ts +1 -0
  5. package/package.json +1 -1
  6. package/rollup.config.js +71 -0
  7. package/rules/ts-getter-setter.js +35 -0
  8. package/src/components/area/config.ts +29 -0
  9. package/src/components/area/index.ts +133 -0
  10. package/{components/area/style.js → src/components/area/style.ts} +9 -10
  11. package/src/components/area/types.ts +2 -0
  12. package/src/components/axis/config.ts +76 -0
  13. package/src/components/axis/index.ts +363 -0
  14. package/{components/axis/style.js → src/components/axis/style.ts} +27 -22
  15. package/src/components/axis/types.ts +4 -0
  16. package/src/components/brush/config.ts +51 -0
  17. package/src/components/brush/index.ts +233 -0
  18. package/{components/brush/style.js → src/components/brush/style.ts} +15 -14
  19. package/src/components/brush/types.ts +8 -0
  20. package/src/components/bullet-legend/config.ts +38 -0
  21. package/src/components/bullet-legend/index.ts +104 -0
  22. package/{components/bullet-legend/style.js → src/components/bullet-legend/style.ts} +18 -16
  23. package/src/components/bullet-legend/types.ts +7 -0
  24. package/src/components/chord-diagram/config.ts +53 -0
  25. package/src/components/chord-diagram/index.ts +401 -0
  26. package/src/components/chord-diagram/modules/label.ts +155 -0
  27. package/src/components/chord-diagram/modules/link.ts +91 -0
  28. package/src/components/chord-diagram/modules/node.ts +80 -0
  29. package/{components/chord-diagram/style.js → src/components/chord-diagram/style.ts} +39 -30
  30. package/src/components/chord-diagram/types.ts +68 -0
  31. package/src/components/crosshair/config.ts +48 -0
  32. package/src/components/crosshair/index.ts +220 -0
  33. package/{components/crosshair/style.js → src/components/crosshair/style.ts} +12 -12
  34. package/src/components/crosshair/types.ts +15 -0
  35. package/src/components/donut/config.ts +65 -0
  36. package/src/components/donut/index.ts +148 -0
  37. package/src/components/donut/modules/arc.ts +86 -0
  38. package/{components/donut/style.js → src/components/donut/style.ts} +20 -18
  39. package/src/components/donut/types.ts +17 -0
  40. package/src/components/flow-legend/config.ts +31 -0
  41. package/src/components/flow-legend/index.ts +103 -0
  42. package/{components/flow-legend/style.js → src/components/flow-legend/style.ts} +25 -21
  43. package/src/components/flow-legend/types.ts +10 -0
  44. package/src/components/free-brush/config.ts +54 -0
  45. package/src/components/free-brush/index.ts +207 -0
  46. package/{components/free-brush/style.js → src/components/free-brush/style.ts} +12 -12
  47. package/src/components/free-brush/types.ts +8 -0
  48. package/src/components/graph/config.ts +280 -0
  49. package/src/components/graph/index.ts +809 -0
  50. package/src/components/graph/modules/layout-helpers.ts +96 -0
  51. package/src/components/graph/modules/layout.ts +502 -0
  52. package/src/components/graph/modules/link/helper.ts +105 -0
  53. package/src/components/graph/modules/link/index.ts +302 -0
  54. package/{components/graph/modules/link/style.js → src/components/graph/modules/link/style.ts} +45 -34
  55. package/src/components/graph/modules/node/helper.ts +162 -0
  56. package/src/components/graph/modules/node/index.ts +343 -0
  57. package/{components/graph/modules/node/style.js → src/components/graph/modules/node/style.ts} +72 -52
  58. package/src/components/graph/modules/panel/helper.ts +160 -0
  59. package/src/components/graph/modules/panel/index.ts +137 -0
  60. package/{components/graph/modules/panel/style.js → src/components/graph/modules/panel/style.ts} +42 -32
  61. package/src/components/graph/modules/shape.ts +108 -0
  62. package/src/components/graph/modules/zoom-levels.ts +6 -0
  63. package/src/components/graph/style.ts +72 -0
  64. package/src/components/graph/types.ts +152 -0
  65. package/src/components/grouped-bar/config.ts +40 -0
  66. package/src/components/grouped-bar/index.ts +325 -0
  67. package/{components/grouped-bar/style.js → src/components/grouped-bar/style.ts} +15 -14
  68. package/src/components/leaflet-flow-map/config.ts +60 -0
  69. package/src/components/leaflet-flow-map/index.ts +279 -0
  70. package/src/components/leaflet-flow-map/renderer-utils.ts +14 -0
  71. package/src/components/leaflet-flow-map/renderer.ts +146 -0
  72. package/{components/leaflet-flow-map/shaders.js → src/components/leaflet-flow-map/shaders.ts} +4 -7
  73. package/src/components/leaflet-flow-map/types.ts +18 -0
  74. package/src/components/leaflet-map/config.ts +234 -0
  75. package/src/components/leaflet-map/index.ts +808 -0
  76. package/src/components/leaflet-map/leaflet.css +625 -0
  77. package/src/components/leaflet-map/modules/clusterBackground.ts +34 -0
  78. package/src/components/leaflet-map/modules/donut.ts +37 -0
  79. package/src/components/leaflet-map/modules/map.ts +178 -0
  80. package/src/components/leaflet-map/modules/node.ts +208 -0
  81. package/src/components/leaflet-map/modules/selectionRing.ts +63 -0
  82. package/src/components/leaflet-map/modules/utils.ts +290 -0
  83. package/{components → src/components}/leaflet-map/renderer/leaflet-maplibre-gl.js +76 -78
  84. package/src/components/leaflet-map/renderer/map-style.ts +24 -0
  85. package/src/components/leaflet-map/renderer/mapboxgl/mapboxgl-dark-theme.json +35 -0
  86. package/src/components/leaflet-map/renderer/mapboxgl/mapboxgl-light-theme.json +35 -0
  87. package/src/components/leaflet-map/renderer/mapboxgl/mapboxgl-settings.json +2185 -0
  88. package/src/components/leaflet-map/renderer/mapboxgl-layer.ts +43 -0
  89. package/src/components/leaflet-map/renderer/mapboxgl-utils.ts +40 -0
  90. package/{components → src/components}/leaflet-map/renderer/maplibre-gl.css.js +2 -4
  91. package/src/components/leaflet-map/style.ts +217 -0
  92. package/src/components/leaflet-map/types.ts +75 -0
  93. package/src/components/line/config.ts +34 -0
  94. package/src/components/line/index.ts +188 -0
  95. package/{components/line/style.js → src/components/line/style.ts} +18 -16
  96. package/src/components/line/types.ts +3 -0
  97. package/src/components/nested-donut/config.ts +75 -0
  98. package/src/components/nested-donut/index.ts +176 -0
  99. package/src/components/nested-donut/modules/arc.ts +78 -0
  100. package/src/components/nested-donut/modules/label.ts +63 -0
  101. package/src/components/nested-donut/style.ts +82 -0
  102. package/src/components/nested-donut/types.ts +29 -0
  103. package/src/components/sankey/config.ts +195 -0
  104. package/src/components/sankey/index.ts +387 -0
  105. package/src/components/sankey/modules/label.ts +228 -0
  106. package/src/components/sankey/modules/link.ts +141 -0
  107. package/src/components/sankey/modules/node.ts +221 -0
  108. package/{components/sankey/style.js → src/components/sankey/style.ts} +60 -44
  109. package/src/components/sankey/types.ts +95 -0
  110. package/src/components/scatter/config.ts +49 -0
  111. package/src/components/scatter/index.ts +220 -0
  112. package/src/components/scatter/modules/point.ts +123 -0
  113. package/src/components/scatter/modules/utils.ts +150 -0
  114. package/{components/scatter/style.js → src/components/scatter/style.ts} +15 -14
  115. package/src/components/scatter/types.ts +21 -0
  116. package/src/components/stacked-bar/config.ts +42 -0
  117. package/src/components/stacked-bar/index.ts +267 -0
  118. package/{components/stacked-bar/style.js → src/components/stacked-bar/style.ts} +15 -14
  119. package/src/components/stacked-bar/types.ts +5 -0
  120. package/src/components/timeline/config.ts +49 -0
  121. package/src/components/timeline/index.ts +302 -0
  122. package/{components/timeline/style.js → src/components/timeline/style.ts} +39 -30
  123. package/src/components/tooltip/config.ts +69 -0
  124. package/src/components/tooltip/index.ts +220 -0
  125. package/{components → src/components}/tooltip/style.js +11 -14
  126. package/src/components/topojson-map/config.ts +124 -0
  127. package/src/components/topojson-map/index.ts +436 -0
  128. package/{components/topojson-map/style.js → src/components/topojson-map/style.ts} +33 -26
  129. package/src/components/topojson-map/types.ts +123 -0
  130. package/src/components/topojson-map/utils.ts +29 -0
  131. package/src/components/vis-controls/config.ts +16 -0
  132. package/src/components/vis-controls/index.ts +68 -0
  133. package/{components/vis-controls/style.js → src/components/vis-controls/style.ts} +34 -27
  134. package/src/components/vis-controls/types.ts +14 -0
  135. package/src/components/xy-labels/config.ts +56 -0
  136. package/src/components/xy-labels/index.ts +109 -0
  137. package/src/components/xy-labels/modules/label.ts +140 -0
  138. package/{components/xy-labels/style.js → src/components/xy-labels/style.ts} +15 -14
  139. package/src/components/xy-labels/types.ts +26 -0
  140. package/src/components.ts +56 -0
  141. package/src/containers/single-container/config.ts +15 -0
  142. package/src/containers/single-container/index.ts +150 -0
  143. package/src/containers/xy-container/config.ts +112 -0
  144. package/src/containers/xy-container/index.ts +407 -0
  145. package/src/containers.ts +6 -0
  146. package/src/core/component/config.ts +61 -0
  147. package/src/core/component/index.ts +154 -0
  148. package/src/core/component/types.ts +9 -0
  149. package/src/core/config/index.ts +12 -0
  150. package/src/core/container/config.ts +56 -0
  151. package/src/core/container/index.ts +136 -0
  152. package/src/core/xy-component/config.ts +46 -0
  153. package/src/core/xy-component/index.ts +90 -0
  154. package/src/data-models/core.ts +15 -0
  155. package/src/data-models/graph.ts +138 -0
  156. package/src/data-models/map-graph.ts +72 -0
  157. package/src/data-models/map.ts +18 -0
  158. package/src/data-models/series.ts +16 -0
  159. package/src/index.ts +7 -0
  160. package/src/maps/china-provinces.json +1 -0
  161. package/src/maps/fr-regions.json +1 -0
  162. package/src/maps/germany-regions.json +1 -0
  163. package/src/maps/ind-regions.json +1 -0
  164. package/src/maps/uk-regions.json +1 -0
  165. package/src/maps/us-counties.json +1 -0
  166. package/src/maps/us-states.json +1 -0
  167. package/src/maps/world-110m-alpha.json +1 -0
  168. package/src/maps/world-simple.json +1 -0
  169. package/src/maps/world-simplest.json +1 -0
  170. package/src/maps.ts +34 -0
  171. package/src/styles/colors.ts +28 -0
  172. package/src/styles/index.ts +38 -0
  173. package/{styles/sizes.js → src/styles/sizes.ts} +6 -8
  174. package/src/types/accessor.ts +5 -0
  175. package/src/types/component.ts +15 -0
  176. package/src/types/curve.ts +62 -0
  177. package/src/types/data.ts +5 -0
  178. package/src/types/direction.ts +6 -0
  179. package/src/types/graph.ts +40 -0
  180. package/src/types/map.ts +5 -0
  181. package/src/types/misc.ts +10 -0
  182. package/src/types/position.ts +23 -0
  183. package/src/types/scale.ts +47 -0
  184. package/src/types/shape.ts +7 -0
  185. package/src/types/spacing.ts +6 -0
  186. package/src/types/svg.ts +32 -0
  187. package/src/types/symbol.ts +21 -0
  188. package/src/types/text.ts +71 -0
  189. package/src/types.ts +31 -0
  190. package/src/utils/color.ts +41 -0
  191. package/src/utils/d3.ts +15 -0
  192. package/src/utils/data.ts +328 -0
  193. package/src/utils/html.ts +13 -0
  194. package/src/utils/map.ts +29 -0
  195. package/src/utils/misc.ts +54 -0
  196. package/src/utils/path.ts +196 -0
  197. package/src/utils/scale.ts +1 -0
  198. package/src/utils/style.ts +37 -0
  199. package/src/utils/svg.ts +49 -0
  200. package/src/utils/text.ts +529 -0
  201. package/src/utils/type.ts +9 -0
  202. package/tsconfig.json +29 -0
  203. package/components/area/config.d.ts +0 -25
  204. package/components/area/config.js +0 -16
  205. package/components/area/config.js.map +0 -1
  206. package/components/area/index.d.ts +0 -19
  207. package/components/area/index.js +0 -102
  208. package/components/area/index.js.map +0 -1
  209. package/components/area/style.d.ts +0 -3
  210. package/components/area/style.js.map +0 -1
  211. package/components/area/types.d.ts +0 -6
  212. package/components/axis/config.d.ts +0 -71
  213. package/components/axis/config.js +0 -32
  214. package/components/axis/config.js.map +0 -1
  215. package/components/axis/index.d.ts +0 -44
  216. package/components/axis/index.js +0 -305
  217. package/components/axis/index.js.map +0 -1
  218. package/components/axis/style.d.ts +0 -9
  219. package/components/axis/style.js.map +0 -1
  220. package/components/axis/types.d.ts +0 -4
  221. package/components/axis/types.js +0 -8
  222. package/components/axis/types.js.map +0 -1
  223. package/components/brush/config.d.ts +0 -42
  224. package/components/brush/config.js +0 -24
  225. package/components/brush/config.js.map +0 -1
  226. package/components/brush/index.d.ts +0 -28
  227. package/components/brush/index.js +0 -199
  228. package/components/brush/index.js.map +0 -1
  229. package/components/brush/style.d.ts +0 -5
  230. package/components/brush/style.js.map +0 -1
  231. package/components/brush/types.d.ts +0 -7
  232. package/components/brush/types.js +0 -8
  233. package/components/brush/types.js.map +0 -1
  234. package/components/bullet-legend/config.d.ts +0 -34
  235. package/components/bullet-legend/config.js +0 -16
  236. package/components/bullet-legend/config.js.map +0 -1
  237. package/components/bullet-legend/index.d.ts +0 -19
  238. package/components/bullet-legend/index.js +0 -79
  239. package/components/bullet-legend/index.js.map +0 -1
  240. package/components/bullet-legend/style.d.ts +0 -6
  241. package/components/bullet-legend/style.js.map +0 -1
  242. package/components/bullet-legend/types.d.ts +0 -7
  243. package/components/bullet-legend/types.js +0 -2
  244. package/components/bullet-legend/types.js.map +0 -1
  245. package/components/chord-diagram/config.d.ts +0 -44
  246. package/components/chord-diagram/config.js +0 -25
  247. package/components/chord-diagram/config.js.map +0 -1
  248. package/components/chord-diagram/index.d.ts +0 -42
  249. package/components/chord-diagram/index.js +0 -305
  250. package/components/chord-diagram/index.js.map +0 -1
  251. package/components/chord-diagram/modules/label.d.ts +0 -8
  252. package/components/chord-diagram/modules/label.js +0 -115
  253. package/components/chord-diagram/modules/label.js.map +0 -1
  254. package/components/chord-diagram/modules/link.d.ts +0 -21
  255. package/components/chord-diagram/modules/link.js +0 -63
  256. package/components/chord-diagram/modules/link.js.map +0 -1
  257. package/components/chord-diagram/modules/node.d.ts +0 -17
  258. package/components/chord-diagram/modules/node.js +0 -52
  259. package/components/chord-diagram/modules/node.js.map +0 -1
  260. package/components/chord-diagram/style.d.ts +0 -13
  261. package/components/chord-diagram/style.js.map +0 -1
  262. package/components/chord-diagram/types.d.ts +0 -58
  263. package/components/chord-diagram/types.js +0 -8
  264. package/components/chord-diagram/types.js.map +0 -1
  265. package/components/crosshair/config.d.ts +0 -43
  266. package/components/crosshair/config.js +0 -19
  267. package/components/crosshair/config.js.map +0 -1
  268. package/components/crosshair/index.d.ts +0 -35
  269. package/components/crosshair/index.js +0 -183
  270. package/components/crosshair/index.js.map +0 -1
  271. package/components/crosshair/style.d.ts +0 -4
  272. package/components/crosshair/style.js.map +0 -1
  273. package/components/crosshair/types.d.ts +0 -13
  274. package/components/crosshair/types.js +0 -2
  275. package/components/crosshair/types.js.map +0 -1
  276. package/components/donut/config.d.ts +0 -59
  277. package/components/donut/config.js +0 -28
  278. package/components/donut/config.js.map +0 -1
  279. package/components/donut/index.d.ts +0 -21
  280. package/components/donut/index.js +0 -107
  281. package/components/donut/index.js.map +0 -1
  282. package/components/donut/modules/arc.d.ts +0 -10
  283. package/components/donut/modules/arc.js +0 -59
  284. package/components/donut/modules/arc.js.map +0 -1
  285. package/components/donut/style.d.ts +0 -7
  286. package/components/donut/style.js.map +0 -1
  287. package/components/donut/types.d.ts +0 -20
  288. package/components/flow-legend/config.d.ts +0 -29
  289. package/components/flow-legend/config.js +0 -18
  290. package/components/flow-legend/config.js.map +0 -1
  291. package/components/flow-legend/index.d.ts +0 -16
  292. package/components/flow-legend/index.js +0 -75
  293. package/components/flow-legend/index.js.map +0 -1
  294. package/components/flow-legend/style.d.ts +0 -8
  295. package/components/flow-legend/style.js.map +0 -1
  296. package/components/flow-legend/types.d.ts +0 -9
  297. package/components/flow-legend/types.js +0 -8
  298. package/components/flow-legend/types.js.map +0 -1
  299. package/components/free-brush/config.d.ts +0 -45
  300. package/components/free-brush/config.js +0 -24
  301. package/components/free-brush/config.js.map +0 -1
  302. package/components/free-brush/index.d.ts +0 -20
  303. package/components/free-brush/index.js +0 -192
  304. package/components/free-brush/index.js.map +0 -1
  305. package/components/free-brush/style.d.ts +0 -4
  306. package/components/free-brush/style.js.map +0 -1
  307. package/components/free-brush/types.d.ts +0 -7
  308. package/components/free-brush/types.js +0 -9
  309. package/components/free-brush/types.js.map +0 -1
  310. package/components/graph/config.d.ts +0 -238
  311. package/components/graph/config.js +0 -84
  312. package/components/graph/config.js.map +0 -1
  313. package/components/graph/index.d.ts +0 -126
  314. package/components/graph/index.js +0 -656
  315. package/components/graph/index.js.map +0 -1
  316. package/components/graph/modules/layout-helpers.d.ts +0 -21
  317. package/components/graph/modules/layout-helpers.js +0 -69
  318. package/components/graph/modules/layout-helpers.js.map +0 -1
  319. package/components/graph/modules/layout.d.ts +0 -10
  320. package/components/graph/modules/layout.js +0 -399
  321. package/components/graph/modules/layout.js.map +0 -1
  322. package/components/graph/modules/link/helper.d.ts +0 -25
  323. package/components/graph/modules/link/helper.js +0 -74
  324. package/components/graph/modules/link/helper.js.map +0 -1
  325. package/components/graph/modules/link/index.d.ts +0 -11
  326. package/components/graph/modules/link/index.js +0 -212
  327. package/components/graph/modules/link/index.js.map +0 -1
  328. package/components/graph/modules/link/style.d.ts +0 -15
  329. package/components/graph/modules/link/style.js.map +0 -1
  330. package/components/graph/modules/node/helper.d.ts +0 -21
  331. package/components/graph/modules/node/helper.js +0 -126
  332. package/components/graph/modules/node/helper.js.map +0 -1
  333. package/components/graph/modules/node/index.d.ts +0 -11
  334. package/components/graph/modules/node/index.js +0 -252
  335. package/components/graph/modules/node/index.js.map +0 -1
  336. package/components/graph/modules/node/style.d.ts +0 -24
  337. package/components/graph/modules/node/style.js.map +0 -1
  338. package/components/graph/modules/panel/helper.d.ts +0 -18
  339. package/components/graph/modules/panel/helper.js +0 -111
  340. package/components/graph/modules/panel/helper.js.map +0 -1
  341. package/components/graph/modules/panel/index.d.ts +0 -7
  342. package/components/graph/modules/panel/index.js +0 -98
  343. package/components/graph/modules/panel/index.js.map +0 -1
  344. package/components/graph/modules/panel/style.d.ts +0 -14
  345. package/components/graph/modules/panel/style.js.map +0 -1
  346. package/components/graph/modules/shape.d.ts +0 -6
  347. package/components/graph/modules/shape.js +0 -80
  348. package/components/graph/modules/shape.js.map +0 -1
  349. package/components/graph/modules/zoom-levels.d.ts +0 -6
  350. package/components/graph/modules/zoom-levels.js +0 -10
  351. package/components/graph/modules/zoom-levels.js.map +0 -1
  352. package/components/graph/style.d.ts +0 -6
  353. package/components/graph/style.js +0 -66
  354. package/components/graph/style.js.map +0 -1
  355. package/components/graph/types.d.ts +0 -125
  356. package/components/graph/types.js +0 -30
  357. package/components/graph/types.js.map +0 -1
  358. package/components/grouped-bar/config.d.ts +0 -36
  359. package/components/grouped-bar/config.js +0 -20
  360. package/components/grouped-bar/config.js.map +0 -1
  361. package/components/grouped-bar/index.d.ts +0 -32
  362. package/components/grouped-bar/index.js +0 -249
  363. package/components/grouped-bar/index.js.map +0 -1
  364. package/components/grouped-bar/style.d.ts +0 -5
  365. package/components/grouped-bar/style.js.map +0 -1
  366. package/components/leaflet-flow-map/config.d.ts +0 -46
  367. package/components/leaflet-flow-map/config.js +0 -25
  368. package/components/leaflet-flow-map/config.js.map +0 -1
  369. package/components/leaflet-flow-map/index.d.ts +0 -52
  370. package/components/leaflet-flow-map/index.js +0 -220
  371. package/components/leaflet-flow-map/index.js.map +0 -1
  372. package/components/leaflet-flow-map/renderer-utils.d.ts +0 -5
  373. package/components/leaflet-flow-map/renderer-utils.js +0 -15
  374. package/components/leaflet-flow-map/renderer-utils.js.map +0 -1
  375. package/components/leaflet-flow-map/renderer.d.ts +0 -26
  376. package/components/leaflet-flow-map/renderer.js +0 -117
  377. package/components/leaflet-flow-map/renderer.js.map +0 -1
  378. package/components/leaflet-flow-map/shaders.d.ts +0 -2
  379. package/components/leaflet-flow-map/shaders.js.map +0 -1
  380. package/components/leaflet-flow-map/types.d.ts +0 -23
  381. package/components/leaflet-map/config.d.ts +0 -193
  382. package/components/leaflet-map/config.js +0 -71
  383. package/components/leaflet-map/config.js.map +0 -1
  384. package/components/leaflet-map/index.d.ts +0 -130
  385. package/components/leaflet-map/index.js +0 -690
  386. package/components/leaflet-map/index.js.map +0 -1
  387. package/components/leaflet-map/leaflet.css.js +0 -5
  388. package/components/leaflet-map/leaflet.css.js.map +0 -1
  389. package/components/leaflet-map/modules/clusterBackground.d.ts +0 -5
  390. package/components/leaflet-map/modules/clusterBackground.js +0 -27
  391. package/components/leaflet-map/modules/clusterBackground.js.map +0 -1
  392. package/components/leaflet-map/modules/donut.d.ts +0 -3
  393. package/components/leaflet-map/modules/donut.js +0 -25
  394. package/components/leaflet-map/modules/donut.js.map +0 -1
  395. package/components/leaflet-map/modules/map.d.ts +0 -14
  396. package/components/leaflet-map/modules/map.js +0 -154
  397. package/components/leaflet-map/modules/map.js.map +0 -1
  398. package/components/leaflet-map/modules/node.d.ts +0 -9
  399. package/components/leaflet-map/modules/node.js +0 -162
  400. package/components/leaflet-map/modules/node.js.map +0 -1
  401. package/components/leaflet-map/modules/selectionRing.d.ts +0 -7
  402. package/components/leaflet-map/modules/selectionRing.js +0 -41
  403. package/components/leaflet-map/modules/selectionRing.js.map +0 -1
  404. package/components/leaflet-map/modules/utils.d.ts +0 -50
  405. package/components/leaflet-map/modules/utils.js +0 -210
  406. package/components/leaflet-map/modules/utils.js.map +0 -1
  407. package/components/leaflet-map/renderer/leaflet-maplibre-gl.js.map +0 -1
  408. package/components/leaflet-map/renderer/map-style.d.ts +0 -4
  409. package/components/leaflet-map/renderer/map-style.js +0 -15
  410. package/components/leaflet-map/renderer/map-style.js.map +0 -1
  411. package/components/leaflet-map/renderer/mapboxgl/mapboxgl-dark-theme.json.js +0 -40
  412. package/components/leaflet-map/renderer/mapboxgl/mapboxgl-dark-theme.json.js.map +0 -1
  413. package/components/leaflet-map/renderer/mapboxgl/mapboxgl-light-theme.json.js +0 -40
  414. package/components/leaflet-map/renderer/mapboxgl/mapboxgl-light-theme.json.js.map +0 -1
  415. package/components/leaflet-map/renderer/mapboxgl/mapboxgl-settings.json.js +0 -4981
  416. package/components/leaflet-map/renderer/mapboxgl/mapboxgl-settings.json.js.map +0 -1
  417. package/components/leaflet-map/renderer/mapboxgl-layer.d.ts +0 -8
  418. package/components/leaflet-map/renderer/mapboxgl-layer.js +0 -27
  419. package/components/leaflet-map/renderer/mapboxgl-layer.js.map +0 -1
  420. package/components/leaflet-map/renderer/mapboxgl-utils.d.ts +0 -4
  421. package/components/leaflet-map/renderer/mapboxgl-utils.js +0 -39
  422. package/components/leaflet-map/renderer/mapboxgl-utils.js.map +0 -1
  423. package/components/leaflet-map/renderer/maplibre-gl.css.js.map +0 -1
  424. package/components/leaflet-map/style.d.ts +0 -52
  425. package/components/leaflet-map/style.js +0 -183
  426. package/components/leaflet-map/style.js.map +0 -1
  427. package/components/leaflet-map/types.d.ts +0 -75
  428. package/components/leaflet-map/types.js +0 -15
  429. package/components/leaflet-map/types.js.map +0 -1
  430. package/components/line/config.d.ts +0 -30
  431. package/components/line/config.js +0 -17
  432. package/components/line/config.js.map +0 -1
  433. package/components/line/index.d.ts +0 -27
  434. package/components/line/index.js +0 -152
  435. package/components/line/index.js.map +0 -1
  436. package/components/line/style.d.ts +0 -6
  437. package/components/line/style.js.map +0 -1
  438. package/components/line/types.d.ts +0 -12
  439. package/components/nested-donut/config.d.ts +0 -59
  440. package/components/nested-donut/config.js +0 -19
  441. package/components/nested-donut/config.js.map +0 -1
  442. package/components/nested-donut/index.d.ts +0 -38
  443. package/components/nested-donut/index.js +0 -133
  444. package/components/nested-donut/index.js.map +0 -1
  445. package/components/nested-donut/modules/arc.d.ts +0 -17
  446. package/components/nested-donut/modules/arc.js +0 -50
  447. package/components/nested-donut/modules/arc.js.map +0 -1
  448. package/components/nested-donut/modules/label.d.ts +0 -7
  449. package/components/nested-donut/modules/label.js +0 -34
  450. package/components/nested-donut/modules/label.js.map +0 -1
  451. package/components/nested-donut/style.d.ts +0 -26
  452. package/components/nested-donut/style.js +0 -70
  453. package/components/nested-donut/style.js.map +0 -1
  454. package/components/nested-donut/types.d.ts +0 -24
  455. package/components/nested-donut/types.js +0 -11
  456. package/components/nested-donut/types.js.map +0 -1
  457. package/components/sankey/config.d.ts +0 -162
  458. package/components/sankey/config.js +0 -65
  459. package/components/sankey/config.js.map +0 -1
  460. package/components/sankey/index.d.ts +0 -59
  461. package/components/sankey/index.js +0 -306
  462. package/components/sankey/index.js.map +0 -1
  463. package/components/sankey/modules/label.d.ts +0 -23
  464. package/components/sankey/modules/label.js +0 -168
  465. package/components/sankey/modules/label.js.map +0 -1
  466. package/components/sankey/modules/link.d.ts +0 -14
  467. package/components/sankey/modules/link.js +0 -108
  468. package/components/sankey/modules/link.js.map +0 -1
  469. package/components/sankey/modules/node.d.ts +0 -10
  470. package/components/sankey/modules/node.js +0 -156
  471. package/components/sankey/modules/node.js.map +0 -1
  472. package/components/sankey/style.d.ts +0 -20
  473. package/components/sankey/style.js.map +0 -1
  474. package/components/sankey/types.d.ts +0 -84
  475. package/components/sankey/types.js +0 -34
  476. package/components/sankey/types.js.map +0 -1
  477. package/components/scatter/config.d.ts +0 -44
  478. package/components/scatter/config.js +0 -23
  479. package/components/scatter/config.js.map +0 -1
  480. package/components/scatter/index.d.ts +0 -28
  481. package/components/scatter/index.js +0 -167
  482. package/components/scatter/index.js.map +0 -1
  483. package/components/scatter/modules/point.d.ts +0 -7
  484. package/components/scatter/modules/point.js +0 -86
  485. package/components/scatter/modules/point.js.map +0 -1
  486. package/components/scatter/modules/utils.d.ts +0 -11
  487. package/components/scatter/modules/utils.js +0 -112
  488. package/components/scatter/modules/utils.js.map +0 -1
  489. package/components/scatter/style.d.ts +0 -5
  490. package/components/scatter/style.js.map +0 -1
  491. package/components/scatter/types.d.ts +0 -19
  492. package/components/stacked-bar/config.d.ts +0 -38
  493. package/components/stacked-bar/config.js +0 -20
  494. package/components/stacked-bar/config.js.map +0 -1
  495. package/components/stacked-bar/index.d.ts +0 -28
  496. package/components/stacked-bar/index.js +0 -208
  497. package/components/stacked-bar/index.js.map +0 -1
  498. package/components/stacked-bar/style.d.ts +0 -5
  499. package/components/stacked-bar/style.js.map +0 -1
  500. package/components/stacked-bar/types.d.ts +0 -5
  501. package/components/timeline/config.d.ts +0 -43
  502. package/components/timeline/config.js +0 -24
  503. package/components/timeline/config.js.map +0 -1
  504. package/components/timeline/index.d.ts +0 -41
  505. package/components/timeline/index.js +0 -244
  506. package/components/timeline/index.js.map +0 -1
  507. package/components/timeline/style.d.ts +0 -13
  508. package/components/timeline/style.js.map +0 -1
  509. package/components/tooltip/config.d.ts +0 -68
  510. package/components/tooltip/config.js +0 -20
  511. package/components/tooltip/config.js.map +0 -1
  512. package/components/tooltip/index.d.ts +0 -36
  513. package/components/tooltip/index.js +0 -184
  514. package/components/tooltip/index.js.map +0 -1
  515. package/components/tooltip/style.js.map +0 -1
  516. package/components/topojson-map/config.d.ts +0 -99
  517. package/components/topojson-map/config.js +0 -42
  518. package/components/topojson-map/config.js.map +0 -1
  519. package/components/topojson-map/index.d.ts +0 -52
  520. package/components/topojson-map/index.js +0 -355
  521. package/components/topojson-map/index.js.map +0 -1
  522. package/components/topojson-map/style.d.ts +0 -11
  523. package/components/topojson-map/style.js.map +0 -1
  524. package/components/topojson-map/types.d.ts +0 -78
  525. package/components/topojson-map/types.js +0 -80
  526. package/components/topojson-map/types.js.map +0 -1
  527. package/components/topojson-map/utils.d.ts +0 -3
  528. package/components/topojson-map/utils.js +0 -30
  529. package/components/topojson-map/utils.js.map +0 -1
  530. package/components/vis-controls/config.d.ts +0 -12
  531. package/components/vis-controls/config.js +0 -13
  532. package/components/vis-controls/config.js.map +0 -1
  533. package/components/vis-controls/index.d.ts +0 -14
  534. package/components/vis-controls/index.js +0 -52
  535. package/components/vis-controls/index.js.map +0 -1
  536. package/components/vis-controls/style.d.ts +0 -11
  537. package/components/vis-controls/style.js.map +0 -1
  538. package/components/vis-controls/types.d.ts +0 -13
  539. package/components/vis-controls/types.js +0 -8
  540. package/components/vis-controls/types.js.map +0 -1
  541. package/components/xy-labels/config.d.ts +0 -48
  542. package/components/xy-labels/config.js +0 -25
  543. package/components/xy-labels/config.js.map +0 -1
  544. package/components/xy-labels/index.d.ts +0 -15
  545. package/components/xy-labels/index.js +0 -87
  546. package/components/xy-labels/index.js.map +0 -1
  547. package/components/xy-labels/modules/label.d.ts +0 -9
  548. package/components/xy-labels/modules/label.js +0 -107
  549. package/components/xy-labels/modules/label.js.map +0 -1
  550. package/components/xy-labels/style.d.ts +0 -5
  551. package/components/xy-labels/style.js.map +0 -1
  552. package/components/xy-labels/types.d.ts +0 -23
  553. package/components/xy-labels/types.js +0 -9
  554. package/components/xy-labels/types.js.map +0 -1
  555. package/components.d.ts +0 -51
  556. package/components.js +0 -29
  557. package/components.js.map +0 -1
  558. package/containers/single-container/config.d.ts +0 -12
  559. package/containers/single-container/config.js +0 -12
  560. package/containers/single-container/config.js.map +0 -1
  561. package/containers/single-container/index.d.ts +0 -19
  562. package/containers/single-container/index.js +0 -128
  563. package/containers/single-container/index.js.map +0 -1
  564. package/containers/xy-container/config.d.ts +0 -99
  565. package/containers/xy-container/config.js +0 -30
  566. package/containers/xy-container/config.js.map +0 -1
  567. package/containers/xy-container/index.d.ts +0 -34
  568. package/containers/xy-container/index.js +0 -330
  569. package/containers/xy-container/index.js.map +0 -1
  570. package/containers.d.ts +0 -6
  571. package/containers.js +0 -4
  572. package/containers.js.map +0 -1
  573. package/core/component/config.d.ts +0 -58
  574. package/core/component/config.js +0 -14
  575. package/core/component/config.js.map +0 -1
  576. package/core/component/index.d.ts +0 -43
  577. package/core/component/index.js +0 -118
  578. package/core/component/index.js.map +0 -1
  579. package/core/component/types.d.ts +0 -2
  580. package/core/component/types.js +0 -2
  581. package/core/component/types.js.map +0 -1
  582. package/core/config/index.d.ts +0 -3
  583. package/core/config/index.js +0 -16
  584. package/core/config/index.js.map +0 -1
  585. package/core/container/config.d.ts +0 -48
  586. package/core/container/config.js +0 -29
  587. package/core/container/config.js.map +0 -1
  588. package/core/container/index.d.ts +0 -26
  589. package/core/container/index.js +0 -105
  590. package/core/container/index.js.map +0 -1
  591. package/core/xy-component/config.d.ts +0 -38
  592. package/core/xy-component/config.js +0 -20
  593. package/core/xy-component/config.js.map +0 -1
  594. package/core/xy-component/index.d.ts +0 -27
  595. package/core/xy-component/index.js +0 -74
  596. package/core/xy-component/index.js.map +0 -1
  597. package/data-models/core.d.ts +0 -6
  598. package/data-models/core.js +0 -14
  599. package/data-models/core.js.map +0 -1
  600. package/data-models/graph.d.ts +0 -24
  601. package/data-models/graph.js +0 -107
  602. package/data-models/graph.js.map +0 -1
  603. package/data-models/map-graph.d.ts +0 -21
  604. package/data-models/map-graph.js +0 -62
  605. package/data-models/map-graph.js.map +0 -1
  606. package/data-models/map.d.ts +0 -5
  607. package/data-models/map.js +0 -12
  608. package/data-models/map.js.map +0 -1
  609. package/data-models/series.d.ts +0 -6
  610. package/data-models/series.js +0 -19
  611. package/data-models/series.js.map +0 -1
  612. package/index.d.ts +0 -7
  613. package/index.js +0 -55
  614. package/index.js.map +0 -1
  615. package/maps/china-provinces.json.js +0 -140373
  616. package/maps/fr-regions.json.js +0 -14162
  617. package/maps/germany-regions.json.js +0 -35760
  618. package/maps/ind-regions.json.js +0 -290584
  619. package/maps/uk-regions.json.js +0 -96233
  620. package/maps/us-counties.json.js +0 -206318
  621. package/maps/us-states.json.js +0 -16345
  622. package/maps/world-110m-alpha.json.js +0 -251366
  623. package/maps/world-simple.json.js +0 -89428
  624. package/maps/world-simplest.json.js +0 -28175
  625. package/maps.d.ts +0 -60
  626. package/maps.js +0 -23
  627. package/styles/colors.d.ts +0 -7
  628. package/styles/colors.js +0 -24
  629. package/styles/colors.js.map +0 -1
  630. package/styles/index.d.ts +0 -7
  631. package/styles/index.js +0 -38
  632. package/styles/index.js.map +0 -1
  633. package/styles/sizes.d.ts +0 -2
  634. package/styles/sizes.js.map +0 -1
  635. package/types/accessor.d.ts +0 -5
  636. package/types/accessor.js +0 -2
  637. package/types/accessor.js.map +0 -1
  638. package/types/component.d.ts +0 -13
  639. package/types/component.js +0 -14
  640. package/types/component.js.map +0 -1
  641. package/types/curve.d.ts +0 -40
  642. package/types/curve.js +0 -46
  643. package/types/curve.js.map +0 -1
  644. package/types/data.d.ts +0 -7
  645. package/types/data.js +0 -2
  646. package/types/data.js.map +0 -1
  647. package/types/direction.d.ts +0 -6
  648. package/types/direction.js +0 -10
  649. package/types/direction.js.map +0 -1
  650. package/types/graph.d.ts +0 -35
  651. package/types/graph.js +0 -2
  652. package/types/graph.js.map +0 -1
  653. package/types/map.d.ts +0 -4
  654. package/types/map.js +0 -2
  655. package/types/map.js.map +0 -1
  656. package/types/misc.d.ts +0 -8
  657. package/types/position.d.ts +0 -20
  658. package/types/position.js +0 -27
  659. package/types/position.js.map +0 -1
  660. package/types/scale.d.ts +0 -23
  661. package/types/scale.js +0 -27
  662. package/types/scale.js.map +0 -1
  663. package/types/shape.d.ts +0 -7
  664. package/types/shape.js +0 -11
  665. package/types/shape.js.map +0 -1
  666. package/types/spacing.d.ts +0 -6
  667. package/types/spacing.js +0 -2
  668. package/types/spacing.js.map +0 -1
  669. package/types/svg.d.ts +0 -18
  670. package/types/svg.js +0 -22
  671. package/types/svg.js.map +0 -1
  672. package/types/symbol.d.ts +0 -18
  673. package/types/symbol.js +0 -24
  674. package/types/symbol.js.map +0 -1
  675. package/types/text.d.ts +0 -46
  676. package/types/text.js +0 -26
  677. package/types/text.js.map +0 -1
  678. package/types.d.ts +0 -27
  679. package/types.js +0 -30
  680. package/types.js.map +0 -1
  681. package/utils/color.d.ts +0 -10
  682. package/utils/color.js +0 -32
  683. package/utils/color.js.map +0 -1
  684. package/utils/d3.d.ts +0 -3
  685. package/utils/d3.js +0 -16
  686. package/utils/d3.js.map +0 -1
  687. package/utils/data.d.ts +0 -45
  688. package/utils/data.js +0 -274
  689. package/utils/data.js.map +0 -1
  690. package/utils/html.d.ts +0 -1
  691. package/utils/html.js +0 -16
  692. package/utils/html.js.map +0 -1
  693. package/utils/map.d.ts +0 -2
  694. package/utils/map.js +0 -20
  695. package/utils/map.js.map +0 -1
  696. package/utils/misc.d.ts +0 -9
  697. package/utils/misc.js +0 -47
  698. package/utils/misc.js.map +0 -1
  699. package/utils/path.d.ts +0 -23
  700. package/utils/path.js +0 -144
  701. package/utils/path.js.map +0 -1
  702. package/utils/scale.d.ts +0 -1
  703. package/utils/style.d.ts +0 -6
  704. package/utils/style.js +0 -24
  705. package/utils/style.js.map +0 -1
  706. package/utils/svg.d.ts +0 -3
  707. package/utils/text.d.ts +0 -139
  708. package/utils/text.js +0 -417
  709. package/utils/text.js.map +0 -1
  710. package/utils/type.d.ts +0 -5
@@ -1,9 +1,10 @@
1
- import { css, injectGlobal } from '@emotion/css';
1
+ import { css, injectGlobal } from '@emotion/css'
2
2
 
3
- const root = css `
3
+ export const root = css`
4
4
  label: timeline-component;
5
- `;
6
- const globalStyles = injectGlobal `
5
+ `
6
+
7
+ export const globalStyles = injectGlobal`
7
8
  :root {
8
9
  --vis-timeline-row-even-fill-color: #FFFFFF;
9
10
  --vis-timeline-row-odd-fill-color: #F7FAFC;
@@ -35,14 +36,17 @@ const globalStyles = injectGlobal `
35
36
  --vis-timeline-scrollbar-color: var(--vis-dark-timeline-scrollbar-color);
36
37
  --vis-timeline-label-color: var(--vis-dark-timeline-label-color);
37
38
  }
38
- `;
39
- const background = css `
39
+ `
40
+
41
+ export const background = css`
40
42
  label: background;
41
- `;
42
- const lines = css `
43
+ `
44
+
45
+ export const lines = css`
43
46
  label: lines;
44
- `;
45
- const line = css `
47
+ `
48
+
49
+ export const line = css`
46
50
  label: line;
47
51
  fill: var(--vis-timeline-line-color);
48
52
  cursor: var(--vis-timeline-cursor);
@@ -53,41 +57,46 @@ const line = css `
53
57
  &.odd {
54
58
  stroke: var(--vis-timeline-line-stroke-color, var(--vis-timeline-row-odd-fill-color));
55
59
  }
56
- `;
57
- const rows = css `
60
+ `
61
+
62
+ export const rows = css`
58
63
  label: rows;
59
- `;
60
- const row = css `
64
+ `
65
+
66
+ export const row = css`
61
67
  label: row;
62
68
  fill: var(--vis-timeline-row-even-fill-color);
63
69
  opacity: var(--vis-timeline-row-background-opacity);
64
- `;
65
- const rowOdd = css `
70
+ `
71
+
72
+ export const rowOdd = css`
66
73
  label: row-odd;
67
74
  fill: var(--vis-timeline-row-odd-fill-color);
68
- `;
69
- const scrollbar = css `
75
+ `
76
+
77
+ export const scrollbar = css`
70
78
  label: scroll-bar;
71
- `;
72
- const scrollbarHandle = css `
79
+ `
80
+
81
+ export const scrollbarHandle = css`
73
82
  label: scroll-bar-handle;
74
83
  fill: var(--vis-timeline-scrollbar-color);
75
- `;
76
- const scrollbarBackground = css `
84
+ `
85
+
86
+ export const scrollbarBackground = css`
77
87
  label: scroll-bar-background;
78
88
  fill: var(--vis-timeline-scrollbar-background-color);
79
- `;
80
- const labels = css `
89
+ `
90
+
91
+ export const labels = css`
81
92
  label: labels;
82
- `;
83
- const label = css `
93
+ `
94
+
95
+ export const label = css`
84
96
  label: label;
85
97
  dominant-baseline: middle;
86
98
  font-size: var(--vis-timeline-label-font-size);
87
99
  fill: var(--vis-timeline-label-color);
88
100
  text-anchor: end;
89
101
  user-select: none;
90
- `;
91
-
92
- export { background, globalStyles, label, labels, line, lines, root, row, rowOdd, rows, scrollbar, scrollbarBackground, scrollbarHandle };
93
- //# sourceMappingURL=style.js.map
102
+ `
@@ -0,0 +1,69 @@
1
+ /* eslint-disable no-irregular-whitespace */
2
+ import { Config } from 'core/config'
3
+ import { ComponentCore } from 'core/component'
4
+
5
+ // Types
6
+ import { Position } from 'types/position'
7
+
8
+ export interface TooltipConfigInterface {
9
+ /** An array of visualization components to interact with. Default: `[]` */
10
+ components?: ComponentCore<unknown>[];
11
+ /** Container to where the Tooltip component should be inserted. Default: `undefined` */
12
+ container?: HTMLElement;
13
+ /** Horizontal placement of the tooltip. Default: `Position.Auto` */
14
+ horizontalPlacement?: Position | string | undefined;
15
+ /** Horizontal shift of the tooltip in pixels. Default: `0` */
16
+ horizontalShift?: number;
17
+ /** Vertical placement of the tooltip. Default: `Position.Top` */
18
+ verticalPlacement?: Position | string | undefined;
19
+ /** Vertical shift of the tooltip in pixels. Default: `0` */
20
+ verticalShift?: number;
21
+ /** Defines the content of the tooltip and hovering over which elements should trigger it.
22
+ * An object containing properties in the following format:
23
+ *
24
+ * ```
25
+ * {
26
+ *  [selectorString]: (d: unknown) => string | HTMLElement
27
+ * }
28
+ * ```
29
+ * e.g.:
30
+ * ```
31
+ * {
32
+ *  [Area.selectors.area]: (d: AreaDatum[]) => `<div>${d.value.toString()}</div>
33
+ * }
34
+ * ```
35
+ */
36
+ triggers?: {
37
+ [selector: string]: (data: any, i: number, elements: (HTMLElement | SVGElement)[]) => string | HTMLElement | undefined | null;
38
+ };
39
+ /** Custom DOM attributes for the tooltip. Useful when you need to refer to a specific tooltip instance
40
+ * by using a CSS selector. Attributes configuration object has the following structure:
41
+ *
42
+ * ```
43
+ * {
44
+ *  [attributeName]: attribute value
45
+ * }
46
+ * ```
47
+ * e.g.:
48
+ * ```
49
+ * {
50
+ *  'type': 'area-tooltip',
51
+ *  'value': 42
52
+ * }
53
+ * ```
54
+ */
55
+ attributes?: { [attr: string]: string | number | boolean };
56
+ }
57
+
58
+ export class TooltipConfig extends Config implements TooltipConfigInterface {
59
+ components: ComponentCore<unknown>[] = []
60
+ container = undefined
61
+ horizontalPlacement = Position.Auto
62
+ horizontalShift = 0
63
+ verticalPlacement = Position.Top
64
+ verticalShift = 0
65
+ attributes: { [attr: string]: string | number | boolean } = {}
66
+ triggers: {
67
+ [selector: string]: (data: any, i: number, elements: (HTMLElement | SVGElement)[]) => string | HTMLElement | undefined | null;
68
+ } = {}
69
+ }
@@ -0,0 +1,220 @@
1
+ import { select, Selection, pointer } from 'd3-selection'
2
+
3
+ // Core
4
+ import { ComponentCore } from 'core/component'
5
+
6
+ // Types
7
+ import { Position } from 'types/position'
8
+
9
+ // Utils
10
+ import { throttle } from 'utils/data'
11
+
12
+ // Config
13
+ import { TooltipConfig, TooltipConfigInterface } from './config'
14
+
15
+ // Style
16
+ import * as s from './style'
17
+
18
+ export class Tooltip {
19
+ element: HTMLElement
20
+ div: Selection<HTMLElement, unknown, null, undefined>
21
+ config: TooltipConfig
22
+ prevConfig: TooltipConfig
23
+ components: ComponentCore<unknown>[]
24
+ static selectors = s
25
+ private _setUpEventsThrottled = throttle(this._setUpEvents, 500)
26
+ private _setContainerPositionThrottled = throttle(this._setContainerPosition, 500)
27
+ private _isShown = false
28
+ private _container: HTMLElement
29
+
30
+ constructor (config: TooltipConfigInterface = {}) {
31
+ this.element = document.createElement('div')
32
+ this.div = select(this.element)
33
+ .attr('class', s.tooltip)
34
+
35
+ this.setConfig(config)
36
+ this.components = this.config.components
37
+ }
38
+
39
+ public setConfig (config: TooltipConfigInterface): void {
40
+ this.prevConfig = this.config
41
+ this.config = new TooltipConfig().init(config)
42
+
43
+ if (this.config.container && (this.config.container !== this.prevConfig?.container)) {
44
+ this.setContainer(this.config.container)
45
+ }
46
+
47
+ this._setUpAttributes()
48
+ }
49
+
50
+ public setContainer (container: HTMLElement): void {
51
+ this.element.parentNode?.removeChild(this.element)
52
+
53
+ this._container = container
54
+ this._container.appendChild(this.element)
55
+
56
+ this._setContainerPositionThrottled()
57
+ }
58
+
59
+ public getContainer (): HTMLElement {
60
+ return this._container
61
+ }
62
+
63
+ public hasContainer (): boolean {
64
+ return !!this._container && this._container.isConnected
65
+ }
66
+
67
+ public setComponents (components: ComponentCore<unknown>[]): void {
68
+ this.components = components
69
+ }
70
+
71
+ public update (): void {
72
+ if (!this._container) return
73
+
74
+ this._setUpEventsThrottled()
75
+ }
76
+
77
+ public show (html: string | HTMLElement, pos: { x: number; y: number }): void {
78
+ if (html instanceof HTMLElement) {
79
+ const node = this.div.select(':first-child').node()
80
+ if (node !== html) this.div.html('').append(() => html)
81
+ } else {
82
+ this.div.html(html)
83
+ }
84
+
85
+ this.div.classed(s.show, true)
86
+ this._isShown = true
87
+ this.place(pos)
88
+ }
89
+
90
+ public hide (): void {
91
+ this.div.classed(s.show, false)
92
+ this._isShown = false
93
+ }
94
+
95
+ public place (pos: { x: number; y: number }): void {
96
+ if (!this.hasContainer()) {
97
+ console.warn('Unovis | Tooltip: Container was not set or is not initialized yet')
98
+ return
99
+ }
100
+ const { config } = this
101
+ const isContainerBody = this.isContainerBody()
102
+ const width = this.element.offsetWidth
103
+ const height = this.element.offsetHeight
104
+ const containerHeight = isContainerBody ? window.innerHeight : this._container.scrollHeight
105
+ const containerWidth = isContainerBody ? window.innerWidth : this._container.scrollWidth
106
+
107
+ const horizontalPlacement = config.horizontalPlacement === Position.Auto
108
+ ? (pos.x > containerWidth / 2 ? Position.Left : Position.Right)
109
+ : config.horizontalPlacement
110
+
111
+ const verticalPlacement = config.verticalPlacement === Position.Auto
112
+ ? (pos.y > containerHeight / 2 ? Position.Top : Position.Bottom)
113
+ : config.verticalPlacement
114
+
115
+ // dx and dy variables shift the tooltip from the default position (above the cursor, centred horizontally)
116
+ const margin = 5
117
+ const dx = horizontalPlacement === Position.Left ? -width - margin - config.horizontalShift
118
+ : horizontalPlacement === Position.Center ? -width / 2
119
+ : margin + config.horizontalShift
120
+ const dy = verticalPlacement === Position.Bottom ? height + margin + config.verticalShift
121
+ : verticalPlacement === Position.Center ? height / 2
122
+ : -margin - config.verticalShift
123
+
124
+ // Constraint to container
125
+ const paddingX = 10
126
+ const hitRight = pos.x > (containerWidth - width - dx - paddingX)
127
+ const hitLeft = pos.x < -dx + paddingX
128
+ const constraintX = hitRight ? (containerWidth - width - dx) - pos.x - paddingX
129
+ : hitLeft ? -dx - pos.x + paddingX : 0
130
+
131
+ const paddingY = 10
132
+ const hitBottom = pos.y > (containerHeight - dy - paddingY)
133
+ const hitTop = pos.y < (height - dy + paddingY)
134
+ const constraintY = hitBottom ? containerHeight - dy - pos.y - paddingY
135
+ : hitTop ? height - dy - pos.y + paddingY : 0
136
+
137
+ // Placing
138
+ // If the container size is smaller than the the tooltip size we just stick the tooltip to the top / left
139
+ const x = containerWidth < width ? 0 : pos.x + constraintX + dx
140
+ const y = containerHeight < height ? height : pos.y + constraintY + dy
141
+
142
+ this.div
143
+ .classed(s.positionFixed, isContainerBody)
144
+ .style('top', isContainerBody ? `${y - height}px` : 'unset')
145
+ .style('bottom', !isContainerBody ? `${containerHeight - y}px` : 'unset')
146
+ .style('left', `${x}px`)
147
+ }
148
+
149
+ public isContainerBody (): boolean {
150
+ return this._container === document.body
151
+ }
152
+
153
+ private _setContainerPosition (): void {
154
+ // Tooltip position calculation relies on the parent position
155
+ // If it's not set (static), we set it to `relative` (not a good practice)
156
+ if (getComputedStyle(this._container)?.position === 'static') {
157
+ this._container.style.position = 'relative'
158
+ }
159
+ }
160
+
161
+ private _setUpEvents (): void {
162
+ const { config: { triggers } } = this
163
+ const isContainerBody = this.isContainerBody()
164
+
165
+ // We use the Event Delegation pattern to set up Tooltip events
166
+ // Every component will have single `mousemove` and `mouseleave` event listener functions, where we'll check
167
+ // the `path` of the event and trigger corresponding callbacks
168
+ this.components.forEach(component => {
169
+ const selection = select(component.element)
170
+ selection
171
+ .on('mousemove.tooltip', (e: MouseEvent) => {
172
+ const [x, y] = isContainerBody ? [e.clientX, e.clientY] : pointer(e, this._container)
173
+ const path: (HTMLElement | SVGGElement)[] = (e.composedPath && e.composedPath()) || (e as any).path || [e.target]
174
+
175
+ // Go through all of the configured triggers
176
+ for (const className of Object.keys(triggers)) {
177
+ const template = triggers[className]
178
+ const els = selection.selectAll<HTMLElement | SVGGElement, unknown>(`.${className}`).nodes()
179
+
180
+ // Go through all of the elements in the event path (from the deepest element upwards)
181
+ for (const el of path) {
182
+ if (el === selection.node()) break // Break on the component's level (usually the `<g>` element)
183
+ if (el.classList.contains(className)) { // If there's a match, show the tooltip
184
+ const i = els.indexOf(el)
185
+ const d = select(el).datum()
186
+ const content = template(d, i, els)
187
+ if (content) this.show(content, { x, y })
188
+ else this.hide()
189
+
190
+ e.stopPropagation() // Stop propagation to prevent other interfering events from being triggered, e.g. Crosshair
191
+ return // Stop looking for other matches
192
+ }
193
+ }
194
+ }
195
+
196
+ // Hide the tooltip if the event didn't pass through any of the configured triggers.
197
+ // We use the `this._isShown` condition as a little performance optimization tweak
198
+ // (we don't want the tooltip to update its class on every mouse movement, see `this.hide()`).
199
+ if (this._isShown) this.hide()
200
+ })
201
+ .on('mouseleave.tooltip', (e: MouseEvent) => {
202
+ e.stopPropagation() // Stop propagation to prevent other interfering events from being triggered, e.g. Crosshair
203
+ this.hide()
204
+ })
205
+ })
206
+ }
207
+
208
+ private _setUpAttributes (): void {
209
+ const attributesMap = this.config.attributes
210
+ if (!attributesMap) return
211
+
212
+ Object.keys(attributesMap).forEach(attr => {
213
+ this.div.attr(attr, attributesMap[attr])
214
+ })
215
+ }
216
+
217
+ public destroy (): void {
218
+ this.div?.remove()
219
+ }
220
+ }
@@ -1,10 +1,10 @@
1
- import { css, injectGlobal } from '@emotion/css';
1
+ import { css, injectGlobal } from '@emotion/css'
2
2
 
3
- const root = css`
3
+ export const root = css`
4
4
  label: tooltip;
5
- `;
5
+ `
6
6
 
7
- const variables = injectGlobal`
7
+ export const variables = injectGlobal`
8
8
  :root {
9
9
  --vis-tooltip-background-color: rgba(255, 255, 255, 0.95);
10
10
  --vis-tooltip-border-color: #e5e9f7;
@@ -32,9 +32,9 @@ const variables = injectGlobal`
32
32
  --vis-tooltip-border-color: var(--vis-color-grey);
33
33
  --vis-tooltip-shadow-color: rgba(0,0,0, 0.95);
34
34
  }
35
- `;
35
+ `
36
36
 
37
- const tooltip = css`
37
+ export const tooltip = css`
38
38
  label: tooltip;
39
39
  display: inline-block;
40
40
  left: 0;
@@ -57,16 +57,13 @@ const tooltip = css`
57
57
  border: solid 1px var(--vis-tooltip-border-color);
58
58
  background-color: var(--vis-tooltip-background-color);
59
59
  backdrop-filter: var(--vis-tooltip-backdrop-filter);
60
- `;
60
+ `
61
61
 
62
- const positionFixed = css`
62
+ export const positionFixed = css`
63
63
  bottom: unset;
64
64
  position: fixed;
65
- `;
65
+ `
66
66
 
67
- const show = css`
67
+ export const show = css`
68
68
  opacity: 1;
69
- `;
70
-
71
- export { positionFixed, root, show, tooltip, variables };
72
- //# sourceMappingURL=style.js.map
69
+ `
@@ -0,0 +1,124 @@
1
+ /* eslint-disable dot-notation */
2
+ import { GeoProjection } from 'd3-geo'
3
+ import { ComponentConfigInterface, ComponentConfig } from 'core/component/config'
4
+
5
+ // Types
6
+ import { ColorAccessor, NumericAccessor, StringAccessor } from 'types/accessor'
7
+
8
+ // Local Types
9
+ import { MapProjection, MapPointLabelPosition } from './types'
10
+
11
+ export interface TopoJSONMapConfigInterface<
12
+ AreaDatum,
13
+ PointDatum = unknown,
14
+ LinkDatum = unknown,
15
+ > extends ComponentConfigInterface {
16
+ // General
17
+ /** MapProjection (aka D3's GeoProjection) instance. Default: `MapProjection.Kavrayskiy7()` */
18
+ projection?: GeoProjection;
19
+ /** Map data in the TopoJSON topology format. Default: `undefined` */
20
+ topojson?: TopoJSON.Topology;
21
+ /** Name of the map features to be displayed, e.g. 'countries' or 'counties'. Default: `countries` */
22
+ mapFeatureName?: string;
23
+ /** Set initial map fit to points instead of topojson features. Default: `false` */
24
+ mapFitToPoints?: boolean;
25
+ /** Initial zoom level. Default: `undefined` */
26
+ zoomFactor?: number;
27
+ /** Disable pan / zoom interactions. Default: `false` */
28
+ disableZoom?: boolean;
29
+ /** Zoom extent. Default: `[0.5, 6]` */
30
+ zoomExtent?: number[];
31
+ /** Zoom animation duration. Default: `400` */
32
+ zoomDuration?: number;
33
+
34
+ /** Link width value or accessor function. Default: `d => d.width ?? 1` */
35
+ linkWidth?: NumericAccessor<LinkDatum>;
36
+ /** Link color value or accessor function. Default: `d => d.color ?? null` */
37
+ linkColor?: ColorAccessor<LinkDatum>;
38
+ /** Link cursor value or accessor function. Default: `null` */
39
+ linkCursor?: StringAccessor<AreaDatum>;
40
+ /** Link id accessor function. Default: `d => d.id` */
41
+ linkId?: StringAccessor<LinkDatum>;
42
+ /** Link source accessor function. Default: `d => d.source` */
43
+ linkSource?: ((l: LinkDatum) => number | string | PointDatum);
44
+ /** Link target accessor function. Default: `d => d.target` */
45
+ linkTarget?: ((l: LinkDatum) => number | string | PointDatum);
46
+
47
+ /** Area id accessor function corresponding to the feature id from TopoJSON. Default: `d => d.id ?? ''` */
48
+ areaId?: StringAccessor<AreaDatum>;
49
+ /** Area color value or accessor function. Default: `d => d.color ?? null` */
50
+ areaColor?: ColorAccessor<AreaDatum>;
51
+ /** Area cursor value or accessor function. Default: `null` */
52
+ areaCursor?: StringAccessor<AreaDatum>;
53
+
54
+ /** Point color accessor. Default: `d => d.color ?? null` */
55
+ pointColor?: ColorAccessor<PointDatum>;
56
+ /** Point radius accessor. Default: `d => d.radius ?? 8` */
57
+ pointRadius?: NumericAccessor<PointDatum>;
58
+ /** Point stroke width accessor. Default: `d => d.strokeWidth ?? null` */
59
+ pointStrokeWidth?: NumericAccessor<PointDatum>;
60
+ /** Point cursor constant value or accessor function. Default: `null` */
61
+ pointCursor?: StringAccessor<AreaDatum>;
62
+ /** Point longitude accessor function. Default: `d => d.longitude ?? null` */
63
+ longitude?: NumericAccessor<PointDatum>;
64
+ /** Point latitude accessor function. Default: `d => d.latitude ?? null` */
65
+ latitude?: NumericAccessor<PointDatum>;
66
+ /** Point label accessor function. Default: `undefined` */
67
+ pointLabel?: StringAccessor<PointDatum>;
68
+ /** Point label position. Default: `Position.Bottom` */
69
+ pointLabelPosition?: MapPointLabelPosition;
70
+ /** Point color brightness ratio for switching between dark and light text label color. Default: `0.65` */
71
+ pointLabelTextBrightnessRatio?: number;
72
+ /** Point id accessor function. Default: `d => d.id` */
73
+ pointId?: ((d: PointDatum, i: number) => string);
74
+
75
+ /** Enables blur and blending between neighbouring points. Default: `false` */
76
+ heatmapMode?: boolean;
77
+ /** Heatmap blur filter stdDeviation value. Default: `10` */
78
+ heatmapModeBlurStdDeviation?: number;
79
+ /** Zoom level at which the heatmap mode will be disabled. Default: `2.5` */
80
+ heatmapModeZoomLevelThreshold?: number;
81
+ }
82
+
83
+ export class TopoJSONMapConfig<
84
+ AreaDatum,
85
+ PointDatum = unknown,
86
+ LinkDatum = unknown,
87
+ > extends ComponentConfig implements TopoJSONMapConfigInterface<AreaDatum, PointDatum, LinkDatum> {
88
+ projection = MapProjection.Kavrayskiy7()
89
+ duration = 1500
90
+ topojson = undefined
91
+ mapFeatureName = 'countries'
92
+ mapFitToPoints = false
93
+
94
+ zoomExtent = [0.5, 6]
95
+ zoomDuration = 400
96
+ disableZoom = false
97
+ zoomFactor = undefined
98
+
99
+ linkWidth = (d: LinkDatum): number => d['width'] ?? 1
100
+ linkColor = (d: LinkDatum): string => d['color'] ?? null
101
+ linkCursor = null
102
+ linkId = (d: LinkDatum, i: number | undefined): string => `${d['id'] ?? i}`
103
+ linkSource = (d: LinkDatum): (number | string | PointDatum) => d['source']
104
+ linkTarget = (d: LinkDatum): (number | string | PointDatum) => d['target']
105
+
106
+ areaId = (d: AreaDatum): string => d['id'] ?? ''
107
+ areaColor = (d: AreaDatum): string => d['color'] ?? null
108
+ areaCursor = null
109
+
110
+ longitude = (d: PointDatum): number => d['longitude']
111
+ latitude = (d: PointDatum): number => d['latitude']
112
+ pointColor = (d: PointDatum): string => d['color'] ?? null
113
+ pointRadius = (d: PointDatum): number => d['radius'] ?? 8
114
+ pointStrokeWidth = (d: PointDatum): number => d['strokeWidth'] ?? 0
115
+ pointCursor = null
116
+ pointLabel = undefined
117
+ pointLabelPosition = MapPointLabelPosition.Bottom
118
+ pointLabelTextBrightnessRatio = 0.65
119
+ pointId = (d: PointDatum): string => d['id']
120
+
121
+ heatmapMode = false
122
+ heatmapModeBlurStdDeviation = 8
123
+ heatmapModeZoomLevelThreshold = 2.5
124
+ }