@unovis/ts 1.4.2-beta.0 → 1.4.3-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/axis/config.d.ts +2 -0
- package/components/axis/config.js.map +1 -1
- package/components/axis/index.js +15 -15
- package/components/axis/index.js.map +1 -1
- package/components/brush/index.js +4 -4
- package/components/brush/index.js.map +1 -1
- package/components/brush/style.d.ts +44 -1
- package/components/brush/style.js +39 -32
- package/components/brush/style.js.map +1 -1
- package/components/graph/config.d.ts +1 -4
- package/components/graph/config.js.map +1 -1
- package/components/graph/index.d.ts +1 -1
- package/components/graph/index.js +22 -2
- package/components/graph/index.js.map +1 -1
- package/components/graph/modules/layout.js +20 -8
- package/components/graph/modules/layout.js.map +1 -1
- package/components/scatter/index.d.ts +1 -0
- package/components/scatter/index.js +19 -12
- package/components/scatter/index.js.map +1 -1
- package/components/scatter/modules/point.js +1 -3
- package/components/scatter/modules/point.js.map +1 -1
- package/components/scatter/types.d.ts +2 -0
- package/containers/single-container/index.js +1 -0
- package/containers/single-container/index.js.map +1 -1
- package/containers/xy-container/index.js +2 -0
- package/containers/xy-container/index.js.map +1 -1
- package/core/container/index.d.ts +1 -0
- package/core/container/index.js +5 -4
- package/core/container/index.js.map +1 -1
- package/package.json +1 -1
- package/types/graph.d.ts +2 -0
- package/types/text.d.ts +2 -0
- package/types/text.js.map +1 -1
- package/utils/text.d.ts +1 -1
- package/utils/text.js +27 -15
- package/utils/text.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/containers/xy-container/index.ts"],"sourcesContent":["import { css } from '@emotion/css'\nimport { extent, merge as mergeArrays } from 'd3-array'\nimport { Selection } from 'd3-selection'\n\n// Global CSS variables (side effects import)\nimport 'styles/index'\n\n// Core\nimport { ContainerCore } from 'core/container'\nimport { XYComponentCore } from 'core/xy-component'\nimport { XYComponentConfigInterface } from 'core/xy-component/config'\n\n// Data Model\nimport { CoreDataModel } from 'data-models/core'\n\n// Types\nimport { Spacing } from 'types/spacing'\nimport { AxisType } from 'components/axis/types'\nimport { ScaleDimension } from 'types/scale'\nimport { Direction } from 'types/direction'\n\n// Utils\nimport { clamp, clean, flatten } from 'utils/data'\nimport { guid } from 'utils/misc'\n\n// Config\nimport { XYContainerDefaultConfig, XYContainerConfigInterface } from './config'\nimport {\n AreaConfigInterface,\n BrushConfigInterface,\n LineConfigInterface,\n ScatterConfigInterface,\n StackedBarConfigInterface,\n TimelineConfigInterface,\n} from '../../components'\n\nexport type XYConfigInterface<Datum> = XYComponentConfigInterface<Datum>\n| StackedBarConfigInterface<Datum>\n| LineConfigInterface<Datum>\n| ScatterConfigInterface<Datum>\n| BrushConfigInterface<Datum>\n| TimelineConfigInterface<Datum>\n| AreaConfigInterface<Datum>\n\nexport class XYContainer<Datum> extends ContainerCore {\n protected _defaultConfig = XYContainerDefaultConfig as XYContainerConfigInterface<Datum>\n protected _svgDefs: Selection<SVGDefsElement, unknown, null, undefined>\n public datamodel: CoreDataModel<Datum[]> = new CoreDataModel()\n public config: XYContainerConfigInterface<Datum> = this._defaultConfig\n private _clipPath: Selection<SVGClipPathElement, unknown, null, undefined>\n private _clipPathId = guid()\n private _axisMargin: Spacing = { top: 0, bottom: 0, left: 0, right: 0 }\n private _firstRender = true\n\n constructor (element: HTMLElement, config?: XYContainerConfigInterface<Datum>, data?: Datum[]) {\n super(element)\n\n this._clipPath = this.svg.append('clipPath')\n .attr('id', this._clipPathId)\n this._clipPath.append('rect')\n\n // When the base tag is specified on the HTML head,\n // Safari fails to find the corresponding filter URL.\n // We have to provide tull url in order to fix that\n const highlightFilterId = 'saturate'\n const baseUrl = window.location.href.replace(window.location.hash, '')\n this.svg.attr('class', css`\n --highlight-filter-id: url(${baseUrl}#${highlightFilterId}); // defining a css variable\n `)\n\n this._svgDefs.append('filter')\n .attr('id', highlightFilterId)\n .attr('filterUnits', 'objectBoundingBox')\n .html('<feColorMatrix type=\"saturate\" in=\"SourceGraphic\" values=\"1.35\"/>')\n\n if (config) {\n this.updateContainer(config, true)\n }\n\n if (data) {\n this.setData(data, true)\n }\n\n // Render if there are axes or components with data\n if (\n this.config.xAxis ||\n this.config.yAxis ||\n this.components?.some(c => c.datamodel.data)\n ) {\n this.render()\n }\n\n // Force re-render axes when fonts are loaded\n (document as any).fonts?.ready.then(() => {\n if (!this._firstRender) this._renderAxes(0)\n })\n }\n\n get components (): XYComponentCore<Datum>[] {\n return this.config.components\n }\n\n // Overriding ContainerCore default get width method to work with axis auto margin\n get width (): number {\n const margin = this._getMargin()\n return clamp(this.containerWidth - margin.left - margin.right, 0, Number.POSITIVE_INFINITY)\n }\n\n // Overriding ContainerCore default get height method to work with axis auto margin\n get height (): number {\n const margin = this._getMargin()\n\n return clamp(this.containerHeight - margin.top - margin.bottom, 0, Number.POSITIVE_INFINITY)\n }\n\n public setData (data: Datum[], preventRender?: boolean): void {\n const { components, config } = this\n if (!data) return\n this.datamodel.data = data\n\n components.forEach((c) => {\n c.setData(data)\n })\n\n config.crosshair?.setData(data)\n config.xAxis?.setData(data)\n config.yAxis?.setData(data)\n config.tooltip?.hide()\n if (!preventRender) this.render()\n }\n\n public updateContainer (containerConfig: XYContainerConfigInterface<Datum>, preventRender?: boolean): void {\n super.updateContainer(containerConfig)\n this._removeAllChildren()\n\n // If there were any new components added we need to pass them data\n this.setData(this.datamodel.data, true)\n\n // Set up the axes\n if (containerConfig.xAxis) {\n this.config.xAxis.config.type = AxisType.X\n this.element.appendChild(containerConfig.xAxis.element)\n }\n if (containerConfig.yAxis) {\n this.config.yAxis.config.type = AxisType.Y\n this.element.appendChild(containerConfig.yAxis.element)\n }\n\n // Re-insert elements to the DOM\n for (const c of this.components) {\n this.element.appendChild(c.element)\n }\n\n // Set up the tooltip\n const tooltip = containerConfig.tooltip\n if (tooltip) {\n if (!tooltip.hasContainer()) tooltip.setContainer(this._container)\n tooltip.setComponents(this.components)\n }\n\n // Set up the crosshair\n const crosshair = containerConfig.crosshair\n if (crosshair) {\n crosshair.setContainer(this.svg)\n crosshair.tooltip = tooltip\n\n this.element.appendChild(crosshair.element)\n }\n\n // Set up annotations\n const annotations = containerConfig.annotations\n if (annotations) {\n this.element.appendChild(annotations.element)\n }\n\n // Clipping path\n this.element.appendChild(this._clipPath.node())\n\n // Defs\n this.element.appendChild(this._svgDefs.node())\n\n // Rendering\n if (!preventRender) this.render()\n }\n\n public updateComponents (componentConfigs: XYConfigInterface<Datum>[], preventRender?: boolean): void {\n const { config } = this\n\n this.components.forEach((c, i) => {\n const componentConfig = componentConfigs[i]\n if (componentConfig) {\n c.setConfig(componentConfigs[i])\n }\n })\n\n this._updateScales(...this.components, config.xAxis, config.yAxis, config.crosshair)\n if (!preventRender) this.render()\n }\n\n public update (containerConfig: XYContainerConfigInterface<Datum>, componentConfigs?: XYComponentConfigInterface<Datum>[], data?: Datum[]): void {\n if (data) this.datamodel.data = data // Just updating the data model because the `updateContainer` method has the `setData` step inside\n if (containerConfig) this.updateContainer(containerConfig, true)\n if (componentConfigs) this.updateComponents(componentConfigs, true)\n this.render()\n }\n\n protected _preRender (): void {\n const { config } = this\n super._preRender()\n\n // Calculate extra margin required to fit the axes\n if (config.autoMargin) {\n this._setAutoMargin()\n }\n\n // Pass size to the components\n const components = clean([...this.components, config.xAxis, config.yAxis, config.crosshair, config.annotations])\n for (const c of components) {\n c.setSize(this.width, this.height, this.containerWidth, this.containerHeight)\n }\n\n // Update Scales of all the components at once to calculate required paddings and sync them\n this._updateScales(...this.components, config.xAxis, config.yAxis, config.crosshair)\n }\n\n protected _render (customDuration?: number): void {\n const { config } = this\n super._render()\n\n // Get chart total margin after auto margin calculations\n const margin = this._getMargin()\n\n // Render components\n for (const c of this.components) {\n c.g.attr('transform', `translate(${margin.left},${margin.top})`)\n .style('clip-path', c.clippable ? `url(#${this._clipPathId})` : null)\n .style('-webkit-clip-path', c.clippable ? `url(#${this._clipPathId})` : null)\n\n c.render(customDuration)\n }\n\n this._renderAxes(this._firstRender ? 0 : customDuration)\n\n // Clip RectsetSize\n // Extending the clipping path to allow small overflow (e.g. Line will looks better that way when it touches the edges)\n const clipPathExtension = 2\n this._clipPath.select('rect')\n .attr('x', -clipPathExtension)\n .attr('y', -clipPathExtension)\n .attr('width', this.width + 2 * clipPathExtension)\n .attr('height', this.height + 2 * clipPathExtension)\n\n // Tooltip\n config.tooltip?.update() // Re-bind events\n\n // Crosshair\n const crosshair = config.crosshair\n if (crosshair) {\n // Pass accessors\n const yAccessors = this.components.filter(c => !c.stacked).map(c => c.config.y)\n const yStackedAccessors = this.components.filter(c => c.stacked).map(c => c.config.y)\n const baselineComponentConfig = this.components.find(c => (c.config as AreaConfigInterface<Datum>).baseline)?.config as AreaConfigInterface<Datum>\n const baselineAccessor = baselineComponentConfig?.baseline\n\n crosshair.accessors = {\n x: this.components[0]?.config.x,\n y: flatten(yAccessors),\n yStacked: flatten(yStackedAccessors),\n baseline: baselineAccessor,\n }\n\n crosshair.g.attr('transform', `translate(${margin.left},${margin.top})`)\n .style('clip-path', `url(#${this._clipPathId})`)\n .style('-webkit-clip-path', `url(#${this._clipPathId})`)\n crosshair.hide()\n }\n\n config.annotations?.g.attr('transform', `translate(${margin.left},${margin.top})`)\n config.annotations?.render()\n\n this._firstRender = false\n }\n\n private _updateScales<T extends XYComponentCore<Datum>> (...components: T[]): void {\n const c = clean(components || this.components)\n this._setScales(...c)\n this._updateScalesDomain(...c)\n this._updateScalesRange(...c)\n }\n\n private _setScales<T extends XYComponentCore<Datum>> (...components: T[]): void {\n const { config } = this\n if (!components) return\n\n // Set the X and Y scales\n if (config.xScale) components.forEach(c => c.setScale(ScaleDimension.X, config.xScale))\n if (config.yScale) components.forEach(c => c.setScale(ScaleDimension.Y, config.yScale))\n }\n\n private _updateScalesDomain<T extends XYComponentCore<Datum>> (...components: T[]): void {\n const { config } = this\n if (!components) return\n\n const componentsWithDomain = components.filter(c => !c.config.excludeFromDomainCalculation)\n\n // Loop over all the dimensions\n Object.values(ScaleDimension).forEach((dimension: ScaleDimension) => {\n const [min, max] = extent(\n mergeArrays(\n componentsWithDomain.map(c => c.getDataExtent(dimension, config.scaleByDomain))\n ) as number[]\n ) // Components with undefined dimension accessors will return [undefined, undefined] but d3.extent will take care of that\n\n const configuredDomain = dimension === ScaleDimension.Y ? config.yDomain : config.xDomain\n const configuredDomainMinConstraint = dimension === ScaleDimension.Y ? config.yDomainMinConstraint : config.xDomainMinConstraint\n const configuredDomainMaxConstraint = dimension === ScaleDimension.Y ? config.yDomainMaxConstraint : config.xDomainMaxConstraint\n const domainMin = configuredDomain?.[0] ?? min ?? 0\n const domainMax = configuredDomain?.[1] ?? max ?? 1\n const domain = [\n clamp(domainMin, configuredDomainMinConstraint?.[0] ?? Number.NEGATIVE_INFINITY, configuredDomainMinConstraint?.[1] ?? Number.POSITIVE_INFINITY),\n clamp(domainMax, configuredDomainMaxConstraint?.[0] ?? Number.NEGATIVE_INFINITY, configuredDomainMaxConstraint?.[1] ?? Number.POSITIVE_INFINITY),\n ]\n\n // Extend the X and Y domains if they're empty and `preventEmptyDomain` was explicitly set to `true`\n // or just the X domain if there is no data provided and `preventEmptyDomain` set to `null`\n if (domain[0] === domain[1]) {\n const hasDataProvided = componentsWithDomain.some(c => c.datamodel.data?.length > 0)\n if (config.preventEmptyDomain || (config.preventEmptyDomain === null && (!hasDataProvided || dimension === ScaleDimension.Y))) {\n domain[1] = domain[0] + 1\n }\n }\n\n components.forEach(c => c.setScaleDomain(dimension, domain))\n })\n }\n\n private _updateScalesRange<T extends XYComponentCore<Datum>> (...components: T[]): void {\n const { config } = this\n if (!components) return\n\n // Set initial scale range\n const isYDirectionSouth = config.yDirection === Direction.South\n const xRange: [number, number] = [config.padding.left ?? 0, this.width - config.padding.right ?? 0]\n const yRange: [number, number] = [this.height - config.padding.bottom ?? 0, config.padding.top ?? 0]\n if (isYDirectionSouth) yRange.reverse()\n\n for (const c of components) {\n c.setScaleRange(ScaleDimension.X, config.xRange ?? xRange)\n c.setScaleRange(ScaleDimension.Y, config.yRange ?? yRange)\n }\n\n // Get and combine bleed\n const bleed = components.map(c => c.bleed).reduce((bleed, b) => {\n for (const key of Object.keys(bleed)) {\n const k = key as keyof Spacing\n if (bleed[k] < b[k]) bleed[k] = b[k]\n }\n return bleed\n }, { top: 0, bottom: 0, left: 0, right: 0 })\n\n // Update scale range\n for (const c of components) {\n c.setScaleRange(ScaleDimension.X, [xRange[0] + bleed.left, xRange[1] - bleed.right])\n c.setScaleRange(\n ScaleDimension.Y,\n isYDirectionSouth\n ? [yRange[0] + bleed.top, yRange[1] - bleed.bottom] // if Y axis is directed downwards\n : [yRange[0] - bleed.bottom, yRange[1] + bleed.top] // if Y axis is directed upwards\n )\n }\n }\n\n private _renderAxes (duration: number): void {\n const { config: { xAxis, yAxis } } = this\n const margin = this._getMargin()\n\n const axes = clean([xAxis, yAxis])\n axes.forEach(axis => {\n const offset = axis.getOffset(margin)\n axis.g.attr('transform', `translate(${offset.left},${offset.top})`)\n axis.render(duration)\n })\n }\n\n private _setAutoMargin (): void {\n const { config: { xAxis, yAxis } } = this\n\n // At first we need to set the domain to the scales\n const components = clean([...this.components, xAxis, yAxis])\n this._updateScalesDomain(...components)\n\n // Calculate margin required by the axes\n // We do two iterations on the first render, because the amount and size of ticks can change\n // after new margin are calculated and applied (axes dimensions will change).\n // That's needed for correct label placement.\n const numIterations = this._firstRender ? 2 : 1\n for (let i = 0; i < numIterations; i += 1) {\n const axisMargin: Spacing = { top: 0, bottom: 0, left: 0, right: 0 }\n this._updateScalesRange(...components)\n const axes = clean([xAxis, yAxis])\n axes.forEach(axis => {\n axis.preRender()\n\n const m = axis.getRequiredMargin()\n if (axisMargin.top < m.top) axisMargin.top = m.top\n if (axisMargin.bottom < m.bottom) axisMargin.bottom = m.bottom\n if (axisMargin.left < m.left) axisMargin.left = m.left\n if (axisMargin.right < m.right) axisMargin.right = m.right\n })\n this._axisMargin = axisMargin\n }\n }\n\n private _getMargin (): Spacing {\n const { config: { margin } } = this\n\n return {\n top: margin.top + this._axisMargin.top,\n bottom: margin.bottom + this._axisMargin.bottom,\n left: margin.left + this._axisMargin.left,\n right: margin.right + this._axisMargin.right,\n }\n }\n\n public destroy (): void {\n const { components, config: { tooltip, crosshair, annotations, xAxis, yAxis } } = this\n super.destroy()\n\n for (const c of components) c?.destroy()\n tooltip?.destroy()\n crosshair?.destroy()\n annotations?.destroy()\n xAxis?.destroy()\n yAxis?.destroy()\n }\n}\n"],"names":["mergeArrays"],"mappings":";;;;;;;;;;;;AA4CM,MAAO,WAAmB,SAAQ,aAAa,CAAA;AAUnD,IAAA,WAAA,CAAa,OAAoB,EAAE,MAA0C,EAAE,IAAc,EAAA;;QAC3F,KAAK,CAAC,OAAO,CAAC,CAAA;QAVN,IAAc,CAAA,cAAA,GAAG,wBAA6D,CAAA;AAEjF,QAAA,IAAA,CAAA,SAAS,GAA2B,IAAI,aAAa,EAAE,CAAA;AACvD,QAAA,IAAA,CAAA,MAAM,GAAsC,IAAI,CAAC,cAAc,CAAA;QAE9D,IAAW,CAAA,WAAA,GAAG,IAAI,EAAE,CAAA;AACpB,QAAA,IAAA,CAAA,WAAW,GAAY,EAAE,GAAG,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAA;QAC/D,IAAY,CAAA,YAAA,GAAG,IAAI,CAAA;QAKzB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC;AACzC,aAAA,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAA;AAC/B,QAAA,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;;;;QAK7B,MAAM,iBAAiB,GAAG,UAAU,CAAA;AACpC,QAAA,MAAM,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,IA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EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,GAAG,IAAI,CAAA;QACtF,KAAK,CAAC,OAAO,EAAE,CAAA;QAEf,KAAK,MAAM,CAAC,IAAI,UAAU;AAAE,YAAA,CAAC,aAAD,CAAC,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAD,CAAC,CAAE,OAAO,EAAE,CAAA;AACxC,QAAA,OAAO,aAAP,OAAO,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAP,OAAO,CAAE,OAAO,EAAE,CAAA;AAClB,QAAA,SAAS,aAAT,SAAS,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAT,SAAS,CAAE,OAAO,EAAE,CAAA;AACpB,QAAA,WAAW,aAAX,WAAW,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAX,WAAW,CAAE,OAAO,EAAE,CAAA;AACtB,QAAA,KAAK,aAAL,KAAK,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAL,KAAK,CAAE,OAAO,EAAE,CAAA;AAChB,QAAA,KAAK,aAAL,KAAK,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAL,KAAK,CAAE,OAAO,EAAE,CAAA;KACjB;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/containers/xy-container/index.ts"],"sourcesContent":["import { css } from '@emotion/css'\nimport { extent, merge as mergeArrays } from 'd3-array'\nimport { Selection } from 'd3-selection'\n\n// Global CSS variables (side effects import)\nimport 'styles/index'\n\n// Core\nimport { ContainerCore } from 'core/container'\nimport { XYComponentCore } from 'core/xy-component'\nimport { XYComponentConfigInterface } from 'core/xy-component/config'\n\n// Data Model\nimport { CoreDataModel } from 'data-models/core'\n\n// Types\nimport { Spacing } from 'types/spacing'\nimport { AxisType } from 'components/axis/types'\nimport { ScaleDimension } from 'types/scale'\nimport { Direction } from 'types/direction'\n\n// Utils\nimport { clamp, clean, flatten } from 'utils/data'\nimport { guid } from 'utils/misc'\n\n// Config\nimport { XYContainerDefaultConfig, XYContainerConfigInterface } from './config'\nimport {\n AreaConfigInterface,\n BrushConfigInterface,\n LineConfigInterface,\n ScatterConfigInterface,\n StackedBarConfigInterface,\n TimelineConfigInterface,\n} from '../../components'\n\nexport type XYConfigInterface<Datum> = XYComponentConfigInterface<Datum>\n| StackedBarConfigInterface<Datum>\n| LineConfigInterface<Datum>\n| ScatterConfigInterface<Datum>\n| BrushConfigInterface<Datum>\n| TimelineConfigInterface<Datum>\n| AreaConfigInterface<Datum>\n\nexport class XYContainer<Datum> extends ContainerCore {\n protected _defaultConfig = XYContainerDefaultConfig as XYContainerConfigInterface<Datum>\n protected _svgDefs: Selection<SVGDefsElement, unknown, null, undefined>\n public datamodel: CoreDataModel<Datum[]> = new CoreDataModel()\n public config: XYContainerConfigInterface<Datum> = this._defaultConfig\n private _clipPath: Selection<SVGClipPathElement, unknown, null, undefined>\n private _clipPathId = guid()\n private _axisMargin: Spacing = { top: 0, bottom: 0, left: 0, right: 0 }\n private _firstRender = true\n\n constructor (element: HTMLElement, config?: XYContainerConfigInterface<Datum>, data?: Datum[]) {\n super(element)\n\n this._clipPath = this.svg.append('clipPath')\n .attr('id', this._clipPathId)\n this._clipPath.append('rect')\n\n // When the base tag is specified on the HTML head,\n // Safari fails to find the corresponding filter URL.\n // We have to provide tull url in order to fix that\n const highlightFilterId = 'saturate'\n const baseUrl = window.location.href.replace(window.location.hash, '')\n this.svg.attr('class', css`\n --highlight-filter-id: url(${baseUrl}#${highlightFilterId}); // defining a css variable\n `)\n\n this._svgDefs.append('filter')\n .attr('id', highlightFilterId)\n .attr('filterUnits', 'objectBoundingBox')\n .html('<feColorMatrix type=\"saturate\" in=\"SourceGraphic\" values=\"1.35\"/>')\n\n if (config) {\n this.updateContainer(config, true)\n }\n\n if (data) {\n this.setData(data, true)\n }\n\n // Render if there are axes or components with data\n if (\n this.config.xAxis ||\n this.config.yAxis ||\n this.components?.some(c => c.datamodel.data)\n ) {\n this.render()\n }\n\n // Force re-render axes when fonts are loaded\n (document as any).fonts?.ready.then(() => {\n if (!this._firstRender) this._renderAxes(0)\n })\n }\n\n get components (): XYComponentCore<Datum>[] {\n return this.config.components\n }\n\n // Overriding ContainerCore default get width method to work with axis auto margin\n get width (): number {\n const margin = this._getMargin()\n return clamp(this.containerWidth - margin.left - margin.right, 0, Number.POSITIVE_INFINITY)\n }\n\n // Overriding ContainerCore default get height method to work with axis auto margin\n get height (): number {\n const margin = this._getMargin()\n\n return clamp(this.containerHeight - margin.top - margin.bottom, 0, Number.POSITIVE_INFINITY)\n }\n\n public setData (data: Datum[], preventRender?: boolean): void {\n const { components, config } = this\n if (!data) return\n this.datamodel.data = data\n\n components.forEach((c) => {\n c.setData(data)\n })\n\n config.crosshair?.setData(data)\n config.xAxis?.setData(data)\n config.yAxis?.setData(data)\n config.tooltip?.hide()\n if (!preventRender) this.render()\n }\n\n public updateContainer (containerConfig: XYContainerConfigInterface<Datum>, preventRender?: boolean): void {\n super.updateContainer(containerConfig)\n this._removeAllChildren()\n\n // If there were any new components added we need to pass them data\n this.setData(this.datamodel.data, true)\n\n // Set up the axes\n if (containerConfig.xAxis) {\n this.config.xAxis.config.type = AxisType.X\n this.element.appendChild(containerConfig.xAxis.element)\n }\n if (containerConfig.yAxis) {\n this.config.yAxis.config.type = AxisType.Y\n this.element.appendChild(containerConfig.yAxis.element)\n }\n\n // Re-insert elements to the DOM\n for (const c of this.components) {\n this.element.appendChild(c.element)\n }\n\n // Set up the tooltip\n const tooltip = containerConfig.tooltip\n if (tooltip) {\n if (!tooltip.hasContainer()) tooltip.setContainer(this._container)\n tooltip.setComponents(this.components)\n }\n\n // Set up the crosshair\n const crosshair = containerConfig.crosshair\n if (crosshair) {\n crosshair.setContainer(this.svg)\n crosshair.tooltip = tooltip\n\n this.element.appendChild(crosshair.element)\n }\n\n // Set up annotations\n const annotations = containerConfig.annotations\n if (annotations) {\n this.element.appendChild(annotations.element)\n }\n\n // Clipping path\n this.element.appendChild(this._clipPath.node())\n\n // Defs\n this.element.appendChild(this._svgDefs.node())\n this.element.appendChild(this._svgDefsExternal.node())\n\n // Rendering\n if (!preventRender) this.render()\n }\n\n public updateComponents (componentConfigs: XYConfigInterface<Datum>[], preventRender?: boolean): void {\n const { config } = this\n\n this.components.forEach((c, i) => {\n const componentConfig = componentConfigs[i]\n if (componentConfig) {\n c.setConfig(componentConfigs[i])\n }\n })\n\n this._updateScales(...this.components, config.xAxis, config.yAxis, config.crosshair)\n if (!preventRender) this.render()\n }\n\n public update (containerConfig: XYContainerConfigInterface<Datum>, componentConfigs?: XYComponentConfigInterface<Datum>[], data?: Datum[]): void {\n if (data) this.datamodel.data = data // Just updating the data model because the `updateContainer` method has the `setData` step inside\n if (containerConfig) this.updateContainer(containerConfig, true)\n if (componentConfigs) this.updateComponents(componentConfigs, true)\n this.render()\n }\n\n protected _preRender (): void {\n const { config } = this\n super._preRender()\n\n // Calculate extra margin required to fit the axes\n if (config.autoMargin) {\n this._setAutoMargin()\n }\n\n // Pass size to the components\n const components = clean([...this.components, config.xAxis, config.yAxis, config.crosshair, config.annotations])\n for (const c of components) {\n c.setSize(this.width, this.height, this.containerWidth, this.containerHeight)\n }\n\n // Update Scales of all the components at once to calculate required paddings and sync them\n this._updateScales(...this.components, config.xAxis, config.yAxis, config.crosshair)\n }\n\n protected _render (customDuration?: number): void {\n const { config } = this\n super._render()\n\n // Get chart total margin after auto margin calculations\n const margin = this._getMargin()\n\n // Render components\n for (const c of this.components) {\n c.g.attr('transform', `translate(${margin.left},${margin.top})`)\n .style('clip-path', c.clippable ? `url(#${this._clipPathId})` : null)\n .style('-webkit-clip-path', c.clippable ? `url(#${this._clipPathId})` : null)\n\n c.render(customDuration)\n }\n\n this._renderAxes(this._firstRender ? 0 : customDuration)\n\n // Clip RectsetSize\n // Extending the clipping path to allow small overflow (e.g. Line will looks better that way when it touches the edges)\n const clipPathExtension = 2\n this._clipPath.select('rect')\n .attr('x', -clipPathExtension)\n .attr('y', -clipPathExtension)\n .attr('width', this.width + 2 * clipPathExtension)\n .attr('height', this.height + 2 * clipPathExtension)\n\n // Tooltip\n config.tooltip?.update() // Re-bind events\n\n // Crosshair\n const crosshair = config.crosshair\n if (crosshair) {\n // Pass accessors\n const yAccessors = this.components.filter(c => !c.stacked).map(c => c.config.y)\n const yStackedAccessors = this.components.filter(c => c.stacked).map(c => c.config.y)\n const baselineComponentConfig = this.components.find(c => (c.config as AreaConfigInterface<Datum>).baseline)?.config as AreaConfigInterface<Datum>\n const baselineAccessor = baselineComponentConfig?.baseline\n\n crosshair.accessors = {\n x: this.components[0]?.config.x,\n y: flatten(yAccessors),\n yStacked: flatten(yStackedAccessors),\n baseline: baselineAccessor,\n }\n\n crosshair.g.attr('transform', `translate(${margin.left},${margin.top})`)\n .style('clip-path', `url(#${this._clipPathId})`)\n .style('-webkit-clip-path', `url(#${this._clipPathId})`)\n crosshair.hide()\n }\n\n config.annotations?.g.attr('transform', `translate(${margin.left},${margin.top})`)\n config.annotations?.render()\n\n this._firstRender = false\n }\n\n private _updateScales<T extends XYComponentCore<Datum>> (...components: T[]): void {\n const c = clean(components || this.components)\n this._setScales(...c)\n this._updateScalesDomain(...c)\n this._updateScalesRange(...c)\n }\n\n private _setScales<T extends XYComponentCore<Datum>> (...components: T[]): void {\n const { config } = this\n if (!components) return\n\n // Set the X and Y scales\n if (config.xScale) components.forEach(c => c.setScale(ScaleDimension.X, config.xScale))\n if (config.yScale) components.forEach(c => c.setScale(ScaleDimension.Y, config.yScale))\n }\n\n private _updateScalesDomain<T extends XYComponentCore<Datum>> (...components: T[]): void {\n const { config } = this\n if (!components) return\n\n const componentsWithDomain = components.filter(c => !c.config.excludeFromDomainCalculation)\n\n // Loop over all the dimensions\n Object.values(ScaleDimension).forEach((dimension: ScaleDimension) => {\n const [min, max] = extent(\n mergeArrays(\n componentsWithDomain.map(c => c.getDataExtent(dimension, config.scaleByDomain))\n ) as number[]\n ) // Components with undefined dimension accessors will return [undefined, undefined] but d3.extent will take care of that\n\n const configuredDomain = dimension === ScaleDimension.Y ? config.yDomain : config.xDomain\n const configuredDomainMinConstraint = dimension === ScaleDimension.Y ? config.yDomainMinConstraint : config.xDomainMinConstraint\n const configuredDomainMaxConstraint = dimension === ScaleDimension.Y ? config.yDomainMaxConstraint : config.xDomainMaxConstraint\n const domainMin = configuredDomain?.[0] ?? min ?? 0\n const domainMax = configuredDomain?.[1] ?? max ?? 1\n const domain = [\n clamp(domainMin, configuredDomainMinConstraint?.[0] ?? Number.NEGATIVE_INFINITY, configuredDomainMinConstraint?.[1] ?? Number.POSITIVE_INFINITY),\n clamp(domainMax, configuredDomainMaxConstraint?.[0] ?? Number.NEGATIVE_INFINITY, configuredDomainMaxConstraint?.[1] ?? Number.POSITIVE_INFINITY),\n ]\n\n // Extend the X and Y domains if they're empty and `preventEmptyDomain` was explicitly set to `true`\n // or just the X domain if there is no data provided and `preventEmptyDomain` set to `null`\n if (domain[0] === domain[1]) {\n const hasDataProvided = componentsWithDomain.some(c => c.datamodel.data?.length > 0)\n if (config.preventEmptyDomain || (config.preventEmptyDomain === null && (!hasDataProvided || dimension === ScaleDimension.Y))) {\n domain[1] = domain[0] + 1\n }\n }\n\n components.forEach(c => c.setScaleDomain(dimension, domain))\n })\n }\n\n private _updateScalesRange<T extends XYComponentCore<Datum>> (...components: T[]): void {\n const { config } = this\n if (!components) return\n\n // Set initial scale range\n const isYDirectionSouth = config.yDirection === Direction.South\n const xRange: [number, number] = [config.padding.left ?? 0, this.width - config.padding.right ?? 0]\n const yRange: [number, number] = [this.height - config.padding.bottom ?? 0, config.padding.top ?? 0]\n if (isYDirectionSouth) yRange.reverse()\n\n for (const c of components) {\n c.setSize(this.width, this.height, this.containerWidth, this.containerHeight)\n c.setScaleRange(ScaleDimension.X, config.xRange ?? xRange)\n c.setScaleRange(ScaleDimension.Y, config.yRange ?? yRange)\n }\n\n // Get and combine bleed\n const bleed = components.map(c => c.bleed).reduce((bleed, b) => {\n for (const key of Object.keys(bleed)) {\n const k = key as keyof Spacing\n if (bleed[k] < b[k]) bleed[k] = b[k]\n }\n return bleed\n }, { top: 0, bottom: 0, left: 0, right: 0 })\n\n // Update scale range\n for (const c of components) {\n c.setScaleRange(ScaleDimension.X, [xRange[0] + bleed.left, xRange[1] - bleed.right])\n c.setScaleRange(\n ScaleDimension.Y,\n isYDirectionSouth\n ? [yRange[0] + bleed.top, yRange[1] - bleed.bottom] // if Y axis is directed downwards\n : [yRange[0] - bleed.bottom, yRange[1] + bleed.top] // if Y axis is directed upwards\n )\n }\n }\n\n private _renderAxes (duration: number): void {\n const { config: { xAxis, yAxis } } = this\n const margin = this._getMargin()\n\n const axes = clean([xAxis, yAxis])\n axes.forEach(axis => {\n const offset = axis.getOffset(margin)\n axis.g.attr('transform', `translate(${offset.left},${offset.top})`)\n axis.render(duration)\n })\n }\n\n private _setAutoMargin (): void {\n const { config: { xAxis, yAxis } } = this\n\n // At first we need to set the domain to the scales\n const components = clean([...this.components, xAxis, yAxis])\n this._updateScalesDomain(...components)\n\n // Calculate margin required by the axes\n // We do two iterations on the first render, because the amount and size of ticks can change\n // after new margin are calculated and applied (axes dimensions will change).\n // That's needed for correct label placement.\n const numIterations = this._firstRender ? 2 : 1\n for (let i = 0; i < numIterations; i += 1) {\n const axisMargin: Spacing = { top: 0, bottom: 0, left: 0, right: 0 }\n this._updateScalesRange(...components)\n const axes = clean([xAxis, yAxis])\n axes.forEach(axis => {\n axis.preRender()\n\n const m = axis.getRequiredMargin()\n if (axisMargin.top < m.top) axisMargin.top = m.top\n if (axisMargin.bottom < m.bottom) axisMargin.bottom = m.bottom\n if (axisMargin.left < m.left) axisMargin.left = m.left\n if (axisMargin.right < m.right) axisMargin.right = m.right\n })\n this._axisMargin = axisMargin\n }\n }\n\n private _getMargin (): Spacing {\n const { config: { margin } } = this\n\n return {\n top: margin.top + this._axisMargin.top,\n bottom: margin.bottom + this._axisMargin.bottom,\n left: margin.left + this._axisMargin.left,\n right: margin.right + this._axisMargin.right,\n }\n }\n\n public destroy (): void {\n const { components, config: { tooltip, crosshair, annotations, xAxis, yAxis } } = this\n super.destroy()\n\n for (const c of components) c?.destroy()\n tooltip?.destroy()\n crosshair?.destroy()\n annotations?.destroy()\n xAxis?.destroy()\n yAxis?.destroy()\n }\n}\n"],"names":["mergeArrays"],"mappings":";;;;;;;;;;;;AA4CM,MAAO,WAAmB,SAAQ,aAAa,CAAA;AAUnD,IAAA,WAAA,CAAa,OAAoB,EAAE,MAA0C,EAAE,IAAc,EAAA;;QAC3F,KAAK,CAAC,OAAO,CAAC,CAAA;QAVN,IAAc,CAAA,cAAA,GAAG,wBAA6D,CAAA;AAEjF,QAAA,IAAA,CAAA,SAAS,GAA2B,IAAI,aAAa,EAAE,CAAA;AACvD,QAAA,IAAA,CAAA,MAAM,GAAsC,IAAI,CAAC,cAAc,CAAA;QAE9D,IAAW,CAAA,WAAA,GAAG,IAAI,EAAE,CAAA;AACpB,QAAA,IAAA,CAAA,WAAW,GAAY,EAAE,GAAG,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAA;QAC/D,IAAY,CAAA,YAAA,GAAG,IAAI,CAAA;QAKzB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC;AACzC,aAAA,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAA;AAC/B,QAAA,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;;;;QAK7B,MAAM,iBAAiB,GAAG,UAAU,CAAA;AACpC,QAAA,MAAM,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,CAAA;QACtE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,CAAA,CAAA;AACK,iCAAA,EAAA,O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CAAC,KAAK;SAC7C,CAAA;KACF;IAEM,OAAO,GAAA;AACZ,QAAA,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,GAAG,IAAI,CAAA;QACtF,KAAK,CAAC,OAAO,EAAE,CAAA;QAEf,KAAK,MAAM,CAAC,IAAI,UAAU;AAAE,YAAA,CAAC,aAAD,CAAC,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAD,CAAC,CAAE,OAAO,EAAE,CAAA;AACxC,QAAA,OAAO,aAAP,OAAO,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAP,OAAO,CAAE,OAAO,EAAE,CAAA;AAClB,QAAA,SAAS,aAAT,SAAS,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAT,SAAS,CAAE,OAAO,EAAE,CAAA;AACpB,QAAA,WAAW,aAAX,WAAW,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAX,WAAW,CAAE,OAAO,EAAE,CAAA;AACtB,QAAA,KAAK,aAAL,KAAK,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAL,KAAK,CAAE,OAAO,EAAE,CAAA;AAChB,QAAA,KAAK,aAAL,KAAK,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAL,KAAK,CAAE,OAAO,EAAE,CAAA;KACjB;AACF;;;;"}
|
|
@@ -11,6 +11,7 @@ export declare class ContainerCore {
|
|
|
11
11
|
protected _isFirstRender: boolean;
|
|
12
12
|
protected _resizeObserver: ResizeObserver | undefined;
|
|
13
13
|
protected _svgDefs: Selection<SVGDefsElement, unknown, null, undefined>;
|
|
14
|
+
protected _svgDefsExternal: Selection<SVGDefsElement, unknown, null, undefined>;
|
|
14
15
|
private _containerSize;
|
|
15
16
|
static DEFAULT_CONTAINER_HEIGHT: number;
|
|
16
17
|
constructor(element: HTMLElement);
|
package/core/container/index.js
CHANGED
|
@@ -22,6 +22,7 @@ class ContainerCore {
|
|
|
22
22
|
.attr('height', ContainerCore.DEFAULT_CONTAINER_HEIGHT) // Overriding default SVG height of 150
|
|
23
23
|
.attr('aria-hidden', true);
|
|
24
24
|
this._svgDefs = this.svg.append('defs');
|
|
25
|
+
this._svgDefsExternal = this.svg.append('defs');
|
|
25
26
|
this.element = this.svg.node();
|
|
26
27
|
}
|
|
27
28
|
updateContainer(config) {
|
|
@@ -35,11 +36,11 @@ class ContainerCore {
|
|
|
35
36
|
_preRender() { }
|
|
36
37
|
// The `_render` step should be used to perform the actual rendering
|
|
37
38
|
_render(duration) {
|
|
38
|
-
const { config } = this;
|
|
39
|
+
const { config, prevConfig } = this;
|
|
39
40
|
// Add `svgDefs` if provided in the config
|
|
40
|
-
if (config.svgDefs) {
|
|
41
|
-
this.
|
|
42
|
-
this.
|
|
41
|
+
if (config.svgDefs !== (prevConfig === null || prevConfig === void 0 ? void 0 : prevConfig.svgDefs)) {
|
|
42
|
+
this._svgDefsExternal.selectAll('*').remove();
|
|
43
|
+
this._svgDefsExternal.html(config.svgDefs);
|
|
43
44
|
}
|
|
44
45
|
// Apply the `aria-label` attribute
|
|
45
46
|
select(this._container)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/core/container/index.ts"],"sourcesContent":["import { select, Selection } from 'd3-selection'\n\n// Types\nimport { Sizing } from 'types/component'\n\n// Utils\nimport { isEqual, clamp, merge } from 'utils/data'\nimport { ResizeObserver } from 'utils/resize-observer'\n\n// Config\nimport { ContainerDefaultConfig, ContainerConfigInterface } from './config'\n\nexport class ContainerCore {\n public svg: Selection<SVGSVGElement, unknown, null, undefined>\n public element: SVGSVGElement\n public prevConfig: ContainerConfigInterface\n public config: ContainerConfigInterface\n\n protected _defaultConfig: ContainerConfigInterface = ContainerDefaultConfig\n protected _container: HTMLElement\n protected _requestedAnimationFrame: number\n protected _isFirstRender = true\n protected _resizeObserver: ResizeObserver | undefined\n protected _svgDefs: Selection<SVGDefsElement, unknown, null, undefined>\n private _containerSize: { width: number; height: number }\n\n // eslint-disable-next-line @typescript-eslint/naming-convention\n static DEFAULT_CONTAINER_HEIGHT = 300\n\n constructor (element: HTMLElement) {\n this._requestedAnimationFrame = null\n this._container = element\n\n // Setting `role` attribute to `image` to make the container accessible\n const container = select(this._container)\n container.attr('role', 'figure')\n\n // Create SVG element for visualizations\n this.svg = container.append('svg')\n // We set `display` to `block` because inline elements have an invisible\n // inline space that adds 4px to the height of the container\n .style('display', 'block')\n .attr('xmlns', 'http://www.w3.org/2000/svg')\n .attr('height', ContainerCore.DEFAULT_CONTAINER_HEIGHT) // Overriding default SVG height of 150\n .attr('aria-hidden', true)\n\n this._svgDefs = this.svg.append('defs')\n this.element = this.svg.node()\n }\n\n public updateContainer<T extends ContainerConfigInterface> (config: T): void {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n this.prevConfig = this.config\n this.config = merge(this._defaultConfig, config)\n }\n\n // The `_preRender` step should be used to perform some actions before rendering.\n // For example, calculating scales, setting component sizes, etc ...\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n protected _preRender (): void {}\n\n // The `_render` step should be used to perform the actual rendering\n protected _render (duration?: number): void {\n const { config } = this\n\n // Add `svgDefs` if provided in the config\n if (config.svgDefs) {\n this.svg.select('.svgDefs').remove()\n this.svg.append('defs').attr('class', 'svgDefs').html(config.svgDefs)\n }\n\n // Apply the `aria-label` attribute\n select(this._container)\n .attr('aria-label', config.ariaLabel)\n\n this._isFirstRender = false\n }\n\n // Warning: Some Containers (i.e. Single Container) may override this method, so if you introduce any changes here,\n // make sure to check that other containers didn't break after them.\n public render (duration = this.config.duration): void {\n const width = this.config.width || this.containerWidth\n const height = this.config.height || this.containerHeight\n\n // We set SVG size in `render()` instead of `_render()`, because the size values in pixels will become\n // available only in the next animation when being accessed via `element.clientWidth` and `element.clientHeight`,\n // and we rely on those values when setting width and size of the components.\n this.svg\n .attr('width', width)\n .attr('height', height)\n\n // Set up Resize Observer. We do it in `render()` to capture container size change if it happened\n // in the next animation frame after the initial `render` was called.\n if (!this._resizeObserver) this._setUpResizeObserver()\n\n // Schedule the actual rendering in the next frame\n cancelAnimationFrame(this._requestedAnimationFrame)\n this._requestedAnimationFrame = requestAnimationFrame(() => {\n this._preRender()\n this._render(duration)\n })\n }\n\n get containerWidth (): number {\n return this.config.width\n ? this.element.clientWidth\n : (this._container.clientWidth || this._container.getBoundingClientRect().width)\n }\n\n get containerHeight (): number {\n return this.config.height\n ? this.element.clientHeight\n : (this._container.clientHeight || this._container.getBoundingClientRect().height || ContainerCore.DEFAULT_CONTAINER_HEIGHT)\n }\n\n get width (): number {\n return clamp(this.containerWidth - this.config.margin.left - this.config.margin.right, 0, Number.POSITIVE_INFINITY)\n }\n\n get height (): number {\n return clamp(this.containerHeight - this.config.margin.top - this.config.margin.bottom, 0, Number.POSITIVE_INFINITY)\n }\n\n protected _removeAllChildren (): void {\n while (this.element.firstChild) {\n this.element.removeChild(this.element.firstChild)\n }\n }\n\n protected _onResize (): void {\n const { config } = this\n const redrawOnResize = config.sizing === Sizing.Fit || config.sizing === Sizing.FitWidth\n if (redrawOnResize) this.render(0)\n }\n\n protected _setUpResizeObserver (): void {\n if (this._resizeObserver) return\n const containerRect = this._container.getBoundingClientRect()\n this._containerSize = { width: containerRect.width, height: containerRect.height }\n\n this._resizeObserver = new ResizeObserver((entries, observer) => {\n const resizedContainerRect = this._container.getBoundingClientRect()\n const resizedContainerSize = { width: resizedContainerRect.width, height: resizedContainerRect.height }\n const hasSizeChanged = !isEqual(this._containerSize, resizedContainerSize)\n // Do resize only if element is attached to the DOM\n // will come in useful when some ancestor of container becomes detached\n if (hasSizeChanged && resizedContainerSize.width && resizedContainerSize.height) {\n this._containerSize = resizedContainerSize\n this._onResize()\n }\n })\n this._resizeObserver.observe(this._container)\n }\n\n public destroy (): void {\n cancelAnimationFrame(this._requestedAnimationFrame)\n this._resizeObserver?.disconnect()\n this.svg.remove()\n }\n}\n"],"names":[],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A,GAAG,GAAG;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/core/container/index.ts"],"sourcesContent":["import { select, Selection } from 'd3-selection'\n\n// Types\nimport { Sizing } from 'types/component'\n\n// Utils\nimport { isEqual, clamp, merge } from 'utils/data'\nimport { ResizeObserver } from 'utils/resize-observer'\n\n// Config\nimport { ContainerDefaultConfig, ContainerConfigInterface } from './config'\n\nexport class ContainerCore {\n public svg: Selection<SVGSVGElement, unknown, null, undefined>\n public element: SVGSVGElement\n public prevConfig: ContainerConfigInterface\n public config: ContainerConfigInterface\n\n protected _defaultConfig: ContainerConfigInterface = ContainerDefaultConfig\n protected _container: HTMLElement\n protected _requestedAnimationFrame: number\n protected _isFirstRender = true\n protected _resizeObserver: ResizeObserver | undefined\n protected _svgDefs: Selection<SVGDefsElement, unknown, null, undefined>\n protected _svgDefsExternal: Selection<SVGDefsElement, unknown, null, undefined>\n private _containerSize: { width: number; height: number }\n\n // eslint-disable-next-line @typescript-eslint/naming-convention\n static DEFAULT_CONTAINER_HEIGHT = 300\n\n constructor (element: HTMLElement) {\n this._requestedAnimationFrame = null\n this._container = element\n\n // Setting `role` attribute to `image` to make the container accessible\n const container = select(this._container)\n container.attr('role', 'figure')\n\n // Create SVG element for visualizations\n this.svg = container.append('svg')\n // We set `display` to `block` because inline elements have an invisible\n // inline space that adds 4px to the height of the container\n .style('display', 'block')\n .attr('xmlns', 'http://www.w3.org/2000/svg')\n .attr('height', ContainerCore.DEFAULT_CONTAINER_HEIGHT) // Overriding default SVG height of 150\n .attr('aria-hidden', true)\n\n this._svgDefs = this.svg.append('defs')\n this._svgDefsExternal = this.svg.append('defs')\n this.element = this.svg.node()\n }\n\n public updateContainer<T extends ContainerConfigInterface> (config: T): void {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n this.prevConfig = this.config\n this.config = merge(this._defaultConfig, config)\n }\n\n // The `_preRender` step should be used to perform some actions before rendering.\n // For example, calculating scales, setting component sizes, etc ...\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n protected _preRender (): void {}\n\n // The `_render` step should be used to perform the actual rendering\n protected _render (duration?: number): void {\n const { config, prevConfig } = this\n\n // Add `svgDefs` if provided in the config\n if (config.svgDefs !== prevConfig?.svgDefs) {\n this._svgDefsExternal.selectAll('*').remove()\n this._svgDefsExternal.html(config.svgDefs)\n }\n\n // Apply the `aria-label` attribute\n select(this._container)\n .attr('aria-label', config.ariaLabel)\n\n this._isFirstRender = false\n }\n\n // Warning: Some Containers (i.e. Single Container) may override this method, so if you introduce any changes here,\n // make sure to check that other containers didn't break after them.\n public render (duration = this.config.duration): void {\n const width = this.config.width || this.containerWidth\n const height = this.config.height || this.containerHeight\n\n // We set SVG size in `render()` instead of `_render()`, because the size values in pixels will become\n // available only in the next animation when being accessed via `element.clientWidth` and `element.clientHeight`,\n // and we rely on those values when setting width and size of the components.\n this.svg\n .attr('width', width)\n .attr('height', height)\n\n // Set up Resize Observer. We do it in `render()` to capture container size change if it happened\n // in the next animation frame after the initial `render` was called.\n if (!this._resizeObserver) this._setUpResizeObserver()\n\n // Schedule the actual rendering in the next frame\n cancelAnimationFrame(this._requestedAnimationFrame)\n this._requestedAnimationFrame = requestAnimationFrame(() => {\n this._preRender()\n this._render(duration)\n })\n }\n\n get containerWidth (): number {\n return this.config.width\n ? this.element.clientWidth\n : (this._container.clientWidth || this._container.getBoundingClientRect().width)\n }\n\n get containerHeight (): number {\n return this.config.height\n ? this.element.clientHeight\n : (this._container.clientHeight || this._container.getBoundingClientRect().height || ContainerCore.DEFAULT_CONTAINER_HEIGHT)\n }\n\n get width (): number {\n return clamp(this.containerWidth - this.config.margin.left - this.config.margin.right, 0, Number.POSITIVE_INFINITY)\n }\n\n get height (): number {\n return clamp(this.containerHeight - this.config.margin.top - this.config.margin.bottom, 0, Number.POSITIVE_INFINITY)\n }\n\n protected _removeAllChildren (): void {\n while (this.element.firstChild) {\n this.element.removeChild(this.element.firstChild)\n }\n }\n\n protected _onResize (): void {\n const { config } = this\n const redrawOnResize = config.sizing === Sizing.Fit || config.sizing === Sizing.FitWidth\n if (redrawOnResize) this.render(0)\n }\n\n protected _setUpResizeObserver (): void {\n if (this._resizeObserver) return\n const containerRect = this._container.getBoundingClientRect()\n this._containerSize = { width: containerRect.width, height: containerRect.height }\n\n this._resizeObserver = new ResizeObserver((entries, observer) => {\n const resizedContainerRect = this._container.getBoundingClientRect()\n const resizedContainerSize = { width: resizedContainerRect.width, height: resizedContainerRect.height }\n const hasSizeChanged = !isEqual(this._containerSize, resizedContainerSize)\n // Do resize only if element is attached to the DOM\n // will come in useful when some ancestor of container becomes detached\n if (hasSizeChanged && resizedContainerSize.width && resizedContainerSize.height) {\n this._containerSize = resizedContainerSize\n this._onResize()\n }\n })\n this._resizeObserver.observe(this._container)\n }\n\n public destroy (): void {\n cancelAnimationFrame(this._requestedAnimationFrame)\n this._resizeObserver?.disconnect()\n this.svg.remove()\n }\n}\n"],"names":[],"mappings":";;;;;;MAYa,aAAa,CAAA;AAkBxB,IAAA,WAAA,CAAa,OAAoB,EAAA;QAZvB,IAAc,CAAA,cAAA,GAA6B,sBAAsB,CAAA;QAGjE,IAAc,CAAA,cAAA,GAAG,IAAI,CAAA;AAU7B,QAAA,IAAI,CAAC,wBAAwB,GAAG,IAAI,CAAA;AACpC,QAAA,IAAI,CAAC,UAAU,GAAG,OAAO,CAAA;;QAGzB,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;AACzC,QAAA,SAAS,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;;QAGhC,IAAI,CAAC,GAAG,GAAG,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC;;;AAG/B,aAAA,KAAK,CAAC,SAAS,EAAE,OAAO,CAAC;AACzB,aAAA,IAAI,CAAC,OAAO,EAAE,4BAA4B,CAAC;aAC3C,IAAI,CAAC,QAAQ,EAAE,aAAa,CAAC,wBAAwB,CAAC;AACtD,aAAA,IAAI,CAAC,a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M,EAAE,oBAAoB,CAAC,MAAM,EAAE,CAAA;YACvG,MAAM,cAAc,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE,oBAAoB,CAAC,CAAA;;;YAG1E,IAAI,cAAc,IAAI,oBAAoB,CAAC,KAAK,IAAI,oBAAoB,CAAC,MAAM,EAAE;AAC/E,gBAAA,IAAI,CAAC,cAAc,GAAG,oBAAoB,CAAA;gBAC1C,IAAI,CAAC,SAAS,EAAE,CAAA;AACjB,aAAA;AACH,SAAC,CAAC,CAAA;QACF,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;KAC9C;IAEM,OAAO,GAAA;;AACZ,QAAA,oBAAoB,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAA;AACnD,QAAA,CAAA,EAAA,GAAA,IAAI,CAAC,eAAe,MAAE,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,UAAU,EAAE,CAAA;AAClC,QAAA,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,CAAA;KAClB;;AArID;AACO,aAAwB,CAAA,wBAAA,GAAG,GAAG;;;;"}
|
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.4.
|
|
4
|
+
"version": "1.4.3-beta.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/f5/unovis.git",
|
package/types/graph.d.ts
CHANGED
package/types/text.d.ts
CHANGED
|
@@ -30,6 +30,7 @@ export declare type UnovisText = {
|
|
|
30
30
|
};
|
|
31
31
|
export declare type UnovisWrappedText = UnovisText & {
|
|
32
32
|
_lines: string[];
|
|
33
|
+
_maxWidth: number;
|
|
33
34
|
_estimatedHeight: number;
|
|
34
35
|
};
|
|
35
36
|
export declare type UnovisTextOptions = {
|
|
@@ -39,6 +40,7 @@ export declare type UnovisTextOptions = {
|
|
|
39
40
|
separator?: string | string[];
|
|
40
41
|
verticalAlign?: VerticalAlign | string;
|
|
41
42
|
textAlign?: TextAlign | string;
|
|
43
|
+
textRotationAngle?: number;
|
|
42
44
|
fastMode?: boolean;
|
|
43
45
|
wordBreak?: boolean;
|
|
44
46
|
};
|
package/types/text.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.js","sources":["../../src/types/text.ts"],"sourcesContent":["export enum TrimMode {\n Start = 'start',\n Middle = 'middle',\n End = 'end',\n}\n\nexport enum VerticalAlign {\n Top = 'top',\n Middle = 'middle',\n Bottom = 'bottom',\n}\n\nexport enum FitMode {\n Wrap = 'wrap',\n Trim = 'trim',\n}\n\nexport enum TextAlign {\n Left = 'left',\n Center = 'center',\n Right = 'right',\n}\n\nexport type UnovisText = {\n // The text content to be displayed.\n text: string;\n // The font size of the text in pixels.\n fontSize: number;\n // The font family of the text (optional). Default: `'var(--vis-font-family)'`.\n fontFamily?: string;\n // The font weight of the text (optional)`.\n fontWeight?: number;\n // The color of the text (optional).\n color?: string;\n // The line height scaling factor for the text (optional).\n lineHeight?: number;\n // The top margin of the text block in pixels (optional).\n marginTop?: number;\n // The bottom margin of the text block in pixels (optional).\n marginBottom?: number;\n // The font width-to-height ratio (optional).\n fontWidthToHeightRatio?: number;\n}\n\nexport type UnovisWrappedText = UnovisText & {\n // An array of text lines, where each element represents a single line of text.\n _lines: string[];\n // Estimated height of this text block\n _estimatedHeight: number;\n}\n\nexport type UnovisTextOptions = {\n // Optional X coordinates of the text.\n x?: number;\n // Optional Y coordinates of the text.\n y?: number;\n // The maximum width of the text in pixels.\n width?: number;\n // The word separator(s) used to split the text into words.\n separator?: string | string[];\n // The vertical alignment of the text ('top', 'middle', or 'bottom').\n verticalAlign?: VerticalAlign | string;\n // The horizontal text alignment ('left', 'center', or 'right').\n textAlign?: TextAlign | string;\n // Whether to use a fast estimation method or a more accurate one for text calculations.\n fastMode?: boolean;\n // Force word break if they don't fit into the width\n wordBreak?: boolean;\n}\n\nexport type UnovisTextFrameOptions = UnovisTextOptions & {\n height?: number;\n}\n\n"],"names":[],"mappings":"IAAY,SAIX;AAJD,CAAA,UAAY,QAAQ,EAAA;AAClB,IAAA,QAAA,CAAA,OAAA,CAAA,GAAA,OAAe,CAAA;AACf,IAAA,QAAA,CAAA,QAAA,CAAA,GAAA,QAAiB,CAAA;AACjB,IAAA,QAAA,CAAA,KAAA,CAAA,GAAA,KAAW,CAAA;AACb,CAAC,EAJW,QAAQ,KAAR,QAAQ,GAInB,EAAA,CAAA,CAAA,CAAA;IAEW,cAIX;AAJD,CAAA,UAAY,aAAa,EAAA;AACvB,IAAA,aAAA,CAAA,KAAA,CAAA,GAAA,KAAW,CAAA;AACX,IAAA,aAAA,CAAA,QAAA,CAAA,GAAA,QAAiB,CAAA;AACjB,IAAA,aAAA,CAAA,QAAA,CAAA,GAAA,QAAiB,CAAA;AACnB,CAAC,EAJW,aAAa,KAAb,aAAa,GAIxB,EAAA,CAAA,CAAA,CAAA;IAEW,QAGX;AAHD,CAAA,UAAY,OAAO,EAAA;AACjB,IAAA,OAAA,CAAA,MAAA,CAAA,GAAA,MAAa,CAAA;AACb,IAAA,OAAA,CAAA,MAAA,CAAA,GAAA,MAAa,CAAA;AACf,CAAC,EAHW,OAAO,KAAP,OAAO,GAGlB,EAAA,CAAA,CAAA,CAAA;IAEW,UAIX;AAJD,CAAA,UAAY,SAAS,EAAA;AACnB,IAAA,SAAA,CAAA,MAAA,CAAA,GAAA,MAAa,CAAA;AACb,IAAA,SAAA,CAAA,QAAA,CAAA,GAAA,QAAiB,CAAA;AACjB,IAAA,SAAA,CAAA,OAAA,CAAA,GAAA,OAAe,CAAA;AACjB,CAAC,EAJW,SAAS,KAAT,SAAS,GAIpB,EAAA,CAAA,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"text.js","sources":["../../src/types/text.ts"],"sourcesContent":["export enum TrimMode {\n Start = 'start',\n Middle = 'middle',\n End = 'end',\n}\n\nexport enum VerticalAlign {\n Top = 'top',\n Middle = 'middle',\n Bottom = 'bottom',\n}\n\nexport enum FitMode {\n Wrap = 'wrap',\n Trim = 'trim',\n}\n\nexport enum TextAlign {\n Left = 'left',\n Center = 'center',\n Right = 'right',\n}\n\nexport type UnovisText = {\n // The text content to be displayed.\n text: string;\n // The font size of the text in pixels.\n fontSize: number;\n // The font family of the text (optional). Default: `'var(--vis-font-family)'`.\n fontFamily?: string;\n // The font weight of the text (optional)`.\n fontWeight?: number;\n // The color of the text (optional).\n color?: string;\n // The line height scaling factor for the text (optional).\n lineHeight?: number;\n // The top margin of the text block in pixels (optional).\n marginTop?: number;\n // The bottom margin of the text block in pixels (optional).\n marginBottom?: number;\n // The font width-to-height ratio (optional).\n fontWidthToHeightRatio?: number;\n}\n\nexport type UnovisWrappedText = UnovisText & {\n // An array of text lines, where each element represents a single line of text.\n _lines: string[];\n // Maximum width of any line of text in this text block\n _maxWidth: number;\n // Estimated height of this text block\n _estimatedHeight: number;\n}\n\nexport type UnovisTextOptions = {\n // Optional X coordinates of the text.\n x?: number;\n // Optional Y coordinates of the text.\n y?: number;\n // The maximum width of the text in pixels.\n width?: number;\n // The word separator(s) used to split the text into words.\n separator?: string | string[];\n // The vertical alignment of the text ('top', 'middle', or 'bottom').\n verticalAlign?: VerticalAlign | string;\n // The horizontal text alignment ('left', 'center', or 'right').\n textAlign?: TextAlign | string;\n // Text rotation\n textRotationAngle?: number;\n // Whether to use a fast estimation method or a more accurate one for text calculations.\n fastMode?: boolean;\n // Force word break if they don't fit into the width\n wordBreak?: boolean;\n}\n\nexport type UnovisTextFrameOptions = UnovisTextOptions & {\n height?: number;\n}\n\n"],"names":[],"mappings":"IAAY,SAIX;AAJD,CAAA,UAAY,QAAQ,EAAA;AAClB,IAAA,QAAA,CAAA,OAAA,CAAA,GAAA,OAAe,CAAA;AACf,IAAA,QAAA,CAAA,QAAA,CAAA,GAAA,QAAiB,CAAA;AACjB,IAAA,QAAA,CAAA,KAAA,CAAA,GAAA,KAAW,CAAA;AACb,CAAC,EAJW,QAAQ,KAAR,QAAQ,GAInB,EAAA,CAAA,CAAA,CAAA;IAEW,cAIX;AAJD,CAAA,UAAY,aAAa,EAAA;AACvB,IAAA,aAAA,CAAA,KAAA,CAAA,GAAA,KAAW,CAAA;AACX,IAAA,aAAA,CAAA,QAAA,CAAA,GAAA,QAAiB,CAAA;AACjB,IAAA,aAAA,CAAA,QAAA,CAAA,GAAA,QAAiB,CAAA;AACnB,CAAC,EAJW,aAAa,KAAb,aAAa,GAIxB,EAAA,CAAA,CAAA,CAAA;IAEW,QAGX;AAHD,CAAA,UAAY,OAAO,EAAA;AACjB,IAAA,OAAA,CAAA,MAAA,CAAA,GAAA,MAAa,CAAA;AACb,IAAA,OAAA,CAAA,MAAA,CAAA,GAAA,MAAa,CAAA;AACf,CAAC,EAHW,OAAO,KAAP,OAAO,GAGlB,EAAA,CAAA,CAAA,CAAA;IAEW,UAIX;AAJD,CAAA,UAAY,SAAS,EAAA;AACnB,IAAA,SAAA,CAAA,MAAA,CAAA,GAAA,MAAa,CAAA;AACb,IAAA,SAAA,CAAA,QAAA,CAAA,GAAA,QAAiB,CAAA;AACjB,IAAA,SAAA,CAAA,OAAA,CAAA,GAAA,OAAe,CAAA;AACjB,CAAC,EAJW,SAAS,KAAT,SAAS,GAIpB,EAAA,CAAA,CAAA;;;;"}
|
package/utils/text.d.ts
CHANGED
|
@@ -128,7 +128,7 @@ export declare const allowedSvgTextTags: string[];
|
|
|
128
128
|
* @param {UnovisText | UnovisText[]} text - The text or array of texts to render.
|
|
129
129
|
* @param {UnovisTextOptions} options - The text options.
|
|
130
130
|
*/
|
|
131
|
-
export declare function renderTextToSvgTextElement(textElement: SVGTextElement, text: UnovisText | UnovisText[], options: UnovisTextOptions): void;
|
|
131
|
+
export declare function renderTextToSvgTextElement(textElement: SVGTextElement, text: UnovisText | UnovisText[], options: UnovisTextOptions, trimmed?: boolean): void;
|
|
132
132
|
/**
|
|
133
133
|
* Renders a text or array of texts into a frame.
|
|
134
134
|
* Calling this function will replace the contents of the specified SVG group.
|
package/utils/text.js
CHANGED
|
@@ -309,6 +309,7 @@ function getWrappedText(text, width = undefined, height = undefined, fastMode =
|
|
|
309
309
|
const blocks = [];
|
|
310
310
|
// Process each text block and its lines based on height limit
|
|
311
311
|
textArrays.forEach((text, i) => {
|
|
312
|
+
var _a;
|
|
312
313
|
let lines = textWrapped[i];
|
|
313
314
|
const prevBlock = i > 0 ? blocks[i - 1] : undefined;
|
|
314
315
|
const prevBlockMarginBottomPx = prevBlock ? prevBlock.marginBottom : 0;
|
|
@@ -316,20 +317,22 @@ function getWrappedText(text, width = undefined, height = undefined, fastMode =
|
|
|
316
317
|
const effectiveMarginPx = Math.max(prevBlockMarginBottomPx, marginTopPx);
|
|
317
318
|
h += effectiveMarginPx;
|
|
318
319
|
const dh = text.fontSize * text.lineHeight;
|
|
320
|
+
let maxWidth = 0;
|
|
319
321
|
// Iterate over lines and handle text overflow based on the height limit if provided
|
|
320
322
|
for (let k = 0; k < lines.length; k += 1) {
|
|
321
323
|
let line = lines[k];
|
|
322
324
|
h += dh;
|
|
325
|
+
const lineWithEllipsis = `${line} …`;
|
|
326
|
+
const textLengthPx = fastMode
|
|
327
|
+
? estimateStringPixelLength(lineWithEllipsis, text.fontSize, text.fontWidthToHeightRatio)
|
|
328
|
+
: getPreciseStringLengthPx(lineWithEllipsis, text.fontFamily, text.fontSize);
|
|
329
|
+
maxWidth = Math.max(textLengthPx, maxWidth);
|
|
323
330
|
if (height && (h + dh) > height && (k !== lines.length - 1)) {
|
|
324
331
|
// Remove hyphen character from the end of the line if it's there
|
|
325
332
|
const lastCharacter = line.charAt(line.length - 1);
|
|
326
333
|
if (lastCharacter === UNOVIS_TEXT_HYPHEN_CHARACTER_DEFAULT) {
|
|
327
334
|
line = line.substr(0, lines[k].length - 1);
|
|
328
335
|
}
|
|
329
|
-
const lineWithEllipsis = `${line} …`;
|
|
330
|
-
const textLengthPx = fastMode
|
|
331
|
-
? estimateStringPixelLength(lineWithEllipsis, text.fontSize, text.fontWidthToHeightRatio)
|
|
332
|
-
: getPreciseStringLengthPx(lineWithEllipsis, text.fontFamily, text.fontSize);
|
|
333
336
|
if (textLengthPx < width) {
|
|
334
337
|
lines[k] = lineWithEllipsis;
|
|
335
338
|
}
|
|
@@ -341,7 +344,7 @@ function getWrappedText(text, width = undefined, height = undefined, fastMode =
|
|
|
341
344
|
}
|
|
342
345
|
}
|
|
343
346
|
// Create wrapped text block with its calculated properties
|
|
344
|
-
blocks.push(Object.assign(Object.assign({}, text), { _lines: lines, _estimatedHeight: h - ((prevBlock === null || prevBlock === void 0 ? void 0 : prevBlock._estimatedHeight) || 0) }));
|
|
347
|
+
blocks.push(Object.assign(Object.assign({}, text), { _lines: lines, _estimatedHeight: h - ((prevBlock === null || prevBlock === void 0 ? void 0 : prevBlock._estimatedHeight) || 0), _maxWidth: Math.max(maxWidth, (_a = prevBlock === null || prevBlock === void 0 ? void 0 : prevBlock._maxWidth) !== null && _a !== void 0 ? _a : 0) }));
|
|
345
348
|
});
|
|
346
349
|
return blocks;
|
|
347
350
|
}
|
|
@@ -402,29 +405,38 @@ const allowedSvgTextTags = ['text', 'tspan', 'textPath', 'altGlyph', 'altGlyphDe
|
|
|
402
405
|
* @param {UnovisText | UnovisText[]} text - The text or array of texts to render.
|
|
403
406
|
* @param {UnovisTextOptions} options - The text options.
|
|
404
407
|
*/
|
|
405
|
-
function renderTextToSvgTextElement(textElement, text, options) {
|
|
408
|
+
function renderTextToSvgTextElement(textElement, text, options, trimmed) {
|
|
406
409
|
var _a, _b;
|
|
407
410
|
const wrappedText = getWrappedText(text, options.width, undefined, options.fastMode, options.separator, options.wordBreak);
|
|
408
411
|
const textElementX = (_a = options.x) !== null && _a !== void 0 ? _a : +textElement.getAttribute('x');
|
|
409
412
|
const textElementY = (_b = options.y) !== null && _b !== void 0 ? _b : +textElement.getAttribute('y');
|
|
410
413
|
const x = textElementX !== null && textElementX !== void 0 ? textElementX : 0;
|
|
411
414
|
let y = textElementY !== null && textElementY !== void 0 ? textElementY : 0;
|
|
412
|
-
if (options.textAlign)
|
|
415
|
+
if (options.textAlign) {
|
|
413
416
|
textElement.setAttribute('text-anchor', getTextAnchorFromTextAlign(options.textAlign));
|
|
417
|
+
}
|
|
414
418
|
if (options.verticalAlign && options.verticalAlign !== VerticalAlign.Top) {
|
|
415
419
|
const height = estimateWrappedTextHeight(wrappedText);
|
|
416
420
|
const dy = options.verticalAlign === VerticalAlign.Middle ? -height / 2
|
|
417
421
|
: options.verticalAlign === VerticalAlign.Bottom ? -height : 0;
|
|
418
422
|
y += dy;
|
|
419
423
|
}
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
424
|
+
if (options.textRotationAngle) {
|
|
425
|
+
textElement.setAttribute('transform', `rotate(${(options.textRotationAngle === 0 || options.textRotationAngle) ? options.textRotationAngle : 0} ${x} ${y})`);
|
|
426
|
+
}
|
|
427
|
+
else {
|
|
428
|
+
textElement.removeAttribute('transform');
|
|
429
|
+
}
|
|
430
|
+
if (!trimmed) {
|
|
431
|
+
const parser = new DOMParser();
|
|
432
|
+
textElement.textContent = '';
|
|
433
|
+
wrappedText.forEach(block => {
|
|
434
|
+
const svgCode = renderTextToTspanStrings([block], x, y).join('');
|
|
435
|
+
const svgCodeSanitized = striptags(svgCode, allowedSvgTextTags);
|
|
436
|
+
const parsedSvgCode = parser.parseFromString(svgCodeSanitized, 'image/svg+xml').firstChild;
|
|
437
|
+
textElement.appendChild(parsedSvgCode);
|
|
438
|
+
});
|
|
439
|
+
}
|
|
428
440
|
}
|
|
429
441
|
/**
|
|
430
442
|
* Renders a text or array of texts into a frame.
|
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, ''') // Escapes quotes with '\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,EAAE,KAAK,CA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O,EAAE,kBAAkB,CAAC,CAAA;AAC/D,IAAA,MAAM,aAAa,GAAG,MAAM,CAAC,eAAe,CAAC,gBAAgB,EAAE,eAAe,CAAC,CAAC,UAAU,CAAA;AAE1F,IAAA,KAAK,CAAC,WAAW,GAAG,EAAE,CAAA;AACtB,IAAA,KAAK,CAAC,WAAW,CAAC,aAAa,CAAC,CAAA;AAClC;;;;"}
|
|
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, ''') // Escapes quotes with '\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 let maxWidth = 0\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 const lineWithEllipsis = `${line} …`\n const textLengthPx = fastMode\n ? estimateStringPixelLength(lineWithEllipsis, text.fontSize, text.fontWidthToHeightRatio)\n : getPreciseStringLengthPx(lineWithEllipsis, text.fontFamily, text.fontSize)\n\n maxWidth = Math.max(textLengthPx, maxWidth)\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 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), _maxWidth: Math.max(maxWidth, prevBlock?._maxWidth ?? 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 trimmed?: boolean\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) {\n textElement.setAttribute('text-anchor', getTextAnchorFromTextAlign(options.textAlign))\n }\n\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 if (options.textRotationAngle) {\n textElement.setAttribute('transform', `rotate(${(options.textRotationAngle === 0 || options.textRotationAngle) ? options.textRotationAngle : 0} ${x} ${y})`)\n } else {\n textElement.removeAttribute('transform')\n }\n\n if (!trimmed) {\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/**\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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