@unovis/ts 1.3.0-alpha.2 → 1.3.0-beta.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 (245) hide show
  1. package/components/area/config.d.ts +6 -10
  2. package/components/area/config.js +3 -12
  3. package/components/area/config.js.map +1 -1
  4. package/components/area/index.d.ts +5 -6
  5. package/components/area/index.js +10 -9
  6. package/components/area/index.js.map +1 -1
  7. package/components/axis/config.d.ts +3 -27
  8. package/components/axis/config.js +3 -30
  9. package/components/axis/config.js.map +1 -1
  10. package/components/axis/index.d.ts +4 -3
  11. package/components/axis/index.js +7 -4
  12. package/components/axis/index.js.map +1 -1
  13. package/components/brush/config.d.ts +2 -12
  14. package/components/brush/config.js +11 -20
  15. package/components/brush/config.js.map +1 -1
  16. package/components/brush/index.d.ts +4 -3
  17. package/components/brush/index.js +4 -3
  18. package/components/brush/index.js.map +1 -1
  19. package/components/bullet-legend/config.d.ts +5 -11
  20. package/components/bullet-legend/config.js +12 -13
  21. package/components/bullet-legend/config.js.map +1 -1
  22. package/components/bullet-legend/index.d.ts +4 -3
  23. package/components/bullet-legend/index.js +11 -18
  24. package/components/bullet-legend/index.js.map +1 -1
  25. package/components/bullet-legend/modules/shape.d.ts +6 -0
  26. package/components/bullet-legend/modules/shape.js +58 -0
  27. package/components/bullet-legend/modules/shape.js.map +1 -0
  28. package/components/bullet-legend/style.js +6 -9
  29. package/components/bullet-legend/style.js.map +1 -1
  30. package/components/bullet-legend/types.d.ts +5 -0
  31. package/components/bullet-legend/types.js +7 -0
  32. package/components/bullet-legend/types.js.map +1 -1
  33. package/components/chord-diagram/config.d.ts +7 -23
  34. package/components/chord-diagram/config.js +3 -22
  35. package/components/chord-diagram/config.js.map +1 -1
  36. package/components/chord-diagram/index.d.ts +4 -3
  37. package/components/chord-diagram/index.js +7 -6
  38. package/components/chord-diagram/index.js.map +1 -1
  39. package/components/chord-diagram/modules/label.d.ts +3 -3
  40. package/components/chord-diagram/modules/label.js +1 -1
  41. package/components/chord-diagram/modules/label.js.map +1 -1
  42. package/components/chord-diagram/modules/link.d.ts +2 -2
  43. package/components/chord-diagram/modules/link.js.map +1 -1
  44. package/components/chord-diagram/modules/node.d.ts +2 -2
  45. package/components/chord-diagram/modules/node.js.map +1 -1
  46. package/components/chord-diagram/types.d.ts +3 -2
  47. package/components/chord-diagram/types.js.map +1 -1
  48. package/components/crosshair/config.d.ts +6 -14
  49. package/components/crosshair/config.js +3 -16
  50. package/components/crosshair/config.js.map +1 -1
  51. package/components/crosshair/index.d.ts +4 -3
  52. package/components/crosshair/index.js +4 -3
  53. package/components/crosshair/index.js.map +1 -1
  54. package/components/donut/config.d.ts +2 -19
  55. package/components/donut/config.js +5 -24
  56. package/components/donut/config.js.map +1 -1
  57. package/components/donut/index.d.ts +4 -3
  58. package/components/donut/index.js +5 -4
  59. package/components/donut/index.js.map +1 -1
  60. package/components/donut/modules/arc.d.ts +3 -3
  61. package/components/donut/modules/arc.js.map +1 -1
  62. package/components/flow-legend/config.d.ts +1 -11
  63. package/components/flow-legend/config.js +11 -16
  64. package/components/flow-legend/config.js.map +1 -1
  65. package/components/flow-legend/index.d.ts +4 -3
  66. package/components/flow-legend/index.js +5 -2
  67. package/components/flow-legend/index.js.map +1 -1
  68. package/components/free-brush/config.d.ts +2 -12
  69. package/components/free-brush/config.js +11 -20
  70. package/components/free-brush/config.js.map +1 -1
  71. package/components/free-brush/index.d.ts +4 -3
  72. package/components/free-brush/index.js +6 -5
  73. package/components/free-brush/index.js.map +1 -1
  74. package/components/graph/config.d.ts +3 -75
  75. package/components/graph/config.js +12 -78
  76. package/components/graph/config.js.map +1 -1
  77. package/components/graph/index.d.ts +8 -7
  78. package/components/graph/index.js +4 -3
  79. package/components/graph/index.js.map +1 -1
  80. package/components/graph/modules/layout.d.ts +7 -7
  81. package/components/graph/modules/layout.js.map +1 -1
  82. package/components/graph/modules/link/helper.d.ts +5 -5
  83. package/components/graph/modules/link/helper.js.map +1 -1
  84. package/components/graph/modules/link/index.d.ts +6 -6
  85. package/components/graph/modules/link/index.js.map +1 -1
  86. package/components/graph/modules/node/index.d.ts +6 -6
  87. package/components/graph/modules/node/index.js +2 -2
  88. package/components/graph/modules/node/index.js.map +1 -1
  89. package/components/graph/modules/panel/helper.d.ts +4 -4
  90. package/components/graph/modules/panel/helper.js.map +1 -1
  91. package/components/graph/modules/panel/index.d.ts +3 -3
  92. package/components/graph/modules/panel/index.js.map +1 -1
  93. package/components/grouped-bar/config.d.ts +5 -13
  94. package/components/grouped-bar/config.js +5 -16
  95. package/components/grouped-bar/config.js.map +1 -1
  96. package/components/grouped-bar/index.d.ts +4 -3
  97. package/components/grouped-bar/index.js +4 -3
  98. package/components/grouped-bar/index.js.map +1 -1
  99. package/components/leaflet-flow-map/config.d.ts +2 -16
  100. package/components/leaflet-flow-map/config.js +3 -21
  101. package/components/leaflet-flow-map/config.js.map +1 -1
  102. package/components/leaflet-flow-map/index.d.ts +4 -3
  103. package/components/leaflet-flow-map/index.js +3 -2
  104. package/components/leaflet-flow-map/index.js.map +1 -1
  105. package/components/leaflet-map/config.d.ts +4 -59
  106. package/components/leaflet-map/config.js +23 -67
  107. package/components/leaflet-map/config.js.map +1 -1
  108. package/components/leaflet-map/index.d.ts +4 -3
  109. package/components/leaflet-map/index.js +4 -3
  110. package/components/leaflet-map/index.js.map +1 -1
  111. package/components/leaflet-map/modules/map.d.ts +3 -3
  112. package/components/leaflet-map/modules/map.js.map +1 -1
  113. package/components/leaflet-map/modules/utils.d.ts +4 -4
  114. package/components/leaflet-map/modules/utils.js +6 -2
  115. package/components/leaflet-map/modules/utils.js.map +1 -1
  116. package/components/leaflet-map/renderer/mapboxgl-layer.d.ts +2 -2
  117. package/components/leaflet-map/renderer/mapboxgl-layer.js.map +1 -1
  118. package/components/line/config.d.ts +6 -11
  119. package/components/line/config.js +3 -13
  120. package/components/line/config.js.map +1 -1
  121. package/components/line/index.d.ts +4 -3
  122. package/components/line/index.js +5 -4
  123. package/components/line/index.js.map +1 -1
  124. package/components/nested-donut/config.d.ts +2 -21
  125. package/components/nested-donut/config.js +3 -24
  126. package/components/nested-donut/config.js.map +1 -1
  127. package/components/nested-donut/index.d.ts +4 -3
  128. package/components/nested-donut/index.js +15 -12
  129. package/components/nested-donut/index.js.map +1 -1
  130. package/components/nested-donut/modules/arc.d.ts +3 -3
  131. package/components/nested-donut/modules/arc.js +2 -1
  132. package/components/nested-donut/modules/arc.js.map +1 -1
  133. package/components/nested-donut/modules/label.d.ts +2 -2
  134. package/components/nested-donut/modules/label.js +9 -6
  135. package/components/nested-donut/modules/label.js.map +1 -1
  136. package/components/nested-donut/types.d.ts +1 -0
  137. package/components/nested-donut/types.js.map +1 -1
  138. package/components/sankey/config.d.ts +2 -47
  139. package/components/sankey/config.js +10 -57
  140. package/components/sankey/config.js.map +1 -1
  141. package/components/sankey/index.d.ts +4 -3
  142. package/components/sankey/index.js +3 -2
  143. package/components/sankey/index.js.map +1 -1
  144. package/components/sankey/modules/label.d.ts +7 -7
  145. package/components/sankey/modules/label.js.map +1 -1
  146. package/components/sankey/modules/link.d.ts +2 -2
  147. package/components/sankey/modules/link.js.map +1 -1
  148. package/components/sankey/modules/node.d.ts +7 -7
  149. package/components/sankey/modules/node.js +1 -1
  150. package/components/sankey/modules/node.js.map +1 -1
  151. package/components/scatter/config.d.ts +4 -16
  152. package/components/scatter/config.js +5 -19
  153. package/components/scatter/config.js.map +1 -1
  154. package/components/scatter/index.d.ts +4 -3
  155. package/components/scatter/index.js +5 -5
  156. package/components/scatter/index.js.map +1 -1
  157. package/components/scatter/modules/point.d.ts +2 -2
  158. package/components/scatter/modules/point.js.map +1 -1
  159. package/components/scatter/modules/utils.d.ts +2 -2
  160. package/components/scatter/modules/utils.js.map +1 -1
  161. package/components/stacked-bar/config.d.ts +5 -13
  162. package/components/stacked-bar/config.js +5 -16
  163. package/components/stacked-bar/config.js.map +1 -1
  164. package/components/stacked-bar/index.d.ts +4 -3
  165. package/components/stacked-bar/index.js +4 -3
  166. package/components/stacked-bar/index.js.map +1 -1
  167. package/components/timeline/config.d.ts +5 -16
  168. package/components/timeline/config.js +9 -21
  169. package/components/timeline/config.js.map +1 -1
  170. package/components/timeline/index.d.ts +4 -3
  171. package/components/timeline/index.js +4 -3
  172. package/components/timeline/index.js.map +1 -1
  173. package/components/tooltip/config.d.ts +1 -15
  174. package/components/tooltip/config.js +12 -16
  175. package/components/tooltip/config.js.map +1 -1
  176. package/components/tooltip/index.d.ts +4 -3
  177. package/components/tooltip/index.js +5 -3
  178. package/components/tooltip/index.js.map +1 -1
  179. package/components/topojson-map/config.d.ts +4 -36
  180. package/components/topojson-map/config.js +3 -38
  181. package/components/topojson-map/config.js.map +1 -1
  182. package/components/topojson-map/index.d.ts +4 -3
  183. package/components/topojson-map/index.js +4 -4
  184. package/components/topojson-map/index.js.map +1 -1
  185. package/components/vis-controls/config.d.ts +1 -5
  186. package/components/vis-controls/config.js +6 -9
  187. package/components/vis-controls/config.js.map +1 -1
  188. package/components/vis-controls/index.d.ts +3 -2
  189. package/components/vis-controls/index.js +5 -2
  190. package/components/vis-controls/index.js.map +1 -1
  191. package/components/xy-labels/config.d.ts +4 -16
  192. package/components/xy-labels/config.js +5 -20
  193. package/components/xy-labels/config.js.map +1 -1
  194. package/components/xy-labels/index.d.ts +4 -3
  195. package/components/xy-labels/index.js +3 -2
  196. package/components/xy-labels/index.js.map +1 -1
  197. package/components/xy-labels/modules/label.d.ts +3 -3
  198. package/components/xy-labels/modules/label.js +1 -1
  199. package/components/xy-labels/modules/label.js.map +1 -1
  200. package/containers/single-container/config.d.ts +2 -4
  201. package/containers/single-container/config.js +3 -8
  202. package/containers/single-container/config.js.map +1 -1
  203. package/containers/single-container/index.d.ts +4 -3
  204. package/containers/single-container/index.js +2 -2
  205. package/containers/single-container/index.js.map +1 -1
  206. package/containers/xy-container/config.d.ts +2 -22
  207. package/containers/xy-container/config.js +3 -26
  208. package/containers/xy-container/config.js.map +1 -1
  209. package/containers/xy-container/index.d.ts +3 -2
  210. package/containers/xy-container/index.js +2 -2
  211. package/containers/xy-container/index.js.map +1 -1
  212. package/core/component/config.d.ts +1 -6
  213. package/core/component/config.js +6 -12
  214. package/core/component/config.js.map +1 -1
  215. package/core/component/index.d.ts +7 -5
  216. package/core/component/index.js +8 -7
  217. package/core/component/index.js.map +1 -1
  218. package/core/container/config.d.ts +1 -21
  219. package/core/container/config.js +21 -25
  220. package/core/container/config.js.map +1 -1
  221. package/core/container/index.d.ts +5 -4
  222. package/core/container/index.js +4 -3
  223. package/core/container/index.js.map +1 -1
  224. package/core/xy-component/config.d.ts +2 -10
  225. package/core/xy-component/config.js +7 -16
  226. package/core/xy-component/config.js.map +1 -1
  227. package/core/xy-component/index.d.ts +5 -4
  228. package/core/xy-component/index.js +2 -0
  229. package/core/xy-component/index.js.map +1 -1
  230. package/data-models/map-graph.d.ts +1 -1
  231. package/data-models/map-graph.js +1 -1
  232. package/data-models/map-graph.js.map +1 -1
  233. package/index.js +1 -0
  234. package/index.js.map +1 -1
  235. package/package.json +1 -1
  236. package/types/accessor.d.ts +1 -1
  237. package/types.js +1 -1
  238. package/utils/color.d.ts +7 -3
  239. package/utils/color.js +18 -2
  240. package/utils/color.js.map +1 -1
  241. package/utils/data.d.ts +1 -1
  242. package/utils/data.js.map +1 -1
  243. package/core/config/index.d.ts +0 -3
  244. package/core/config/index.js +0 -16
  245. package/core/config/index.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/timeline/index.ts"],"sourcesContent":["import { select, Selection } from 'd3-selection'\nimport { Transition } from 'd3-transition'\nimport { scaleOrdinal, ScaleOrdinal } from 'd3-scale'\nimport { drag, D3DragEvent } from 'd3-drag'\nimport { max } from 'd3-array'\n\n// Core\nimport { XYComponentCore } from 'core/xy-component'\n\n// Utils\nimport { isNumber, unique, arrayOfIndices, getMin, getMax, getString, getNumber } from 'utils/data'\nimport { smartTransition } from 'utils/d3'\nimport { getColor } from 'utils/color'\nimport { trimSVGText } from 'utils/text'\n\n// Config\nimport { TimelineConfig, TimelineConfigInterface } from './config'\n\n// Styles\nimport * as s from './style'\n\nexport class Timeline<Datum> extends XYComponentCore<Datum, TimelineConfig<Datum>, TimelineConfigInterface<Datum>> {\n static selectors = s\n config: TimelineConfig<Datum> = new TimelineConfig()\n events = {\n [Timeline.selectors.rows]: {\n wheel: this._onMouseWheel.bind(this),\n },\n [Timeline.selectors.line]: {\n wheel: this._onMouseWheel.bind(this),\n },\n }\n\n private _background: Selection<SVGRectElement, unknown, SVGGElement, unknown>\n private _rowsGroup: Selection<SVGGElement, unknown, SVGGElement, unknown>\n private _linesGroup: Selection<SVGGElement, unknown, SVGGElement, unknown>\n private _labelsGroup: Selection<SVGGElement, unknown, SVGGElement, unknown>\n private _scrollBarGroup: Selection<SVGGElement, unknown, SVGGElement, unknown>\n private _scrollBarBackground: Selection<SVGRectElement, unknown, SVGGElement, unknown>\n private _scrollBarHandle: Selection<SVGRectElement, unknown, SVGGElement, unknown>\n private _scrollBarWidth = 5\n private _scrollDistance = 0\n private _scrollBarMargin = 5\n private _maxScroll = 0\n private _scrollbarHeight = 0\n private _labelMargin = 5\n\n constructor (config?: TimelineConfigInterface<Datum>) {\n super()\n if (config) this.config.init(config)\n\n // Invisible background rect to track events\n this._background = this.g.append('rect').attr('class', s.background)\n\n // Group for content\n this._rowsGroup = this.g.append('g').attr('class', s.rows)\n this._linesGroup = this.g.append('g').attr('class', s.lines)\n this._labelsGroup = this.g.append('g').attr('class', s.labels)\n this._scrollBarGroup = this.g.append('g').attr('class', s.scrollbar)\n\n // Scroll bar\n this._scrollBarBackground = this._scrollBarGroup.append('rect')\n .attr('class', s.scrollbarBackground)\n\n this._scrollBarHandle = this._scrollBarGroup.append('rect')\n .attr('class', s.scrollbarHandle)\n\n // Set up scrollbar drag event\n const dragBehaviour = drag<SVGRectElement, unknown>()\n .on('drag', this._onScrollbarDrag.bind(this))\n\n this._scrollBarHandle.call(dragBehaviour)\n }\n\n get bleed (): { top: number; bottom: number; left: number; right: number } {\n const { config, datamodel: { data } } = this\n\n // We calculate the longest label width to set the bleed values accordingly\n let labelsBleed = 0\n if (config.showLabels) {\n if (config.labelWidth) labelsBleed = config.labelWidth + this._labelMargin\n else {\n const recordLabels = this._getRecordLabels(data)\n const longestLabel = recordLabels.reduce((acc, val) => acc.length > val.length ? acc : val, '')\n const label = this._labelsGroup.append('text')\n .attr('class', s.label)\n .text(longestLabel)\n .call(trimSVGText, config.maxLabelWidth)\n const labelWidth = label.node().getBBox().width\n this._labelsGroup.empty()\n\n const tolerance = 1.15 // Some characters are wider than others so we add a little of extra space to take that into account\n labelsBleed = labelWidth ? tolerance * labelWidth + this._labelMargin : 0\n }\n }\n\n const maxLineWidth = this._getMaxLineWidth()\n return {\n top: 0,\n bottom: 0,\n left: maxLineWidth / 2 + labelsBleed,\n right: maxLineWidth / 2 + this._scrollBarWidth + this._scrollBarMargin,\n }\n }\n\n _render (customDuration?: number): void {\n super._render(customDuration)\n const { config, datamodel: { data } } = this\n const duration = isNumber(customDuration) ? customDuration : config.duration\n const xRange = this.xScale.range()\n const yRange = this.yScale.range()\n const yStart = Math.min(...yRange)\n const yHeight = Math.abs(yRange[1] - yRange[0])\n const maxLineWidth = this._getMaxLineWidth()\n const recordLabels = this._getRecordLabels(data)\n const recordLabelsUnique = unique(recordLabels)\n const numUniqueRecords = recordLabelsUnique.length\n\n // Ordinal scale to handle records on the same type\n const ordinalScale: ScaleOrdinal<string, number> = scaleOrdinal()\n ordinalScale.range(arrayOfIndices(numUniqueRecords))\n\n // Invisible Background rect to track events\n this._background\n .attr('width', this._width)\n .attr('height', this._height)\n .attr('opacity', 0)\n\n // Labels\n const labels = this._labelsGroup.selectAll<SVGTextElement, string>(`.${s.label}`)\n .data(config.showLabels ? recordLabelsUnique : [])\n\n const labelsEnter = labels.enter().append('text')\n .attr('class', s.label)\n\n labelsEnter.merge(labels)\n .attr('x', xRange[0] - maxLineWidth / 2 - this._labelMargin)\n .attr('y', (label, i) => yStart + (ordinalScale(label) + 0.5) * config.rowHeight)\n .text(label => label)\n .each((label, i, els) => {\n trimSVGText(select(els[i]), config.labelWidth || config.maxLabelWidth)\n })\n\n labels.exit().remove()\n\n // Row background rects\n const xStart = xRange[0]\n const numRows = Math.max(Math.floor(yHeight / config.rowHeight), numUniqueRecords)\n const recordTypes: (string | undefined)[] = Array(numRows).fill(null).map((_, i) => recordLabelsUnique[i])\n const rects = this._rowsGroup.selectAll<SVGRectElement, number>(`.${s.row}`)\n .data(recordTypes)\n\n const rectsEnter = rects.enter().append('rect')\n .attr('class', s.row)\n\n rectsEnter.merge(rects)\n .classed(s.rowOdd, config.alternatingRowColors ? (_, i) => !(i % 2) : null)\n .attr('x', xStart - maxLineWidth / 2)\n .attr('width', xRange[1] - xStart + maxLineWidth)\n .attr('y', (_, i) => yStart + i * config.rowHeight)\n .attr('height', config.rowHeight)\n\n rects.exit().remove()\n\n // Lines\n const lines = this._linesGroup.selectAll<SVGRectElement, Datum>(`.${s.line}`)\n .data(data, (d: Datum, i) => `${getString(d, config.id, i) ?? i}`)\n const linesEnter = lines.enter().append('rect')\n .attr('class', s.line)\n .classed(s.rowOdd, config.alternatingRowColors\n ? (d, i) => !(recordLabelsUnique.indexOf(this._getRecordType(d, i)) % 2)\n : null)\n .style('fill', (d, i) => getColor(d, config.color, i))\n .attr('transform', 'translate(0, 10)')\n .style('opacity', 0)\n this._positionLines(linesEnter, ordinalScale)\n\n const linesMerged = smartTransition(linesEnter.merge(lines), duration)\n .style('fill', (d, i) => getColor(d, config.color, ordinalScale(this._getRecordType(d, i))))\n .attr('transform', 'translate(0, 0)')\n .style('cursor', (d, i) => getString(d, config.cursor, i))\n .style('opacity', 1)\n\n this._positionLines(linesMerged, ordinalScale)\n\n smartTransition(lines.exit(), duration)\n .style('opacity', 0)\n .remove()\n\n // Scroll Bar\n const contentBBox = this._rowsGroup.node().getBBox() // We determine content size using the rects group because lines are animated\n const absoluteContentHeight = contentBBox.height\n this._scrollbarHeight = yHeight * yHeight / absoluteContentHeight || 0\n this._maxScroll = Math.max(absoluteContentHeight - yHeight, 0)\n\n this._scrollBarGroup\n .attr('transform', `translate(${this._width - this._scrollBarWidth}, ${yStart})`)\n .attr('opacity', this._maxScroll ? 1 : 0)\n\n this._scrollBarBackground\n .attr('width', this._scrollBarWidth)\n .attr('height', this._height)\n .attr('rx', this._scrollBarWidth / 2)\n .attr('ry', this._scrollBarWidth / 2)\n\n this._scrollBarHandle\n .attr('width', this._scrollBarWidth)\n .attr('height', this._scrollbarHeight)\n .attr('rx', this._scrollBarWidth / 2)\n .attr('ry', this._scrollBarWidth / 2)\n\n this._updateScrollPosition(0)\n }\n\n private _positionLines (\n selection: Selection<SVGRectElement, Datum, SVGGElement, unknown> | Transition<SVGRectElement, Datum, SVGGElement, unknown>,\n ordinalScale: ScaleOrdinal<string, number>\n ): void {\n const { config, xScale, yScale } = this\n const yRange = yScale.range()\n const yStart = Math.min(...yRange)\n\n selection.each((d, i, elements) => {\n const x = getNumber(d, config.x, i)\n const y = ordinalScale(this._getRecordType(d, i)) * config.rowHeight\n const length = getNumber(d, config.length, i) ?? 0\n\n // Rect dimensions\n const height = getNumber(d, config.lineWidth, i)\n const width = xScale(x + length) - xScale(x)\n\n if (width < 0) {\n console.warn('Unovis | Timeline: Line segments should not have negative lengths. Setting to 0.')\n }\n\n select(elements[i])\n .attr('x', xScale(x))\n .attr('y', yStart + y + (config.rowHeight - height) / 2)\n .attr('width', config.showEmptySegments\n ? Math.max(config.lineCap ? height : 1, width)\n : Math.max(0, width))\n .attr('height', height)\n .attr('rx', config.lineCap ? height / 2 : null)\n .style('opacity', 1)\n })\n }\n\n private _onScrollbarDrag (event: D3DragEvent<any, any, any>): void {\n const yRange = this.yScale.range()\n const yHeight = Math.abs(yRange[1] - yRange[0])\n this._updateScrollPosition(event.dy * this._maxScroll / (yHeight - this._scrollbarHeight))\n }\n\n private _onMouseWheel (d: unknown, event: WheelEvent): void {\n const { config } = this\n\n this._updateScrollPosition(event?.deltaY)\n if (this._scrollDistance > 0 && this._scrollDistance < this._maxScroll) event?.preventDefault()\n\n config.onScroll?.(this._scrollDistance)\n\n // Programmatically trigger a mousemove event to update Tooltip or Crosshair if they were set up\n const e = new Event('mousemove')\n this.element.dispatchEvent(e)\n }\n\n private _updateScrollPosition (diff: number): void {\n const yRange = this.yScale.range()\n const yHeight = Math.abs(yRange[1] - yRange[0])\n\n this._scrollDistance += diff\n this._scrollDistance = Math.max(0, this._scrollDistance)\n this._scrollDistance = Math.min(this._maxScroll, this._scrollDistance)\n\n this._linesGroup.attr('transform', `translate(0,${-this._scrollDistance})`)\n this._rowsGroup.attr('transform', `translate(0,${-this._scrollDistance})`)\n this._labelsGroup.attr('transform', `translate(0,${-this._scrollDistance})`)\n const scrollBarPosition = (this._scrollDistance / this._maxScroll * (yHeight - this._scrollbarHeight)) || 0\n this._scrollBarHandle.attr('y', scrollBarPosition)\n }\n\n private _getMaxLineWidth (): number {\n const { config, datamodel: { data } } = this\n return max(data, (d, i) => getNumber(d, config.lineWidth, i)) ?? 0\n }\n\n private _getRecordType (d: Datum, i: number): string {\n return getString(d, this.config.type) || `__${i}`\n }\n\n private _getRecordLabels (data: Datum[]): string[] {\n return data.map((d, i) => getString(d, this.config.type) || `${i + 1}`)\n }\n\n // Override the default XYComponent getXDataExtent method to take into account line lengths\n getXDataExtent (): number[] {\n const { config, datamodel } = this\n const min = getMin(datamodel.data, config.x)\n const max = getMax(datamodel.data, (d, i) => getNumber(d, config.x, i) + (getNumber(d, config.length, i) ?? 0))\n return [min, max]\n }\n}\n"],"names":["s.background","s.rows","s.lines","s.labels","s.scrollbar","s.scrollbarBackground","s.scrollbarHandle","label","s.label","s.row","s.rowOdd","s.line","s"],"mappings":";;;;;;;;;;;;;AAqBM,MAAO,QAAgB,SAAQ,eAA6E,CAAA;AA0BhH,IAAA,WAAA,CAAa,MAAuC,EAAA;AAClD,QAAA,KAAK,EAAE,CAAA;AAzBT,QAAA,IAAA,C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AA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAI,CAAC,CAAC,CAAA,EAAA,CAAC,CAAA;AAC/G,QAAA,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;KAClB;;AAtRM,QAAS,CAAA,SAAA,GAAGE,KAAC;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/timeline/index.ts"],"sourcesContent":["import { select, Selection } from 'd3-selection'\nimport { Transition } from 'd3-transition'\nimport { scaleOrdinal, ScaleOrdinal } from 'd3-scale'\nimport { drag, D3DragEvent } from 'd3-drag'\nimport { max } from 'd3-array'\n\n// Core\nimport { XYComponentCore } from 'core/xy-component'\n\n// Utils\nimport { isNumber, unique, arrayOfIndices, getMin, getMax, getString, getNumber } from 'utils/data'\nimport { smartTransition } from 'utils/d3'\nimport { getColor } from 'utils/color'\nimport { trimSVGText } from 'utils/text'\n\n// Config\nimport { TimelineDefaultConfig, TimelineConfigInterface } from './config'\n\n// Styles\nimport * as s from './style'\n\nexport class Timeline<Datum> extends XYComponentCore<Datum, TimelineConfigInterface<Datum>> {\n static selectors = s\n protected _defaultConfig = TimelineDefaultConfig as TimelineConfigInterface<Datum>\n public config: TimelineConfigInterface<Datum> = this._defaultConfig\n\n events = {\n [Timeline.selectors.rows]: {\n wheel: this._onMouseWheel.bind(this),\n },\n [Timeline.selectors.line]: {\n wheel: this._onMouseWheel.bind(this),\n },\n }\n\n private _background: Selection<SVGRectElement, unknown, SVGGElement, unknown>\n private _rowsGroup: Selection<SVGGElement, unknown, SVGGElement, unknown>\n private _linesGroup: Selection<SVGGElement, unknown, SVGGElement, unknown>\n private _labelsGroup: Selection<SVGGElement, unknown, SVGGElement, unknown>\n private _scrollBarGroup: Selection<SVGGElement, unknown, SVGGElement, unknown>\n private _scrollBarBackground: Selection<SVGRectElement, unknown, SVGGElement, unknown>\n private _scrollBarHandle: Selection<SVGRectElement, unknown, SVGGElement, unknown>\n private _scrollBarWidth = 5\n private _scrollDistance = 0\n private _scrollBarMargin = 5\n private _maxScroll = 0\n private _scrollbarHeight = 0\n private _labelMargin = 5\n\n constructor (config?: TimelineConfigInterface<Datum>) {\n super()\n if (config) this.setConfig(config)\n\n // Invisible background rect to track events\n this._background = this.g.append('rect').attr('class', s.background)\n\n // Group for content\n this._rowsGroup = this.g.append('g').attr('class', s.rows)\n this._linesGroup = this.g.append('g').attr('class', s.lines)\n this._labelsGroup = this.g.append('g').attr('class', s.labels)\n this._scrollBarGroup = this.g.append('g').attr('class', s.scrollbar)\n\n // Scroll bar\n this._scrollBarBackground = this._scrollBarGroup.append('rect')\n .attr('class', s.scrollbarBackground)\n\n this._scrollBarHandle = this._scrollBarGroup.append('rect')\n .attr('class', s.scrollbarHandle)\n\n // Set up scrollbar drag event\n const dragBehaviour = drag<SVGRectElement, unknown>()\n .on('drag', this._onScrollbarDrag.bind(this))\n\n this._scrollBarHandle.call(dragBehaviour)\n }\n\n get bleed (): { top: number; bottom: number; left: number; right: number } {\n const { config, datamodel: { data } } = this\n\n // We calculate the longest label width to set the bleed values accordingly\n let labelsBleed = 0\n if (config.showLabels) {\n if (config.labelWidth) labelsBleed = config.labelWidth + this._labelMargin\n else {\n const recordLabels = this._getRecordLabels(data)\n const longestLabel = recordLabels.reduce((acc, val) => acc.length > val.length ? acc : val, '')\n const label = this._labelsGroup.append('text')\n .attr('class', s.label)\n .text(longestLabel)\n .call(trimSVGText, config.maxLabelWidth)\n const labelWidth = label.node().getBBox().width\n this._labelsGroup.empty()\n\n const tolerance = 1.15 // Some characters are wider than others so we add a little of extra space to take that into account\n labelsBleed = labelWidth ? tolerance * labelWidth + this._labelMargin : 0\n }\n }\n\n const maxLineWidth = this._getMaxLineWidth()\n return {\n top: 0,\n bottom: 0,\n left: maxLineWidth / 2 + labelsBleed,\n right: maxLineWidth / 2 + this._scrollBarWidth + this._scrollBarMargin,\n }\n }\n\n _render (customDuration?: number): void {\n super._render(customDuration)\n const { config, datamodel: { data } } = this\n const duration = isNumber(customDuration) ? customDuration : config.duration\n const xRange = this.xScale.range()\n const yRange = this.yScale.range()\n const yStart = Math.min(...yRange)\n const yHeight = Math.abs(yRange[1] - yRange[0])\n const maxLineWidth = this._getMaxLineWidth()\n const recordLabels = this._getRecordLabels(data)\n const recordLabelsUnique = unique(recordLabels)\n const numUniqueRecords = recordLabelsUnique.length\n\n // Ordinal scale to handle records on the same type\n const ordinalScale: ScaleOrdinal<string, number> = scaleOrdinal()\n ordinalScale.range(arrayOfIndices(numUniqueRecords))\n\n // Invisible Background rect to track events\n this._background\n .attr('width', this._width)\n .attr('height', this._height)\n .attr('opacity', 0)\n\n // Labels\n const labels = this._labelsGroup.selectAll<SVGTextElement, string>(`.${s.label}`)\n .data(config.showLabels ? recordLabelsUnique : [])\n\n const labelsEnter = labels.enter().append('text')\n .attr('class', s.label)\n\n labelsEnter.merge(labels)\n .attr('x', xRange[0] - maxLineWidth / 2 - this._labelMargin)\n .attr('y', (label, i) => yStart + (ordinalScale(label) + 0.5) * config.rowHeight)\n .text(label => label)\n .each((label, i, els) => {\n trimSVGText(select(els[i]), config.labelWidth || config.maxLabelWidth)\n })\n\n labels.exit().remove()\n\n // Row background rects\n const xStart = xRange[0]\n const numRows = Math.max(Math.floor(yHeight / config.rowHeight), numUniqueRecords)\n const recordTypes: (string | undefined)[] = Array(numRows).fill(null).map((_, i) => recordLabelsUnique[i])\n const rects = this._rowsGroup.selectAll<SVGRectElement, number>(`.${s.row}`)\n .data(recordTypes)\n\n const rectsEnter = rects.enter().append('rect')\n .attr('class', s.row)\n\n rectsEnter.merge(rects)\n .classed(s.rowOdd, config.alternatingRowColors ? (_, i) => !(i % 2) : null)\n .attr('x', xStart - maxLineWidth / 2)\n .attr('width', xRange[1] - xStart + maxLineWidth)\n .attr('y', (_, i) => yStart + i * config.rowHeight)\n .attr('height', config.rowHeight)\n\n rects.exit().remove()\n\n // Lines\n const lines = this._linesGroup.selectAll<SVGRectElement, Datum>(`.${s.line}`)\n .data(data, (d: Datum, i) => `${getString(d, config.id, i) ?? i}`)\n const linesEnter = lines.enter().append('rect')\n .attr('class', s.line)\n .classed(s.rowOdd, config.alternatingRowColors\n ? (d, i) => !(recordLabelsUnique.indexOf(this._getRecordType(d, i)) % 2)\n : null)\n .style('fill', (d, i) => getColor(d, config.color, i))\n .attr('transform', 'translate(0, 10)')\n .style('opacity', 0)\n this._positionLines(linesEnter, ordinalScale)\n\n const linesMerged = smartTransition(linesEnter.merge(lines), duration)\n .style('fill', (d, i) => getColor(d, config.color, ordinalScale(this._getRecordType(d, i))))\n .attr('transform', 'translate(0, 0)')\n .style('cursor', (d, i) => getString(d, config.cursor, i))\n .style('opacity', 1)\n\n this._positionLines(linesMerged, ordinalScale)\n\n smartTransition(lines.exit(), duration)\n .style('opacity', 0)\n .remove()\n\n // Scroll Bar\n const contentBBox = this._rowsGroup.node().getBBox() // We determine content size using the rects group because lines are animated\n const absoluteContentHeight = contentBBox.height\n this._scrollbarHeight = yHeight * yHeight / absoluteContentHeight || 0\n this._maxScroll = Math.max(absoluteContentHeight - yHeight, 0)\n\n this._scrollBarGroup\n .attr('transform', `translate(${this._width - this._scrollBarWidth}, ${yStart})`)\n .attr('opacity', this._maxScroll ? 1 : 0)\n\n this._scrollBarBackground\n .attr('width', this._scrollBarWidth)\n .attr('height', this._height)\n .attr('rx', this._scrollBarWidth / 2)\n .attr('ry', this._scrollBarWidth / 2)\n\n this._scrollBarHandle\n .attr('width', this._scrollBarWidth)\n .attr('height', this._scrollbarHeight)\n .attr('rx', this._scrollBarWidth / 2)\n .attr('ry', this._scrollBarWidth / 2)\n\n this._updateScrollPosition(0)\n }\n\n private _positionLines (\n selection: Selection<SVGRectElement, Datum, SVGGElement, unknown> | Transition<SVGRectElement, Datum, SVGGElement, unknown>,\n ordinalScale: ScaleOrdinal<string, number>\n ): void {\n const { config, xScale, yScale } = this\n const yRange = yScale.range()\n const yStart = Math.min(...yRange)\n\n selection.each((d, i, elements) => {\n const x = getNumber(d, config.x, i)\n const y = ordinalScale(this._getRecordType(d, i)) * config.rowHeight\n const length = getNumber(d, config.length, i) ?? 0\n\n // Rect dimensions\n const height = getNumber(d, config.lineWidth, i)\n const width = xScale(x + length) - xScale(x)\n\n if (width < 0) {\n console.warn('Unovis | Timeline: Line segments should not have negative lengths. Setting to 0.')\n }\n\n select(elements[i])\n .attr('x', xScale(x))\n .attr('y', yStart + y + (config.rowHeight - height) / 2)\n .attr('width', config.showEmptySegments\n ? Math.max(config.lineCap ? height : 1, width)\n : Math.max(0, width))\n .attr('height', height)\n .attr('rx', config.lineCap ? height / 2 : null)\n .style('opacity', 1)\n })\n }\n\n private _onScrollbarDrag (event: D3DragEvent<any, any, any>): void {\n const yRange = this.yScale.range()\n const yHeight = Math.abs(yRange[1] - yRange[0])\n this._updateScrollPosition(event.dy * this._maxScroll / (yHeight - this._scrollbarHeight))\n }\n\n private _onMouseWheel (d: unknown, event: WheelEvent): void {\n const { config } = this\n\n this._updateScrollPosition(event?.deltaY)\n if (this._scrollDistance > 0 && this._scrollDistance < this._maxScroll) event?.preventDefault()\n\n config.onScroll?.(this._scrollDistance)\n\n // Programmatically trigger a mousemove event to update Tooltip or Crosshair if they were set up\n const e = new Event('mousemove')\n this.element.dispatchEvent(e)\n }\n\n private _updateScrollPosition (diff: number): void {\n const yRange = this.yScale.range()\n const yHeight = Math.abs(yRange[1] - yRange[0])\n\n this._scrollDistance += diff\n this._scrollDistance = Math.max(0, this._scrollDistance)\n this._scrollDistance = Math.min(this._maxScroll, this._scrollDistance)\n\n this._linesGroup.attr('transform', `translate(0,${-this._scrollDistance})`)\n this._rowsGroup.attr('transform', `translate(0,${-this._scrollDistance})`)\n this._labelsGroup.attr('transform', `translate(0,${-this._scrollDistance})`)\n const scrollBarPosition = (this._scrollDistance / this._maxScroll * (yHeight - this._scrollbarHeight)) || 0\n this._scrollBarHandle.attr('y', scrollBarPosition)\n }\n\n private _getMaxLineWidth (): number {\n const { config, datamodel: { data } } = this\n return max(data, (d, i) => getNumber(d, config.lineWidth, i)) ?? 0\n }\n\n private _getRecordType (d: Datum, i: number): string {\n return getString(d, this.config.type) || `__${i}`\n }\n\n private _getRecordLabels (data: Datum[]): string[] {\n return data.map((d, i) => getString(d, this.config.type) || `${i + 1}`)\n }\n\n // Override the default XYComponent getXDataExtent method to take into account line lengths\n getXDataExtent (): number[] {\n const { config, datamodel } = this\n const min = getMin(datamodel.data, config.x)\n const max = getMax(datamodel.data, (d, i) => getNumber(d, config.x, i) + (getNumber(d, config.length, i) ?? 0))\n return [min, max]\n }\n}\n"],"names":["s.background","s.rows","s.lines","s.labels","s.scrollbar","s.scrollbarBackground","s.scrollbarHandle","label","s.label","s.row","s.rowOdd","s.line","s"],"mappings":";;;;;;;;;;;;;AAqBM,MAAO,QAAgB,SAAQ,eAAsD,CAAA;AA4BzF,IAAA,WAAA,CAAa,MAAuC,EAAA;AAClD,QAAA,KAAK,EAAE,CAAA;QA3BC,IAAc,CAAA,cAAA,GAAG,qBAAuD,CAAA;AAC3E,QAAA,IAAA,CAAA,MAAM,GAAmC,IAAI,CAAC,cAAc,CAAA;AAEnE,QAAA,IAAA,CAAA,MAAM,GAAG;AACP,YAAA,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,GAAG;gBACzB,KAAK,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC;AACrC,aAAA;AACD,YAAA,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,GAAG;gBACzB,KAAK,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC;AACrC,aAAA;SACF,CAAA;QASO,IAAe,CAAA,eAAA,GAAG,CAAC,CAAA;QACnB,IAAe,CAAA,eAAA,GAAG,CAAC,CAAA;QACnB,IAAgB,CAAA,gBAAA,GAAG,CAAC,CAAA;QACpB,IAAU,CAAA,UAAA,GAAG,CAAC,CAAA;QACd,IAAgB,CAAA,gBAAA,GAAG,CAAC,CAAA;QACpB,IAAY,CAAA,YAAA,GAAG,CAAC,CAAA;AAItB,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C,EAAE,CAAC,KAAK,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAG,EAAA,CAAC,GAAG,CAAC,CAAE,CAAA,CAAC,CAAA;KACxE;;IAGD,cAAc,GAAA;AACZ,QAAA,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI,CAAA;AAClC,QAAA,MAAM,GAAG,GAAG,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAA;QAC5C,MAAM,GAAG,GAAG,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,EAAA,IAAA,EAAA,CAAA,CAAA,OAAA,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAA,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAI,CAAC,CAAC,CAAA,EAAA,CAAC,CAAA;AAC/G,QAAA,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;KAClB;;AAxRM,QAAS,CAAA,SAAA,GAAGE,KAAC;;;;"}
@@ -1,4 +1,3 @@
1
- import { Config } from "../../core/config";
2
1
  import { ComponentCore } from "../../core/component";
3
2
  import { Position } from "../../types/position";
4
3
  export interface TooltipConfigInterface {
@@ -52,17 +51,4 @@ export interface TooltipConfigInterface {
52
51
  [attr: string]: string | number | boolean;
53
52
  };
54
53
  }
55
- export declare class TooltipConfig extends Config implements TooltipConfigInterface {
56
- components: ComponentCore<unknown>[];
57
- container: any;
58
- horizontalPlacement: Position;
59
- horizontalShift: number;
60
- verticalPlacement: Position;
61
- verticalShift: number;
62
- attributes: {
63
- [attr: string]: string | number | boolean;
64
- };
65
- triggers: {
66
- [selector: string]: (data: any, i: number, elements: (HTMLElement | SVGElement)[]) => string | HTMLElement | undefined | null;
67
- };
68
- }
54
+ export declare const TooltipDefaultConfig: TooltipConfigInterface;
@@ -1,20 +1,16 @@
1
- import { Config } from '../../core/config/index.js';
2
1
  import { Position } from '../../types/position.js';
3
2
 
4
- /* eslint-disable no-irregular-whitespace */
5
- class TooltipConfig extends Config {
6
- constructor() {
7
- super(...arguments);
8
- this.components = [];
9
- this.container = undefined;
10
- this.horizontalPlacement = Position.Auto;
11
- this.horizontalShift = 0;
12
- this.verticalPlacement = Position.Top;
13
- this.verticalShift = 0;
14
- this.attributes = {};
15
- this.triggers = {};
16
- }
17
- }
3
+ // Types
4
+ const TooltipDefaultConfig = {
5
+ components: [],
6
+ container: undefined,
7
+ horizontalPlacement: Position.Auto,
8
+ horizontalShift: 0,
9
+ verticalPlacement: Position.Top,
10
+ verticalShift: 0,
11
+ attributes: {},
12
+ triggers: {},
13
+ };
18
14
 
19
- export { TooltipConfig };
15
+ export { TooltipDefaultConfig };
20
16
  //# sourceMappingURL=config.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sources":["../../../src/components/tooltip/config.ts"],"sourcesContent":["/* eslint-disable no-irregular-whitespace */\nimport { Config } from 'core/config'\nimport { ComponentCore } from 'core/component'\n\n// Types\nimport { Position } from 'types/position'\n\nexport interface TooltipConfigInterface {\n /** An array of visualization components to interact with. Default: `[]` */\n components?: ComponentCore<unknown>[];\n /** Container to where the Tooltip component should be inserted. Default: `undefined` */\n container?: HTMLElement;\n /** Horizontal placement of the tooltip. Default: `Position.Auto` */\n horizontalPlacement?: Position | string | undefined;\n /** Horizontal shift of the tooltip in pixels. Default: `0` */\n horizontalShift?: number;\n /** Vertical placement of the tooltip. Default: `Position.Top` */\n verticalPlacement?: Position | string | undefined;\n /** Vertical shift of the tooltip in pixels. Default: `0` */\n verticalShift?: number;\n /** Defines the content of the tooltip and hovering over which elements should trigger it.\n * An object containing properties in the following format:\n *\n * ```\n * {\n *  [selectorString]: (d: unknown) => string | HTMLElement\n * }\n * ```\n * e.g.:\n * ```\n * {\n *  [Area.selectors.area]: (d: AreaDatum[]) => `<div>${d.value.toString()}</div>\n * }\n * ```\n */\n triggers?: {\n [selector: string]: (data: any, i: number, elements: (HTMLElement | SVGElement)[]) => string | HTMLElement | undefined | null;\n };\n /** Custom DOM attributes for the tooltip. Useful when you need to refer to a specific tooltip instance\n * by using a CSS selector. Attributes configuration object has the following structure:\n *\n * ```\n * {\n *  [attributeName]: attribute value\n * }\n * ```\n * e.g.:\n * ```\n * {\n *  'type': 'area-tooltip',\n *  'value': 42\n * }\n * ```\n */\n attributes?: { [attr: string]: string | number | boolean };\n}\n\nexport class TooltipConfig extends Config implements TooltipConfigInterface {\n components: ComponentCore<unknown>[] = []\n container = undefined\n horizontalPlacement = Position.Auto\n horizontalShift = 0\n verticalPlacement = Position.Top\n verticalShift = 0\n attributes: { [attr: string]: string | number | boolean } = {}\n triggers: {\n [selector: string]: (data: any, i: number, elements: (HTMLElement | SVGElement)[]) => string | HTMLElement | undefined | null;\n } = {}\n}\n"],"names":[],"mappings":";;;AAAA;AAyDM,MAAO,aAAc,SAAQ,MAAM,CAAA;AAAzC,IAAA,WAAA,GAAA;;QACE,IAAU,CAAA,UAAA,GAA6B,EAAE,CAAA;QACzC,IAAS,CAAA,SAAA,GAAG,SAAS,CAAA;AACrB,QAAA,IAAA,CAAA,mBAAmB,GAAG,QAAQ,CAAC,IAAI,CAAA;QACnC,IAAe,CAAA,eAAA,GAAG,CAAC,CAAA;AACnB,QAAA,IAAA,CAAA,iBAAiB,GAAG,QAAQ,CAAC,GAAG,CAAA;QAChC,IAAa,CAAA,aAAA,GAAG,CAAC,CAAA;QACjB,IAAU,CAAA,UAAA,GAAkD,EAAE,CAAA;QAC9D,IAAQ,CAAA,QAAA,GAEJ,EAAE,CAAA;KACP;AAAA;;;;"}
1
+ {"version":3,"file":"config.js","sources":["../../../src/components/tooltip/config.ts"],"sourcesContent":["/* eslint-disable no-irregular-whitespace */\nimport { ComponentCore } from 'core/component'\n\n// Types\nimport { Position } from 'types/position'\n\nexport interface TooltipConfigInterface {\n /** An array of visualization components to interact with. Default: `[]` */\n components?: ComponentCore<unknown>[];\n /** Container to where the Tooltip component should be inserted. Default: `undefined` */\n container?: HTMLElement;\n /** Horizontal placement of the tooltip. Default: `Position.Auto` */\n horizontalPlacement?: Position | string | undefined;\n /** Horizontal shift of the tooltip in pixels. Default: `0` */\n horizontalShift?: number;\n /** Vertical placement of the tooltip. Default: `Position.Top` */\n verticalPlacement?: Position | string | undefined;\n /** Vertical shift of the tooltip in pixels. Default: `0` */\n verticalShift?: number;\n /** Defines the content of the tooltip and hovering over which elements should trigger it.\n * An object containing properties in the following format:\n *\n * ```\n * {\n *  [selectorString]: (d: unknown) => string | HTMLElement\n * }\n * ```\n * e.g.:\n * ```\n * {\n *  [Area.selectors.area]: (d: AreaDatum[]) => `<div>${d.value.toString()}</div>\n * }\n * ```\n */\n triggers?: {\n [selector: string]: (data: any, i: number, elements: (HTMLElement | SVGElement)[]) => string | HTMLElement | undefined | null;\n };\n /** Custom DOM attributes for the tooltip. Useful when you need to refer to a specific tooltip instance\n * by using a CSS selector. Attributes configuration object has the following structure:\n *\n * ```\n * {\n *  [attributeName]: attribute value\n * }\n * ```\n * e.g.:\n * ```\n * {\n *  'type': 'area-tooltip',\n *  'value': 42\n * }\n * ```\n */\n attributes?: { [attr: string]: string | number | boolean };\n}\n\nexport const TooltipDefaultConfig: TooltipConfigInterface = {\n components: [],\n container: undefined,\n horizontalPlacement: Position.Auto,\n horizontalShift: 0,\n verticalPlacement: Position.Top,\n verticalShift: 0,\n attributes: {},\n triggers: {},\n}\n\n"],"names":[],"mappings":";;AAGA;AAqDa,MAAA,oBAAoB,GAA2B;AAC1D,IAAA,UAAU,EAAE,EAAE;AACd,IAAA,SAAS,EAAE,SAAS;IACpB,mBAAmB,EAAE,QAAQ,CAAC,IAAI;AAClC,IAAA,eAAe,EAAE,CAAC;IAClB,iBAAiB,EAAE,QAAQ,CAAC,GAAG;AAC/B,IAAA,aAAa,EAAE,CAAC;AAChB,IAAA,UAAU,EAAE,EAAE;AACd,IAAA,QAAQ,EAAE,EAAE;;;;;"}
@@ -1,11 +1,12 @@
1
1
  import { Selection } from 'd3-selection';
2
2
  import { ComponentCore } from "../../core/component";
3
- import { TooltipConfig, TooltipConfigInterface } from './config';
3
+ import { TooltipConfigInterface } from './config';
4
4
  export declare class Tooltip {
5
5
  element: HTMLElement;
6
6
  div: Selection<HTMLElement, unknown, null, undefined>;
7
- config: TooltipConfig;
8
- prevConfig: TooltipConfig;
7
+ protected _defaultConfig: TooltipConfigInterface;
8
+ config: TooltipConfigInterface;
9
+ prevConfig: TooltipConfigInterface;
9
10
  components: ComponentCore<unknown>[];
10
11
  static selectors: any;
11
12
  private _setUpEventsThrottled;
@@ -1,12 +1,14 @@
1
1
  import { select, pointer } from 'd3-selection';
2
2
  import { Position } from '../../types/position.js';
3
- import { throttle } from '../../utils/data.js';
4
- import { TooltipConfig } from './config.js';
3
+ import { throttle, merge } from '../../utils/data.js';
4
+ import { TooltipDefaultConfig } from './config.js';
5
5
  import * as style from './style.js';
6
6
  import { tooltip, show, positionFixed } from './style.js';
7
7
 
8
8
  class Tooltip {
9
9
  constructor(config = {}) {
10
+ this._defaultConfig = TooltipDefaultConfig;
11
+ this.config = this._defaultConfig;
10
12
  this._setUpEventsThrottled = throttle(this._setUpEvents, 500);
11
13
  this._setContainerPositionThrottled = throttle(this._setContainerPosition, 500);
12
14
  this._isShown = false;
@@ -19,7 +21,7 @@ class Tooltip {
19
21
  setConfig(config) {
20
22
  var _a;
21
23
  this.prevConfig = this.config;
22
- this.config = new TooltipConfig().init(config);
24
+ this.config = merge(this._defaultConfig, config);
23
25
  if (this.config.container && (this.config.container !== ((_a = this.prevConfig) === null || _a === void 0 ? void 0 : _a.container))) {
24
26
  this.setContainer(this.config.container);
25
27
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/tooltip/index.ts"],"sourcesContent":["import { select, Selection, pointer } from 'd3-selection'\n\n// Core\nimport { ComponentCore } from 'core/component'\n\n// Types\nimport { Position } from 'types/position'\n\n// Utils\nimport { throttle } from 'utils/data'\n\n// Config\nimport { TooltipConfig, TooltipConfigInterface } from './config'\n\n// Style\nimport * as s from './style'\n\nexport class Tooltip {\n element: HTMLElement\n div: Selection<HTMLElement, unknown, null, undefined>\n config: TooltipConfig\n prevConfig: TooltipConfig\n components: ComponentCore<unknown>[]\n static selectors = s\n private _setUpEventsThrottled = throttle(this._setUpEvents, 500)\n private _setContainerPositionThrottled = throttle(this._setContainerPosition, 500)\n private _isShown = false\n private _container: HTMLElement\n\n constructor (config: TooltipConfigInterface = {}) {\n this.element = document.createElement('div')\n this.div = select(this.element)\n .attr('class', s.tooltip)\n\n this.setConfig(config)\n this.components = this.config.components\n }\n\n public setConfig (config: TooltipConfigInterface): void {\n this.prevConfig = this.config\n this.config = new TooltipConfig().init(config)\n\n if (this.config.container && (this.config.container !== this.prevConfig?.container)) {\n this.setContainer(this.config.container)\n }\n\n this._setUpAttributes()\n }\n\n public setContainer (container: HTMLElement): void {\n this.element.parentNode?.removeChild(this.element)\n\n this._container = container\n this._container.appendChild(this.element)\n\n this._setContainerPositionThrottled()\n }\n\n public getContainer (): HTMLElement {\n return this._container\n }\n\n public hasContainer (): boolean {\n return !!this._container && this._container.isConnected\n }\n\n public setComponents (components: ComponentCore<unknown>[]): void {\n this.components = components\n }\n\n public update (): void {\n if (!this._container) return\n\n this._setUpEventsThrottled()\n }\n\n public show (html: string | HTMLElement, pos: { x: number; y: number }): void {\n if (html instanceof HTMLElement) {\n const node = this.div.select(':first-child').node()\n if (node !== html) this.div.html('').append(() => html)\n } else {\n this.div.html(html)\n }\n\n this.div.classed(s.show, true)\n this._isShown = true\n this.place(pos)\n }\n\n public hide (): void {\n this.div.classed(s.show, false)\n this._isShown = false\n }\n\n public place (pos: { x: number; y: number }): void {\n if (!this.hasContainer()) {\n console.warn('Unovis | Tooltip: Container was not set or is not initialized yet')\n return\n }\n const { config } = this\n const isContainerBody = this.isContainerBody()\n const width = this.element.offsetWidth\n const height = this.element.offsetHeight\n const containerHeight = isContainerBody ? window.innerHeight : this._container.scrollHeight\n const containerWidth = isContainerBody ? window.innerWidth : this._container.scrollWidth\n\n const horizontalPlacement = config.horizontalPlacement === Position.Auto\n ? (pos.x > containerWidth / 2 ? Position.Left : Position.Right)\n : config.horizontalPlacement\n\n const verticalPlacement = config.verticalPlacement === Position.Auto\n ? (pos.y > containerHeight / 2 ? Position.Top : Position.Bottom)\n : config.verticalPlacement\n\n // dx and dy variables shift the tooltip from the default position (above the cursor, centred horizontally)\n const margin = 5\n const dx = horizontalPlacement === Position.Left ? -width - margin - config.horizontalShift\n : horizontalPlacement === Position.Center ? -width / 2\n : margin + config.horizontalShift\n const dy = verticalPlacement === Position.Bottom ? height + margin + config.verticalShift\n : verticalPlacement === Position.Center ? height / 2\n : -margin - config.verticalShift\n\n // Constraint to container\n const paddingX = 10\n const hitRight = pos.x > (containerWidth - width - dx - paddingX)\n const hitLeft = pos.x < -dx + paddingX\n const constraintX = hitRight ? (containerWidth - width - dx) - pos.x - paddingX\n : hitLeft ? -dx - pos.x + paddingX : 0\n\n const paddingY = 10\n const hitBottom = pos.y > (containerHeight - dy - paddingY)\n const hitTop = pos.y < (height - dy + paddingY)\n const constraintY = hitBottom ? containerHeight - dy - pos.y - paddingY\n : hitTop ? height - dy - pos.y + paddingY : 0\n\n // Placing\n // If the container size is smaller than the the tooltip size we just stick the tooltip to the top / left\n const x = containerWidth < width ? 0 : pos.x + constraintX + dx\n const y = containerHeight < height ? height : pos.y + constraintY + dy\n\n this.div\n .classed(s.positionFixed, isContainerBody)\n .style('top', isContainerBody ? `${y - height}px` : 'unset')\n .style('bottom', !isContainerBody ? `${containerHeight - y}px` : 'unset')\n .style('left', `${x}px`)\n }\n\n public isContainerBody (): boolean {\n return this._container === document.body\n }\n\n private _setContainerPosition (): void {\n // Tooltip position calculation relies on the parent position\n // If it's not set (static), we set it to `relative` (not a good practice)\n if (getComputedStyle(this._container)?.position === 'static') {\n this._container.style.position = 'relative'\n }\n }\n\n private _setUpEvents (): void {\n const { config: { triggers } } = this\n const isContainerBody = this.isContainerBody()\n\n // We use the Event Delegation pattern to set up Tooltip events\n // Every component will have single `mousemove` and `mouseleave` event listener functions, where we'll check\n // the `path` of the event and trigger corresponding callbacks\n this.components.forEach(component => {\n const selection = select(component.element)\n selection\n .on('mousemove.tooltip', (e: MouseEvent) => {\n const [x, y] = isContainerBody ? [e.clientX, e.clientY] : pointer(e, this._container)\n const path: (HTMLElement | SVGGElement)[] = (e.composedPath && e.composedPath()) || (e as any).path || [e.target]\n\n // Go through all of the configured triggers\n for (const className of Object.keys(triggers)) {\n const template = triggers[className]\n const els = selection.selectAll<HTMLElement | SVGGElement, unknown>(`.${className}`).nodes()\n\n // Go through all of the elements in the event path (from the deepest element upwards)\n for (const el of path) {\n if (el === selection.node()) break // Break on the component's level (usually the `<g>` element)\n if (el.classList.contains(className)) { // If there's a match, show the tooltip\n const i = els.indexOf(el)\n const d = select(el).datum()\n const content = template(d, i, els)\n if (content) this.show(content, { x, y })\n else this.hide()\n\n e.stopPropagation() // Stop propagation to prevent other interfering events from being triggered, e.g. Crosshair\n return // Stop looking for other matches\n }\n }\n }\n\n // Hide the tooltip if the event didn't pass through any of the configured triggers.\n // We use the `this._isShown` condition as a little performance optimization tweak\n // (we don't want the tooltip to update its class on every mouse movement, see `this.hide()`).\n if (this._isShown) this.hide()\n })\n .on('mouseleave.tooltip', (e: MouseEvent) => {\n e.stopPropagation() // Stop propagation to prevent other interfering events from being triggered, e.g. Crosshair\n this.hide()\n })\n })\n }\n\n private _setUpAttributes (): void {\n const attributesMap = this.config.attributes\n if (!attributesMap) return\n\n Object.keys(attributesMap).forEach(attr => {\n this.div.attr(attr, attributesMap[attr])\n })\n }\n\n public destroy (): void {\n this.div?.remove()\n }\n}\n"],"names":["s.tooltip","s.show","s.positionFixed","s"],"mappings":";;;;;;;MAiBa,OAAO,CAAA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C,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,CAAA;AACnC,4BAAA,IAAI,OAAO;gCAAE,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAA;;gCACpC,IAAI,CAAC,IAAI,EAAE,CAAA;AAEhB,4BAAA,CAAC,CAAC,eAAe,EAAE,CAAA;AACnB,4BAAA,OAAM;AACP,yBAAA;AACF,qBAAA;AACF,iBAAA;;;;gBAKD,IAAI,IAAI,CAAC,QAAQ;oBAAE,IAAI,CAAC,IAAI,EAAE,CAAA;AAChC,aAAC,CAAC;AACD,iBAAA,EAAE,CAAC,oBAAoB,EAAE,CAAC,CAAa,KAAI;AAC1C,gBAAA,CAAC,CAAC,eAAe,EAAE,CAAA;gBACnB,IAAI,CAAC,IAAI,EAAE,CAAA;AACb,aAAC,CAAC,CAAA;AACN,SAAC,CAAC,CAAA;KACH;IAEO,gBAAgB,GAAA;AACtB,QAAA,MAAM,aAAa,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,CAAA;AAC5C,QAAA,IAAI,CAAC,aAAa;YAAE,OAAM;QAE1B,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,IAAI,IAAG;AACxC,YAAA,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC,CAAA;AAC1C,SAAC,CAAC,CAAA;KACH;IAEM,OAAO,GAAA;;AACZ,QAAA,CAAA,EAAA,GAAA,IAAI,CAAC,GAAG,MAAE,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,MAAM,EAAE,CAAA;KACnB;;AAnMM,OAAS,CAAA,SAAA,GAAGC,KAAC;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/tooltip/index.ts"],"sourcesContent":["import { select, Selection, pointer } from 'd3-selection'\n\n// Core\nimport { ComponentCore } from 'core/component'\n\n// Types\nimport { Position } from 'types/position'\n\n// Utils\nimport { merge, throttle } from 'utils/data'\n\n// Config\nimport { TooltipDefaultConfig, TooltipConfigInterface } from './config'\n\n// Style\nimport * as s from './style'\n\nexport class Tooltip {\n element: HTMLElement\n div: Selection<HTMLElement, unknown, null, undefined>\n protected _defaultConfig = TooltipDefaultConfig as TooltipConfigInterface\n public config: TooltipConfigInterface = this._defaultConfig\n prevConfig: TooltipConfigInterface\n components: ComponentCore<unknown>[]\n static selectors = s\n private _setUpEventsThrottled = throttle(this._setUpEvents, 500)\n private _setContainerPositionThrottled = throttle(this._setContainerPosition, 500)\n private _isShown = false\n private _container: HTMLElement\n\n constructor (config: TooltipConfigInterface = {}) {\n this.element = document.createElement('div')\n this.div = select(this.element)\n .attr('class', s.tooltip)\n\n this.setConfig(config)\n this.components = this.config.components\n }\n\n public setConfig (config: TooltipConfigInterface): void {\n this.prevConfig = this.config\n this.config = merge(this._defaultConfig, config)\n\n if (this.config.container && (this.config.container !== this.prevConfig?.container)) {\n this.setContainer(this.config.container)\n }\n\n this._setUpAttributes()\n }\n\n public setContainer (container: HTMLElement): void {\n this.element.parentNode?.removeChild(this.element)\n\n this._container = container\n this._container.appendChild(this.element)\n\n this._setContainerPositionThrottled()\n }\n\n public getContainer (): HTMLElement {\n return this._container\n }\n\n public hasContainer (): boolean {\n return !!this._container && this._container.isConnected\n }\n\n public setComponents (components: ComponentCore<unknown>[]): void {\n this.components = components\n }\n\n public update (): void {\n if (!this._container) return\n\n this._setUpEventsThrottled()\n }\n\n public show (html: string | HTMLElement, pos: { x: number; y: number }): void {\n if (html instanceof HTMLElement) {\n const node = this.div.select(':first-child').node()\n if (node !== html) this.div.html('').append(() => html)\n } else {\n this.div.html(html)\n }\n\n this.div.classed(s.show, true)\n this._isShown = true\n this.place(pos)\n }\n\n public hide (): void {\n this.div.classed(s.show, false)\n this._isShown = false\n }\n\n public place (pos: { x: number; y: number }): void {\n if (!this.hasContainer()) {\n console.warn('Unovis | Tooltip: Container was not set or is not initialized yet')\n return\n }\n const { config } = this\n const isContainerBody = this.isContainerBody()\n const width = this.element.offsetWidth\n const height = this.element.offsetHeight\n const containerHeight = isContainerBody ? window.innerHeight : this._container.scrollHeight\n const containerWidth = isContainerBody ? window.innerWidth : this._container.scrollWidth\n\n const horizontalPlacement = config.horizontalPlacement === Position.Auto\n ? (pos.x > containerWidth / 2 ? Position.Left : Position.Right)\n : config.horizontalPlacement\n\n const verticalPlacement = config.verticalPlacement === Position.Auto\n ? (pos.y > containerHeight / 2 ? Position.Top : Position.Bottom)\n : config.verticalPlacement\n\n // dx and dy variables shift the tooltip from the default position (above the cursor, centred horizontally)\n const margin = 5\n const dx = horizontalPlacement === Position.Left ? -width - margin - config.horizontalShift\n : horizontalPlacement === Position.Center ? -width / 2\n : margin + config.horizontalShift\n const dy = verticalPlacement === Position.Bottom ? height + margin + config.verticalShift\n : verticalPlacement === Position.Center ? height / 2\n : -margin - config.verticalShift\n\n // Constraint to container\n const paddingX = 10\n const hitRight = pos.x > (containerWidth - width - dx - paddingX)\n const hitLeft = pos.x < -dx + paddingX\n const constraintX = hitRight ? (containerWidth - width - dx) - pos.x - paddingX\n : hitLeft ? -dx - pos.x + paddingX : 0\n\n const paddingY = 10\n const hitBottom = pos.y > (containerHeight - dy - paddingY)\n const hitTop = pos.y < (height - dy + paddingY)\n const constraintY = hitBottom ? containerHeight - dy - pos.y - paddingY\n : hitTop ? height - dy - pos.y + paddingY : 0\n\n // Placing\n // If the container size is smaller than the the tooltip size we just stick the tooltip to the top / left\n const x = containerWidth < width ? 0 : pos.x + constraintX + dx\n const y = containerHeight < height ? height : pos.y + constraintY + dy\n\n this.div\n .classed(s.positionFixed, isContainerBody)\n .style('top', isContainerBody ? `${y - height}px` : 'unset')\n .style('bottom', !isContainerBody ? `${containerHeight - y}px` : 'unset')\n .style('left', `${x}px`)\n }\n\n public isContainerBody (): boolean {\n return this._container === document.body\n }\n\n private _setContainerPosition (): void {\n // Tooltip position calculation relies on the parent position\n // If it's not set (static), we set it to `relative` (not a good practice)\n if (getComputedStyle(this._container)?.position === 'static') {\n this._container.style.position = 'relative'\n }\n }\n\n private _setUpEvents (): void {\n const { config: { triggers } } = this\n const isContainerBody = this.isContainerBody()\n\n // We use the Event Delegation pattern to set up Tooltip events\n // Every component will have single `mousemove` and `mouseleave` event listener functions, where we'll check\n // the `path` of the event and trigger corresponding callbacks\n this.components.forEach(component => {\n const selection = select(component.element)\n selection\n .on('mousemove.tooltip', (e: MouseEvent) => {\n const [x, y] = isContainerBody ? [e.clientX, e.clientY] : pointer(e, this._container)\n const path: (HTMLElement | SVGGElement)[] = (e.composedPath && e.composedPath()) || (e as any).path || [e.target]\n\n // Go through all of the configured triggers\n for (const className of Object.keys(triggers)) {\n const template = triggers[className]\n const els = selection.selectAll<HTMLElement | SVGGElement, unknown>(`.${className}`).nodes()\n\n // Go through all of the elements in the event path (from the deepest element upwards)\n for (const el of path) {\n if (el === selection.node()) break // Break on the component's level (usually the `<g>` element)\n if (el.classList.contains(className)) { // If there's a match, show the tooltip\n const i = els.indexOf(el)\n const d = select(el).datum()\n const content = template(d, i, els)\n if (content) this.show(content, { x, y })\n else this.hide()\n\n e.stopPropagation() // Stop propagation to prevent other interfering events from being triggered, e.g. Crosshair\n return // Stop looking for other matches\n }\n }\n }\n\n // Hide the tooltip if the event didn't pass through any of the configured triggers.\n // We use the `this._isShown` condition as a little performance optimization tweak\n // (we don't want the tooltip to update its class on every mouse movement, see `this.hide()`).\n if (this._isShown) this.hide()\n })\n .on('mouseleave.tooltip', (e: MouseEvent) => {\n e.stopPropagation() // Stop propagation to prevent other interfering events from being triggered, e.g. Crosshair\n this.hide()\n })\n })\n }\n\n private _setUpAttributes (): void {\n const attributesMap = this.config.attributes\n if (!attributesMap) return\n\n Object.keys(attributesMap).forEach(attr => {\n this.div.attr(attr, attributesMap[attr])\n })\n }\n\n public destroy (): void {\n this.div?.remove()\n }\n}\n"],"names":["s.tooltip","s.show","s.positionFixed","s"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,SAAA,GAAGC,KAAC;;;;"}
@@ -1,5 +1,5 @@
1
1
  import { GeoProjection } from 'd3-geo';
2
- import { ComponentConfigInterface, ComponentConfig } from "../../core/component/config";
2
+ import { ComponentConfigInterface } from "../../core/component/config";
3
3
  import { ColorAccessor, NumericAccessor, StringAccessor } from "../../types/accessor";
4
4
  import { MapPointLabelPosition } from './types';
5
5
  export interface TopoJSONMapConfigInterface<AreaDatum, PointDatum = unknown, LinkDatum = unknown> extends ComponentConfigInterface {
@@ -24,7 +24,7 @@ export interface TopoJSONMapConfigInterface<AreaDatum, PointDatum = unknown, Lin
24
24
  /** Link color value or accessor function. Default: `d => d.color ?? null` */
25
25
  linkColor?: ColorAccessor<LinkDatum>;
26
26
  /** Link cursor value or accessor function. Default: `null` */
27
- linkCursor?: StringAccessor<AreaDatum>;
27
+ linkCursor?: StringAccessor<LinkDatum>;
28
28
  /** Link id accessor function. Default: `d => d.id` */
29
29
  linkId?: StringAccessor<LinkDatum>;
30
30
  /** Link source accessor function. Default: `d => d.source` */
@@ -44,7 +44,7 @@ export interface TopoJSONMapConfigInterface<AreaDatum, PointDatum = unknown, Lin
44
44
  /** Point stroke width accessor. Default: `d => d.strokeWidth ?? null` */
45
45
  pointStrokeWidth?: NumericAccessor<PointDatum>;
46
46
  /** Point cursor constant value or accessor function. Default: `null` */
47
- pointCursor?: StringAccessor<AreaDatum>;
47
+ pointCursor?: StringAccessor<PointDatum>;
48
48
  /** Point longitude accessor function. Default: `d => d.longitude ?? null` */
49
49
  longitude?: NumericAccessor<PointDatum>;
50
50
  /** Point latitude accessor function. Default: `d => d.latitude ?? null` */
@@ -64,36 +64,4 @@ export interface TopoJSONMapConfigInterface<AreaDatum, PointDatum = unknown, Lin
64
64
  /** Zoom level at which the heatmap mode will be disabled. Default: `2.5` */
65
65
  heatmapModeZoomLevelThreshold?: number;
66
66
  }
67
- export declare class TopoJSONMapConfig<AreaDatum, PointDatum = unknown, LinkDatum = unknown> extends ComponentConfig implements TopoJSONMapConfigInterface<AreaDatum, PointDatum, LinkDatum> {
68
- projection: GeoProjection;
69
- duration: number;
70
- topojson: any;
71
- mapFeatureName: string;
72
- mapFitToPoints: boolean;
73
- zoomExtent: number[];
74
- zoomDuration: number;
75
- disableZoom: boolean;
76
- zoomFactor: any;
77
- linkWidth: (d: LinkDatum) => number;
78
- linkColor: (d: LinkDatum) => string;
79
- linkCursor: any;
80
- linkId: (d: LinkDatum, i: number | undefined) => string;
81
- linkSource: (d: LinkDatum) => (number | string | PointDatum);
82
- linkTarget: (d: LinkDatum) => (number | string | PointDatum);
83
- areaId: (d: AreaDatum) => string;
84
- areaColor: (d: AreaDatum) => string;
85
- areaCursor: any;
86
- longitude: (d: PointDatum) => number;
87
- latitude: (d: PointDatum) => number;
88
- pointColor: (d: PointDatum) => string;
89
- pointRadius: (d: PointDatum) => number;
90
- pointStrokeWidth: (d: PointDatum) => number;
91
- pointCursor: any;
92
- pointLabel: any;
93
- pointLabelPosition: MapPointLabelPosition;
94
- pointLabelTextBrightnessRatio: number;
95
- pointId: (d: PointDatum) => string;
96
- heatmapMode: boolean;
97
- heatmapModeBlurStdDeviation: number;
98
- heatmapModeZoomLevelThreshold: number;
99
- }
67
+ export declare const TopoJSONMapDefaultConfig: TopoJSONMapConfigInterface<unknown, unknown, unknown>;
@@ -1,42 +1,7 @@
1
- import { ComponentConfig } from '../../core/component/config.js';
1
+ import { ComponentDefaultConfig } from '../../core/component/config.js';
2
2
  import { MapProjection, MapPointLabelPosition } from './types.js';
3
3
 
4
- class TopoJSONMapConfig extends ComponentConfig {
5
- constructor() {
6
- super(...arguments);
7
- this.projection = MapProjection.Kavrayskiy7();
8
- this.duration = 1500;
9
- this.topojson = undefined;
10
- this.mapFeatureName = 'countries';
11
- this.mapFitToPoints = false;
12
- this.zoomExtent = [0.5, 6];
13
- this.zoomDuration = 400;
14
- this.disableZoom = false;
15
- this.zoomFactor = undefined;
16
- this.linkWidth = (d) => { var _a; return (_a = d['width']) !== null && _a !== void 0 ? _a : 1; };
17
- this.linkColor = (d) => { var _a; return (_a = d['color']) !== null && _a !== void 0 ? _a : null; };
18
- this.linkCursor = null;
19
- this.linkId = (d, i) => { var _a; return `${(_a = d['id']) !== null && _a !== void 0 ? _a : i}`; };
20
- this.linkSource = (d) => d['source'];
21
- this.linkTarget = (d) => d['target'];
22
- this.areaId = (d) => { var _a; return (_a = d['id']) !== null && _a !== void 0 ? _a : ''; };
23
- this.areaColor = (d) => { var _a; return (_a = d['color']) !== null && _a !== void 0 ? _a : null; };
24
- this.areaCursor = null;
25
- this.longitude = (d) => d['longitude'];
26
- this.latitude = (d) => d['latitude'];
27
- this.pointColor = (d) => { var _a; return (_a = d['color']) !== null && _a !== void 0 ? _a : null; };
28
- this.pointRadius = (d) => { var _a; return (_a = d['radius']) !== null && _a !== void 0 ? _a : 8; };
29
- this.pointStrokeWidth = (d) => { var _a; return (_a = d['strokeWidth']) !== null && _a !== void 0 ? _a : 0; };
30
- this.pointCursor = null;
31
- this.pointLabel = undefined;
32
- this.pointLabelPosition = MapPointLabelPosition.Bottom;
33
- this.pointLabelTextBrightnessRatio = 0.65;
34
- this.pointId = (d) => d['id'];
35
- this.heatmapMode = false;
36
- this.heatmapModeBlurStdDeviation = 8;
37
- this.heatmapModeZoomLevelThreshold = 2.5;
38
- }
39
- }
4
+ const TopoJSONMapDefaultConfig = Object.assign(Object.assign({}, ComponentDefaultConfig), { projection: MapProjection.Kavrayskiy7(), duration: 1500, topojson: undefined, mapFeatureName: 'countries', mapFitToPoints: false, zoomExtent: [0.5, 6], zoomDuration: 400, disableZoom: false, zoomFactor: undefined, linkWidth: (d) => { var _a; return (_a = d['width']) !== null && _a !== void 0 ? _a : 1; }, linkColor: (d) => { var _a; return (_a = d['color']) !== null && _a !== void 0 ? _a : null; }, linkCursor: null, linkId: (d, i) => { var _a; return `${(_a = d['id']) !== null && _a !== void 0 ? _a : i}`; }, linkSource: (d) => d['source'], linkTarget: (d) => d['target'], areaId: (d) => { var _a; return (_a = d['id']) !== null && _a !== void 0 ? _a : ''; }, areaColor: (d) => { var _a; return (_a = d['color']) !== null && _a !== void 0 ? _a : null; }, areaCursor: null, longitude: (d) => d['longitude'], latitude: (d) => d['latitude'], pointColor: (d) => { var _a; return (_a = d['color']) !== null && _a !== void 0 ? _a : null; }, pointRadius: (d) => { var _a; return (_a = d['radius']) !== null && _a !== void 0 ? _a : 8; }, pointStrokeWidth: (d) => { var _a; return (_a = d['strokeWidth']) !== null && _a !== void 0 ? _a : 0; }, pointCursor: null, pointLabel: undefined, pointLabelPosition: MapPointLabelPosition.Bottom, pointLabelTextBrightnessRatio: 0.65, pointId: (d) => d['id'], heatmapMode: false, heatmapModeBlurStdDeviation: 8, heatmapModeZoomLevelThreshold: 2.5 });
40
5
 
41
- export { TopoJSONMapConfig };
6
+ export { TopoJSONMapDefaultConfig };
42
7
  //# sourceMappingURL=config.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sources":["../../../src/components/topojson-map/config.ts"],"sourcesContent":["/* eslint-disable dot-notation */\nimport { GeoProjection } from 'd3-geo'\nimport { ComponentConfigInterface, ComponentConfig } from 'core/component/config'\n\n// Types\nimport { ColorAccessor, NumericAccessor, StringAccessor } from 'types/accessor'\n\n// Local Types\nimport { MapProjection, MapPointLabelPosition } from './types'\n\nexport interface TopoJSONMapConfigInterface<\n AreaDatum,\n PointDatum = unknown,\n LinkDatum = unknown,\n> extends ComponentConfigInterface {\n // General\n /** MapProjection (aka D3's GeoProjection) instance. Default: `MapProjection.Kavrayskiy7()` */\n projection?: GeoProjection;\n /** Map data in the TopoJSON topology format. Default: `undefined` */\n topojson?: TopoJSON.Topology;\n /** Name of the map features to be displayed, e.g. 'countries' or 'counties'. Default: `countries` */\n mapFeatureName?: string;\n /** Set initial map fit to points instead of topojson features. Default: `false` */\n mapFitToPoints?: boolean;\n /** Initial zoom level. Default: `undefined` */\n zoomFactor?: number;\n /** Disable pan / zoom interactions. Default: `false` */\n disableZoom?: boolean;\n /** Zoom extent. Default: `[0.5, 6]` */\n zoomExtent?: number[];\n /** Zoom animation duration. Default: `400` */\n zoomDuration?: number;\n\n /** Link width value or accessor function. Default: `d => d.width ?? 1` */\n linkWidth?: NumericAccessor<LinkDatum>;\n /** Link color value or accessor function. Default: `d => d.color ?? null` */\n linkColor?: ColorAccessor<LinkDatum>;\n /** Link cursor value or accessor function. Default: `null` */\n linkCursor?: StringAccessor<AreaDatum>;\n /** Link id accessor function. Default: `d => d.id` */\n linkId?: StringAccessor<LinkDatum>;\n /** Link source accessor function. Default: `d => d.source` */\n linkSource?: ((l: LinkDatum) => number | string | PointDatum);\n /** Link target accessor function. Default: `d => d.target` */\n linkTarget?: ((l: LinkDatum) => number | string | PointDatum);\n\n /** Area id accessor function corresponding to the feature id from TopoJSON. Default: `d => d.id ?? ''` */\n areaId?: StringAccessor<AreaDatum>;\n /** Area color value or accessor function. Default: `d => d.color ?? null` */\n areaColor?: ColorAccessor<AreaDatum>;\n /** Area cursor value or accessor function. Default: `null` */\n areaCursor?: StringAccessor<AreaDatum>;\n\n /** Point color accessor. Default: `d => d.color ?? null` */\n pointColor?: ColorAccessor<PointDatum>;\n /** Point radius accessor. Default: `d => d.radius ?? 8` */\n pointRadius?: NumericAccessor<PointDatum>;\n /** Point stroke width accessor. Default: `d => d.strokeWidth ?? null` */\n pointStrokeWidth?: NumericAccessor<PointDatum>;\n /** Point cursor constant value or accessor function. Default: `null` */\n pointCursor?: StringAccessor<AreaDatum>;\n /** Point longitude accessor function. Default: `d => d.longitude ?? null` */\n longitude?: NumericAccessor<PointDatum>;\n /** Point latitude accessor function. Default: `d => d.latitude ?? null` */\n latitude?: NumericAccessor<PointDatum>;\n /** Point label accessor function. Default: `undefined` */\n pointLabel?: StringAccessor<PointDatum>;\n /** Point label position. Default: `Position.Bottom` */\n pointLabelPosition?: MapPointLabelPosition;\n /** Point color brightness ratio for switching between dark and light text label color. Default: `0.65` */\n pointLabelTextBrightnessRatio?: number;\n /** Point id accessor function. Default: `d => d.id` */\n pointId?: ((d: PointDatum, i: number) => string);\n\n /** Enables blur and blending between neighbouring points. Default: `false` */\n heatmapMode?: boolean;\n /** Heatmap blur filter stdDeviation value. Default: `10` */\n heatmapModeBlurStdDeviation?: number;\n /** Zoom level at which the heatmap mode will be disabled. Default: `2.5` */\n heatmapModeZoomLevelThreshold?: number;\n}\n\nexport class TopoJSONMapConfig<\n AreaDatum,\n PointDatum = unknown,\n LinkDatum = unknown,\n> extends ComponentConfig implements TopoJSONMapConfigInterface<AreaDatum, PointDatum, LinkDatum> {\n projection = MapProjection.Kavrayskiy7()\n duration = 1500\n topojson = undefined\n mapFeatureName = 'countries'\n mapFitToPoints = false\n\n zoomExtent = [0.5, 6]\n zoomDuration = 400\n disableZoom = false\n zoomFactor = undefined\n\n linkWidth = (d: LinkDatum): number => d['width'] ?? 1\n linkColor = (d: LinkDatum): string => d['color'] ?? null\n linkCursor = null\n linkId = (d: LinkDatum, i: number | undefined): string => `${d['id'] ?? i}`\n linkSource = (d: LinkDatum): (number | string | PointDatum) => d['source']\n linkTarget = (d: LinkDatum): (number | string | PointDatum) => d['target']\n\n areaId = (d: AreaDatum): string => d['id'] ?? ''\n areaColor = (d: AreaDatum): string => d['color'] ?? null\n areaCursor = null\n\n longitude = (d: PointDatum): number => d['longitude']\n latitude = (d: PointDatum): number => d['latitude']\n pointColor = (d: PointDatum): string => d['color'] ?? null\n pointRadius = (d: PointDatum): number => d['radius'] ?? 8\n pointStrokeWidth = (d: PointDatum): number => d['strokeWidth'] ?? 0\n pointCursor = null\n pointLabel = undefined\n pointLabelPosition = MapPointLabelPosition.Bottom\n pointLabelTextBrightnessRatio = 0.65\n pointId = (d: PointDatum): string => d['id']\n\n heatmapMode = false\n heatmapModeBlurStdDeviation = 8\n heatmapModeZoomLevelThreshold = 2.5\n}\n"],"names":[],"mappings":";;;AAkFM,MAAO,iBAIX,SAAQ,eAAe,CAAA;AAJzB,IAAA,WAAA,GAAA;;AAKE,QAAA,IAAA,CAAA,UAAU,GAA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,MAAM,CAAA;QACjD,IAA6B,CAAA,6BAAA,GAAG,IAAI,CAAA;QACpC,IAAO,CAAA,OAAA,GAAG,CAAC,CAAa,KAAa,CAAC,CAAC,IAAI,CAAC,CAAA;QAE5C,IAAW,CAAA,WAAA,GAAG,KAAK,CAAA;QACnB,IAA2B,CAAA,2BAAA,GAAG,CAAC,CAAA;QAC/B,IAA6B,CAAA,6BAAA,GAAG,GAAG,CAAA;KACpC;AAAA;;;;"}
1
+ {"version":3,"file":"config.js","sources":["../../../src/components/topojson-map/config.ts"],"sourcesContent":["/* eslint-disable dot-notation */\nimport { GeoProjection } from 'd3-geo'\nimport { ComponentConfigInterface, ComponentDefaultConfig } from 'core/component/config'\n\n// Types\nimport { ColorAccessor, NumericAccessor, StringAccessor } from 'types/accessor'\n\n// Local Types\nimport { MapProjection, MapPointLabelPosition } from './types'\n\nexport interface TopoJSONMapConfigInterface<\n AreaDatum,\n PointDatum = unknown,\n LinkDatum = unknown,\n> extends ComponentConfigInterface {\n // General\n /** MapProjection (aka D3's GeoProjection) instance. Default: `MapProjection.Kavrayskiy7()` */\n projection?: GeoProjection;\n /** Map data in the TopoJSON topology format. Default: `undefined` */\n topojson?: TopoJSON.Topology;\n /** Name of the map features to be displayed, e.g. 'countries' or 'counties'. Default: `countries` */\n mapFeatureName?: string;\n /** Set initial map fit to points instead of topojson features. Default: `false` */\n mapFitToPoints?: boolean;\n /** Initial zoom level. Default: `undefined` */\n zoomFactor?: number;\n /** Disable pan / zoom interactions. Default: `false` */\n disableZoom?: boolean;\n /** Zoom extent. Default: `[0.5, 6]` */\n zoomExtent?: number[];\n /** Zoom animation duration. Default: `400` */\n zoomDuration?: number;\n\n /** Link width value or accessor function. Default: `d => d.width ?? 1` */\n linkWidth?: NumericAccessor<LinkDatum>;\n /** Link color value or accessor function. Default: `d => d.color ?? null` */\n linkColor?: ColorAccessor<LinkDatum>;\n /** Link cursor value or accessor function. Default: `null` */\n linkCursor?: StringAccessor<LinkDatum>;\n /** Link id accessor function. Default: `d => d.id` */\n linkId?: StringAccessor<LinkDatum>;\n /** Link source accessor function. Default: `d => d.source` */\n linkSource?: ((l: LinkDatum) => number | string | PointDatum);\n /** Link target accessor function. Default: `d => d.target` */\n linkTarget?: ((l: LinkDatum) => number | string | PointDatum);\n\n /** Area id accessor function corresponding to the feature id from TopoJSON. Default: `d => d.id ?? ''` */\n areaId?: StringAccessor<AreaDatum>;\n /** Area color value or accessor function. Default: `d => d.color ?? null` */\n areaColor?: ColorAccessor<AreaDatum>;\n /** Area cursor value or accessor function. Default: `null` */\n areaCursor?: StringAccessor<AreaDatum>;\n\n /** Point color accessor. Default: `d => d.color ?? null` */\n pointColor?: ColorAccessor<PointDatum>;\n /** Point radius accessor. Default: `d => d.radius ?? 8` */\n pointRadius?: NumericAccessor<PointDatum>;\n /** Point stroke width accessor. Default: `d => d.strokeWidth ?? null` */\n pointStrokeWidth?: NumericAccessor<PointDatum>;\n /** Point cursor constant value or accessor function. Default: `null` */\n pointCursor?: StringAccessor<PointDatum>;\n /** Point longitude accessor function. Default: `d => d.longitude ?? null` */\n longitude?: NumericAccessor<PointDatum>;\n /** Point latitude accessor function. Default: `d => d.latitude ?? null` */\n latitude?: NumericAccessor<PointDatum>;\n /** Point label accessor function. Default: `undefined` */\n pointLabel?: StringAccessor<PointDatum>;\n /** Point label position. Default: `Position.Bottom` */\n pointLabelPosition?: MapPointLabelPosition;\n /** Point color brightness ratio for switching between dark and light text label color. Default: `0.65` */\n pointLabelTextBrightnessRatio?: number;\n /** Point id accessor function. Default: `d => d.id` */\n pointId?: ((d: PointDatum, i: number) => string);\n\n /** Enables blur and blending between neighbouring points. Default: `false` */\n heatmapMode?: boolean;\n /** Heatmap blur filter stdDeviation value. Default: `10` */\n heatmapModeBlurStdDeviation?: number;\n /** Zoom level at which the heatmap mode will be disabled. Default: `2.5` */\n heatmapModeZoomLevelThreshold?: number;\n}\n\nexport const TopoJSONMapDefaultConfig: TopoJSONMapConfigInterface<unknown, unknown, unknown> = {\n ...ComponentDefaultConfig,\n projection: MapProjection.Kavrayskiy7(),\n duration: 1500,\n topojson: undefined,\n mapFeatureName: 'countries',\n mapFitToPoints: false,\n\n zoomExtent: [0.5, 6],\n zoomDuration: 400,\n disableZoom: false,\n zoomFactor: undefined,\n\n linkWidth: <LinkDatum>(d: LinkDatum): number => d['width'] ?? 1,\n linkColor: <LinkDatum>(d: LinkDatum): string => d['color'] ?? null,\n linkCursor: null,\n linkId: <LinkDatum>(d: LinkDatum, i: number | undefined): string => `${d['id'] ?? i}`,\n linkSource: <LinkDatum>(d: LinkDatum): (number | string | unknown) => d['source'],\n linkTarget: <LinkDatum>(d: LinkDatum): (number | string | unknown) => d['target'],\n\n areaId: <AreaDatum>(d: AreaDatum): string => d['id'] ?? '',\n areaColor: <AreaDatum>(d: AreaDatum): string => d['color'] ?? null,\n areaCursor: null,\n\n longitude: <PointDatum>(d: PointDatum): number => d['longitude'],\n latitude: <PointDatum>(d: PointDatum): number => d['latitude'],\n pointColor: <PointDatum>(d: PointDatum): string => d['color'] ?? null,\n pointRadius: <PointDatum>(d: PointDatum): number => d['radius'] ?? 8,\n pointStrokeWidth: <PointDatum>(d: PointDatum): number => d['strokeWidth'] ?? 0,\n pointCursor: null,\n pointLabel: undefined,\n pointLabelPosition: MapPointLabelPosition.Bottom,\n pointLabelTextBrightnessRatio: 0.65,\n pointId: <PointDatum>(d: PointDatum): string => d['id'],\n\n heatmapMode: false,\n heatmapModeBlurStdDeviation: 8,\n heatmapModeZoomLevelThreshold: 2.5,\n}\n\n"],"names":[],"mappings":";;;AAkFO,MAAM,wBAAwB,GAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAChC,sBAAsB,CACzB,EAAA,EAAA,UAAU,EAAE,aAAa,CAAC,WAAW,EAAE,EACvC,QAAQ,EAAE,IAAI,EACd,QAAQ,EAAE,SAAS,EACnB,cAAc,EAAE,WAAW,EAC3B,cAAc,EAAE,KAAK,EAErB,UAAU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EAAA,GAAI,IAAI,CAAA,EAAA,EAClE,UAAU,EAAE,IAAI,EAEhB,SAAS,EAAE,CAAa,CAAa,KAAa,CAAC,CAAC,WAAW,CAAC,EAChE,QAAQ,EAAE,CAAa,CAAa,KAAa,CAAC,CAAC,UAAU,CAAC,EAC9D,UAAU,EAAE,CAAa,CAAa,KAAa,EAAA,IAAA,EAAA,CAAA,CAAA,OAAA,CAAA,EAAA,GAAA,CAAC,CAAC,OAAO,CAAC,MAAI,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAA,IAAI,CAAA,EAAA,EACrE,WAAW,EAAE,CAAa,CAAa,KAAY,EAAA,IAAA,EAAA,CAAA,CAAC,OAAA,CAAA,EAAA,GAAA,CAAC,CAAC,QAAQ,CAAC,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAI,CAAC,CAAA,EAAA,EACpE,gBAAgB,EAAE,CAAa,CAAa,KAAY,EAAA,IAAA,EAAA,CAAA,CAAC,OAAA,CAAA,EAAA,GAAA,CAAC,CAAC,aAAa,CAAC,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAI,CAAC,CAAA,EAAA,EAC9E,WAAW,EAAE,IAAI,EACjB,UAAU,EAAE,SAAS,EACrB,kBAAkB,EAAE,qBAAqB,CAAC,MAAM,EAChD,6BAA6B,EAAE,IAAI,EACnC,OAAO,EAAE,CAAa,CAAa,KAAa,CAAC,CAAC,IAAI,CAAC,EAEvD,WAAW,EAAE,KAAK,EAClB,2BAA2B,EAAE,CAAC,EAC9B,6BAA6B,EAAE,GAAG;;;;"}
@@ -3,11 +3,12 @@ import { D3ZoomEvent, ZoomTransform } from 'd3-zoom';
3
3
  import { ComponentCore } from "../../core/component";
4
4
  import { MapGraphDataModel } from "../../data-models/map-graph";
5
5
  import { MapData } from './types';
6
- import { TopoJSONMapConfig, TopoJSONMapConfigInterface } from './config';
6
+ import { TopoJSONMapConfigInterface } from './config';
7
7
  import * as s from './style';
8
- export declare class TopoJSONMap<AreaDatum, PointDatum = unknown, LinkDatum = unknown> extends ComponentCore<MapData<AreaDatum, PointDatum, LinkDatum>, TopoJSONMapConfig<AreaDatum, PointDatum, LinkDatum>, TopoJSONMapConfigInterface<AreaDatum, PointDatum, LinkDatum>> {
8
+ export declare class TopoJSONMap<AreaDatum, PointDatum = unknown, LinkDatum = unknown> extends ComponentCore<MapData<AreaDatum, PointDatum, LinkDatum>, TopoJSONMapConfigInterface<AreaDatum, PointDatum, LinkDatum>> {
9
9
  static selectors: typeof s;
10
- config: TopoJSONMapConfig<AreaDatum, PointDatum, LinkDatum>;
10
+ protected _defaultConfig: TopoJSONMapConfigInterface<AreaDatum, PointDatum, LinkDatum>;
11
+ config: TopoJSONMapConfigInterface<AreaDatum, PointDatum, LinkDatum>;
11
12
  datamodel: MapGraphDataModel<AreaDatum, PointDatum, LinkDatum>;
12
13
  g: Selection<SVGGElement, unknown, null, undefined>;
13
14
  private _firstRender;
@@ -10,7 +10,7 @@ import { smartTransition } from '../../utils/d3.js';
10
10
  import { getColor, hexToBrightness } from '../../utils/color.js';
11
11
  import { isStringCSSVariable, getCSSVariableValue } from '../../utils/misc.js';
12
12
  import { MapPointLabelPosition } from './types.js';
13
- import { TopoJSONMapConfig } from './config.js';
13
+ import { TopoJSONMapDefaultConfig } from './config.js';
14
14
  import { getLonLat, arc } from './utils.js';
15
15
  import * as style from './style.js';
16
16
  import { background, features, links, points, feature as feature$1, link, point, pointCircle, pointLabel } from './style.js';
@@ -18,7 +18,8 @@ import { background, features, links, points, feature as feature$1, link, point,
18
18
  class TopoJSONMap extends ComponentCore {
19
19
  constructor(config, data) {
20
20
  super();
21
- this.config = new TopoJSONMapConfig();
21
+ this._defaultConfig = TopoJSONMapDefaultConfig;
22
+ this.config = this._defaultConfig;
22
23
  this.datamodel = new MapGraphDataModel();
23
24
  this._firstRender = true;
24
25
  this._isResizing = false;
@@ -169,7 +170,6 @@ class TopoJSONMap extends ComponentCore {
169
170
  edges.exit().remove();
170
171
  }
171
172
  _renderPoints(duration) {
172
- var _a;
173
173
  const { config, datamodel } = this;
174
174
  const pointData = datamodel.points;
175
175
  const points = this._pointsGroup
@@ -202,7 +202,7 @@ class TopoJSONMap extends ComponentCore {
202
202
  .style('stroke-width', d => getNumber(d, config.pointStrokeWidth) / this._currentZoomLevel);
203
203
  const pointLabelsMerged = pointsMerged.select(`.${pointLabel}`);
204
204
  pointLabelsMerged
205
- .text((_a = config.pointLabel) !== null && _a !== void 0 ? _a : '')
205
+ .text(d => { var _a; return (_a = getString(d, config.pointLabel)) !== null && _a !== void 0 ? _a : ''; })
206
206
  .style('font-size', d => {
207
207
  if (config.pointLabelPosition === MapPointLabelPosition.Bottom) {
208
208
  return `calc(var(--vis-map-point-label-font-size) / ${this._currentZoomLevel}`;