@unovis/ts 1.6.6-beta.0 → 1.6.6-stellar.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 (50) hide show
  1. package/components/axis/config.d.ts +7 -10
  2. package/components/axis/config.js +1 -1
  3. package/components/axis/config.js.map +1 -1
  4. package/components/axis/index.d.ts +0 -1
  5. package/components/axis/index.js +53 -44
  6. package/components/axis/index.js.map +1 -1
  7. package/components/axis/style.d.ts +38 -2
  8. package/components/axis/style.js +24 -28
  9. package/components/axis/style.js.map +1 -1
  10. package/components/brush/config.d.ts +0 -3
  11. package/components/brush/config.js +1 -1
  12. package/components/brush/config.js.map +1 -1
  13. package/components/brush/index.d.ts +0 -1
  14. package/components/brush/index.js +3 -7
  15. package/components/brush/index.js.map +1 -1
  16. package/components/crosshair/config.d.ts +0 -2
  17. package/components/crosshair/config.js +1 -1
  18. package/components/crosshair/config.js.map +1 -1
  19. package/components/crosshair/index.d.ts +0 -2
  20. package/components/crosshair/index.js +1 -8
  21. package/components/crosshair/index.js.map +1 -1
  22. package/components/sankey/config.d.ts +0 -2
  23. package/components/sankey/config.js +1 -1
  24. package/components/sankey/config.js.map +1 -1
  25. package/components/sankey/index.d.ts +2 -2
  26. package/components/sankey/index.js +5 -12
  27. package/components/sankey/index.js.map +1 -1
  28. package/components/sankey/types.d.ts +0 -4
  29. package/components/sankey/types.js +2 -7
  30. package/components/sankey/types.js.map +1 -1
  31. package/components/scatter/index.js +0 -2
  32. package/components/scatter/index.js.map +1 -1
  33. package/components/timeline/config.d.ts +1 -5
  34. package/components/timeline/config.js +2 -2
  35. package/components/timeline/config.js.map +1 -1
  36. package/components/timeline/index.d.ts +2 -2
  37. package/components/timeline/index.js +31 -64
  38. package/components/timeline/index.js.map +1 -1
  39. package/components/timeline/style.d.ts +1 -6
  40. package/components/timeline/style.js +46 -40
  41. package/components/timeline/style.js.map +1 -1
  42. package/components/topojson-map/index.d.ts +2 -2
  43. package/components/topojson-map/index.js +24 -5
  44. package/components/topojson-map/index.js.map +1 -1
  45. package/index.js +1 -1
  46. package/package.json +1 -1
  47. package/types.js +1 -1
  48. package/utils/text.js +2 -6
  49. package/utils/text.js.map +1 -1
  50. package/types/style.d.ts +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/scatter/index.ts"],"sourcesContent":["import { Selection, select } from 'd3-selection'\nimport { max, min } from 'd3-array'\n\n// Core\nimport { XYComponentCore } from 'core/xy-component'\n\n// Utils\nimport { isNumber, getExtent, getNumber, getString, isArray, flatten, getValue } from 'utils/data'\nimport { getColor } from 'utils/color'\nimport { smartTransition } from 'utils/d3'\nimport { getCSSVariableValueInPixels } from 'utils/misc'\n\n// Types\nimport { Spacing } from 'types/spacing'\nimport { SymbolType } from 'types/symbol'\nimport { NumericAccessor } from 'types/accessor'\nimport { Position } from 'types/position'\nimport { ContinuousScale } from 'types/scale'\n\n// Local Types\nimport { ScatterPointGroupNode, ScatterPoint } from './types'\n\n// Config\nimport { ScatterDefaultConfig, ScatterConfigInterface } from './config'\n\n// Modules\nimport { createPoints, updatePoints, removePoints } from './modules/point'\nimport { collideLabels, getEstimatedLabelBBox } from './modules/utils'\n\n// Styles\nimport * as s from './style'\n\n\nexport class Scatter<Datum> extends XYComponentCore<Datum, ScatterConfigInterface<Datum>> {\n static selectors = s\n protected _defaultConfig = ScatterDefaultConfig as ScatterConfigInterface<Datum>\n public config: ScatterConfigInterface<Datum> = this._defaultConfig\n\n events = {\n [Scatter.selectors.point]: {\n mouseenter: this._onPointMouseOver.bind(this),\n mouseleave: this._onPointMouseOut.bind(this),\n },\n }\n\n private _pointData: ScatterPoint<Datum>[][] = []\n private _points: Selection<SVGGElement, ScatterPoint<Datum>, SVGGElement, ScatterPoint<Datum>[]>\n private _sizeScale: ContinuousScale\n private _collideLabelsAnimFrameId: ReturnType<typeof requestAnimationFrame>\n\n constructor (config?: ScatterConfigInterface<Datum>) {\n super()\n if (config) this.setConfig(config)\n }\n\n setConfig (config: ScatterConfigInterface<Datum>): void {\n super.setConfig(config)\n this._updateSizeScale()\n }\n\n setData (data: Datum[]): void {\n super.setData(data)\n this._updateSizeScale()\n }\n\n get bleed (): Spacing {\n this._pointData = this._getOnScreenData()\n const pointDataFlat: ScatterPoint<Datum>[] = flatten(this._pointData)\n\n const yRangeStart = min(this.yScale.range())\n const yRangeEnd = max(this.yScale.range())\n const xRangeStart = this.xScale.range()[0]\n const xRangeEnd = this.xScale.range()[1]\n\n const fontSizePx = getCSSVariableValueInPixels('var(--vis-scatter-point-label-text-font-size)', this.element)\n\n const extent = pointDataFlat.reduce((ext, d) => {\n const x = this.xScale(d._point.xValue)\n const y = this.yScale(d._point.yValue)\n const r = d._point.sizePx / 2\n\n ext.minX = Math.min(ext.minX, x - r)\n ext.maxX = Math.max(ext.maxX, x + r)\n ext.minY = Math.min(ext.minY, y - r)\n ext.maxY = Math.max(ext.maxY, y + r)\n\n if (d._point.label) {\n const labelBBox = getEstimatedLabelBBox(d, d._point.labelPosition, this.xScale, this.yScale, fontSizePx)\n ext.minX = Math.min(ext.minX, labelBBox.x)\n ext.maxX = Math.max(ext.maxX, labelBBox.x + labelBBox.width)\n ext.minY = Math.min(ext.minY, labelBBox.y)\n ext.maxY = Math.max(ext.maxY, labelBBox.y + labelBBox.height)\n }\n return ext\n }, {\n minX: Number.POSITIVE_INFINITY,\n maxX: Number.NEGATIVE_INFINITY,\n minY: Number.POSITIVE_INFINITY,\n maxY: Number.NEGATIVE_INFINITY,\n })\n\n const coeff = 1.2 // Multiplier to take into account subsequent scale range changes and shape irregularities\n const top = extent.minY < yRangeStart ? coeff * (yRangeStart - extent.minY) : 0\n const bottom = extent.maxY > yRangeEnd ? coeff * (extent.maxY - yRangeEnd) : 0\n const left = extent.minX < xRangeStart ? coeff * (xRangeStart - extent.minX) : 0\n const right = extent.maxX > xRangeEnd ? coeff * (extent.maxX - xRangeEnd) : 0\n\n return { top, bottom, left, right }\n }\n\n _render (customDuration?: number): void {\n const { config } = this\n const duration = isNumber(customDuration) ? customDuration : config.duration\n\n // Groups\n const pointGroups = this.g\n .selectAll<SVGGElement, ScatterPoint<Datum>[]>(`.${s.pointGroup}`)\n .data(this._pointData)\n\n const pointGroupsEnter = pointGroups\n .enter()\n .append('g')\n .attr('class', s.pointGroup)\n\n const pointGroupsMerged = pointGroupsEnter.merge(pointGroups)\n smartTransition(pointGroupsMerged, duration)\n .style('opacity', 1)\n\n const pointGroupExit = pointGroups.exit().attr('class', s.pointGroupExit)\n smartTransition(pointGroupExit, duration).style('opacity', 0).remove()\n\n // Points\n const points = pointGroupsMerged\n .selectAll<SVGGElement, ScatterPoint<Datum>>(`.${s.point}`)\n .data(\n d => d,\n d => `${getString(d, config.id, d._point.pointIndex) ?? d._point.pointIndex}`\n )\n\n const pointsEnter = points.enter().append('g')\n .attr('class', s.point)\n createPoints(pointsEnter, this.xScale, this.yScale)\n\n this._points = pointsEnter.merge(points)\n updatePoints(this._points, config, this.xScale, this.yScale, duration)\n\n removePoints(points.exit<ScatterPoint<Datum>>(), this.xScale, this.yScale, duration)\n\n // Take care of overlapping labels\n if (this._hasLabels()) {\n this._resolveLabelOverlap()\n }\n }\n\n private _hasLabels (): boolean {\n // If label config is not defined, no labels will be shown\n if (!this.config.label) return false\n\n // Check if any point in the flattened data has a label\n const pointDataFlat: ScatterPoint<Datum>[] = flatten(this._pointData)\n return pointDataFlat.some(d => d._point.label)\n }\n\n private _resolveLabelOverlap (): void {\n if (!this.config.labelHideOverlapping) {\n const label = this._points.selectAll<SVGTextElement, ScatterPoint<Datum>>('text')\n label.attr('opacity', null)\n return\n }\n\n cancelAnimationFrame(this._collideLabelsAnimFrameId)\n this._collideLabelsAnimFrameId = requestAnimationFrame(() => {\n collideLabels(this._points, this.config, this.xScale, this.yScale)\n })\n }\n\n private _updateSizeScale (): void {\n const { config, datamodel } = this\n\n this._sizeScale = config.sizeScale.copy()\n this._sizeScale.domain(getExtent(datamodel.data, config.size))\n this._sizeScale.range(config.sizeRange ?? [0, 0])\n }\n\n private _getOnScreenData (): ScatterPoint<Datum>[][] {\n const { config, datamodel: { data } } = this\n\n const xDomain = this.xScale.domain().map((d: number | Date) => +d) // Convert Date to number\n const yDomain = this.yScale.domain().map((d: number | Date) => +d) // Convert Date to number\n const yAccessors = (isArray(config.y) ? config.y : [config.y]) as NumericAccessor<Datum>[]\n\n const maxSizeValue = max<number>(flatten(yAccessors.map((y, j) => data?.map(d => getNumber(d, config.size, j)))))\n const maxSizePx = config.sizeRange ? this._sizeScale(maxSizeValue) : maxSizeValue\n\n const maxSizeXDomain = (this.xScale.invert(maxSizePx) as number) - (this.xScale.invert(0) as number)\n const maxSizeYDomain = Math.abs((this.yScale.invert(maxSizePx) as number) - (this.yScale.invert(0) as number))\n\n return yAccessors.map((y, j) => {\n return data?.reduce<ScatterPoint<Datum>[]>((acc, d, i) => {\n const xValue = getNumber(d, config.x, i)\n const yValue = getNumber(d, y, j)\n if (xValue == null || yValue == null) return acc\n\n const pointSize = getNumber(d, config.size, i)\n const pointSizeScaled = config.sizeRange ? this._sizeScale(pointSize) : pointSize\n const pointSizeXDomain = (this.xScale.invert(pointSizeScaled) as number) - (this.xScale.invert(0) as number)\n const pointSizeYDomain = Math.abs((this.yScale.invert(pointSizeScaled) as number) - (this.yScale.invert(0) as number))\n\n if (\n ((xValue - pointSizeXDomain / 2) >= (xDomain[0] - maxSizeXDomain / 2)) &&\n ((xValue + pointSizeXDomain / 2) <= (xDomain[1] + maxSizeXDomain / 2)) &&\n ((yValue - pointSizeYDomain / 2) >= (yDomain[0] - maxSizeYDomain / 2)) &&\n ((yValue + pointSizeYDomain / 2) <= (yDomain[1] + maxSizeYDomain / 2))\n ) {\n acc.push({\n ...d,\n _point: {\n xValue: xValue,\n yValue: yValue,\n sizePx: pointSizeScaled,\n color: getColor(d, config.color, j),\n strokeColor: getColor(d, config.strokeColor, j, true),\n strokeWidthPx: getNumber(d, config.strokeWidth, j),\n shape: getString(d, config.shape, j) as SymbolType,\n label: getString(d, config.label, j),\n labelColor: getColor(d, config.labelColor, j, true),\n labelPosition: getValue(d, config.labelPosition, i) as Position,\n cursor: getString(d, config.cursor, j),\n groupIndex: j,\n pointIndex: i,\n },\n })\n }\n\n return acc\n }, []) ?? []\n })\n }\n\n private _onPointMouseOver (d: ScatterPoint<Datum>, event: MouseEvent): void {\n const point = select(event.target as SVGGElement)\n const pointNode = point.node() as ScatterPointGroupNode | null\n if (pointNode) pointNode._forceShowLabel = true\n\n point.raise()\n this._resolveLabelOverlap()\n }\n\n private _onPointMouseOut (d: ScatterPoint<Datum>, event: MouseEvent): void {\n const pointNode = select(event.target as SVGGElement).node() as ScatterPointGroupNode | null\n if (pointNode) delete pointNode._forceShowLabel\n\n this._resolveLabelOverlap()\n }\n}\n"],"names":["s.pointGroup","pointGroupExit","s.pointGroupExit","s.point","s"],"mappings":";;;;;;;;;;;;;AAiCM,MAAO,OAAe,SAAQ,eAAqD,CAAA;AAiBvF,IAAA,WAAA,CAAa,MAAsC,EAAA;AACjD,QAAA,KAAK,EAAE,CAAA;QAhBC,IAAc,CAAA,cAAA,GAAG,oBAAqD,CAAA;AACzE,QAAA,IAAA,CAAA,MAAM,GAAkC,IAAI,CAAC,cAAc,CAAA;AAElE,QAAA,IAAA,CAAA,MAAM,GAAG;AACP,YAAA,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,GAAG;gBACzB,UAAU,EAAE,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC;gBAC7C,UAAU,EAAE,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC;AAC7C,aAAA;SACF,CAAA;QAEO,IAAU,CAAA,UAAA,GAA4B,EAAE,CAAA;AAO9C,QAAA,IAAI,MAAM;AAAE,YAAA,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAA;KACnC;AAED,IAAA,SAAS,CAAE,MAAqC,EAAA;AAC9C,QAAA,KAAK,CAAC,SAAS,CAAC,MAAM,C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EAAE,MAAM,CAAC,aAAa,EAAE,CAAC,CAAa;4BAC/D,MAAM,EAAE,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;AACtC,4BAAA,UAAU,EAAE,CAAC;AACb,4BAAA,UAAU,EAAE,CAAC;AACd,yBAAA,EAAA,CAAA,CACD,CAAA;AACH,iBAAA;AAED,gBAAA,OAAO,GAAG,CAAA;AACZ,aAAC,EAAE,EAAE,CAAC,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAI,EAAE,CAAA;AACd,SAAC,CAAC,CAAA;KACH;IAEO,iBAAiB,CAAE,CAAsB,EAAE,KAAiB,EAAA;QAClE,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,MAAqB,CAAC,CAAA;AACjD,QAAA,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,EAAkC,CAAA;AAC9D,QAAA,IAAI,SAAS;AAAE,YAAA,SAAS,CAAC,eAAe,GAAG,IAAI,CAAA;QAE/C,KAAK,CAAC,KAAK,EAAE,CAAA;QACb,IAAI,CAAC,oBAAoB,EAAE,CAAA;KAC5B;IAEO,gBAAgB,CAAE,CAAsB,EAAE,KAAiB,EAAA;QACjE,MAAM,SAAS,GAAG,MAAM,CAAC,KAAK,CAAC,MAAqB,CAAC,CAAC,IAAI,EAAkC,CAAA;AAC5F,QAAA,IAAI,SAAS;YAAE,OAAO,SAAS,CAAC,eAAe,CAAA;QAE/C,IAAI,CAAC,oBAAoB,EAAE,CAAA;KAC5B;;AA3NM,OAAS,CAAA,SAAA,GAAGC,KAAC;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/scatter/index.ts"],"sourcesContent":["import { Selection, select } from 'd3-selection'\nimport { max, min } from 'd3-array'\n\n// Core\nimport { XYComponentCore } from 'core/xy-component'\n\n// Utils\nimport { isNumber, getExtent, getNumber, getString, isArray, flatten, getValue } from 'utils/data'\nimport { getColor } from 'utils/color'\nimport { smartTransition } from 'utils/d3'\nimport { getCSSVariableValueInPixels } from 'utils/misc'\n\n// Types\nimport { Spacing } from 'types/spacing'\nimport { SymbolType } from 'types/symbol'\nimport { NumericAccessor } from 'types/accessor'\nimport { Position } from 'types/position'\nimport { ContinuousScale } from 'types/scale'\n\n// Local Types\nimport { ScatterPointGroupNode, ScatterPoint } from './types'\n\n// Config\nimport { ScatterDefaultConfig, ScatterConfigInterface } from './config'\n\n// Modules\nimport { createPoints, updatePoints, removePoints } from './modules/point'\nimport { collideLabels, getEstimatedLabelBBox } from './modules/utils'\n\n// Styles\nimport * as s from './style'\n\n\nexport class Scatter<Datum> extends XYComponentCore<Datum, ScatterConfigInterface<Datum>> {\n static selectors = s\n protected _defaultConfig = ScatterDefaultConfig as ScatterConfigInterface<Datum>\n public config: ScatterConfigInterface<Datum> = this._defaultConfig\n\n events = {\n [Scatter.selectors.point]: {\n mouseenter: this._onPointMouseOver.bind(this),\n mouseleave: this._onPointMouseOut.bind(this),\n },\n }\n\n private _pointData: ScatterPoint<Datum>[][] = []\n private _points: Selection<SVGGElement, ScatterPoint<Datum>, SVGGElement, ScatterPoint<Datum>[]>\n private _sizeScale: ContinuousScale\n private _collideLabelsAnimFrameId: ReturnType<typeof requestAnimationFrame>\n\n constructor (config?: ScatterConfigInterface<Datum>) {\n super()\n if (config) this.setConfig(config)\n }\n\n setConfig (config: ScatterConfigInterface<Datum>): void {\n super.setConfig(config)\n this._updateSizeScale()\n }\n\n setData (data: Datum[]): void {\n super.setData(data)\n this._updateSizeScale()\n }\n\n get bleed (): Spacing {\n this._pointData = this._getOnScreenData()\n const pointDataFlat: ScatterPoint<Datum>[] = flatten(this._pointData)\n\n const yRangeStart = min(this.yScale.range())\n const yRangeEnd = max(this.yScale.range())\n const xRangeStart = this.xScale.range()[0]\n const xRangeEnd = this.xScale.range()[1]\n\n const fontSizePx = getCSSVariableValueInPixels('var(--vis-scatter-point-label-text-font-size)', this.element)\n\n const extent = pointDataFlat.reduce((ext, d) => {\n const x = this.xScale(d._point.xValue)\n const y = this.yScale(d._point.yValue)\n const r = d._point.sizePx / 2\n\n ext.minX = Math.min(ext.minX, x - r)\n ext.maxX = Math.max(ext.maxX, x + r)\n ext.minY = Math.min(ext.minY, y - r)\n ext.maxY = Math.max(ext.maxY, y + r)\n\n if (d._point.label) {\n const labelBBox = getEstimatedLabelBBox(d, d._point.labelPosition, this.xScale, this.yScale, fontSizePx)\n ext.minX = Math.min(ext.minX, labelBBox.x)\n ext.maxX = Math.max(ext.maxX, labelBBox.x + labelBBox.width)\n ext.minY = Math.min(ext.minY, labelBBox.y)\n ext.maxY = Math.max(ext.maxY, labelBBox.y + labelBBox.height)\n }\n return ext\n }, {\n minX: Number.POSITIVE_INFINITY,\n maxX: Number.NEGATIVE_INFINITY,\n minY: Number.POSITIVE_INFINITY,\n maxY: Number.NEGATIVE_INFINITY,\n })\n\n const coeff = 1.2 // Multiplier to take into account subsequent scale range changes and shape irregularities\n const top = extent.minY < yRangeStart ? coeff * (yRangeStart - extent.minY) : 0\n const bottom = extent.maxY > yRangeEnd ? coeff * (extent.maxY - yRangeEnd) : 0\n const left = extent.minX < xRangeStart ? coeff * (xRangeStart - extent.minX) : 0\n const right = extent.maxX > xRangeEnd ? coeff * (extent.maxX - xRangeEnd) : 0\n\n return { top, bottom, left, right }\n }\n\n _render (customDuration?: number): void {\n const { config } = this\n const duration = isNumber(customDuration) ? customDuration : config.duration\n\n // Groups\n const pointGroups = this.g\n .selectAll<SVGGElement, ScatterPoint<Datum>[]>(`.${s.pointGroup}`)\n .data(this._pointData)\n\n const pointGroupsEnter = pointGroups\n .enter()\n .append('g')\n .attr('class', s.pointGroup)\n\n const pointGroupsMerged = pointGroupsEnter.merge(pointGroups)\n smartTransition(pointGroupsMerged, duration)\n .style('opacity', 1)\n\n const pointGroupExit = pointGroups.exit().attr('class', s.pointGroupExit)\n smartTransition(pointGroupExit, duration).style('opacity', 0).remove()\n\n // Points\n const points = pointGroupsMerged\n .selectAll<SVGGElement, ScatterPoint<Datum>>(`.${s.point}`)\n .data(\n d => d,\n d => `${getString(d, config.id, d._point.pointIndex) ?? d._point.pointIndex}`\n )\n\n const pointsEnter = points.enter().append('g')\n .attr('class', s.point)\n createPoints(pointsEnter, this.xScale, this.yScale)\n\n this._points = pointsEnter.merge(points)\n updatePoints(this._points, config, this.xScale, this.yScale, duration)\n\n removePoints(points.exit<ScatterPoint<Datum>>(), this.xScale, this.yScale, duration)\n\n // Take care of overlapping labels\n if (this._hasLabels()) {\n this._resolveLabelOverlap()\n }\n }\n\n private _hasLabels (): boolean {\n // If label config is not defined, no labels will be shown\n if (!this.config.label) return false\n\n // Check if any point in the flattened data has a label\n const pointDataFlat: ScatterPoint<Datum>[] = flatten(this._pointData)\n return pointDataFlat.some(d => d._point.label)\n }\n\n private _resolveLabelOverlap (): void {\n if (!this.config.labelHideOverlapping) {\n const label = this._points.selectAll<SVGTextElement, ScatterPoint<Datum>>('text')\n label.attr('opacity', null)\n return\n }\n\n cancelAnimationFrame(this._collideLabelsAnimFrameId)\n this._collideLabelsAnimFrameId = requestAnimationFrame(() => {\n collideLabels(this._points, this.config, this.xScale, this.yScale)\n })\n }\n\n private _updateSizeScale (): void {\n const { config, datamodel } = this\n\n this._sizeScale = config.sizeScale.copy()\n this._sizeScale.domain(getExtent(datamodel.data, config.size))\n this._sizeScale.range(config.sizeRange ?? [0, 0])\n }\n\n private _getOnScreenData (): ScatterPoint<Datum>[][] {\n const { config, datamodel: { data } } = this\n\n const xDomain = this.xScale.domain().map((d: number | Date) => +d) // Convert Date to number\n const yDomain = this.yScale.domain().map((d: number | Date) => +d) // Convert Date to number\n const yAccessors = (isArray(config.y) ? config.y : [config.y]) as NumericAccessor<Datum>[]\n\n const maxSizeValue = max<number>(flatten(yAccessors.map((y, j) => data?.map(d => getNumber(d, config.size, j)))))\n const maxSizePx = config.sizeRange ? this._sizeScale(maxSizeValue) : maxSizeValue\n\n const maxSizeXDomain = (this.xScale.invert(maxSizePx) as number) - (this.xScale.invert(0) as number)\n const maxSizeYDomain = Math.abs((this.yScale.invert(maxSizePx) as number) - (this.yScale.invert(0) as number))\n\n return yAccessors.map((y, j) => {\n return data?.reduce<ScatterPoint<Datum>[]>((acc, d, i) => {\n const xValue = getNumber(d, config.x, i)\n const yValue = getNumber(d, y, j)\n const pointSize = getNumber(d, config.size, i)\n const pointSizeScaled = config.sizeRange ? this._sizeScale(pointSize) : pointSize\n const pointSizeXDomain = (this.xScale.invert(pointSizeScaled) as number) - (this.xScale.invert(0) as number)\n const pointSizeYDomain = Math.abs((this.yScale.invert(pointSizeScaled) as number) - (this.yScale.invert(0) as number))\n\n if (\n ((xValue - pointSizeXDomain / 2) >= (xDomain[0] - maxSizeXDomain / 2)) &&\n ((xValue + pointSizeXDomain / 2) <= (xDomain[1] + maxSizeXDomain / 2)) &&\n ((yValue - pointSizeYDomain / 2) >= (yDomain[0] - maxSizeYDomain / 2)) &&\n ((yValue + pointSizeYDomain / 2) <= (yDomain[1] + maxSizeYDomain / 2))\n ) {\n acc.push({\n ...d,\n _point: {\n xValue: xValue,\n yValue: yValue,\n sizePx: pointSizeScaled,\n color: getColor(d, config.color, j),\n strokeColor: getColor(d, config.strokeColor, j, true),\n strokeWidthPx: getNumber(d, config.strokeWidth, j),\n shape: getString(d, config.shape, j) as SymbolType,\n label: getString(d, config.label, j),\n labelColor: getColor(d, config.labelColor, j, true),\n labelPosition: getValue(d, config.labelPosition, i) as Position,\n cursor: getString(d, config.cursor, j),\n groupIndex: j,\n pointIndex: i,\n },\n })\n }\n\n return acc\n }, []) ?? []\n })\n }\n\n private _onPointMouseOver (d: ScatterPoint<Datum>, event: MouseEvent): void {\n const point = select(event.target as SVGGElement)\n const pointNode = point.node() as ScatterPointGroupNode | null\n if (pointNode) pointNode._forceShowLabel = true\n\n point.raise()\n this._resolveLabelOverlap()\n }\n\n private _onPointMouseOut (d: ScatterPoint<Datum>, event: MouseEvent): void {\n const pointNode = select(event.target as SVGGElement).node() as ScatterPointGroupNode | null\n if (pointNode) delete pointNode._forceShowLabel\n\n this._resolveLabelOverlap()\n }\n}\n"],"names":["s.pointGroup","pointGroupExit","s.pointGroupExit","s.point","s"],"mappings":";;;;;;;;;;;;;AAiCM,MAAO,OAAe,SAAQ,eAAqD,CAAA;AAiBvF,IAAA,WAAA,CAAa,MAAsC,EAAA;AACjD,QAAA,KAAK,EAAE,CAAA;QAhBC,IAAc,CAAA,cAAA,GAAG,oBAAqD,CAAA;AACzE,QAAA,IAAA,CAAA,MAAM,GAAkC,IAAI,CAAC,cAAc,CAAA;AAElE,QAAA,IAAA,CAAA,MAAM,GAAG;AACP,YAAA,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,GAAG;gBACzB,UAAU,EAAE,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC;gBAC7C,UAAU,EAAE,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC;AAC7C,aAAA;SACF,CAAA;QAEO,IAAU,CAAA,UAAA,GAA4B,EAAE,CAAA;AAO9C,QAAA,IAAI,MAAM;AAAE,YAAA,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAA;KACnC;AAED,IAAA,SAAS,CAAE,MAAqC,EAAA;AAC9C,QAAA,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAA;QACvB,IAAI,CAAC,gBAAgB,EAAE,CAAA;KACxB;AAED,IAAA,OAAO,CAAE,IAAa,EAAA;AACpB,QAAA,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;QACnB,IAAI,CAAC,gBAAgB,EAAE,CAAA;KACxB;AAED,IAAA,IAAI,KAAK,GAAA;AACP,QAAA,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,gBAAgB,EAAE,CAAA;QACzC,MAAM,aAAa,GAA0B,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;QAErE,MAAM,WAAW,GAAG,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,EAA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,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,EAAkC,CAAA;AAC9D,QAAA,IAAI,SAAS;AAAE,YAAA,SAAS,CAAC,eAAe,GAAG,IAAI,CAAA;QAE/C,KAAK,CAAC,KAAK,EAAE,CAAA;QACb,IAAI,CAAC,oBAAoB,EAAE,CAAA;KAC5B;IAEO,gBAAgB,CAAE,CAAsB,EAAE,KAAiB,EAAA;QACjE,MAAM,SAAS,GAAG,MAAM,CAAC,KAAK,CAAC,MAAqB,CAAC,CAAC,IAAI,EAAkC,CAAA;AAC5F,QAAA,IAAI,SAAS;YAAE,OAAO,SAAS,CAAC,eAAe,CAAA;QAE/C,IAAI,CAAC,oBAAoB,EAAE,CAAA;KAC5B;;AAzNM,OAAS,CAAA,SAAA,GAAGC,KAAC;;;;"}
@@ -1,7 +1,7 @@
1
1
  import { XYComponentConfigInterface } from "../../core/xy-component/config";
2
2
  import { WithOptional } from "../../types/misc";
3
3
  import { ColorAccessor, NumericAccessor, StringAccessor, GenericAccessor } from "../../types/accessor";
4
- import { TextAlign, TrimMode } from "../../types/text";
4
+ import { TextAlign } from "../../types/text";
5
5
  import { Arrangement } from "../../types/position";
6
6
  import type { TimelineArrow, TimelineLineRenderState, TimelineRowIcon, TimelineRowLabel } from './types';
7
7
  export interface TimelineConfigInterface<Datum> extends WithOptional<XYComponentConfigInterface<Datum>, 'y'> {
@@ -74,10 +74,6 @@ export interface TimelineConfigInterface<Datum> extends WithOptional<XYComponent
74
74
  rowMaxLabelWidth?: number;
75
75
  /** Text alignment for labels: `TextAlign.Left`, `TextAlign.Center` or `TextAlign.Right`. Default: `TextAlign.Right` */
76
76
  rowLabelTextAlign?: TextAlign | `${TextAlign}`;
77
- /** Row label trim mode when width is limited: `TrimMode.Start`, `TrimMode.Middle` or `TrimMode.End`. Default: `TrimMode.Middle` */
78
- rowLabelTrimMode?: TrimMode | `${TrimMode}`;
79
- /** Row label margin in pixels. Can be a single number or a `[left, right]` tuple. Default: `[0, 5]` */
80
- rowLabelMargin?: number | [number, number];
81
77
  arrows?: TimelineArrow[];
82
78
  /** Control the animation by specify the initial position for new lines as [x, y]. Default: `undefined` */
83
79
  animationLineEnterPosition?: [
@@ -1,5 +1,5 @@
1
1
  import { XYComponentDefaultConfig } from '../../core/xy-component/config.js';
2
- import { TextAlign, TrimMode } from '../../types/text.js';
2
+ import { TextAlign } from '../../types/text.js';
3
3
  import { Arrangement } from '../../types/position.js';
4
4
 
5
5
  const TimelineDefaultConfig = Object.assign(Object.assign({}, XYComponentDefaultConfig), { id: undefined,
@@ -8,7 +8,7 @@ const TimelineDefaultConfig = Object.assign(Object.assign({}, XYComponentDefault
8
8
  // Rows
9
9
  rowHeight: 22, alternatingRowColors: true,
10
10
  // Row Labels
11
- showLabels: false, labelWidth: undefined, maxLabelWidth: 120, showRowLabels: undefined, rowLabelFormatter: undefined, rowIcon: undefined, rowLabelStyle: undefined, rowLabelWidth: undefined, rowMaxLabelWidth: undefined, rowLabelTextAlign: TextAlign.Right, rowLabelTrimMode: TrimMode.Middle, rowLabelMargin: [0, 5],
11
+ showLabels: false, labelWidth: undefined, maxLabelWidth: 120, showRowLabels: undefined, rowLabelFormatter: undefined, rowIcon: undefined, rowLabelStyle: undefined, rowLabelWidth: undefined, rowMaxLabelWidth: undefined, rowLabelTextAlign: TextAlign.Right,
12
12
  // Arrows
13
13
  arrows: undefined,
14
14
  // Animation
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sources":["../../../src/components/timeline/config.ts"],"sourcesContent":["import { XYComponentConfigInterface, XYComponentDefaultConfig } from 'core/xy-component/config'\n\n// Types\nimport { WithOptional } from 'types/misc'\nimport { ColorAccessor, NumericAccessor, StringAccessor, GenericAccessor } from 'types/accessor'\nimport { TextAlign, TrimMode } from 'types/text'\nimport { Arrangement } from 'types/position'\n\n// Local Types\nimport type { TimelineArrow, TimelineLineRenderState, TimelineRowIcon, TimelineRowLabel } from './types'\n\nexport interface TimelineConfigInterface<Datum> extends WithOptional<XYComponentConfigInterface<Datum>, 'y'> {\n // Items (Lines)\n /** @deprecated This property has been renamed to `key` */\n type?: StringAccessor<Datum>;\n /** @deprecated This property has been renamed to `lineDuration` */\n length?: NumericAccessor<Datum>;\n /** @deprecated This property has been renamed to `lineCursor` */\n cursor?: StringAccessor<Datum>;\n /** Timeline item row accessor function. Records with the `lineRow` will be plotted in one row. Default: `undefined` */\n lineRow?: StringAccessor<Datum>;\n /** Timeline item duration accessor function. Default: `undefined`. Falls back to the deprecated `length` property */\n lineDuration?: NumericAccessor<Datum>;\n /** Timeline item color accessor function. Default: `d => d.color` */\n color?: ColorAccessor<Datum>;\n /** Width of the timeline items. Default: `8` */\n lineWidth?: NumericAccessor<Datum>;\n /** Display rounded ends for timeline items. Default: `true` */\n lineCap?: boolean;\n /** Provide a href to an SVG defined in container's `svgDefs` to display an icon at the start of the line. Default: undefined */\n lineStartIcon?: StringAccessor<Datum>;\n /** Line start icon color accessor function. Default: `undefined` */\n lineStartIconColor?: StringAccessor<Datum>;\n /** Line start icon size accessor function. Default: `undefined` */\n lineStartIconSize?: NumericAccessor<Datum>;\n /** Line start icon arrangement configuration. Controls how the icon is positioned relative to the line.\n * Accepts values from the Arrangement enum: `Arrangement.Start`, `Arrangement.Middle`, `Arrangement.End` or a string equivalent.\n * Default: `Arrangement.Inside` */\n lineStartIconArrangement?: GenericAccessor<Arrangement | `${Arrangement}`, Datum>;\n /** Provide a href to an SVG defined in container's `svgDefs` to display an icon at the end of the line. Default: undefined */\n lineEndIcon?: StringAccessor<Datum>;\n /** Line end icon color accessor function. Default: `undefined` */\n lineEndIconColor?: StringAccessor<Datum>;\n /** Line end icon size accessor function. Default: `undefined` */\n lineEndIconSize?: NumericAccessor<Datum>;\n /** Line end icon arrangement configuration. Controls how the icon is positioned relative to the line.\n * Accepts values from the Arrangement enum: `Arrangement.Start`, `Arrangement.Middle`, `Arrangement.End` or a string equivalent.\n * Default: `Arrangement.Inside` */\n lineEndIconArrangement?: GenericAccessor<Arrangement | `${Arrangement}`, Datum>;\n /** Configurable Timeline item cursor when hovering over. Default: `undefined` */\n lineCursor?: StringAccessor<Datum>;\n /** Sets the minimum line length to 1 pixel for better visibility of small values.\n * When `lineCap` is set to `true`, the segment will be rendered as a circle.\n * Default: `false` */\n showEmptySegments?: boolean;\n /** Center small segments when `showEmptySegments` and `lineCap` are set to `true`.\n * Default: `true` */\n showEmptySegmentsCorrectPosition?: boolean;\n\n /** Timeline row height. Default: `22` */\n rowHeight?: number;\n /** Alternating row colors. Default: `true` */\n alternatingRowColors?: boolean;\n\n // Row Labels\n /** @deprecated This property has been renamed to `showRowLabels */\n showLabels?: boolean;\n /** @deprecated This property has been renamed to `rowLabelWidth */\n labelWidth?: number;\n /** @deprecated This property has been renamed to `rowMaxLabelWidth */\n maxLabelWidth?: number;\n\n /** Show row labels when set to `true`. Default: `false`. Falls back to deprecated `showLabels` */\n showRowLabels?: boolean;\n /** Row label style as an object with the `{ [property-name]: value }` format. Default: `undefined` */\n rowLabelStyle?: GenericAccessor<Record<string, string>, TimelineRowLabel<Datum>>;\n /** Row label formatter function. Default: `undefined` */\n rowLabelFormatter?: (key: string, items: Datum[], i: number) => string;\n /** Provide an icon href to be displayed before the row label. Default: `undefined` */\n rowIcon?: (key: string, items: Datum[], i: number) => TimelineRowIcon | undefined;\n /** Fixed label width in pixels. Labels longer than the specified value will be trimmed. Default: `undefined`. Falls back to deprecated `labelWidth`. */\n rowLabelWidth?: number;\n /** Maximum label width in pixels. Labels longer than the specified value will be trimmed. Default: `undefined`. Falls back to deprecated `maxLabelWidth`. */\n rowMaxLabelWidth?: number;\n /** Text alignment for labels: `TextAlign.Left`, `TextAlign.Center` or `TextAlign.Right`. Default: `TextAlign.Right` */\n rowLabelTextAlign?: TextAlign | `${TextAlign}`;\n /** Row label trim mode when width is limited: `TrimMode.Start`, `TrimMode.Middle` or `TrimMode.End`. Default: `TrimMode.Middle` */\n rowLabelTrimMode?: TrimMode | `${TrimMode}`;\n /** Row label margin in pixels. Can be a single number or a `[left, right]` tuple. Default: `[0, 5]` */\n rowLabelMargin?: number | [number, number];\n\n // Arrows\n arrows?: TimelineArrow[];\n\n // Animation\n /** Control the animation by specify the initial position for new lines as [x, y]. Default: `undefined` */\n animationLineEnterPosition?:\n [number | undefined | null, number | undefined | null] |\n ((d: Datum & TimelineLineRenderState, i: number, data: (Datum & TimelineLineRenderState)[]) => [number | undefined, number | undefined]) |\n undefined;\n /** Control the animation by specify the destination position for exiting lines as [x, y]. Default: `undefined` */\n animationLineExitPosition?: [number | undefined | null, number | undefined | null] |\n ((d: Datum & TimelineLineRenderState, i: number, data: (Datum & TimelineLineRenderState)[]) => [number | undefined, number | undefined]) |\n undefined;\n\n // Callbacks\n /** Scrolling callback function: `(scrollTop: number) => void`. Default: `undefined` */\n onScroll?: (scrollTop: number) => void;\n}\n\nexport const TimelineDefaultConfig: TimelineConfigInterface<unknown> = {\n ...XYComponentDefaultConfig,\n id: undefined,\n\n // Items (Lines)\n cursor: undefined, // Deprecated (see above)\n type: (d: unknown): string => (d as { type: string }).type, // Deprecated (see above)\n length: (d: unknown): number => (d as { length: number }).length, // Deprecated (see above)\n color: (d: unknown): string => (d as { color: string }).color,\n lineRow: undefined,\n lineDuration: undefined,\n lineWidth: 8,\n lineCap: false,\n lineCursor: undefined,\n showEmptySegments: false,\n showEmptySegmentsCorrectPosition: true,\n lineStartIcon: undefined,\n lineStartIconColor: undefined,\n lineStartIconSize: undefined,\n lineStartIconArrangement: Arrangement.Inside,\n lineEndIcon: undefined,\n lineEndIconColor: undefined,\n lineEndIconSize: undefined,\n lineEndIconArrangement: Arrangement.Inside,\n\n // Rows\n rowHeight: 22,\n alternatingRowColors: true,\n\n // Row Labels\n showLabels: false, // Deprecated (see above)\n labelWidth: undefined, // Deprecated (see above)\n maxLabelWidth: 120, // Deprecated (see above)\n\n showRowLabels: undefined,\n rowLabelFormatter: undefined,\n rowIcon: undefined,\n rowLabelStyle: undefined,\n rowLabelWidth: undefined,\n rowMaxLabelWidth: undefined,\n rowLabelTextAlign: TextAlign.Right,\n rowLabelTrimMode: TrimMode.Middle,\n rowLabelMargin: [0, 5],\n\n // Arrows\n arrows: undefined,\n\n // Animation\n animationLineEnterPosition: undefined,\n\n // Callbacks\n onScroll: undefined,\n}\n"],"names":[],"mappings":";;;;MA8Ga,qBAAqB,GAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAC7B,wBAAwB,CAC3B,EAAA,EAAA,EAAE,EAAE,SAAS;;IAGb,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,CAAC,CAAU,KAAc,CAAsB,CAAC,IAAI,EAC1D,MAAM,EAAE,CAAC,CAAU,KAAc,CAAwB,CAAC,MAAM,EAChE,KAAK,EAAE,CAAC,CAAU,KAAc,CAAuB,CAAC,KAAK,EAC7D,OAAO,EAAE,SAAS,EAClB,YAAY,EAAE,SAAS,EACvB,SAAS,EAAE,CAAC,EACZ,OAAO,EAAE,KAAK,EACd,UAAU,EAAE,SAAS,EACrB,iBAAiB,EAAE,KAAK,EACxB,gCAAgC,EAAE,IAAI,EACtC,aAAa,EAAE,SAAS,EACxB,kBAAkB,EAAE,SAAS,EAC7B,iBAAiB,EAAE,SAAS,EAC5B,wBAAwB,EAAE,WAAW,CAAC,MAAM,EAC5C,WAAW,EAAE,SAAS,EACtB,gBAAgB,EAAE,SAAS,EAC3B,eAAe,EAAE,SAAS,EAC1B,sBAAsB,EAAE,WAAW,CAAC,MAAM;;AAG1C,IAAA,SAAS,EAAE,EAAE,EACb,oBAAoB,EAAE,IAAI;;IAG1B,UAAU,EAAE,KAAK,EACjB,UAAU,EAAE,SAAS,EACrB,aAAa,EAAE,GAAG,EAElB,aAAa,EAAE,SAAS,EACxB,iBAAiB,EAAE,SAAS,EAC5B,OAAO,EAAE,SAAS,EAClB,aAAa,EAAE,SAAS,EACxB,aAAa,EAAE,SAAS,EACxB,gBAAgB,EAAE,SAAS,EAC3B,iBAAiB,EAAE,SAAS,CAAC,KAAK,EAClC,gBAAgB,EAAE,QAAQ,CAAC,MAAM,EACjC,cAAc,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;;AAGtB,IAAA,MAAM,EAAE,SAAS;;AAGjB,IAAA,0BAA0B,EAAE,SAAS;;IAGrC,QAAQ,EAAE,SAAS,EAAA;;;;"}
1
+ {"version":3,"file":"config.js","sources":["../../../src/components/timeline/config.ts"],"sourcesContent":["import { XYComponentConfigInterface, XYComponentDefaultConfig } from 'core/xy-component/config'\n\n// Types\nimport { WithOptional } from 'types/misc'\nimport { ColorAccessor, NumericAccessor, StringAccessor, GenericAccessor } from 'types/accessor'\nimport { TextAlign } from 'types/text'\nimport { Arrangement } from 'types/position'\n\n// Local Types\nimport type { TimelineArrow, TimelineLineRenderState, TimelineRowIcon, TimelineRowLabel } from './types'\n\nexport interface TimelineConfigInterface<Datum> extends WithOptional<XYComponentConfigInterface<Datum>, 'y'> {\n // Items (Lines)\n /** @deprecated This property has been renamed to `key` */\n type?: StringAccessor<Datum>;\n /** @deprecated This property has been renamed to `lineDuration` */\n length?: NumericAccessor<Datum>;\n /** @deprecated This property has been renamed to `lineCursor` */\n cursor?: StringAccessor<Datum>;\n /** Timeline item row accessor function. Records with the `lineRow` will be plotted in one row. Default: `undefined` */\n lineRow?: StringAccessor<Datum>;\n /** Timeline item duration accessor function. Default: `undefined`. Falls back to the deprecated `length` property */\n lineDuration?: NumericAccessor<Datum>;\n /** Timeline item color accessor function. Default: `d => d.color` */\n color?: ColorAccessor<Datum>;\n /** Width of the timeline items. Default: `8` */\n lineWidth?: NumericAccessor<Datum>;\n /** Display rounded ends for timeline items. Default: `true` */\n lineCap?: boolean;\n /** Provide a href to an SVG defined in container's `svgDefs` to display an icon at the start of the line. Default: undefined */\n lineStartIcon?: StringAccessor<Datum>;\n /** Line start icon color accessor function. Default: `undefined` */\n lineStartIconColor?: StringAccessor<Datum>;\n /** Line start icon size accessor function. Default: `undefined` */\n lineStartIconSize?: NumericAccessor<Datum>;\n /** Line start icon arrangement configuration. Controls how the icon is positioned relative to the line.\n * Accepts values from the Arrangement enum: `Arrangement.Start`, `Arrangement.Middle`, `Arrangement.End` or a string equivalent.\n * Default: `Arrangement.Inside` */\n lineStartIconArrangement?: GenericAccessor<Arrangement | `${Arrangement}`, Datum>;\n /** Provide a href to an SVG defined in container's `svgDefs` to display an icon at the end of the line. Default: undefined */\n lineEndIcon?: StringAccessor<Datum>;\n /** Line end icon color accessor function. Default: `undefined` */\n lineEndIconColor?: StringAccessor<Datum>;\n /** Line end icon size accessor function. Default: `undefined` */\n lineEndIconSize?: NumericAccessor<Datum>;\n /** Line end icon arrangement configuration. Controls how the icon is positioned relative to the line.\n * Accepts values from the Arrangement enum: `Arrangement.Start`, `Arrangement.Middle`, `Arrangement.End` or a string equivalent.\n * Default: `Arrangement.Inside` */\n lineEndIconArrangement?: GenericAccessor<Arrangement | `${Arrangement}`, Datum>;\n /** Configurable Timeline item cursor when hovering over. Default: `undefined` */\n lineCursor?: StringAccessor<Datum>;\n /** Sets the minimum line length to 1 pixel for better visibility of small values.\n * When `lineCap` is set to `true`, the segment will be rendered as a circle.\n * Default: `false` */\n showEmptySegments?: boolean;\n /** Center small segments when `showEmptySegments` and `lineCap` are set to `true`.\n * Default: `true` */\n showEmptySegmentsCorrectPosition?: boolean;\n\n /** Timeline row height. Default: `22` */\n rowHeight?: number;\n /** Alternating row colors. Default: `true` */\n alternatingRowColors?: boolean;\n\n // Row Labels\n /** @deprecated This property has been renamed to `showRowLabels */\n showLabels?: boolean;\n /** @deprecated This property has been renamed to `rowLabelWidth */\n labelWidth?: number;\n /** @deprecated This property has been renamed to `rowMaxLabelWidth */\n maxLabelWidth?: number;\n\n /** Show row labels when set to `true`. Default: `false`. Falls back to deprecated `showLabels` */\n showRowLabels?: boolean;\n /** Row label style as an object with the `{ [property-name]: value }` format. Default: `undefined` */\n rowLabelStyle?: GenericAccessor<Record<string, string>, TimelineRowLabel<Datum>>;\n /** Row label formatter function. Default: `undefined` */\n rowLabelFormatter?: (key: string, items: Datum[], i: number) => string;\n /** Provide an icon href to be displayed before the row label. Default: `undefined` */\n rowIcon?: (key: string, items: Datum[], i: number) => TimelineRowIcon | undefined;\n /** Fixed label width in pixels. Labels longer than the specified value will be trimmed. Default: `undefined`. Falls back to deprecated `labelWidth`. */\n rowLabelWidth?: number;\n /** Maximum label width in pixels. Labels longer than the specified value will be trimmed. Default: `undefined`. Falls back to deprecated `maxLabelWidth`. */\n rowMaxLabelWidth?: number;\n /** Text alignment for labels: `TextAlign.Left`, `TextAlign.Center` or `TextAlign.Right`. Default: `TextAlign.Right` */\n rowLabelTextAlign?: TextAlign | `${TextAlign}`;\n\n // Arrows\n arrows?: TimelineArrow[];\n\n // Animation\n /** Control the animation by specify the initial position for new lines as [x, y]. Default: `undefined` */\n animationLineEnterPosition?:\n [number | undefined | null, number | undefined | null] |\n ((d: Datum & TimelineLineRenderState, i: number, data: (Datum & TimelineLineRenderState)[]) => [number | undefined, number | undefined]) |\n undefined;\n /** Control the animation by specify the destination position for exiting lines as [x, y]. Default: `undefined` */\n animationLineExitPosition?: [number | undefined | null, number | undefined | null] |\n ((d: Datum & TimelineLineRenderState, i: number, data: (Datum & TimelineLineRenderState)[]) => [number | undefined, number | undefined]) |\n undefined;\n\n // Callbacks\n /** Scrolling callback function: `(scrollTop: number) => void`. Default: `undefined` */\n onScroll?: (scrollTop: number) => void;\n}\n\nexport const TimelineDefaultConfig: TimelineConfigInterface<unknown> = {\n ...XYComponentDefaultConfig,\n id: undefined,\n\n // Items (Lines)\n cursor: undefined, // Deprecated (see above)\n type: (d: unknown): string => (d as { type: string }).type, // Deprecated (see above)\n length: (d: unknown): number => (d as { length: number }).length, // Deprecated (see above)\n color: (d: unknown): string => (d as { color: string }).color,\n lineRow: undefined,\n lineDuration: undefined,\n lineWidth: 8,\n lineCap: false,\n lineCursor: undefined,\n showEmptySegments: false,\n showEmptySegmentsCorrectPosition: true,\n lineStartIcon: undefined,\n lineStartIconColor: undefined,\n lineStartIconSize: undefined,\n lineStartIconArrangement: Arrangement.Inside,\n lineEndIcon: undefined,\n lineEndIconColor: undefined,\n lineEndIconSize: undefined,\n lineEndIconArrangement: Arrangement.Inside,\n\n // Rows\n rowHeight: 22,\n alternatingRowColors: true,\n\n // Row Labels\n showLabels: false, // Deprecated (see above)\n labelWidth: undefined, // Deprecated (see above)\n maxLabelWidth: 120, // Deprecated (see above)\n\n showRowLabels: undefined,\n rowLabelFormatter: undefined,\n rowIcon: undefined,\n rowLabelStyle: undefined,\n rowLabelWidth: undefined,\n rowMaxLabelWidth: undefined,\n rowLabelTextAlign: TextAlign.Right,\n\n // Arrows\n arrows: undefined,\n\n // Animation\n animationLineEnterPosition: undefined,\n\n // Callbacks\n onScroll: undefined,\n}\n"],"names":[],"mappings":";;;;MA0Ga,qBAAqB,GAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAC7B,wBAAwB,CAC3B,EAAA,EAAA,EAAE,EAAE,SAAS;;IAGb,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,CAAC,CAAU,KAAc,CAAsB,CAAC,IAAI,EAC1D,MAAM,EAAE,CAAC,CAAU,KAAc,CAAwB,CAAC,MAAM,EAChE,KAAK,EAAE,CAAC,CAAU,KAAc,CAAuB,CAAC,KAAK,EAC7D,OAAO,EAAE,SAAS,EAClB,YAAY,EAAE,SAAS,EACvB,SAAS,EAAE,CAAC,EACZ,OAAO,EAAE,KAAK,EACd,UAAU,EAAE,SAAS,EACrB,iBAAiB,EAAE,KAAK,EACxB,gCAAgC,EAAE,IAAI,EACtC,aAAa,EAAE,SAAS,EACxB,kBAAkB,EAAE,SAAS,EAC7B,iBAAiB,EAAE,SAAS,EAC5B,wBAAwB,EAAE,WAAW,CAAC,MAAM,EAC5C,WAAW,EAAE,SAAS,EACtB,gBAAgB,EAAE,SAAS,EAC3B,eAAe,EAAE,SAAS,EAC1B,sBAAsB,EAAE,WAAW,CAAC,MAAM;;AAG1C,IAAA,SAAS,EAAE,EAAE,EACb,oBAAoB,EAAE,IAAI;;AAG1B,IAAA,UAAU,EAAE,KAAK,EACjB,UAAU,EAAE,SAAS,EACrB,aAAa,EAAE,GAAG,EAElB,aAAa,EAAE,SAAS,EACxB,iBAAiB,EAAE,SAAS,EAC5B,OAAO,EAAE,SAAS,EAClB,aAAa,EAAE,SAAS,EACxB,aAAa,EAAE,SAAS,EACxB,gBAAgB,EAAE,SAAS,EAC3B,iBAAiB,EAAE,SAAS,CAAC,KAAK;;AAGlC,IAAA,MAAM,EAAE,SAAS;;AAGjB,IAAA,0BAA0B,EAAE,SAAS;;IAGrC,QAAQ,EAAE,SAAS,EAAA;;;;"}
@@ -25,8 +25,9 @@ export declare class Timeline<Datum> extends XYComponentCore<Datum, TimelineConf
25
25
  private _scrollBarMargin;
26
26
  private _maxScroll;
27
27
  private _scrollbarHeight;
28
+ private _labelMargin;
28
29
  private _labelWidth;
29
- private _lineIconBleed;
30
+ private _rowIconBleed;
30
31
  private _lineBleed;
31
32
  /** We define a dedicated clipping path for this component because it needs to behave
32
33
  * differently than the regular XYContainer's clipPath */
@@ -37,7 +38,6 @@ export declare class Timeline<Datum> extends XYComponentCore<Datum, TimelineConf
37
38
  setData(data: Datum[]): void;
38
39
  get bleed(): Spacing;
39
40
  _render(customDuration?: number): void;
40
- private _getRowLabelMargin;
41
41
  private _getLineLength;
42
42
  private _getLineWidth;
43
43
  private _getLineDuration;
@@ -12,7 +12,7 @@ import { guid } from '../../utils/misc.js';
12
12
  import '../../types.js';
13
13
  import { TimelineDefaultConfig } from './config.js';
14
14
  import * as style from './style.js';
15
- import { background, rows, arrows, lines, labels, rowIcons, scrollbar, scrollbarBackground, scrollbarHandle, label, rowIcon, labelBackground, row, rowOdd, lineGroup, line, lineStartIcon, lineEndIcon, arrow } from './style.js';
15
+ import { background, rows, arrows, lines, labels, rowIcons, scrollbar, scrollbarBackground, scrollbarHandle, label, rowIcon, row, rowOdd, lineGroup, line, lineStartIcon, lineEndIcon, arrow } from './style.js';
16
16
  import { TIMELINE_DEFAULT_ARROW_HEAD_LENGTH, TIMELINE_DEFAULT_ARROW_HEAD_WIDTH, TIMELINE_DEFAULT_ARROW_MARGIN } from './constants.js';
17
17
  import { getIconBleed } from './utils.js';
18
18
  import { TextAlign } from '../../types/text.js';
@@ -30,9 +30,6 @@ class Timeline extends XYComponentCore {
30
30
  [Timeline.selectors.label]: {
31
31
  wheel: this._onMouseWheel.bind(this),
32
32
  },
33
- [Timeline.selectors.labelBackground]: {
34
- wheel: this._onMouseWheel.bind(this),
35
- },
36
33
  [Timeline.selectors.rows]: {
37
34
  wheel: this._onMouseWheel.bind(this),
38
35
  },
@@ -45,8 +42,9 @@ class Timeline extends XYComponentCore {
45
42
  this._scrollBarMargin = 5;
46
43
  this._maxScroll = 0;
47
44
  this._scrollbarHeight = 0;
45
+ this._labelMargin = 5;
48
46
  this._labelWidth = 0; // Will be overridden in `get bleed ()`
49
- this._lineIconBleed = [0, 0];
47
+ this._rowIconBleed = [0, 0];
50
48
  this._lineBleed = [0, 0];
51
49
  /** We define a dedicated clipping path for this component because it needs to behave
52
50
  * differently than the regular XYContainer's clipPath */
@@ -86,31 +84,26 @@ class Timeline extends XYComponentCore {
86
84
  super.setData(data);
87
85
  }
88
86
  get bleed() {
89
- var _a, _b, _c;
87
+ var _a, _b, _c, _d;
90
88
  const { config, datamodel: { data } } = this;
91
89
  const rowLabels = this._getRowLabels(data);
92
90
  const rowHeight = config.rowHeight || (this._height / (rowLabels.length || 1));
93
- const hasRowIcons = rowLabels.some(l => l.iconHref);
94
- const maxRowIconSize = max(rowLabels.map(l => l.iconSize || 0));
91
+ const hasIcons = rowLabels.some(l => l.iconHref);
92
+ const maxIconSize = max(rowLabels.map(l => l.iconSize || 0));
95
93
  // We calculate the longest label width to set the bleed values accordingly
96
94
  if ((_a = config.showRowLabels) !== null && _a !== void 0 ? _a : config.showLabels) {
97
- const [marginLeft, marginRight] = this._getRowLabelMargin();
98
- if ((_b = config.rowLabelWidth) !== null && _b !== void 0 ? _b : config.labelWidth) {
99
- // We add a little of extra space to take into account the fact that `trimSVGText` is not always precise
100
- const tolerance = 1.1;
101
- this._labelWidth = tolerance * ((_c = config.rowLabelWidth) !== null && _c !== void 0 ? _c : config.labelWidth) + marginLeft + marginRight;
102
- }
95
+ if ((_b = config.rowLabelWidth) !== null && _b !== void 0 ? _b : config.labelWidth)
96
+ this._labelWidth = ((_c = config.rowLabelWidth) !== null && _c !== void 0 ? _c : config.labelWidth) + this._labelMargin;
103
97
  else {
104
- const labels = rowLabels.map(l => {
105
- var _a;
106
- return this._labelsGroup.append('text')
107
- .attr('class', label)
108
- .text(l.formattedLabel || '')
109
- .call(trimSVGText, (_a = config.rowMaxLabelWidth) !== null && _a !== void 0 ? _a : config.maxLabelWidth, config.rowLabelTrimMode);
110
- });
111
- const labelWidth = max(labels.map(l => l.node().getBBox().width)) || 0;
112
- labels.forEach(l => l.remove());
113
- this._labelWidth = labelWidth ? labelWidth + marginLeft + marginRight : 0;
98
+ const longestLabel = rowLabels.reduce((longestLabel, l) => longestLabel.formattedLabel.length > l.formattedLabel.length ? longestLabel : l, rowLabels[0]);
99
+ const label$1 = this._labelsGroup.append('text')
100
+ .attr('class', label)
101
+ .text((longestLabel === null || longestLabel === void 0 ? void 0 : longestLabel.formattedLabel) || '')
102
+ .call(trimSVGText, (_d = config.rowMaxLabelWidth) !== null && _d !== void 0 ? _d : config.maxLabelWidth);
103
+ const labelWidth = label$1.node().getBBox().width;
104
+ label$1.remove();
105
+ const tolerance = 1.15; // Some characters are wider than others so we add a little of extra space to take that into account
106
+ this._labelWidth = labelWidth ? tolerance * labelWidth + this._labelMargin : 0;
114
107
  }
115
108
  }
116
109
  // There can be multiple start / end items with the same timestamp, so we need to find the shortest one
@@ -143,23 +136,23 @@ class Timeline extends XYComponentCore {
143
136
  }
144
137
  this._lineBleed = lineBleed;
145
138
  // Icon bleed
146
- const lineIconBleed = [0, 0];
139
+ const iconBleed = [0, 0];
147
140
  if (config.lineStartIcon) {
148
- lineIconBleed[0] = max(data, (d, i) => getIconBleed(d, i, config.lineStartIcon, config.lineStartIconSize, config.lineStartIconArrangement, rowHeight)) || 0;
141
+ iconBleed[0] = max(data, (d, i) => getIconBleed(d, i, config.lineStartIcon, config.lineStartIconSize, config.lineStartIconArrangement, rowHeight)) || 0;
149
142
  }
150
143
  if (config.lineEndIcon) {
151
- lineIconBleed[1] = max(data, (d, i) => getIconBleed(d, i, config.lineEndIcon, config.lineEndIconSize, config.lineEndIconArrangement, rowHeight)) || 0;
144
+ iconBleed[1] = max(data, (d, i) => getIconBleed(d, i, config.lineEndIcon, config.lineEndIconSize, config.lineEndIconArrangement, rowHeight)) || 0;
152
145
  }
153
- this._lineIconBleed = lineIconBleed;
146
+ this._rowIconBleed = iconBleed;
154
147
  return {
155
148
  top: 0,
156
149
  bottom: 0,
157
- left: this._labelWidth + lineIconBleed[0] + (hasRowIcons ? maxRowIconSize : 0) + lineBleed[0],
158
- right: this._scrollBarWidth + this._scrollBarMargin + lineIconBleed[1] + lineBleed[1],
150
+ left: this._labelWidth + iconBleed[0] + (hasIcons ? maxIconSize : 0) + lineBleed[0],
151
+ right: this._scrollBarWidth + this._scrollBarMargin + iconBleed[1] + lineBleed[1],
159
152
  };
160
153
  }
161
154
  _render(customDuration) {
162
- var _a, _b, _c;
155
+ var _a;
163
156
  super._render(customDuration);
164
157
  const { config, datamodel: { data } } = this;
165
158
  const duration = isNumber(customDuration) ? customDuration : config.duration;
@@ -188,7 +181,6 @@ class Timeline extends XYComponentCore {
188
181
  .attr('width', l => l.iconSize)
189
182
  .attr('height', l => l.iconSize)
190
183
  .attr('y', l => yStart + (yOrdinalScale(l.label) + 0.5) * rowHeight - l.iconSize / 2)
191
- .style('color', l => l.iconColor)
192
184
  .style('opacity', 0);
193
185
  smartTransition(rowIconsEnter.merge(rowIcons), duration)
194
186
  .attr('href', l => l.iconHref)
@@ -204,28 +196,11 @@ class Timeline extends XYComponentCore {
204
196
  // Labels
205
197
  const labels = this._labelsGroup.selectAll(`.${label}`)
206
198
  .data(((_a = config.showRowLabels) !== null && _a !== void 0 ? _a : config.showLabels) ? rowLabels : [], l => l === null || l === void 0 ? void 0 : l.label);
207
- const [labelMarginLeft, labelMarginRight] = this._getRowLabelMargin();
208
199
  const labelOffset = config.rowLabelTextAlign === TextAlign.Center ? this._labelWidth / 2
209
- : config.rowLabelTextAlign === TextAlign.Left ? this._labelWidth - labelMarginLeft
210
- : labelMarginRight;
211
- const xStart = xRange[0] - this._lineBleed[0] - this._lineIconBleed[0];
200
+ : config.rowLabelTextAlign === TextAlign.Left ? this._labelWidth
201
+ : this._labelMargin;
202
+ const xStart = xRange[0] - this._rowIconBleed[0] - this._lineBleed[0];
212
203
  const labelXStart = xStart - labelOffset;
213
- // Invisible background rects covering the full label column width for pointer events
214
- const labelBackgrounds = this._labelsGroup
215
- .selectAll(`.${labelBackground}`)
216
- .data(((_b = config.showRowLabels) !== null && _b !== void 0 ? _b : config.showLabels) ? rowLabels : [], l => l === null || l === void 0 ? void 0 : l.label);
217
- const labelBackgroundsEnter = labelBackgrounds.enter().append('rect')
218
- .attr('class', labelBackground)
219
- .attr('x', xStart - this._labelWidth)
220
- .attr('y', l => yStart + yOrdinalScale(l.label) * rowHeight)
221
- .attr('width', this._labelWidth)
222
- .attr('height', rowHeight);
223
- labelBackgroundsEnter.merge(labelBackgrounds)
224
- .attr('x', xStart - this._labelWidth)
225
- .attr('y', l => yStart + yOrdinalScale(l.label) * rowHeight)
226
- .attr('width', this._labelWidth)
227
- .attr('height', rowHeight);
228
- labelBackgrounds.exit().remove();
229
204
  const labelsEnter = labels.enter().append('text')
230
205
  .attr('class', label)
231
206
  .attr('x', labelXStart)
@@ -236,8 +211,7 @@ class Timeline extends XYComponentCore {
236
211
  .each((label, i, els) => {
237
212
  var _a, _b;
238
213
  const labelSelection = select(els[i]);
239
- const maxLabelWidth = ((_a = config.rowLabelWidth) !== null && _a !== void 0 ? _a : config.labelWidth) || ((_b = config.rowMaxLabelWidth) !== null && _b !== void 0 ? _b : config.maxLabelWidth);
240
- trimSVGText(labelSelection, maxLabelWidth, config.rowLabelTrimMode);
214
+ trimSVGText(labelSelection, ((_a = config.rowLabelWidth) !== null && _a !== void 0 ? _a : config.labelWidth) || ((_b = config.rowMaxLabelWidth) !== null && _b !== void 0 ? _b : config.maxLabelWidth));
241
215
  // Apply custom label style if it has been provided
242
216
  const customStyle = getValue(label, config.rowLabelStyle);
243
217
  if (!isPlainObject(customStyle))
@@ -255,7 +229,7 @@ class Timeline extends XYComponentCore {
255
229
  .style('opacity', 0)
256
230
  .remove();
257
231
  // Row background rects
258
- const timelineWidth = xRange[1] - xRange[0] + this._lineIconBleed[0] + this._lineIconBleed[1] + this._lineBleed[0] + this._lineBleed[1];
232
+ const timelineWidth = xRange[1] - xRange[0] + this._rowIconBleed[0] + this._rowIconBleed[1] + this._lineBleed[0] + this._lineBleed[1];
259
233
  const numRows = Math.max(Math.floor(yHeight / rowHeight), numRowLabels);
260
234
  const recordTypes = Array(numRows).fill(null).map((_, i) => rowLabels[i]);
261
235
  const rects = this._rowsGroup.selectAll(`.${row}`)
@@ -386,19 +360,12 @@ class Timeline extends XYComponentCore {
386
360
  .attr('ry', this._scrollBarWidth / 2);
387
361
  this._updateScrollPosition(0);
388
362
  // Clip path
389
- // Arrowheads can get cut off when they are too close to the edges, so we extend the clip path to account for them.
390
- // TODO: In rare scenarios this can have unwanted side effects, so we might need to create a dedicated clip path for arrows.
391
- const maxArrowHeadWidth = (_c = max(arrowsData !== null && arrowsData !== void 0 ? arrowsData : [], a => { var _a; return (_a = a.arrowHeadWidth) !== null && _a !== void 0 ? _a : TIMELINE_DEFAULT_ARROW_HEAD_WIDTH; })) !== null && _c !== void 0 ? _c : 0;
392
363
  const clipPathRect = this._clipPath.select('rect');
393
364
  smartTransition(clipPathRect, clipPathRect.attr('width') ? duration : 0)
394
- .attr('x', xStart - maxArrowHeadWidth / 2)
395
- .attr('width', timelineWidth + maxArrowHeadWidth)
365
+ .attr('x', xStart)
366
+ .attr('width', timelineWidth)
396
367
  .attr('height', this._height);
397
368
  }
398
- _getRowLabelMargin() {
399
- const m = this.config.rowLabelMargin;
400
- return Array.isArray(m) ? m : [m, m];
401
- }
402
369
  _getLineLength(d, i) {
403
370
  var _a, _b;
404
371
  const { config, xScale } = this;