@unovis/ts 1.3.2-beta.2 → 1.4.0-alpha.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 (45) hide show
  1. package/components/chord-diagram/config.d.ts +1 -1
  2. package/components/chord-diagram/config.js.map +1 -1
  3. package/components/chord-diagram/index.js +2 -2
  4. package/components/chord-diagram/index.js.map +1 -1
  5. package/components/chord-diagram/modules/layout.d.ts +1 -1
  6. package/components/chord-diagram/modules/layout.js +7 -4
  7. package/components/chord-diagram/modules/layout.js.map +1 -1
  8. package/components/chord-diagram/modules/node.js +1 -1
  9. package/components/chord-diagram/modules/node.js.map +1 -1
  10. package/components/graph/config.d.ts +9 -12
  11. package/components/graph/config.js +1 -1
  12. package/components/graph/config.js.map +1 -1
  13. package/components/graph/index.d.ts +1 -1
  14. package/components/graph/index.js +14 -37
  15. package/components/graph/index.js.map +1 -1
  16. package/components/graph/modules/link/helper.d.ts +4 -6
  17. package/components/graph/modules/link/helper.js +15 -25
  18. package/components/graph/modules/link/helper.js.map +1 -1
  19. package/components/graph/modules/link/index.d.ts +3 -3
  20. package/components/graph/modules/link/index.js +108 -88
  21. package/components/graph/modules/link/index.js.map +1 -1
  22. package/components/graph/modules/link/style.d.ts +4 -4
  23. package/components/graph/modules/link/style.js +24 -20
  24. package/components/graph/modules/link/style.js.map +1 -1
  25. package/components/graph/modules/node/helper.d.ts +1 -0
  26. package/components/graph/modules/node/helper.js +4 -1
  27. package/components/graph/modules/node/helper.js.map +1 -1
  28. package/components/graph/modules/node/index.js +23 -7
  29. package/components/graph/modules/node/index.js.map +1 -1
  30. package/components/graph/modules/node/style.js +6 -3
  31. package/components/graph/modules/node/style.js.map +1 -1
  32. package/components/graph/modules/shape.d.ts +1 -1
  33. package/components/graph/modules/shape.js +4 -3
  34. package/components/graph/modules/shape.js.map +1 -1
  35. package/components/graph/types.d.ts +47 -0
  36. package/components/graph/types.js.map +1 -1
  37. package/components/timeline/config.js +1 -1
  38. package/components/timeline/config.js.map +1 -1
  39. package/components/timeline/index.js +13 -8
  40. package/components/timeline/index.js.map +1 -1
  41. package/package.json +1 -1
  42. package/utils/svg.d.ts +2 -0
  43. package/utils/svg.js +52 -0
  44. package/utils/svg.js.map +1 -0
  45. package/utils/text.js.map +1 -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 { 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,CAA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AAC,CAAC,CAAC,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
+ {"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) ?? [\n this._getRecordType(d, i), getNumber(d, config.x, i),\n ].join('-'))\n\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, ordinalScale(this._getRecordType(d, i))))\n .call(this._positionLines.bind(this), ordinalScale)\n .attr('transform', 'translate(0, 10)')\n .style('opacity', 0)\n\n const linesMerged = linesEnter.merge(lines)\n .style('fill', (d, i) => getColor(d, config.color, ordinalScale(this._getRecordType(d, i))))\n .style('cursor', (d, i) => getString(d, config.cursor, i))\n .call(this._positionLines.bind(this), ordinalScale)\n\n smartTransition(linesMerged, duration)\n .attr('transform', 'translate(0, 0)')\n .style('opacity', 1)\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 })\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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AAM,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;;AA3RM,QAAS,CAAA,SAAA,GAAGE,KAAC;;;;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unovis/ts",
3
3
  "description": "Modular data visualization framework for React, Angular, Svelte, and vanilla TypeScript or JavaScript",
4
- "version": "1.3.2-beta.2",
4
+ "version": "1.4.0-alpha.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/f5/unovis.git",
package/utils/svg.d.ts CHANGED
@@ -1,3 +1,5 @@
1
1
  import { TransformValues } from "../types/svg";
2
+ export declare const allowedSvgTags: string[];
2
3
  export declare function getTransformValues(svgElement: SVGElement): TransformValues;
3
4
  export declare function transformValuesToString(transformValues: TransformValues): string;
5
+ export declare function sanitizeSvgString(svgString: string, allowedTags?: string[]): string;
package/utils/svg.js ADDED
@@ -0,0 +1,52 @@
1
+ import striptags from 'striptags';
2
+ import { allowedSvgTextTags } from './text.js';
3
+
4
+ const allowedSvgTags = [
5
+ 'svg', 'g', 'path', 'rect', 'circle', 'ellipse', 'line', 'polyline', 'polygon',
6
+ 'defs', 'clipPath', 'use', 'symbol', 'image', 'marker', 'style', 'mask',
7
+ ...allowedSvgTextTags,
8
+ ];
9
+ function getTransformValues(svgElement) {
10
+ // Get the transform attribute value from the SVG element
11
+ const transformAttribute = svgElement.getAttribute('transform');
12
+ // Regular expressions to extract translate and scale values from the transform attribute
13
+ const translateRegex = /translate\(\s*(-?[\d.]+)\s*,?\s*(-?[\d.]+)?\s*\)/;
14
+ const scaleRegex = /scale\(\s*(-?[\d.]+)\s*,?\s*(-?[\d.]+)?\s*\)/;
15
+ // Initialize default values
16
+ const transformValues = {
17
+ translate: { x: 0, y: 0 },
18
+ scale: { x: 1, y: 1 },
19
+ };
20
+ if (transformAttribute) {
21
+ // Extract translate values
22
+ const translateMatches = transformAttribute.match(translateRegex);
23
+ if (translateMatches) {
24
+ transformValues.translate.x = parseFloat(translateMatches[1]);
25
+ transformValues.translate.y = translateMatches[2] ? parseFloat(translateMatches[2]) : 0;
26
+ }
27
+ // Extract scale values
28
+ const scaleMatches = transformAttribute.match(scaleRegex);
29
+ if (scaleMatches) {
30
+ transformValues.scale.x = parseFloat(scaleMatches[1]);
31
+ transformValues.scale.y = scaleMatches[2] ? parseFloat(scaleMatches[2]) : transformValues.scale.x;
32
+ }
33
+ }
34
+ return transformValues;
35
+ }
36
+ function transformValuesToString(transformValues) {
37
+ const translateString = `translate(${transformValues.translate.x} ${transformValues.translate.y})`;
38
+ // Only include scaleString when both scale values are not 1
39
+ const shouldIncludeScaleString = transformValues.scale.x !== 1 || transformValues.scale.y !== 1;
40
+ const scaleString = shouldIncludeScaleString ? `scale(${transformValues.scale.x} ${transformValues.scale.y})` : '';
41
+ // Combine the translate and scale strings into a single transform attribute string
42
+ const transformString = scaleString
43
+ ? `${translateString} ${scaleString}`
44
+ : translateString;
45
+ return transformString;
46
+ }
47
+ function sanitizeSvgString(svgString, allowedTags = allowedSvgTags) {
48
+ return striptags(svgString, allowedTags);
49
+ }
50
+
51
+ export { allowedSvgTags, getTransformValues, sanitizeSvgString, transformValuesToString };
52
+ //# sourceMappingURL=svg.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"svg.js","sources":["../../src/utils/svg.ts"],"sourcesContent":["import { TransformValues } from 'types/svg'\nimport striptags from 'striptags'\n\nimport { allowedSvgTextTags } from './text'\n\nexport const allowedSvgTags = [\n 'svg', 'g', 'path', 'rect', 'circle', 'ellipse', 'line', 'polyline', 'polygon',\n 'defs', 'clipPath', 'use', 'symbol', 'image', 'marker', 'style', 'mask',\n ...allowedSvgTextTags,\n]\n\nexport function getTransformValues (svgElement: SVGElement): TransformValues {\n // Get the transform attribute value from the SVG element\n const transformAttribute = svgElement.getAttribute('transform')\n\n // Regular expressions to extract translate and scale values from the transform attribute\n const translateRegex = /translate\\(\\s*(-?[\\d.]+)\\s*,?\\s*(-?[\\d.]+)?\\s*\\)/\n const scaleRegex = /scale\\(\\s*(-?[\\d.]+)\\s*,?\\s*(-?[\\d.]+)?\\s*\\)/\n\n // Initialize default values\n const transformValues: TransformValues = {\n translate: { x: 0, y: 0 },\n scale: { x: 1, y: 1 },\n }\n\n if (transformAttribute) {\n // Extract translate values\n const translateMatches = transformAttribute.match(translateRegex)\n if (translateMatches) {\n transformValues.translate.x = parseFloat(translateMatches[1])\n transformValues.translate.y = translateMatches[2] ? parseFloat(translateMatches[2]) : 0\n }\n\n // Extract scale values\n const scaleMatches = transformAttribute.match(scaleRegex)\n if (scaleMatches) {\n transformValues.scale.x = parseFloat(scaleMatches[1])\n transformValues.scale.y = scaleMatches[2] ? parseFloat(scaleMatches[2]) : transformValues.scale.x\n }\n }\n\n return transformValues\n}\n\nexport function transformValuesToString (transformValues: TransformValues): string {\n const translateString = `translate(${transformValues.translate.x} ${transformValues.translate.y})`\n\n // Only include scaleString when both scale values are not 1\n const shouldIncludeScaleString = transformValues.scale.x !== 1 || transformValues.scale.y !== 1\n const scaleString = shouldIncludeScaleString ? `scale(${transformValues.scale.x} ${transformValues.scale.y})` : ''\n\n // Combine the translate and scale strings into a single transform attribute string\n const transformString = scaleString\n ? `${translateString} ${scaleString}`\n : translateString\n\n return transformString\n}\n\nexport function sanitizeSvgString (svgString: string, allowedTags = allowedSvgTags): string {\n return striptags(svgString, allowedTags)\n}\n"],"names":[],"mappings":";;;AAKa,MAAA,cAAc,GA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CAAC,KAAK,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC,CAAA;AAClG,SAAA;AACF,KAAA;AAED,IAAA,OAAO,eAAe,CAAA;AACxB,CAAC;AAEK,SAAU,uBAAuB,CAAE,eAAgC,EAAA;AACvE,IAAA,MAAM,eAAe,GAAG,CAAa,UAAA,EAAA,eAAe,CAAC,SAAS,CAAC,CAAC,CAAA,CAAA,EAAI,eAAe,CAAC,SAAS,CAAC,CAAC,GAAG,CAAA;;AAGlG,IAAA,MAAM,wBAAwB,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,IAAI,eAAe,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAA;IAC/F,MAAM,WAAW,GAAG,wBAAwB,GAAG,CAAA,MAAA,EAAS,eAAe,CAAC,KAAK,CAAC,CAAC,CAAI,CAAA,EAAA,eAAe,CAAC,KAAK,CAAC,CAAC,GAAG,GAAG,EAAE,CAAA;;IAGlH,MAAM,eAAe,GAAG,WAAW;AACjC,UAAE,CAAA,EAAG,eAAe,CAAA,CAAA,EAAI,WAAW,CAAE,CAAA;UACnC,eAAe,CAAA;AAEnB,IAAA,OAAO,eAAe,CAAA;AACxB,CAAC;SAEe,iBAAiB,CAAE,SAAiB,EAAE,WAAW,GAAG,cAAc,EAAA;AAChF,IAAA,OAAO,SAAS,CAAC,SAAS,EAAE,WAAW,CAAC,CAAA;AAC1C;;;;"}
package/utils/text.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"text.js","sources":["../../src/utils/text.ts"],"sourcesContent":["import { Selection } from 'd3-selection'\nimport { sum } from 'd3-array'\nimport striptags from 'striptags'\n\n// Types\nimport { TextAlign, TrimMode, UnovisText, UnovisTextFrameOptions, UnovisTextOptions, UnovisWrappedText, VerticalAlign } from 'types/text'\n\n// Utils\nimport { flatten, isArray, merge } from 'utils/data'\nimport { getTextAnchorFromTextAlign } from 'types/svg'\n\n// Styles\nimport { getFontWidthToHeightRatio, UNOVIS_TEXT_DEFAULT, UNOVIS_TEXT_SEPARATOR_DEFAULT, UNOVIS_TEXT_HYPHEN_CHARACTER_DEFAULT } from 'styles/index'\n\n/**\n * Converts a kebab-case string to camelCase.\n *\n * @param {string} str - The kebab-case string to be converted.\n * @returns {string} The resulting camelCase string.\n */\nexport function kebabCaseToCamel (str: string): string {\n return str.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase())\n}\n\n/**\n * Converts a given string to kebab-case.\n * @param {string} str - The input string to be converted to kebab-case.\n * @returns {string} - The kebab-cased string.\n */\nexport function kebabCase (str: string): string {\n return str.match(/[A-Z]{2,}(?=[A-Z][a-z0-9]*|\\b)|[A-Z]?[a-z0-9]*|[A-Z]|[0-9]+/g)\n ?.filter(Boolean)\n .map(x => x.toLowerCase())\n .join('-')\n}\n\nexport function escapeStringKeepHash (str: string): string {\n return str\n .replace(/['\"]/g, '&#39;') // Escapes quotes with &#39;\n // eslint-disable-next-line no-control-regex\n .replace(/\\u0000/g, '\\\\0') // Escapes null characters\n .replace(/\\n/g, '\\\\n') // Escapes new lines\n .replace(/\\r/g, '\\\\r') // Escapes carriage returns\n .replace(/\\v/g, '\\\\v') // Escapes vertical tabs\n .replace(/\\t/g, '\\\\t') // Escapes horizontal tabs\n .replace(/\\f/g, '\\\\f') // Escapes form feeds\n}\n\n/**\n * Trims the input string from the start, leaving only the specified maximum length.\n * @param {string} [str=''] - The input string to be trimmed.\n * @param {number} [maxLength=15] - The maximum allowed length of the trimmed string.\n * @returns {string} - The trimmed string.\n */\nexport function trimStringStart (str = '', maxLength = 15): string {\n return str.length > maxLength ? `…${str.substr(str.length - maxLength, maxLength)}` : str\n}\n\n/**\n * Trims the input string from the middle, leaving only the specified maximum length.\n * @param {string} [str=''] - The input string to be trimmed.\n * @param {number} [maxLength=15] - The maximum allowed length of the trimmed string.\n * @returns {string} - The trimmed string.\n */\nexport function trimStringMiddle (str = '', maxLength = 15): string {\n const dist = Math.floor((maxLength - 3) / 2)\n return str.length > maxLength ? `${str.substr(0, dist)}…${str.substr(-dist, dist)}` : str\n}\n\n/**\n * Trims the input string from the end, leaving only the specified maximum length.\n * @param {string} [str=''] - The input string to be trimmed.\n * @param {number} [maxLength=15] - The maximum allowed length of the trimmed string.\n * @returns {string} - The trimmed string.\n */\nexport function trimStringEnd (str = '', maxLength = 15): string {\n return str.length > maxLength ? `${str.substr(0, maxLength)}…` : str\n}\n\n/**\n * Trims the input string according to the specified trim mode.\n * @param {string} [str=''] - The input string to be trimmed.\n * @param {number} [length=15] - The maximum allowed length of the trimmed string.\n * @param {TrimMode} [type=TrimMode.Middle] - The trim mode to be applied.\n * @returns {string} - The trimmed string.\n */\nexport function trimString (str = '', length = 15, type = TrimMode.Middle): string {\n let result = trimStringEnd(str, length)\n if (type === TrimMode.Start) result = trimStringStart(str, length)\n else if (type === TrimMode.Middle) result = trimStringMiddle(str, length)\n return result\n}\n\n/**\n * Splits the input string according to the specified separators.\n * @param {string} text - The input string to be split.\n * @param {string[]} [separators=[' ']] - The array of separators to be used for splitting.\n * @returns {string[]} - The array of split words.\n */\nexport function splitString (text: string, separators = [' ']): string[] {\n let result = [text] as Array<string | string[]>\n for (let i = 0; i < separators.length; i++) {\n const sep = separators[i]\n result.forEach((d, index) => {\n const separated = (d as string).split(sep)\n const words = separated.map((word, j) => `${word}${j === separated.length - 1 ? '' : sep}`)\n result[index] = words\n })\n result = flatten(result)\n }\n\n return result as string[]\n}\n\n/**\n * Wraps an SVG text element to fit within the specified width.\n * @param {Selection<SVGTextElement, any, SVGElement, any>} textElement - The SVG text element to be wrapped.\n * @param {number} width - The maximum allowed width for the text element.\n * @param {(string | string[])} [separator=[' ', '-', '.', ',']] - The separator(s) to be used for wrapping.\n */\nexport function wrapSVGText (\n textElement: Selection<SVGTextElement, any, SVGElement, any>,\n width: number,\n separator: string | string[] = [' ', '-', '.', ',']\n): void {\n const text = textElement.text()\n if (!text) return\n\n // Wrap\n const separators = (isArray(separator) ? separator : [separator]) as string[]\n const words = splitString(text, separators)\n const x = parseFloat(textElement.attr('x')) || 0\n\n textElement.text('')\n let tspan = textElement.append('tspan').attr('x', x)\n let tspanContent = `${words[0]}`\n tspan.text(tspanContent)\n\n words.forEach((word, i) => {\n if (i === 0) return\n\n const tspanText = `${tspanContent}${word}`\n tspan.text(tspanText)\n const tspanWidth = tspan.node().getComputedTextLength()\n if (tspanWidth > width) {\n tspan.text(tspanContent.trim())\n\n tspan = textElement.append('tspan')\n .attr('x', x)\n .attr('dy', '1.2em')\n .text(word)\n\n tspanContent = word\n } else tspanContent += word\n })\n}\n\n/**\n * Trims an SVG text element based on the specified max width, trim type, and other options.\n * @param {Selection<SVGTextElement, any, SVGElement, any>} svgTextSelection - The D3 selection of the SVG text element to be trimmed.\n * @param {number} [maxWidth=50] - The maximum width of the text element.\n * @param {TrimMode} [trimType=TrimMode.Middle] - The type of trim (start, middle, or end).\n * @param {boolean} [fastMode=true] - Whether to use a fast estimation method for text length calculation.\n * @param {number} [fontSize=0] - The font size of the text.\n * @param {number} [fontWidthToHeightRatio=getFontWidthToHeightRatio()] - The font width to height ratio.\n * @returns {boolean} True if the text was trimmed, false otherwise.\n */\nexport function trimSVGText (\n svgTextSelection: Selection<SVGTextElement, any, SVGElement, any>,\n maxWidth = 50,\n trimType = TrimMode.Middle,\n fastMode = true,\n fontSize = +window.getComputedStyle(svgTextSelection.node())?.fontSize || 0,\n fontWidthToHeightRatio = getFontWidthToHeightRatio()\n): boolean {\n const text = svgTextSelection.text()\n const textLength = text.length\n\n const textWidth = fastMode ? fontSize * textLength * fontWidthToHeightRatio : svgTextSelection.node().getComputedTextLength()\n const tolerance = 1.1\n const maxCharacters = Math.ceil(textLength * maxWidth / (tolerance * textWidth))\n if (maxCharacters < textLength) {\n svgTextSelection.text(trimString(text, maxCharacters, trimType))\n return true\n }\n\n return false\n}\n\n/**\n * Estimates the length of a string in pixels.\n * @param {string} str - The string to be measured.\n * @param {number} fontSize - The font size of the string.\n * @param {number} [fontWidthToHeightRatio=getFontWidthToHeightRatio()] - The font width to height ratio.\n * @returns {number} The estimated length of the string in pixels.\n */\nexport function estimateStringPixelLength (\n str: string,\n fontSize: number,\n fontWidthToHeightRatio = getFontWidthToHeightRatio()\n): number {\n return str.length * fontSize * fontWidthToHeightRatio || 0\n}\n\n/**\n * Calculates the precise length of a string in pixels.\n * @param {string} str - The string to be measured.\n * @param {string} [fontFamily] - The font family of the string.\n * @param {(string | number)} [fontSize] - The font size of the string.\n * @returns {number} The precise length of the string in pixels.\n */\nexport function getPreciseStringLengthPx (str: string, fontFamily?: string, fontSize?: string | number): number {\n const svgNS = 'http://www.w3.org/2000/svg'\n const svg = document.createElementNS(svgNS, 'svg')\n const text = document.createElementNS(svgNS, 'text')\n\n text.textContent = str\n text.setAttribute('font-size', `${fontSize}`)\n text.setAttribute('font-family', fontFamily)\n\n svg.appendChild(text)\n document.body.appendChild(svg)\n const length = text.getComputedTextLength()\n document.body.removeChild(svg)\n\n return length\n}\n\n/**\n * Estimates the dimensions of an SVG text element.\n *\n * @export\n * @param {Selection<SVGTextElement, any, SVGElement, any>} svgTextSelection - The D3 selection of the SVG text element.\n * @param {number} fontSize - The font size.\n * @param {number} [dy=0.32] - The line height scaling factor.\n * @param {boolean} [fastMode=true] - Whether to use a fast estimation method or a more accurate one.\n * @param {number} [fontWidthToHeightRatio] - The font width-to-height ratio.\n * @returns {{width: number, height: number}} - The estimated dimensions of the text element.\n */\nexport function estimateTextSize (\n svgTextSelection: Selection<SVGTextElement, any, SVGElement, any>,\n fontSize: number,\n dy = 0.32,\n fastMode = true,\n fontWidthToHeightRatio?: number\n): { width: number; height: number } {\n fontWidthToHeightRatio = fontWidthToHeightRatio || getFontWidthToHeightRatio()\n const tspanSelection = svgTextSelection.selectAll('tspan')\n\n const lines = tspanSelection.size() || 1\n const height = svgTextSelection.text() ? 0.85 * fontSize * lines * (1 + dy) - dy : 0\n\n let width = 0\n if (tspanSelection.empty()) {\n const textLength = svgTextSelection.text().length\n width = fastMode ? fontSize * textLength * fontWidthToHeightRatio : svgTextSelection.node().getComputedTextLength()\n } else {\n for (const tspan of tspanSelection.nodes()) {\n const tspanTextLength = (tspan as SVGTSpanElement).textContent.length\n const w = fastMode ? fontSize * tspanTextLength * fontWidthToHeightRatio : (tspan as SVGTSpanElement).getComputedTextLength()\n if (w > width) width = w\n }\n }\n\n return { width, height }\n}\n\n/**\n * Breaks a text block into lines based on the specified width.\n *\n * @param {UnovisText} textBlock - The text block to break into lines.\n * @param {number | undefined} [width=undefined] - The maximum width of a line in pixels.\n * @param {(number | undefined)} [height=undefined] - The height limit for the wrapped text in pixels.\n * @param {boolean} [fastMode=true] - Whether to use a fast estimation method or a more accurate one.\n * @param {string | string[]} [separator] - The word separators.\n * @returns {string[]} - The text split into lines.\n */\nfunction breakTextIntoLines (\n textBlock: UnovisText,\n width: number | undefined = undefined,\n fastMode = true,\n separator: string | string[] = UNOVIS_TEXT_SEPARATOR_DEFAULT,\n wordBreak = false\n): string[] {\n const text = `${textBlock.text}`\n if (!text) return []\n const separators = Array.isArray(separator) ? separator : [separator]\n\n const splitByNewLine = text.split('\\n')\n return splitByNewLine.map((str) => {\n const lines: string[] = []\n if (!width) return [str]\n\n const words = splitString(str, separators)\n let line = ''\n for (let i = 0; i < words.length; i += 1) {\n const textLengthPx = fastMode\n ? estimateStringPixelLength(line + words[i], textBlock.fontSize, textBlock.fontWidthToHeightRatio)\n : getPreciseStringLengthPx(line + words[i], textBlock.fontFamily, textBlock.fontSize)\n\n if (textLengthPx < width || i === 0) {\n line += words[i]\n } else {\n lines.push(line.trim())\n line = words[i]\n }\n\n // Word break functionality\n const minCharactersOnLine = 2\n if (wordBreak) {\n while (line.trim().length > minCharactersOnLine) {\n const subLineLengthPx = fastMode\n ? estimateStringPixelLength(line, textBlock.fontSize, textBlock.fontWidthToHeightRatio)\n : getPreciseStringLengthPx(line, textBlock.fontFamily, textBlock.fontSize)\n\n if (subLineLengthPx > width) {\n let breakIndex = (line.trim()).length - minCharactersOnLine // Place at least `minCharactersOnLine` characters onto the next line\n while (breakIndex > 0) {\n const subLine = `${line.substring(0, breakIndex)}${UNOVIS_TEXT_HYPHEN_CHARACTER_DEFAULT}` // Use hyphen when force breaking words\n const subLinePx = fastMode\n ? estimateStringPixelLength(subLine, textBlock.fontSize, textBlock.fontWidthToHeightRatio)\n : getPreciseStringLengthPx(subLine, textBlock.fontFamily, textBlock.fontSize)\n\n // If the subline is less than the width, or just one character left, break the line\n if (subLinePx <= width || breakIndex === 1) {\n lines.push(subLine.trim())\n line = line.substring(breakIndex)\n break\n }\n breakIndex--\n }\n } else {\n break\n }\n }\n }\n }\n\n // Adding the final line after the loop\n if (line) lines.push(line.trim())\n\n return lines\n }).flat()\n}\n\n/**\n * Wraps a text or array of texts to fit within specified width and height, if provided.\n *\n * @export\n * @param {UnovisText | UnovisText[]} text - The text or array of texts to wrap.\n * @param {number | undefined} [width=undefined] - The maximum width of a line in pixels.\n * @param {boolean} [fastMode=true] - Whether to use a fast estimation method or a more accurate one.\n * @param {string | string[]} [separator] - The word separators.\n * @returns {UnovisWrappedText[]} - The wrapped texts.\n */\nexport function getWrappedText (\n text: UnovisText | UnovisText[],\n width: number | undefined = undefined,\n height: number | undefined = undefined,\n fastMode = true,\n separator: string | string[] = UNOVIS_TEXT_SEPARATOR_DEFAULT,\n wordBreak = false\n): UnovisWrappedText[] {\n // Merge input text with default values and convert it to an array if it's not already\n const textArrays = Array.isArray(text) ? text.map(t => merge(UNOVIS_TEXT_DEFAULT, t)) : [merge(UNOVIS_TEXT_DEFAULT, text)]\n\n // Break input text into lines based on width and separator\n const textWrapped: Array<string[]> = textArrays.map(block => breakTextIntoLines(block, width, fastMode, separator, wordBreak))\n\n const firstBlock = textArrays[0]\n let h = -firstBlock.fontSize * (firstBlock.lineHeight - 1)\n const blocks: UnovisWrappedText[] = []\n\n // Process each text block and its lines based on height limit\n textArrays.forEach((text, i) => {\n let lines = textWrapped[i]\n\n const prevBlock = i > 0 ? blocks[i - 1] : undefined\n const prevBlockMarginBottomPx = prevBlock ? prevBlock.marginBottom : 0\n const marginTopPx = text.marginTop\n const effectiveMarginPx = Math.max(prevBlockMarginBottomPx, marginTopPx)\n\n h += effectiveMarginPx\n const dh = text.fontSize * text.lineHeight\n // Iterate over lines and handle text overflow based on the height limit if provided\n for (let k = 0; k < lines.length; k += 1) {\n let line = lines[k]\n h += dh\n\n if (height && (h + dh) > height && (k !== lines.length - 1)) {\n // Remove hyphen character from the end of the line if it's there\n const lastCharacter = line.charAt(line.length - 1)\n if (lastCharacter === UNOVIS_TEXT_HYPHEN_CHARACTER_DEFAULT) {\n line = line.substr(0, lines[k].length - 1)\n }\n\n const lineWithEllipsis = `${line} …`\n const textLengthPx = fastMode\n ? estimateStringPixelLength(lineWithEllipsis, text.fontSize, text.fontWidthToHeightRatio)\n : getPreciseStringLengthPx(lineWithEllipsis, text.fontFamily, text.fontSize)\n\n if (textLengthPx < width) {\n lines[k] = lineWithEllipsis\n } else {\n lines[k] = `${lines[k].substr(0, lines[k].length - 2)}…`\n }\n\n lines = lines.slice(0, k + 1)\n break\n }\n }\n\n // Create wrapped text block with its calculated properties\n blocks.push({ ...text, _lines: lines, _estimatedHeight: h - (prevBlock?._estimatedHeight || 0) })\n })\n\n return blocks\n}\n\n\n/**\n * Renders a text or array of texts to SVG tspan strings.\n *\n * @param {UnovisWrappedText[]} blocks - The wrapped text blocks.\n * @param {number} [x=0] - The x-coordinate for the tspan elements.\n * @param {number} [y] - The y-coordinate for the tspan elements.\n * @returns {string[]} - The SVG tspan strings.\n */\nfunction renderTextToTspanStrings (blocks: UnovisWrappedText[], x = 0, y?: number): string[] {\n return blocks.map((b, i) => {\n const prevBlock = i > 0 ? blocks[i - 1] : undefined\n const prevBlockMarginBottomEm = prevBlock ? prevBlock.marginBottom / prevBlock.fontSize : 0\n const marginTopEm = b.marginTop / b.fontSize\n const marginEm = Math.max(prevBlockMarginBottomEm, marginTopEm)\n const attributes = {\n fontSize: b.fontSize,\n fontFamily: b.fontFamily,\n fontWeight: b.fontWeight,\n fill: b.color,\n y: (i === 0) && y,\n }\n\n const attributesString = Object.entries(attributes)\n .filter(([_, value]) => value)\n .map(([key, value]) => `${kebabCase(key)}=\"${escapeStringKeepHash(value.toString())}\"`)\n .join(' ')\n\n return `<tspan xmlns=\"http://www.w3.org/2000/svg\" ${attributesString}>${b._lines.map((line, k) => {\n let dy: number\n if (i === 0 && k === 0) dy = 0.8 + marginEm\n else if (k === 0) dy = marginEm + b.lineHeight\n else dy = b.lineHeight\n\n return `<tspan x=\"${x}\" dy=\"${dy}em\">${line.length ? line : ' '}</tspan>`\n }).join('')}</tspan>`\n })\n}\n\n/**\n * Estimates the height of wrapped text blocks.\n *\n * @export\n * @param {UnovisWrappedText[]} blocks - The wrapped text blocks.\n * @returns {number} - The estimated height of the wrapped text blocks.\n */\nexport function estimateWrappedTextHeight (blocks: UnovisWrappedText[]): number {\n return sum(blocks, b => b._estimatedHeight)\n}\n\nexport const allowedSvgTextTags = ['text', 'tspan', 'textPath', 'altGlyph', 'altGlyphDef', 'altGlyphItem', 'glyphRef', 'textRef', 'textArea']\n/**\n * Renders a text or array of texts to an SVG text element.\n * Calling this function will replace the contents of the specified SVG text element.\n *\n * @export\n * @param {SVGTextElement} textElement - The SVG text element to render the text into.\n * @param {UnovisText | UnovisText[]} text - The text or array of texts to render.\n * @param {UnovisTextOptions} options - The text options.\n */\nexport function renderTextToSvgTextElement (\n textElement: SVGTextElement,\n text: UnovisText | UnovisText[],\n options: UnovisTextOptions\n): void {\n const wrappedText = getWrappedText(text, options.width, undefined, options.fastMode, options.separator, options.wordBreak)\n const textElementX = options.x ?? +textElement.getAttribute('x')\n const textElementY = options.y ?? +textElement.getAttribute('y')\n const x = textElementX ?? 0\n let y = textElementY ?? 0\n if (options.textAlign) textElement.setAttribute('text-anchor', getTextAnchorFromTextAlign(options.textAlign))\n if (options.verticalAlign && options.verticalAlign !== VerticalAlign.Top) {\n const height = estimateWrappedTextHeight(wrappedText)\n const dy = options.verticalAlign === VerticalAlign.Middle ? -height / 2\n : options.verticalAlign === VerticalAlign.Bottom ? -height : 0\n\n y += dy\n }\n\n const parser = new DOMParser()\n textElement.textContent = ''\n wrappedText.forEach(block => {\n const svgCode = renderTextToTspanStrings([block], x, y).join('')\n const svgCodeSanitized = striptags(svgCode, allowedSvgTextTags)\n const parsedSvgCode = parser.parseFromString(svgCodeSanitized, 'image/svg+xml').firstChild\n textElement.appendChild(parsedSvgCode)\n })\n}\n\n/**\n * Renders a text or array of texts into a frame.\n * Calling this function will replace the contents of the specified SVG group.\n *\n * @export\n * @param {SVGGElement} group - The SVG group element to render the text into.\n * @param {UnovisText | UnovisText[]} text - The text or array of texts to render.\n * @param {UnovisTextFrameOptions} frameOptions - The text frame options.\n */\nexport function renderTextIntoFrame (\n group: SVGGElement,\n text: UnovisText | UnovisText[],\n frameOptions: UnovisTextFrameOptions\n): void {\n const wrappedText = getWrappedText(text, frameOptions.width, frameOptions.height, frameOptions.fastMode, frameOptions.separator, frameOptions.wordBreak)\n\n const x = frameOptions.textAlign === TextAlign.Center ? frameOptions.width / 2\n : frameOptions.textAlign === TextAlign.Right ? frameOptions.width : 0\n\n let y = 0\n const height = estimateWrappedTextHeight(wrappedText)\n\n // If the frame has height, the text will be vertically aligned within the frame.\n // If not, the text will be aligned against the `y` position of the frame.\n const dh = frameOptions.height - height\n y = frameOptions.verticalAlign === VerticalAlign.Middle ? dh / 2\n : frameOptions.verticalAlign === VerticalAlign.Bottom ? dh : 0\n\n\n const translate = (frameOptions.x || frameOptions.y)\n ? `transform=\"translate(${frameOptions.x ?? 0},${frameOptions.y ?? 0})\"`\n : ''\n\n const svgCode =\n `<text\n xmlns=\"http://www.w3.org/2000/svg\"\n text-anchor=\"${getTextAnchorFromTextAlign(frameOptions.textAlign)}\"\n ${translate}\n >\n ${renderTextToTspanStrings(wrappedText, x, y).join('')}\n </text>`\n\n const parser = new DOMParser()\n const svgCodeSanitized = striptags(svgCode, allowedSvgTextTags)\n const parsedSvgCode = parser.parseFromString(svgCodeSanitized, 'image/svg+xml').firstChild\n\n group.textContent = ''\n group.appendChild(parsedSvgCode)\n}\n"],"names":[],"mappings":";;;;;;;AAcA;;;;;AAKG;AACG,SAAU,gBAAgB,CAAE,GAAW,EAAA;AAC3C,IAAA,OAAO,GAAG,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC,WAAW,EAAE,CAAC,CAAA;AACtE,CAAC;AAED;;;;AAIG;AACG,SAAU,SAAS,CAAE,GAAW,EAAA;;IACpC,OAAO,CAAA,EAAA,GAAA,GAAG,CAAC,KAAK,CAAC,8DAA8D,CAAC,MAC5E,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,MAAM,CAAC,OAAO,CACf,CAAA,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAA,CACxB,IAAI,CAAC,GAAG,CAAC,CAAA;AACd,CAAC;AAEK,SAAU,oBAAoB,CAAE,GAAW,EAAA;AAC/C,IAAA,OAAO,GAAG;AACP,SAAA,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC;;AAEzB,SAAA,OAAO,CAAC,SAAS,EAAE,KAAK,CAAC;AACzB,SAAA,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;AACrB,SAAA,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;AACrB,SAAA,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;AACrB,SAAA,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;AACrB,SAAA,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;AAC1B,CAAC;AAED;;;;;AAKG;AACG,SAAU,eAAe,CAAE,GAAG,GAAG,EAAE,EAAE,SAAS,GAAG,EAAE,EAAA;IACvD,OAAO,GAAG,CAAC,MAA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AClC;;;;"}
1
+ {"version":3,"file":"text.js","sources":["../../src/utils/text.ts"],"sourcesContent":["import { Selection } from 'd3-selection'\nimport { sum } from 'd3-array'\nimport striptags from 'striptags'\n\n// Types\nimport { TextAlign, TrimMode, UnovisText, UnovisTextFrameOptions, UnovisTextOptions, UnovisWrappedText, VerticalAlign } from 'types/text'\n\n// Utils\nimport { flatten, isArray, merge } from 'utils/data'\nimport { getTextAnchorFromTextAlign } from 'types/svg'\n\n// Styles\nimport { getFontWidthToHeightRatio, UNOVIS_TEXT_DEFAULT, UNOVIS_TEXT_SEPARATOR_DEFAULT, UNOVIS_TEXT_HYPHEN_CHARACTER_DEFAULT } from 'styles/index'\n\n/**\n * Converts a kebab-case string to camelCase.\n *\n * @param {string} str - The kebab-case string to be converted.\n * @returns {string} The resulting camelCase string.\n */\nexport function kebabCaseToCamel (str: string): string {\n return str.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase())\n}\n\n/**\n * Converts a given string to kebab-case.\n * @param {string} str - The input string to be converted to kebab-case.\n * @returns {string} - The kebab-cased string.\n */\nexport function kebabCase (str: string): string {\n return str.match(/[A-Z]{2,}(?=[A-Z][a-z0-9]*|\\b)|[A-Z]?[a-z0-9]*|[A-Z]|[0-9]+/g)\n ?.filter(Boolean)\n .map(x => x.toLowerCase())\n .join('-')\n}\n\nexport function escapeStringKeepHash (str: string): string {\n return str\n .replace(/['\"]/g, '&#39;') // Escapes quotes with &#39;\n // eslint-disable-next-line no-control-regex\n .replace(/\\u0000/g, '\\\\0') // Escapes null characters\n .replace(/\\n/g, '\\\\n') // Escapes new lines\n .replace(/\\r/g, '\\\\r') // Escapes carriage returns\n .replace(/\\v/g, '\\\\v') // Escapes vertical tabs\n .replace(/\\t/g, '\\\\t') // Escapes horizontal tabs\n .replace(/\\f/g, '\\\\f') // Escapes form feeds\n}\n\n/**\n * Trims the input string from the start, leaving only the specified maximum length.\n * @param {string} [str=''] - The input string to be trimmed.\n * @param {number} [maxLength=15] - The maximum allowed length of the trimmed string.\n * @returns {string} - The trimmed string.\n */\nexport function trimStringStart (str = '', maxLength = 15): string {\n return str.length > maxLength ? `…${str.substr(str.length - maxLength, maxLength)}` : str\n}\n\n/**\n * Trims the input string from the middle, leaving only the specified maximum length.\n * @param {string} [str=''] - The input string to be trimmed.\n * @param {number} [maxLength=15] - The maximum allowed length of the trimmed string.\n * @returns {string} - The trimmed string.\n */\nexport function trimStringMiddle (str = '', maxLength = 15): string {\n const dist = Math.floor((maxLength - 3) / 2)\n return str.length > maxLength ? `${str.substr(0, dist)}…${str.substr(-dist, dist)}` : str\n}\n\n/**\n * Trims the input string from the end, leaving only the specified maximum length.\n * @param {string} [str=''] - The input string to be trimmed.\n * @param {number} [maxLength=15] - The maximum allowed length of the trimmed string.\n * @returns {string} - The trimmed string.\n */\nexport function trimStringEnd (str = '', maxLength = 15): string {\n return str.length > maxLength ? `${str.substr(0, maxLength)}…` : str\n}\n\n/**\n * Trims the input string according to the specified trim mode.\n * @param {string} [str=''] - The input string to be trimmed.\n * @param {number} [length=15] - The maximum allowed length of the trimmed string.\n * @param {TrimMode} [type=TrimMode.Middle] - The trim mode to be applied.\n * @returns {string} - The trimmed string.\n */\nexport function trimString (str = '', length = 15, type = TrimMode.Middle): string {\n let result = trimStringEnd(str, length)\n if (type === TrimMode.Start) result = trimStringStart(str, length)\n else if (type === TrimMode.Middle) result = trimStringMiddle(str, length)\n return result\n}\n\n/**\n * Splits the input string according to the specified separators.\n * @param {string} text - The input string to be split.\n * @param {string[]} [separators=[' ']] - The array of separators to be used for splitting.\n * @returns {string[]} - The array of split words.\n */\nexport function splitString (text: string, separators = [' ']): string[] {\n let result = [text] as Array<string | string[]>\n for (let i = 0; i < separators.length; i++) {\n const sep = separators[i]\n result.forEach((d, index) => {\n const separated = (d as string).split(sep)\n const words = separated.map((word, j) => `${word}${j === separated.length - 1 ? '' : sep}`)\n result[index] = words\n })\n result = flatten(result)\n }\n\n return result as string[]\n}\n\n/**\n * Wraps an SVG text element to fit within the specified width.\n * @param {Selection<SVGTextElement, any, SVGElement, any>} textElement - The SVG text element to be wrapped.\n * @param {number} width - The maximum allowed width for the text element.\n * @param {(string | string[])} [separator=[' ', '-', '.', ',']] - The separator(s) to be used for wrapping.\n */\nexport function wrapSVGText (\n textElement: Selection<SVGTextElement, any, SVGElement, any>,\n width: number,\n separator: string | string[] = [' ', '-', '.', ',']\n): void {\n const text = textElement.text()\n if (!text) return\n\n // Wrap\n const separators = (isArray(separator) ? separator : [separator]) as string[]\n const words = splitString(text, separators)\n const x = parseFloat(textElement.attr('x')) || 0\n\n textElement.text('')\n let tspan = textElement.append('tspan').attr('x', x)\n let tspanContent = `${words[0]}`\n tspan.text(tspanContent)\n\n words.forEach((word, i) => {\n if (i === 0) return\n\n const tspanText = `${tspanContent}${word}`\n tspan.text(tspanText)\n const tspanWidth = tspan.node().getComputedTextLength()\n if (tspanWidth > width) {\n tspan.text(tspanContent.trim())\n\n tspan = textElement.append('tspan')\n .attr('x', x)\n .attr('dy', '1.2em')\n .text(word)\n\n tspanContent = word\n } else tspanContent += word\n })\n}\n\n/**\n * Trims an SVG text element based on the specified max width, trim type, and other options.\n * @param {Selection<SVGTextElement, any, SVGElement, any>} svgTextSelection - The D3 selection of the SVG text element to be trimmed.\n * @param {number} [maxWidth=50] - The maximum width of the text element.\n * @param {TrimMode} [trimType=TrimMode.Middle] - The type of trim (start, middle, or end).\n * @param {boolean} [fastMode=true] - Whether to use a fast estimation method for text length calculation.\n * @param {number} [fontSize=0] - The font size of the text.\n * @param {number} [fontWidthToHeightRatio=getFontWidthToHeightRatio()] - The font width to height ratio.\n * @returns {boolean} True if the text was trimmed, false otherwise.\n */\nexport function trimSVGText (\n svgTextSelection: Selection<SVGTextElement, any, SVGElement, any>,\n maxWidth = 50,\n trimType = TrimMode.Middle,\n fastMode = true,\n fontSize = +window.getComputedStyle(svgTextSelection.node())?.fontSize || 0,\n fontWidthToHeightRatio = getFontWidthToHeightRatio()\n): boolean {\n const text = svgTextSelection.text()\n const textLength = text.length\n\n const textWidth = fastMode ? fontSize * textLength * fontWidthToHeightRatio : svgTextSelection.node().getComputedTextLength()\n const tolerance = 1.1\n const maxCharacters = Math.ceil(textLength * maxWidth / (tolerance * textWidth))\n if (maxCharacters < textLength) {\n svgTextSelection.text(trimString(text, maxCharacters, trimType))\n return true\n }\n\n return false\n}\n\n/**\n * Estimates the length of a string in pixels.\n * @param {string} str - The string to be measured.\n * @param {number} fontSize - The font size of the string.\n * @param {number} [fontWidthToHeightRatio=getFontWidthToHeightRatio()] - The font width to height ratio.\n * @returns {number} The estimated length of the string in pixels.\n */\nexport function estimateStringPixelLength (\n str: string,\n fontSize: number,\n fontWidthToHeightRatio = getFontWidthToHeightRatio()\n): number {\n return str.length * fontSize * fontWidthToHeightRatio || 0\n}\n\n/**\n * Calculates the precise length of a string in pixels.\n * @param {string} str - The string to be measured.\n * @param {string} [fontFamily] - The font family of the string.\n * @param {(string | number)} [fontSize] - The font size of the string.\n * @returns {number} The precise length of the string in pixels.\n */\nexport function getPreciseStringLengthPx (str: string, fontFamily?: string, fontSize?: string | number): number {\n const svgNS = 'http://www.w3.org/2000/svg'\n const svg = document.createElementNS(svgNS, 'svg')\n const text = document.createElementNS(svgNS, 'text')\n\n text.textContent = str\n text.setAttribute('font-size', `${fontSize}`)\n text.setAttribute('font-family', fontFamily)\n\n svg.appendChild(text)\n document.body.appendChild(svg)\n const length = text.getComputedTextLength()\n document.body.removeChild(svg)\n\n return length\n}\n\n/**\n * Estimates the dimensions of an SVG text element.\n *\n * @export\n * @param {Selection<SVGTextElement, any, SVGElement, any>} svgTextSelection - The D3 selection of the SVG text element.\n * @param {number} fontSize - The font size.\n * @param {number} [dy=0.32] - The line height scaling factor.\n * @param {boolean} [fastMode=true] - Whether to use a fast estimation method or a more accurate one.\n * @param {number} [fontWidthToHeightRatio] - The font width-to-height ratio.\n * @returns {{width: number, height: number}} - The estimated dimensions of the text element.\n */\nexport function estimateTextSize (\n svgTextSelection: Selection<SVGTextElement, any, SVGElement, any>,\n fontSize: number,\n dy = 0.32,\n fastMode = true,\n fontWidthToHeightRatio?: number\n): { width: number; height: number } {\n fontWidthToHeightRatio = fontWidthToHeightRatio || getFontWidthToHeightRatio()\n const tspanSelection = svgTextSelection.selectAll('tspan')\n\n const lines = tspanSelection.size() || 1\n const height = svgTextSelection.text() ? 0.85 * fontSize * lines * (1 + dy) - dy : 0\n\n let width = 0\n if (tspanSelection.empty()) {\n const textLength = svgTextSelection.text().length\n width = fastMode ? fontSize * textLength * fontWidthToHeightRatio : svgTextSelection.node().getComputedTextLength()\n } else {\n for (const tspan of tspanSelection.nodes()) {\n const tspanTextLength = (tspan as SVGTSpanElement).textContent.length\n const w = fastMode ? fontSize * tspanTextLength * fontWidthToHeightRatio : (tspan as SVGTSpanElement).getComputedTextLength()\n if (w > width) width = w\n }\n }\n\n return { width, height }\n}\n\n/**\n * Breaks a text block into lines based on the specified width.\n *\n * @param {UnovisText} textBlock - The text block to break into lines.\n * @param {number | undefined} [width=undefined] - The maximum width of a line in pixels.\n * @param {(number | undefined)} [height=undefined] - The height limit for the wrapped text in pixels.\n * @param {boolean} [fastMode=true] - Whether to use a fast estimation method or a more accurate one.\n * @param {string | string[]} [separator] - The word separators.\n * @returns {string[]} - The text split into lines.\n */\nfunction breakTextIntoLines (\n textBlock: UnovisText,\n width: number | undefined = undefined,\n fastMode = true,\n separator: string | string[] = UNOVIS_TEXT_SEPARATOR_DEFAULT,\n wordBreak = false\n): string[] {\n const text = `${textBlock.text}`\n if (!text) return []\n const separators = Array.isArray(separator) ? separator : [separator]\n\n const splitByNewLine = text.split('\\n')\n return splitByNewLine.map((str) => {\n const lines: string[] = []\n if (!width) return [str]\n\n const words = splitString(str, separators)\n let line = ''\n for (let i = 0; i < words.length; i += 1) {\n const textLengthPx = fastMode\n ? estimateStringPixelLength(line + words[i], textBlock.fontSize, textBlock.fontWidthToHeightRatio)\n : getPreciseStringLengthPx(line + words[i], textBlock.fontFamily, textBlock.fontSize)\n\n if (textLengthPx < width || i === 0) {\n line += words[i]\n } else {\n lines.push(line.trim())\n line = words[i]\n }\n\n // Word break functionality\n const minCharactersOnLine = 2\n if (wordBreak) {\n while (line.trim().length > minCharactersOnLine) {\n const subLineLengthPx = fastMode\n ? estimateStringPixelLength(line, textBlock.fontSize, textBlock.fontWidthToHeightRatio)\n : getPreciseStringLengthPx(line, textBlock.fontFamily, textBlock.fontSize)\n\n if (subLineLengthPx > width) {\n let breakIndex = (line.trim()).length - minCharactersOnLine // Place at least `minCharactersOnLine` characters onto the next line\n while (breakIndex > 0) {\n const subLine = `${line.substring(0, breakIndex)}${UNOVIS_TEXT_HYPHEN_CHARACTER_DEFAULT}` // Use hyphen when force breaking words\n const subLinePx = fastMode\n ? estimateStringPixelLength(subLine, textBlock.fontSize, textBlock.fontWidthToHeightRatio)\n : getPreciseStringLengthPx(subLine, textBlock.fontFamily, textBlock.fontSize)\n\n // If the subline is less than the width, or just one character left, break the line\n if (subLinePx <= width || breakIndex === 1) {\n lines.push(subLine.trim())\n line = line.substring(breakIndex)\n break\n }\n breakIndex--\n }\n } else {\n break\n }\n }\n }\n }\n\n // Adding the final line after the loop\n if (line) lines.push(line.trim())\n\n return lines\n }).flat()\n}\n\n/**\n * Wraps a text or array of texts to fit within specified width and height, if provided.\n *\n * @export\n * @param {UnovisText | UnovisText[]} text - The text or array of texts to wrap.\n * @param {number | undefined} [width=undefined] - The maximum width of a line in pixels.\n * @param {boolean} [fastMode=true] - Whether to use a fast estimation method or a more accurate one.\n * @param {string | string[]} [separator] - The word separators.\n * @returns {UnovisWrappedText[]} - The wrapped texts.\n */\nexport function getWrappedText (\n text: UnovisText | UnovisText[],\n width: number | undefined = undefined,\n height: number | undefined = undefined,\n fastMode = true,\n separator: string | string[] = UNOVIS_TEXT_SEPARATOR_DEFAULT,\n wordBreak = false\n): UnovisWrappedText[] {\n // Merge input text with default values and convert it to an array if it's not already\n const textArrays = Array.isArray(text) ? text.map(t => merge(UNOVIS_TEXT_DEFAULT, t)) : [merge(UNOVIS_TEXT_DEFAULT, text)]\n\n // Break input text into lines based on width and separator\n const textWrapped: Array<string[]> = textArrays.map(block => breakTextIntoLines(block, width, fastMode, separator, wordBreak))\n\n const firstBlock = textArrays[0]\n let h = -firstBlock.fontSize * (firstBlock.lineHeight - 1)\n const blocks: UnovisWrappedText[] = []\n\n // Process each text block and its lines based on height limit\n textArrays.forEach((text, i) => {\n let lines = textWrapped[i]\n\n const prevBlock = i > 0 ? blocks[i - 1] : undefined\n const prevBlockMarginBottomPx = prevBlock ? prevBlock.marginBottom : 0\n const marginTopPx = text.marginTop\n const effectiveMarginPx = Math.max(prevBlockMarginBottomPx, marginTopPx)\n\n h += effectiveMarginPx\n const dh = text.fontSize * text.lineHeight\n // Iterate over lines and handle text overflow based on the height limit if provided\n for (let k = 0; k < lines.length; k += 1) {\n let line = lines[k]\n h += dh\n\n if (height && (h + dh) > height && (k !== lines.length - 1)) {\n // Remove hyphen character from the end of the line if it's there\n const lastCharacter = line.charAt(line.length - 1)\n if (lastCharacter === UNOVIS_TEXT_HYPHEN_CHARACTER_DEFAULT) {\n line = line.substr(0, lines[k].length - 1)\n }\n\n const lineWithEllipsis = `${line} …`\n const textLengthPx = fastMode\n ? estimateStringPixelLength(lineWithEllipsis, text.fontSize, text.fontWidthToHeightRatio)\n : getPreciseStringLengthPx(lineWithEllipsis, text.fontFamily, text.fontSize)\n\n if (textLengthPx < width) {\n lines[k] = lineWithEllipsis\n } else {\n lines[k] = `${lines[k].substr(0, lines[k].length - 2)}…`\n }\n\n lines = lines.slice(0, k + 1)\n break\n }\n }\n\n // Create wrapped text block with its calculated properties\n blocks.push({ ...text, _lines: lines, _estimatedHeight: h - (prevBlock?._estimatedHeight || 0) })\n })\n\n return blocks\n}\n\n\n/**\n * Renders a text or array of texts to SVG tspan strings.\n *\n * @param {UnovisWrappedText[]} blocks - The wrapped text blocks.\n * @param {number} [x=0] - The x-coordinate for the tspan elements.\n * @param {number} [y] - The y-coordinate for the tspan elements.\n * @returns {string[]} - The SVG tspan strings.\n */\nfunction renderTextToTspanStrings (blocks: UnovisWrappedText[], x = 0, y?: number): string[] {\n return blocks.map((b, i) => {\n const prevBlock = i > 0 ? blocks[i - 1] : undefined\n const prevBlockMarginBottomEm = prevBlock ? prevBlock.marginBottom / prevBlock.fontSize : 0\n const marginTopEm = b.marginTop / b.fontSize\n const marginEm = Math.max(prevBlockMarginBottomEm, marginTopEm)\n const attributes = {\n fontSize: b.fontSize,\n fontFamily: b.fontFamily,\n fontWeight: b.fontWeight,\n fill: b.color,\n y: (i === 0) && y,\n }\n\n const attributesString = Object.entries(attributes)\n .filter(([_, value]) => value)\n .map(([key, value]) => `${kebabCase(key)}=\"${escapeStringKeepHash(value.toString())}\"`)\n .join(' ')\n\n return `<tspan xmlns=\"http://www.w3.org/2000/svg\" ${attributesString}>${b._lines.map((line, k) => {\n let dy: number\n if (i === 0 && k === 0) dy = 0.8 + marginEm\n else if (k === 0) dy = marginEm + b.lineHeight\n else dy = b.lineHeight\n\n return `<tspan x=\"${x}\" dy=\"${dy}em\">${line.length ? line : ' '}</tspan>`\n }).join('')}</tspan>`\n })\n}\n\n/**\n * Estimates the height of wrapped text blocks.\n *\n * @export\n * @param {UnovisWrappedText[]} blocks - The wrapped text blocks.\n * @returns {number} - The estimated height of the wrapped text blocks.\n */\nexport function estimateWrappedTextHeight (blocks: UnovisWrappedText[]): number {\n return sum(blocks, b => b._estimatedHeight)\n}\n\nexport const allowedSvgTextTags = ['text', 'tspan', 'textPath', 'altGlyph', 'altGlyphDef', 'altGlyphItem', 'glyphRef', 'textRef', 'textArea']\n\n/**\n * Renders a text or array of texts to an SVG text element.\n * Calling this function will replace the contents of the specified SVG text element.\n *\n * @export\n * @param {SVGTextElement} textElement - The SVG text element to render the text into.\n * @param {UnovisText | UnovisText[]} text - The text or array of texts to render.\n * @param {UnovisTextOptions} options - The text options.\n */\nexport function renderTextToSvgTextElement (\n textElement: SVGTextElement,\n text: UnovisText | UnovisText[],\n options: UnovisTextOptions\n): void {\n const wrappedText = getWrappedText(text, options.width, undefined, options.fastMode, options.separator, options.wordBreak)\n const textElementX = options.x ?? +textElement.getAttribute('x')\n const textElementY = options.y ?? +textElement.getAttribute('y')\n const x = textElementX ?? 0\n let y = textElementY ?? 0\n if (options.textAlign) textElement.setAttribute('text-anchor', getTextAnchorFromTextAlign(options.textAlign))\n if (options.verticalAlign && options.verticalAlign !== VerticalAlign.Top) {\n const height = estimateWrappedTextHeight(wrappedText)\n const dy = options.verticalAlign === VerticalAlign.Middle ? -height / 2\n : options.verticalAlign === VerticalAlign.Bottom ? -height : 0\n\n y += dy\n }\n\n const parser = new DOMParser()\n textElement.textContent = ''\n wrappedText.forEach(block => {\n const svgCode = renderTextToTspanStrings([block], x, y).join('')\n const svgCodeSanitized = striptags(svgCode, allowedSvgTextTags)\n const parsedSvgCode = parser.parseFromString(svgCodeSanitized, 'image/svg+xml').firstChild\n textElement.appendChild(parsedSvgCode)\n })\n}\n\n/**\n * Renders a text or array of texts into a frame.\n * Calling this function will replace the contents of the specified SVG group.\n *\n * @export\n * @param {SVGGElement} group - The SVG group element to render the text into.\n * @param {UnovisText | UnovisText[]} text - The text or array of texts to render.\n * @param {UnovisTextFrameOptions} frameOptions - The text frame options.\n */\nexport function renderTextIntoFrame (\n group: SVGGElement,\n text: UnovisText | UnovisText[],\n frameOptions: UnovisTextFrameOptions\n): void {\n const wrappedText = getWrappedText(text, frameOptions.width, frameOptions.height, frameOptions.fastMode, frameOptions.separator, frameOptions.wordBreak)\n\n const x = frameOptions.textAlign === TextAlign.Center ? frameOptions.width / 2\n : frameOptions.textAlign === TextAlign.Right ? frameOptions.width : 0\n\n let y = 0\n const height = estimateWrappedTextHeight(wrappedText)\n\n // If the frame has height, the text will be vertically aligned within the frame.\n // If not, the text will be aligned against the `y` position of the frame.\n const dh = frameOptions.height - height\n y = frameOptions.verticalAlign === VerticalAlign.Middle ? dh / 2\n : frameOptions.verticalAlign === VerticalAlign.Bottom ? dh : 0\n\n\n const translate = (frameOptions.x || frameOptions.y)\n ? `transform=\"translate(${frameOptions.x ?? 0},${frameOptions.y ?? 0})\"`\n : ''\n\n const svgCode =\n `<text\n xmlns=\"http://www.w3.org/2000/svg\"\n text-anchor=\"${getTextAnchorFromTextAlign(frameOptions.textAlign)}\"\n ${translate}\n >\n ${renderTextToTspanStrings(wrappedText, x, y).join('')}\n </text>`\n\n const parser = new DOMParser()\n const svgCodeSanitized = striptags(svgCode, allowedSvgTextTags)\n const parsedSvgCode = parser.parseFromString(svgCodeSanitized, 'image/svg+xml').firstChild\n\n group.textContent = ''\n group.appendChild(parsedSvgCode)\n}\n"],"names":[],"mappings":";;;;;;;AAcA;;;;;AAKG;AACG,SAAU,gBAAgB,CAAE,GAAW,EAAA;AAC3C,IAAA,OAAO,GAAG,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC,WAAW,EAAE,CAAC,CAAA;AACtE,CAAC;AAED;;;;AAIG;AACG,SAAU,SAAS,CAAE,GAAW,EAAA;;IACpC,OAAO,CAAA,EAAA,GAAA,GAAG,CAAC,KAAK,CAAC,8DAA8D,CAAC,MAC5E,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,MAAM,CAAC,OAAO,CACf,CAAA,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAA,CACxB,IAAI,CAAC,GAAG,CAAC,CAAA;AACd,CAAC;AAEK,SAAU,oBAAoB,CAAE,GAAW,EAAA;AAC/C,IAAA,OAAO,GAAG;AACP,SAAA,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC;;AAEzB,SAAA,OAAO,CAAC,SAAS,EAAE,KAAK,CAAC;AACzB,SAAA,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;AACrB,SAAA,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;AACrB,SAAA,OAAO,CAAC,KAAK,EAA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