@meonode/canvas 1.0.0 → 1.1.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/Readme.md +142 -10
- package/dist/cjs/canvas/canvas.type.d.ts +101 -1
- package/dist/cjs/canvas/canvas.type.d.ts.map +1 -1
- package/dist/cjs/canvas/chart.canvas.util.d.ts +20 -0
- package/dist/cjs/canvas/chart.canvas.util.d.ts.map +1 -0
- package/dist/cjs/canvas/chart.canvas.util.js +582 -0
- package/dist/cjs/canvas/chart.canvas.util.js.map +1 -0
- package/dist/cjs/canvas/text.canvas.util.d.ts +18 -0
- package/dist/cjs/canvas/text.canvas.util.d.ts.map +1 -1
- package/dist/cjs/canvas/text.canvas.util.js +19 -0
- package/dist/cjs/canvas/text.canvas.util.js.map +1 -1
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/canvas/canvas.type.d.ts +101 -1
- package/dist/esm/canvas/canvas.type.d.ts.map +1 -1
- package/dist/esm/canvas/chart.canvas.util.d.ts +20 -0
- package/dist/esm/canvas/chart.canvas.util.d.ts.map +1 -0
- package/dist/esm/canvas/chart.canvas.util.js +578 -0
- package/dist/esm/canvas/text.canvas.util.d.ts +18 -0
- package/dist/esm/canvas/text.canvas.util.d.ts.map +1 -1
- package/dist/esm/canvas/text.canvas.util.js +19 -0
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chart.canvas.util.js","sources":["../../../../src/canvas/chart.canvas.util.ts"],"sourcesContent":["import { BoxNode, Row } from '@/canvas/layout.canvas.util.js'\nimport type { BaseProps, CartesianChartData, ChartDataset, ChartProps, ChartType, PieChartDataPoint } from '@/canvas/canvas.type.js'\nimport type { CanvasRenderingContext2D } from 'skia-canvas'\nimport { Style } from '@/constant/common.const.js'\nimport { TextNode } from '@/canvas/text.canvas.util.js'\n\nexport class ChartNode<T extends ChartType> extends BoxNode {\n private chartData: CartesianChartData | PieChartDataPoint[]\n private chartType: ChartProps<T>['type']\n private chartOptions: ChartProps<T>['options']\n\n constructor(props: ChartProps<T> & BaseProps) {\n // Set default intrinsic size if not provided\n const defaultWidth = props.width ?? 400\n const defaultHeight = props.height ?? 300\n\n super({\n ...props,\n width: defaultWidth,\n height: defaultHeight,\n name: 'Chart',\n })\n\n this.chartData = props.data\n this.chartType = props.type\n this.chartOptions = {\n showLabels: true,\n showLegend: true,\n labelFontSize: 12,\n legendPosition: 'bottom',\n ...props.options,\n }\n\n this.validateProps()\n }\n\n private validateProps() {\n if (this.chartType === 'bar' || this.chartType === 'line') {\n const data = this.chartData as CartesianChartData\n if (!data.labels || !data.datasets) {\n console.warn(`[ChartNode] Warning: Cartesian chart (${this.chartType}) is missing 'labels' or 'datasets' in its data prop.`)\n }\n data.datasets?.forEach((dataset, i) => {\n if (dataset.data.length !== data.labels.length) {\n console.warn(\n `[ChartNode] Warning: In dataset ${i} (\"${dataset.label}\"), the number of data points (${dataset.data.length}) does not match the number of labels (${data.labels.length}).`,\n )\n }\n })\n } else if (this.chartType === 'pie' || this.chartType === 'doughnut') {\n const data = this.chartData as PieChartDataPoint[]\n if (!Array.isArray(data)) {\n console.warn(`[ChartNode] Warning: ${this.chartType} chart expects an array of PieChartDataPoint, but received a different type.`)\n }\n }\n }\n\n protected _renderContent(ctx: CanvasRenderingContext2D, x: number, y: number, width: number, height: number) {\n // First render background/borders from parent\n super._renderContent(ctx, x, y, width, height)\n\n // Then render chart-specific content\n const paddingLeft = this.node.getComputedPadding(Style.Edge.Left)\n const paddingRight = this.node.getComputedPadding(Style.Edge.Right)\n const paddingTop = this.node.getComputedPadding(Style.Edge.Top)\n const paddingBottom = this.node.getComputedPadding(Style.Edge.Bottom)\n const contentX = x + paddingLeft\n const contentY = y + paddingTop\n const contentWidth = width - paddingLeft - paddingRight\n const contentHeight = height - paddingTop - paddingBottom\n\n switch (this.chartType) {\n case 'bar':\n this.renderBarChart(ctx, contentX, contentY, contentWidth, contentHeight)\n break\n case 'line':\n this.renderLineChart(ctx, contentX, contentY, contentWidth, contentHeight)\n break\n case 'pie':\n this.renderPieChart(ctx, contentX, contentY, contentWidth, contentHeight)\n break\n case 'doughnut':\n this.renderDoughnutChart(ctx, contentX, contentY, contentWidth, contentHeight)\n break\n }\n }\n\n private getLegendLayout(ctx: CanvasRenderingContext2D, totalWidth: number, totalHeight: number) {\n if (!this.chartOptions?.showLegend) {\n return { x: 0, y: 0, width: 0, height: 0, chartWidth: totalWidth, chartHeight: totalHeight, chartX: 0, chartY: 0 }\n }\n\n const legendItems = 'datasets' in this.chartData ? this.chartData.datasets : (this.chartData as PieChartDataPoint[])\n if (legendItems.length === 0) {\n return { x: 0, y: 0, width: 0, height: 0, chartWidth: totalWidth, chartHeight: totalHeight, chartX: 0, chartY: 0 }\n }\n\n const fontSize = this.chartOptions?.labelFontSize || 12\n ctx.font = `${fontSize}px ${this.props.fontFamily || 'sans-serif'}`\n const metrics = ctx.measureText('Mg')\n const textHeight = metrics.actualBoundingBoxAscent + metrics.actualBoundingBoxDescent\n const itemHeight = Math.ceil(textHeight + 8)\n const position = this.chartOptions.legendPosition\n const boxSize = Math.min(15, itemHeight - 2)\n\n const legendItemLabels =\n 'datasets' in this.chartData ? this.chartData.datasets.map(d => d.label) : (this.chartData as PieChartDataPoint[]).map(p => `${p.label} (${p.value})`)\n\n let calculatedLegendHeight: number\n let calculatedLegendWidth: number\n\n if (position === 'top' || position === 'bottom') {\n let currentX = 0\n let numRows = 1\n const itemPadding = 20\n legendItemLabels.forEach(label => {\n const labelWidth = ctx.measureText(label).width\n const itemWidth = boxSize + 5 + labelWidth + itemPadding\n\n if (currentX > 0 && currentX + itemWidth > totalWidth) {\n numRows++\n currentX = 0\n }\n currentX += itemWidth\n })\n calculatedLegendHeight = numRows * itemHeight + 10\n calculatedLegendWidth = totalWidth\n } else {\n // 'left' or 'right'\n const maxLabelWidth = Math.max(...legendItemLabels.map(label => ctx.measureText(label).width))\n calculatedLegendWidth = maxLabelWidth + boxSize + 25 // padding + box + padding + text\n calculatedLegendHeight = totalHeight\n }\n\n let effectiveChartWidth = totalWidth\n let effectiveChartHeight = totalHeight\n let legendAreaX: number\n let legendAreaY: number\n let chartAreaX: number\n let chartAreaY: number\n let legendAreaWidth: number\n let legendAreaHeight: number\n\n if (position === 'top' || position === 'bottom') {\n effectiveChartHeight -= calculatedLegendHeight\n legendAreaHeight = calculatedLegendHeight\n legendAreaWidth = totalWidth\n legendAreaX = 0\n chartAreaX = 0\n\n if (position === 'top') {\n chartAreaY = calculatedLegendHeight\n legendAreaY = 0\n } else {\n // bottom\n legendAreaY = effectiveChartHeight\n chartAreaY = 0\n }\n } else {\n // 'left' or 'right'\n effectiveChartWidth -= calculatedLegendWidth\n legendAreaWidth = calculatedLegendWidth\n legendAreaHeight = totalHeight\n legendAreaY = 0\n chartAreaY = 0\n\n if (position === 'left') {\n chartAreaX = calculatedLegendWidth\n legendAreaX = 0\n } else {\n // right\n legendAreaX = effectiveChartWidth\n chartAreaX = 0\n }\n }\n\n return {\n x: legendAreaX,\n y: legendAreaY,\n width: legendAreaWidth,\n height: legendAreaHeight,\n chartWidth: effectiveChartWidth,\n chartHeight: effectiveChartHeight,\n chartX: chartAreaX,\n chartY: chartAreaY,\n }\n }\n\n private renderBarChart(ctx: CanvasRenderingContext2D, x: number, y: number, width: number, height: number) {\n if (this.chartType !== 'bar') return\n const chartData = this.chartData as CartesianChartData\n const chartOptions = this.chartOptions as ChartProps<'bar'>['options']\n\n const legendLayout = this.getLegendLayout(ctx, width, height)\n const chartX = x + legendLayout.chartX\n const chartY = y + legendLayout.chartY\n const chartWidth = legendLayout.chartWidth\n const chartHeight = legendLayout.chartHeight\n\n const { labels, datasets } = chartData\n const maxValue = Math.max(...datasets.flatMap(d => d.data))\n\n let labelHeight = 0\n if (chartOptions?.showLabels) {\n const fontSize = chartOptions.labelFontSize || 12\n ctx.font = `${fontSize}px ${this.props.fontFamily || 'sans-serif'}`\n const metrics = ctx.measureText('Mg')\n labelHeight = metrics.actualBoundingBoxAscent + metrics.actualBoundingBoxDescent + 10 // with padding\n }\n const finalChartHeight = chartHeight - labelHeight\n\n const groupWidth = chartWidth / labels.length\n const barSpacing = groupWidth * 0.2\n const barWidth = (groupWidth - barSpacing) / datasets.length\n\n // Render grid\n if (chartOptions?.grid?.show) {\n ctx.strokeStyle = chartOptions.grid.color || '#e0e0e0'\n ctx.lineWidth = 1\n if (chartOptions.grid.style === 'dashed') {\n ctx.setLineDash([5, 5])\n } else if (chartOptions.grid.style === 'dotted') {\n ctx.setLineDash([2, 2])\n }\n\n for (let i = 0; i <= 5; i++) {\n const gridY = chartY + (finalChartHeight / 5) * i\n ctx.beginPath()\n ctx.moveTo(chartX, gridY)\n ctx.lineTo(chartX + chartWidth, gridY)\n ctx.stroke()\n }\n ctx.setLineDash([])\n }\n\n // Render bars\n labels.forEach((label, index) => {\n const groupX = chartX + index * groupWidth + barSpacing / 2\n\n datasets.forEach((dataset, datasetIndex) => {\n const barHeight = (dataset.data[index] / maxValue) * finalChartHeight\n const barX = groupX + datasetIndex * barWidth\n const barY = chartY + finalChartHeight - barHeight\n\n ctx.fillStyle = dataset.color || this.generateColor(datasetIndex)\n ctx.fillRect(barX, barY, barWidth, barHeight)\n })\n\n // Render labels\n if (chartOptions?.showLabels) {\n const { renderLabelItem } = chartOptions\n if (renderLabelItem) {\n const labelNode = renderLabelItem({ item: label, index })\n if (labelNode) {\n labelNode.processInitialChildren()\n labelNode.node.calculateLayout(undefined, undefined, Style.Direction.LTR)\n const layout = labelNode.node.getComputedLayout()\n labelNode.render(ctx, groupX + (groupWidth - barSpacing) / 2 - layout.width / 2, chartY + finalChartHeight + labelHeight / 2 - layout.height / 2)\n }\n } else {\n TextNode.renderSimpleText(ctx, label, groupX + (groupWidth - barSpacing) / 2, chartY + finalChartHeight + labelHeight / 2, {\n color: chartOptions.labelColor || chartOptions.axisColor,\n fontSize: chartOptions.labelFontSize,\n fontFamily: this.props.fontFamily,\n textAlign: 'center',\n textBaseline: 'middle',\n })\n }\n }\n })\n\n // Render legend\n if (chartOptions?.showLegend) {\n this.renderLegend(ctx, x + legendLayout.x, y + legendLayout.y, legendLayout.width, legendLayout.height)\n }\n }\n\n private renderLineChart(ctx: CanvasRenderingContext2D, x: number, y: number, width: number, height: number) {\n if (this.chartType !== 'line') return\n const chartData = this.chartData as CartesianChartData\n const chartOptions = this.chartOptions as ChartProps<'line'>['options']\n\n const legendLayout = this.getLegendLayout(ctx, width, height)\n const chartX = x + legendLayout.chartX\n const chartY = y + legendLayout.chartY\n const chartWidth = legendLayout.chartWidth\n const chartHeight = legendLayout.chartHeight\n\n const { labels, datasets } = chartData\n const maxValue = Math.max(...datasets.flatMap(d => d.data))\n\n let labelHeight = 0\n if (chartOptions?.showLabels) {\n const fontSize = chartOptions.labelFontSize || 12\n ctx.font = `${fontSize}px ${this.props.fontFamily || 'sans-serif'}`\n const metrics = ctx.measureText('Mg')\n labelHeight = metrics.actualBoundingBoxAscent + metrics.actualBoundingBoxDescent + 10 // with padding\n }\n const finalChartHeight = chartHeight - labelHeight\n const pointSpacing = chartWidth / (labels.length > 1 ? labels.length - 1 : 1)\n\n // Render grid\n if (chartOptions?.grid?.show) {\n ctx.strokeStyle = chartOptions.grid.color || '#e0e0e0'\n ctx.lineWidth = 1\n if (chartOptions.grid.style === 'dashed') {\n ctx.setLineDash([5, 5])\n } else if (chartOptions.grid.style === 'dotted') {\n ctx.setLineDash([2, 2])\n }\n\n for (let i = 0; i <= 5; i++) {\n const gridY = chartY + (finalChartHeight / 5) * i\n ctx.beginPath()\n ctx.moveTo(chartX, gridY)\n ctx.lineTo(chartX + chartWidth, gridY)\n ctx.stroke()\n }\n ctx.setLineDash([])\n }\n\n // Render lines and points\n datasets.forEach((dataset, datasetIndex) => {\n ctx.strokeStyle = dataset.color || this.generateColor(datasetIndex)\n ctx.lineWidth = 2\n ctx.beginPath()\n\n dataset.data.forEach((value, index) => {\n const pointX = chartX + index * pointSpacing\n const pointY = chartY + finalChartHeight - (value / maxValue) * finalChartHeight\n\n if (index === 0) {\n ctx.moveTo(pointX, pointY)\n } else {\n ctx.lineTo(pointX, pointY)\n }\n })\n ctx.stroke()\n\n // Render points\n dataset.data.forEach((value, index) => {\n const pointX = chartX + index * pointSpacing\n const pointY = chartY + finalChartHeight - (value / maxValue) * finalChartHeight\n ctx.fillStyle = dataset.color || this.generateColor(datasetIndex)\n ctx.beginPath()\n ctx.arc(pointX, pointY, 4, 0, Math.PI * 2)\n ctx.fill()\n })\n })\n\n // Render labels\n if (chartOptions?.showLabels) {\n const { renderLabelItem } = chartOptions\n labels.forEach((label, index) => {\n const pointX = chartX + index * pointSpacing\n if (renderLabelItem) {\n const labelNode = renderLabelItem({ item: label, index })\n if (labelNode) {\n labelNode.processInitialChildren()\n labelNode.node.calculateLayout(undefined, undefined, Style.Direction.LTR)\n const layout = labelNode.node.getComputedLayout()\n labelNode.render(ctx, pointX - layout.width / 2, chartY + finalChartHeight + labelHeight / 2 - layout.height / 2)\n }\n } else {\n TextNode.renderSimpleText(ctx, label, pointX, chartY + finalChartHeight + labelHeight / 2, {\n color: chartOptions.labelColor || chartOptions.axisColor,\n fontSize: chartOptions.labelFontSize,\n fontFamily: this.props.fontFamily,\n textAlign: 'center',\n textBaseline: 'middle',\n })\n }\n })\n }\n\n if (chartOptions?.showLegend) {\n this.renderLegend(ctx, x + legendLayout.x, y + legendLayout.y, legendLayout.width, legendLayout.height)\n }\n }\n\n private renderPieChart(ctx: CanvasRenderingContext2D, x: number, y: number, width: number, height: number) {\n if (this.chartType !== 'pie') return\n const data = this.chartData as PieChartDataPoint[]\n const chartOptions = this.chartOptions as ChartProps<'pie'>['options']\n\n const legendLayout = this.getLegendLayout(ctx, width, height)\n const chartX = x + legendLayout.chartX\n const chartY = y + legendLayout.chartY\n const chartWidth = legendLayout.chartWidth\n const chartHeight = legendLayout.chartHeight\n\n const centerX = chartX + chartWidth / 2\n const centerY = chartY + chartHeight / 2\n const radius = Math.min(chartWidth, chartHeight) / 2 - 10\n\n const total = data.reduce((sum, point) => sum + point.value, 0)\n let currentAngle = -Math.PI / 2 // Start at top\n\n data.forEach((point, index) => {\n const sliceAngle = (point.value / total) * Math.PI * 2\n const startAngle = currentAngle\n const endAngle = currentAngle + sliceAngle\n\n ctx.fillStyle = point.color || this.generateColor(index)\n ctx.beginPath()\n ctx.moveTo(centerX, centerY)\n ctx.arc(centerX, centerY, radius, startAngle, endAngle)\n ctx.closePath()\n ctx.fill()\n\n // Draw slice border\n ctx.strokeStyle = '#fff'\n ctx.lineWidth = 2\n ctx.stroke()\n\n // Render labels\n if (chartOptions?.showLabels) {\n const { renderLabelItem } = chartOptions\n const labelAngle = startAngle + sliceAngle / 2\n const labelRadius = radius * 0.7\n const labelX = centerX + Math.cos(labelAngle) * labelRadius\n const labelY = centerY + Math.sin(labelAngle) * labelRadius\n\n if (renderLabelItem) {\n const labelNode = renderLabelItem({ item: point, index })\n if (labelNode) {\n labelNode.processInitialChildren()\n labelNode.node.calculateLayout(undefined, undefined, Style.Direction.LTR)\n const layout = labelNode.node.getComputedLayout()\n labelNode.render(ctx, labelX - layout.width / 2, labelY - layout.height / 2)\n }\n } else {\n TextNode.renderSimpleText(ctx, point.label, labelX, labelY, {\n color: chartOptions.labelColor,\n fontSize: chartOptions.labelFontSize,\n fontFamily: this.props.fontFamily,\n textAlign: 'center',\n textBaseline: 'middle',\n })\n }\n }\n\n currentAngle = endAngle\n })\n\n if (chartOptions?.showLegend) {\n this.renderLegend(ctx, x + legendLayout.x, y + legendLayout.y, legendLayout.width, legendLayout.height)\n }\n }\n\n private renderDoughnutChart(ctx: CanvasRenderingContext2D, x: number, y: number, width: number, height: number) {\n if (this.chartType !== 'doughnut') return\n const data = this.chartData as PieChartDataPoint[]\n const chartOptions = this.chartOptions as ChartProps<'doughnut'>['options']\n\n const legendLayout = this.getLegendLayout(ctx, width, height)\n const chartX = x + legendLayout.chartX\n const chartY = y + legendLayout.chartY\n const chartWidth = legendLayout.chartWidth\n const chartHeight = legendLayout.chartHeight\n\n const centerX = chartX + chartWidth / 2\n const centerY = chartY + chartHeight / 2\n const outerRadius = Math.min(chartWidth, chartHeight) / 2 - 10\n const innerRadius = outerRadius * (chartOptions?.innerRadius ?? 0.6)\n\n const total = data.reduce((sum, point) => sum + point.value, 0)\n let currentAngle = -Math.PI / 2\n\n data.forEach((point, index) => {\n const sliceAngle = (point.value / total) * Math.PI * 2\n const startAngle = currentAngle\n const endAngle = currentAngle + sliceAngle\n\n ctx.fillStyle = point.color || this.generateColor(index)\n ctx.beginPath()\n ctx.arc(centerX, centerY, outerRadius, startAngle, endAngle)\n ctx.arc(centerX, centerY, innerRadius, endAngle, startAngle, true)\n ctx.closePath()\n ctx.fill()\n\n ctx.strokeStyle = '#fff'\n ctx.lineWidth = 2\n ctx.stroke()\n\n // Render labels\n if (chartOptions?.showLabels) {\n const { renderLabelItem } = chartOptions\n const labelAngle = startAngle + sliceAngle / 2\n const labelRadius = innerRadius + (outerRadius - innerRadius) / 2\n const labelX = centerX + Math.cos(labelAngle) * labelRadius\n const labelY = centerY + Math.sin(labelAngle) * labelRadius\n\n if (renderLabelItem) {\n const labelNode = renderLabelItem({ item: point, index })\n if (labelNode) {\n labelNode.processInitialChildren()\n labelNode.node.calculateLayout(undefined, undefined, Style.Direction.LTR)\n const layout = labelNode.node.getComputedLayout()\n labelNode.render(ctx, labelX - layout.width / 2, labelY - layout.height / 2)\n }\n } else {\n TextNode.renderSimpleText(ctx, point.label, labelX, labelY, {\n color: chartOptions.labelColor,\n fontSize: chartOptions.labelFontSize,\n fontFamily: this.props.fontFamily,\n textAlign: 'center',\n textBaseline: 'middle',\n })\n }\n }\n\n currentAngle = endAngle\n })\n\n if (chartOptions?.showLegend) {\n this.renderLegend(ctx, x + legendLayout.x, y + legendLayout.y, legendLayout.width, legendLayout.height)\n }\n }\n\n private renderLegend(ctx: CanvasRenderingContext2D, x: number, y: number, width: number, height: number) {\n const { renderLegendItem } = this.chartOptions\n\n if (renderLegendItem) {\n let legendNodes: (BoxNode | null | undefined)[]\n if (this.chartType === 'bar' || this.chartType === 'line') {\n const items = (this.chartData as CartesianChartData).datasets\n const render = renderLegendItem as (props: { item: ChartDataset; index: number; color: string }) => BoxNode | null | undefined\n legendNodes = items.map((item, index) => {\n const color = item.color || this.generateColor(index)\n return render({ item, index, color })\n })\n } else {\n const items = this.chartData as PieChartDataPoint[]\n const render = renderLegendItem as (props: { item: PieChartDataPoint; index: number; color: string }) => BoxNode | null | undefined\n legendNodes = items.map((item, index) => {\n const color = item.color || this.generateColor(index)\n return render({ item, index, color })\n })\n }\n\n const finalNodes = legendNodes.filter((node): node is BoxNode => !!node)\n\n if (finalNodes.length > 0) {\n const legendContainer = Row({\n children: finalNodes,\n width,\n height,\n justifyContent: Style.Justify.Center,\n alignItems: Style.Align.Center,\n flexWrap: Style.Wrap.Wrap,\n gap: 10,\n })\n legendContainer.processInitialChildren()\n legendContainer.node.calculateLayout(width, height, Style.Direction.LTR)\n legendContainer.render(ctx, x, y)\n }\n return\n }\n\n // Fallback to default rendering if renderLegendItem is not provided\n const legendItems =\n 'datasets' in this.chartData\n ? this.chartData.datasets.map(d => ({ label: d.label, value: d.data.reduce((a, b) => a + b, 0) }))\n : (this.chartData as PieChartDataPoint[])\n const fontSize = this.chartOptions?.labelFontSize || 12\n ctx.font = `${fontSize}px ${this.props.fontFamily || 'sans-serif'}`\n\n const metrics = ctx.measureText('Mg')\n const textHeight = metrics.actualBoundingBoxAscent + metrics.actualBoundingBoxDescent\n const itemHeight = Math.ceil(textHeight + 8)\n const boxSize = Math.min(15, itemHeight - 2)\n\n const position = this.chartOptions.legendPosition\n if (position === 'top' || position === 'bottom') {\n const itemPadding = 20 // horizontal padding between items\n const rows: { items: { label: string; color: string; width: number }[]; width: number }[] = []\n let currentRow: { items: { label: string; color: string; width: number }[]; width: number } = { items: [], width: 0 }\n\n legendItems.forEach((point, index) => {\n const color =\n ('datasets' in this.chartData ? (this.chartData as CartesianChartData).datasets[index].color : (point as any).color) || this.generateColor(index)\n const label = 'datasets' in this.chartData ? point.label : `${point.label} (${point.value})`\n const labelWidth = ctx.measureText(label).width\n const itemWidth = boxSize + 5 + labelWidth\n\n if (currentRow.items.length > 0 && currentRow.width + itemPadding + itemWidth > width) {\n rows.push(currentRow)\n currentRow = { items: [], width: 0 }\n }\n\n currentRow.items.push({ label, color, width: itemWidth })\n currentRow.width += itemWidth + (currentRow.items.length > 1 ? itemPadding : 0)\n })\n rows.push(currentRow)\n\n let currentY = y + 5\n rows.forEach(row => {\n let currentX = x + (width - row.width) / 2\n row.items.forEach(item => {\n const boxY = currentY + (itemHeight - boxSize) / 2\n ctx.fillStyle = item.color\n ctx.fillRect(currentX, boxY, boxSize, boxSize)\n\n TextNode.renderSimpleText(ctx, item.label, currentX + boxSize + 5, currentY + itemHeight / 2, {\n color: this.chartOptions?.labelColor,\n fontSize,\n fontFamily: this.props.fontFamily,\n textAlign: 'left',\n textBaseline: 'middle',\n })\n\n currentX += item.width + itemPadding\n })\n currentY += itemHeight\n })\n } else {\n // 'left' or 'right'\n const totalHeight = legendItems.length * itemHeight\n const startY = y + (height - totalHeight) / 2\n\n legendItems.forEach((point, index) => {\n const itemX = x + 10\n const itemY = startY + index * itemHeight\n\n const boxY = itemY + (itemHeight - boxSize) / 2\n ctx.fillStyle =\n ('datasets' in this.chartData ? (this.chartData as CartesianChartData).datasets[index].color : (point as any).color) || this.generateColor(index)\n ctx.fillRect(itemX, boxY, boxSize, boxSize)\n\n const label = 'datasets' in this.chartData ? point.label : `${point.label} (${point.value})`\n TextNode.renderSimpleText(ctx, label, itemX + boxSize + 5, itemY + itemHeight / 2, {\n color: this.chartOptions?.labelColor,\n fontSize,\n fontFamily: this.props.fontFamily,\n textAlign: 'left',\n textBaseline: 'middle',\n })\n })\n }\n }\n\n private generateColor(index: number): string {\n const colors = ['#FF6384', '#36A2EB', '#FFCE56', '#4BC0C0', '#9966FF', '#FF9F40', '#C9CBCF']\n return colors[index % colors.length]\n }\n}\n\nexport const Chart = <T extends ChartType>(props: ChartProps<T> & BaseProps): ChartNode<T> => new ChartNode(props)\n"],"names":["BoxNode","Style","TextNode","Row"],"mappings":";;;;;;AAMM,MAAO,SAA+B,SAAQA,0BAAO,CAAA;AACjD,IAAA,SAAS;AACT,IAAA,SAAS;AACT,IAAA,YAAY;AAEpB,IAAA,WAAA,CAAY,KAAgC,EAAA;;AAE1C,QAAA,MAAM,YAAY,GAAG,KAAK,CAAC,KAAK,IAAI,GAAG;AACvC,QAAA,MAAM,aAAa,GAAG,KAAK,CAAC,MAAM,IAAI,GAAG;AAEzC,QAAA,KAAK,CAAC;AACJ,YAAA,GAAG,KAAK;AACR,YAAA,KAAK,EAAE,YAAY;AACnB,YAAA,MAAM,EAAE,aAAa;AACrB,YAAA,IAAI,EAAE,OAAO;AACd,SAAA,CAAC;AAEF,QAAA,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,IAAI;AAC3B,QAAA,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,IAAI;QAC3B,IAAI,CAAC,YAAY,GAAG;AAClB,YAAA,UAAU,EAAE,IAAI;AAChB,YAAA,UAAU,EAAE,IAAI;AAChB,YAAA,aAAa,EAAE,EAAE;AACjB,YAAA,cAAc,EAAE,QAAQ;YACxB,GAAG,KAAK,CAAC,OAAO;SACjB;QAED,IAAI,CAAC,aAAa,EAAE;IACtB;IAEQ,aAAa,GAAA;AACnB,QAAA,IAAI,IAAI,CAAC,SAAS,KAAK,KAAK,IAAI,IAAI,CAAC,SAAS,KAAK,MAAM,EAAE;AACzD,YAAA,MAAM,IAAI,GAAG,IAAI,CAAC,SAA+B;YACjD,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;gBAClC,OAAO,C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,CAAC,KAAK,CAAA,EAAA,EAAK,KAAK,CAAC,KAAK,CAAA,CAAA,CAAG;AAC5F,gBAAAA,yBAAQ,CAAC,gBAAgB,CAAC,GAAG,EAAE,KAAK,EAAE,KAAK,GAAG,OAAO,GAAG,CAAC,EAAE,KAAK,GAAG,UAAU,GAAG,CAAC,EAAE;AACjF,oBAAA,KAAK,EAAE,IAAI,CAAC,YAAY,EAAE,UAAU;oBACpC,QAAQ;AACR,oBAAA,UAAU,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU;AACjC,oBAAA,SAAS,EAAE,MAAM;AACjB,oBAAA,YAAY,EAAE,QAAQ;AACvB,iBAAA,CAAC;AACJ,YAAA,CAAC,CAAC;QACJ;IACF;AAEQ,IAAA,aAAa,CAAC,KAAa,EAAA;AACjC,QAAA,MAAM,MAAM,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC;QAC5F,OAAO,MAAM,CAAC,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC;IACtC;AACD;AAEM,MAAM,KAAK,GAAG,CAAsB,KAAgC,KAAmB,IAAI,SAAS,CAAC,KAAK;;;;;"}
|
|
@@ -17,6 +17,24 @@ export declare class TextNode extends BoxNode {
|
|
|
17
17
|
lineGap: number;
|
|
18
18
|
};
|
|
19
19
|
constructor(text?: number | string, props?: TextProps);
|
|
20
|
+
/**
|
|
21
|
+
* Renders a simple, single-line text string without complex layout calculations.
|
|
22
|
+
* A lightweight, static utility for drawing text where layout is handled externally.
|
|
23
|
+
* @param ctx The canvas rendering context.
|
|
24
|
+
* @param text The string to render.
|
|
25
|
+
* @param x The x-coordinate for rendering.
|
|
26
|
+
* @param y The y-coordinate for rendering.
|
|
27
|
+
* @param props Basic text styling properties.
|
|
28
|
+
*/
|
|
29
|
+
static renderSimpleText(ctx: CanvasRenderingContext2D, text: string, x: number, y: number, props?: {
|
|
30
|
+
fontFamily?: string;
|
|
31
|
+
fontSize?: number;
|
|
32
|
+
fontWeight?: TextProps['fontWeight'];
|
|
33
|
+
fontStyle?: TextProps['fontStyle'];
|
|
34
|
+
color?: string;
|
|
35
|
+
textAlign?: CanvasRenderingContext2D['textAlign'];
|
|
36
|
+
textBaseline?: CanvasRenderingContext2D['textBaseline'];
|
|
37
|
+
}): void;
|
|
20
38
|
protected applyDefaults(): void;
|
|
21
39
|
/**
|
|
22
40
|
* Processes Unix-like escape sequences in text strings.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.canvas.util.d.ts","sourceRoot":"","sources":["../../../src/canvas/text.canvas.util.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAe,MAAM,yBAAyB,CAAA;AACrE,OAAO,EAAU,KAAK,wBAAwB,EAA2B,MAAM,aAAa,CAAA;AAC5F,OAAO,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAA;AAGxD;;;GAGG;AACH,qBAAa,QAAS,SAAQ,OAAO;IACnC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAoB;IAC7C,OAAO,CAAC,KAAK,CAAsB;IACnC,OAAO,CAAC,MAAM,CAAC,kBAAkB,CAAwC;IACzE,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAU;IACxC,OAAO,CAAC,WAAW,CAAe;IAClC,OAAO,CAAC,WAAW,CAAe;IAClC,OAAO,CAAC,kBAAkB,CAAe;IAEjC,KAAK,EAAE,SAAS,GAAG;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAA;gBAElC,IAAI,GAAE,MAAM,GAAG,MAAW,EAAE,KAAK,GAAE,SAAc;
|
|
1
|
+
{"version":3,"file":"text.canvas.util.d.ts","sourceRoot":"","sources":["../../../src/canvas/text.canvas.util.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAe,MAAM,yBAAyB,CAAA;AACrE,OAAO,EAAU,KAAK,wBAAwB,EAA2B,MAAM,aAAa,CAAA;AAC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;OAEG;IACH,OAAO,CAAC,yBAAyB;IAQjC;;;;;;;;;;;;;;OAcG;IACH,OAAO,CAAC,WAAW;IA8NnB;;;;;;;;;OASG;IACH,OAAO,CAAC,YAAY;IAuKpB;;;;;;;OAOG;IACH,OAAO,CAAC,aAAa;IAmErB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAQzB;;;;;;;;;;;;;;;;OAgBG;cACgB,cAAc,CAAC,GAAG,EAAE,wBAAwB,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;CA8UrH;AAED;;GAEG;AACH,eAAO,MAAM,IAAI,GAAI,MAAM,MAAM,GAAG,MAAM,EAAE,QAAQ,SAAS,aAA8B,CAAA"}
|
|
@@ -39,6 +39,25 @@ class TextNode extends layout_canvas_util.BoxNode {
|
|
|
39
39
|
this.node.setMeasureFunc(this.measureText.bind(this));
|
|
40
40
|
this.applyDefaults();
|
|
41
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* Renders a simple, single-line text string without complex layout calculations.
|
|
44
|
+
* A lightweight, static utility for drawing text where layout is handled externally.
|
|
45
|
+
* @param ctx The canvas rendering context.
|
|
46
|
+
* @param text The string to render.
|
|
47
|
+
* @param x The x-coordinate for rendering.
|
|
48
|
+
* @param y The y-coordinate for rendering.
|
|
49
|
+
* @param props Basic text styling properties.
|
|
50
|
+
*/
|
|
51
|
+
static renderSimpleText(ctx, text, x, y, props = {}) {
|
|
52
|
+
ctx.save();
|
|
53
|
+
const { fontFamily = 'sans-serif', fontSize = 12, fontWeight = 'normal', fontStyle = 'normal', color = '#333', textAlign = 'left', textBaseline = 'alphabetic', } = props;
|
|
54
|
+
ctx.font = `${fontStyle} ${fontWeight} ${fontSize}px ${fontFamily}`;
|
|
55
|
+
ctx.fillStyle = color;
|
|
56
|
+
ctx.textAlign = textAlign;
|
|
57
|
+
ctx.textBaseline = textBaseline;
|
|
58
|
+
ctx.fillText(text, x, y);
|
|
59
|
+
ctx.restore();
|
|
60
|
+
}
|
|
42
61
|
applyDefaults() {
|
|
43
62
|
const textDefaults = {
|
|
44
63
|
fontSize: 16,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.canvas.util.js","sources":["../../../../src/canvas/text.canvas.util.ts"],"sourcesContent":["// TODO: Add comprehensive unit tests for this file.\n\nimport type { TextProps, TextSegment } from '@/canvas/canvas.type.js'\nimport { Canvas, type CanvasRenderingContext2D, type FontVariantSetting } from 'skia-canvas'\nimport { BoxNode } from '@/canvas/layout.canvas.util.js'\nimport { Style, MeasureMode } from '@/constant/common.const.js'\n\n/**\n * Node for rendering text content with rich text styling support\n * Supports color and weight variations through HTML-like tags\n */\nexport class TextNode extends BoxNode {\n private readonly segments: TextSegment[] = []\n private lines: TextSegment[][] = []\n private static measurementContext: CanvasRenderingContext2D | null = null\n private readonly metricsString = 'Ag|``'\n private lineHeights: number[] = []\n private lineAscents: number[] = []\n private lineContentHeights: number[] = []\n\n declare props: TextProps & { lineGap: number }\n\n constructor(text: number | string = '', props: TextProps = {}) {\n const initialProps = {\n name: 'TextNode',\n flexShrink: 1,\n lineGap: 0,\n ...props,\n children: undefined,\n }\n super(initialProps)\n this.props = initialProps\n // Process escape sequences before parsing rich text\n const processedText = this.processEscapeSequences(String(text ?? ''))\n this.segments = this.parseRichText(processedText, {\n color: this.props.color,\n weight: this.props.fontWeight,\n size: this.props.fontSize,\n b: this.props.fontWeight === 'bold',\n i: this.props.fontStyle === 'italic',\n })\n this.node.setMeasureFunc(this.measureText.bind(this))\n this.applyDefaults()\n }\n\n protected override applyDefaults(): void {\n const textDefaults: Required<\n Pick<TextProps, 'fontSize' | 'fontFamily' | 'fontWeight' | 'fontStyle' | 'color' | 'textAlign' | 'verticalAlign' | 'ellipsis' | 'lineGap'>\n > & {\n lineHeight: undefined | number\n maxLines: undefined | number\n letterSpacing: undefined | number\n wordSpacing: undefined | number\n fontVariant: undefined | FontVariantSetting\n } = {\n fontSize: 16,\n fontFamily: 'sans-serif',\n fontWeight: 'normal',\n fontStyle: 'normal',\n color: 'black',\n textAlign: 'left',\n verticalAlign: 'top',\n fontVariant: undefined,\n lineHeight: undefined,\n lineGap: 0,\n maxLines: undefined,\n ellipsis: false,\n letterSpacing: undefined,\n wordSpacing: undefined,\n }\n\n let defaultsApplied = false\n for (const key of Object.keys(textDefaults) as (keyof typeof textDefaults)[]) {\n if (this.props[key] === undefined && textDefaults[key] !== undefined) {\n this.props[key as string] = textDefaults[key]\n defaultsApplied = true\n }\n }\n\n if (defaultsApplied && !this.node.isDirty()) {\n const affectsMeasurement = [\n 'fontSize',\n 'fontFamily',\n 'fontWeight',\n 'fontStyle',\n 'lineHeight',\n 'maxLines',\n 'lineGap',\n 'letterSpacing',\n 'wordSpacing',\n ].some(measureKey => this.props[measureKey] === textDefaults[measureKey])\n if (affectsMeasurement) {\n this.node.markDirty()\n }\n }\n }\n\n /**\n * Processes Unix-like escape sequences in text strings.\n * Converts escaped characters into their actual representations.\n *\n * Supported escape sequences:\n * - \\n - Newline (line feed)\n * - \\t - Tab (converted to 4 spaces)\n * - \\r - Carriage return (treated as newline)\n * - \\\\ - Literal backslash\n * - \\' - Single quote\n * - \\\" - Double quote\n * - \\0 - Null character (removed)\n * - \\b - Backspace (removed)\n * - \\f - Form feed (treated as newline)\n * - \\v - Vertical tab (treated as newline)\n * @param input Raw text string potentially containing escape sequences\n * @returns Processed string with escape sequences converted\n */\n private processEscapeSequences(input: string): string {\n return input.replace(/\\\\(.)/g, (match, char) => {\n switch (char) {\n case 'n':\n return '\\n' // Newline\n case 't':\n return ' ' // Tab as 4 spaces\n case 'r':\n return '\\n' // Carriage return treated as newline\n case '\\\\':\n return '\\\\' // Literal backslash\n case \"'\":\n return \"'\" // Single quote\n case '\"':\n return '\"' // Double quote\n case '0':\n return '' // Null character (remove)\n case 'b':\n return '' // Backspace (remove)\n case 'f':\n return '\\n' // Form feed as newline\n case 'v':\n return '\\n' // Vertical tab as newline\n default:\n // Unknown escape sequence - keep original\n return match\n }\n })\n }\n\n /**\n * Parses input text with HTML-style markup into styled text segments.\n *\n * Supported tags:\n * - <color=\"value\"> - Sets text color (hex code or CSS color name)\n * - <weight=\"value\"> - Sets font weight (100-900 or keywords like \"bold\")\n * - <size=\"value\"> - Sets font size in pixels\n * - <b> - Makes text bold (shorthand for weight=\"bold\")\n * - <i> - Makes text italic\n *\n * Tag values can use double quotes, single quotes, or no quotes:\n * <color=\"red\">, <color='red'>, <color=red>\n *\n * Tags can be nested and must be properly closed with </tag>\n * @param input Text string containing markup tags\n * @param baseStyle Default style properties to apply to all segments\n * @returns Array of styled text segments with consistent style properties\n */\n private parseRichText(input: string, baseStyle: Partial<TextSegment>): TextSegment[] {\n // Match opening/closing tags with optional quoted/unquoted values\n // Capture groups: (1) closing slash, (2) tag name, (3) double quoted value, (4) single quoted value, (5) unquoted value\n const tagRegex = /<(\\/?)(\\w+)(?:=(?:\"([^\"]*)\"|'([^']*)'|([^\\s>]+)))?>/g\n const stack: Partial<TextSegment>[] = []\n const segments: TextSegment[] = []\n let lastIndex = 0\n let currentStyle: Partial<TextSegment> = { ...baseStyle }\n\n // Helper to create a styled segment ensuring all style properties are included\n const applyStyle = (text: string) => {\n if (!text) return\n segments.push({\n text,\n color: currentStyle.color,\n weight: currentStyle.weight,\n size: currentStyle.size,\n b: currentStyle.b,\n i: currentStyle.i,\n })\n }\n\n let match: RegExpExecArray | null\n while ((match = tagRegex.exec(input))) {\n const [, closingSlash, tagNameStr, quotedVal1, quotedVal2, unquotedVal] = match\n const tagName = tagNameStr.toLowerCase()\n const value = quotedVal1 || quotedVal2 || unquotedVal\n\n // Process text content before the current tag\n applyStyle(input.slice(lastIndex, match.index))\n lastIndex = tagRegex.lastIndex\n\n if (!closingSlash) {\n // Opening tag: Save current style state and apply new style\n stack.push({ ...currentStyle })\n\n switch (tagName) {\n case 'color':\n // Support any valid CSS color value\n currentStyle.color = value as TextSegment['color']\n break\n\n case 'weight':\n // Support numeric weights (100-900) or keywords\n currentStyle.weight = value as TextSegment['weight']\n break\n\n case 'size':\n // Parse pixel size as number, revert to default if invalid\n currentStyle.size = value ? Number(value) : undefined\n if (isNaN(currentStyle.size as number)) {\n console.warn(`[TextNode ${this.key || ''}] Invalid numeric value for size tag: ${value}`)\n currentStyle.size = undefined\n }\n break\n\n case 'b':\n // Simple bold flag\n currentStyle.b = true\n break\n\n case 'i':\n // Simple italic flag\n currentStyle.i = true\n break\n }\n } else {\n // Closing tag: Restore previous style state\n currentStyle = stack.pop() || { ...baseStyle }\n }\n }\n\n // Process remaining text after last tag\n applyStyle(input.slice(lastIndex))\n\n // Don't filter out empty segments - they might represent empty lines\n return segments\n }\n\n private formatSpacing(value: TextProps['letterSpacing'] | TextProps['wordSpacing']) {\n if (typeof value === 'number') return `${value}px`\n return value || 'normal'\n }\n\n private parseSpacingToPx(spacingValue: number | string | undefined, fontSize: number): number {\n if (spacingValue === undefined || spacingValue === 'normal') {\n return 0\n }\n if (typeof spacingValue === 'number') {\n return spacingValue // Treat raw number as px\n }\n if (typeof spacingValue === 'string') {\n const trimmed = spacingValue.trim()\n if (trimmed.endsWith('px')) {\n return parseFloat(trimmed) || 0\n }\n if (trimmed.endsWith('em')) {\n // Convert em based on the current font size\n return (parseFloat(trimmed) || 0) * fontSize\n }\n // Attempt to parse as a raw number (pixels) if no unit\n const parsed = parseFloat(trimmed)\n if (!isNaN(parsed)) {\n return parsed\n }\n }\n return 0 // Default fallback\n }\n\n /**\n * Generates a CSS font string by combining base TextProps with optional TextSegment styling.\n * Follows browser font string format: \"font-style font-weight font-size font-family\"\n *\n * Priority for style properties:\n * - Weight: segment <weight> tag > segment <b> tag > base fontWeight prop\n * - Style: segment <i> > base fontStyle\n * - Size: segment size > base fontSize\n * - Family: base fontFamily\n * @param segmentStyle Optional TextSegment styling to override base props\n * @returns Formatted CSS font string for canvas context\n */\n private getFontString(segmentStyle?: Partial<TextSegment>): string {\n const baseStyle = this.props\n let effectiveWeight: TextSegment['weight'] | number | undefined\n\n // Determine italic style - segment <i> tag overrides base style\n const effectiveStyle = segmentStyle?.i ? 'italic' : baseStyle.fontStyle || 'normal'\n\n // Determine font weight with priority:\n // 1. Segment explicit weight (<weight> tag)\n // 2. Segment bold flag (<b> tag)\n // 3. Base font weight prop\n if (segmentStyle?.weight) {\n effectiveWeight = segmentStyle.weight\n } else if (segmentStyle?.b) {\n effectiveWeight = 'bold'\n } else {\n effectiveWeight = baseStyle.fontWeight || 'normal'\n }\n\n // Use segment size if specified, otherwise base size with 16px default\n const effectiveSize = segmentStyle?.size ? segmentStyle.size : baseStyle.fontSize || 16\n\n // Combine properties into CSS font string format\n const style = {\n fontStyle: effectiveStyle,\n fontWeight: effectiveWeight,\n fontSize: effectiveSize,\n fontFamily: baseStyle.fontFamily || 'sans-serif',\n }\n\n return `${style.fontStyle} ${style.fontWeight} ${style.fontSize}px ${style.fontFamily}`\n }\n\n /**\n * Gets lines to process respecting maxLines constraint\n */\n private getLinesToMeasureOrRender(): TextSegment[][] {\n const maxLines = this.props.maxLines\n if (maxLines !== undefined && maxLines > 0 && this.lines.length > maxLines) {\n return this.lines.slice(0, maxLines)\n }\n return this.lines\n }\n\n /**\n * Measures text dimensions and calculates layout metrics for the YogaLayout engine.\n * Handles text wrapping, line height calculations, and dynamic leading.\n *\n * Line heights are determined by:\n * 1. Using props.lineHeight as fixed pixel value if provided\n * 2. Otherwise calculating dynamic height based on largest font size per line\n * 3. Adding leading space above/below text content\n * 4. Including specified line gaps between lines\n * @param widthConstraint Maximum allowed width in pixels for text layout\n * @param widthMode YogaLayout mode determining how width constraint is applied\n * @returns Calculated minimum dimensions required to render text content\n * - width: Total width needed for text layout\n * - height: Total height including line heights and gaps\n */\n private measureText(widthConstraint: number, widthMode: MeasureMode): { width: number; height: number } {\n // Create measurement canvas if not exists\n if (!TextNode.measurementContext) {\n TextNode.measurementContext = new Canvas(1, 1).getContext('2d')\n }\n const baseFontSize = this.props.fontSize || 16\n const ctx = TextNode.measurementContext!\n ctx.save()\n\n // Setup text measurement context\n ctx.letterSpacing = this.formatSpacing(this.props.letterSpacing)\n ctx.wordSpacing = 'normal' // Handled manually via parsedWordSpacingPx\n const parsedWordSpacingPx = this.parseSpacingToPx(this.props.wordSpacing, baseFontSize)\n\n // Pre-measure each text segment width with its specific styling\n for (const segment of this.segments) {\n ctx.font = this.getFontString(segment)\n if (typeof this.props.fontVariant === 'string') {\n ctx.fontVariant = this.props.fontVariant\n } else if (this.props.fontVariant !== undefined) {\n console.warn(`[TextNode ${this.key || ''}] Invalid fontVariant prop type in measureText (segment width):`, this.props.fontVariant)\n if (ctx.fontVariant !== 'normal') ctx.fontVariant = 'normal'\n } else {\n if (ctx.fontVariant !== 'normal') ctx.fontVariant = 'normal'\n }\n segment.width = ctx.measureText(segment.text).width\n }\n\n // Calculate available layout width\n const availableWidthForContent = widthMode === Style.MeasureMode.Undefined ? Infinity : Math.max(0, widthConstraint)\n const epsilon = 0.001 // Float precision compensation\n\n // Wrap text into lines based on available width\n this.lines = this.wrapTextRich(ctx, this.segments, availableWidthForContent + epsilon, parsedWordSpacingPx)\n\n // Initialize line metrics arrays\n this.lineHeights = [] // Final heights including leading\n this.lineAscents = [] // Text ascent heights\n this.lineContentHeights = [] // Raw content heights (ascent + descent)\n\n let totalTextHeight = 0\n const linesToMeasure = this.getLinesToMeasureOrRender()\n const numLines = linesToMeasure.length\n const defaultLineHeightMultiplier = 1.2 // Base leading multiplier\n\n // Calculate metrics for each line\n for (const line of linesToMeasure) {\n let maxAscent = 0\n let maxDescent = 0\n let maxFontSizeOnLine = 0\n\n // Handle empty line metrics\n if (line.length === 0) {\n ctx.font = this.getFontString()\n if (typeof this.props.fontVariant === 'string') {\n ctx.fontVariant = this.props.fontVariant\n } else if (this.props.fontVariant !== undefined) {\n console.warn(`[TextNode ${this.key || ''}] Invalid fontVariant prop type in measureText (empty line):`, this.props.fontVariant)\n if (ctx.fontVariant !== 'normal') ctx.fontVariant = 'normal'\n } else {\n if (ctx.fontVariant !== 'normal') ctx.fontVariant = 'normal'\n }\n const metrics = ctx.measureText(this.metricsString)\n maxAscent = metrics.actualBoundingBoxAscent ?? baseFontSize * 0.8\n maxDescent = metrics.actualBoundingBoxDescent ?? baseFontSize * 0.2\n maxFontSizeOnLine = baseFontSize\n } else {\n // Calculate max metrics across all segments in line\n for (const segment of line) {\n if (/^\\s+$/.test(segment.text)) continue\n\n const segmentSize = segment.size || baseFontSize\n maxFontSizeOnLine = Math.max(maxFontSizeOnLine, segmentSize)\n\n ctx.font = this.getFontString(segment)\n if (typeof this.props.fontVariant === 'string') {\n ctx.fontVariant = this.props.fontVariant\n } else if (this.props.fontVariant !== undefined) {\n console.warn(`[TextNode ${this.key || ''}] Invalid fontVariant prop type in measureText (segment height):`, this.props.fontVariant)\n if (ctx.fontVariant !== 'normal') ctx.fontVariant = 'normal'\n } else {\n if (ctx.fontVariant !== 'normal') ctx.fontVariant = 'normal'\n }\n\n const metrics = ctx.measureText(this.metricsString)\n const ascent = metrics.actualBoundingBoxAscent ?? segmentSize * 0.8\n const descent = metrics.actualBoundingBoxDescent ?? segmentSize * 0.2\n\n maxAscent = Math.max(maxAscent, ascent)\n maxDescent = Math.max(maxDescent, descent)\n }\n }\n\n // Fallback metrics for lines with only whitespace\n if (maxAscent === 0 && maxDescent === 0 && line.length > 0) {\n ctx.font = this.getFontString()\n if (typeof this.props.fontVariant === 'string') {\n ctx.fontVariant = this.props.fontVariant\n } else if (this.props.fontVariant !== undefined) {\n console.warn(`[TextNode ${this.key || ''}] Invalid fontVariant prop type in measureText (fallback):`, this.props.fontVariant)\n if (ctx.fontVariant !== 'normal') ctx.fontVariant = 'normal'\n } else {\n if (ctx.fontVariant !== 'normal') ctx.fontVariant = 'normal'\n }\n const metrics = ctx.measureText(this.metricsString)\n maxAscent = metrics.actualBoundingBoxAscent ?? baseFontSize * 0.8\n maxDescent = metrics.actualBoundingBoxDescent ?? baseFontSize * 0.2\n maxFontSizeOnLine = maxFontSizeOnLine || baseFontSize\n }\n\n maxFontSizeOnLine = maxFontSizeOnLine || baseFontSize\n\n // Calculate total content height for line\n const actualContentHeight = maxAscent + maxDescent\n\n // Determine final line box height with leading\n const targetLineBoxHeight =\n typeof this.props.lineHeight === 'number' && this.props.lineHeight > 0 ? this.props.lineHeight : maxFontSizeOnLine * defaultLineHeightMultiplier\n\n // Use larger of target height or content height to prevent clipping\n const finalLineHeight = Math.max(actualContentHeight, targetLineBoxHeight)\n\n // Store line metrics for rendering\n this.lineHeights.push(finalLineHeight)\n this.lineAscents.push(maxAscent)\n this.lineContentHeights.push(actualContentHeight)\n\n totalTextHeight += finalLineHeight\n }\n\n // Add line gap spacing to total height\n const lineGapValue = this.props.lineGap\n const totalGapHeight = Math.max(0, (numLines - 1) * lineGapValue)\n const calculatedContentHeight = totalTextHeight + totalGapHeight\n\n // Calculate width required for text content\n const spaceWidth = this.measureSpaceWidth(ctx)\n let singleLineWidth = 0\n let firstWordInSingleLine = true\n for (const segment of this.segments) {\n const words = segment.text.split(/(\\s+)/).filter(Boolean)\n for (const word of words) {\n if (/^\\s+$/.test(word)) continue\n ctx.font = this.getFontString(segment)\n if (typeof this.props.fontVariant === 'string') {\n ctx.fontVariant = this.props.fontVariant\n } else if (this.props.fontVariant !== undefined) {\n console.warn(`[TextNode ${this.key || ''}] Invalid fontVariant prop type in measureText (single line width):`, this.props.fontVariant)\n if (ctx.fontVariant !== 'normal') ctx.fontVariant = 'normal'\n } else {\n if (ctx.fontVariant !== 'normal') ctx.fontVariant = 'normal'\n }\n const wordWidth = ctx.measureText(word).width\n if (!firstWordInSingleLine) {\n singleLineWidth += spaceWidth + parsedWordSpacingPx\n }\n singleLineWidth += wordWidth\n firstWordInSingleLine = false\n }\n }\n\n // Determine final content width based on wrapping\n let requiredContentWidth: number\n if (singleLineWidth <= availableWidthForContent) {\n requiredContentWidth = singleLineWidth\n if (linesToMeasure.length > 1 && this.props.maxLines !== 1 && !this.segments.some(s => s.text.includes('\\n'))) {\n console.warn(\n `[TextNode ${this.key || ''}] Rich text should fit (${singleLineWidth.toFixed(2)} <= ${availableWidthForContent.toFixed(2)}) but wrapTextRich produced ${linesToMeasure.length} lines. Width calculation might be slightly off due to complex spacing/kerning.`,\n )\n let maxWrappedLineWidth = 0\n for (const line of linesToMeasure) {\n let currentLineWidth = 0\n let firstWordOnWrappedLine = true\n for (const segment of line) {\n const segmentWidth = segment.width ?? 0\n const isSpaceSegment = /^\\s+$/.test(segment.text)\n if (!isSpaceSegment) {\n if (!firstWordOnWrappedLine) {\n currentLineWidth += spaceWidth + parsedWordSpacingPx\n }\n currentLineWidth += segmentWidth\n firstWordOnWrappedLine = false\n }\n }\n maxWrappedLineWidth = Math.max(maxWrappedLineWidth, currentLineWidth)\n }\n requiredContentWidth = Math.max(singleLineWidth, maxWrappedLineWidth)\n }\n } else {\n let maxWrappedLineWidth = 0\n for (const line of linesToMeasure) {\n let currentLineWidth = 0\n let firstWordOnWrappedLine = true\n for (const segment of line) {\n const segmentWidth = segment.width ?? 0\n const isSpaceSegment = /^\\s+$/.test(segment.text)\n if (!isSpaceSegment) {\n if (!firstWordOnWrappedLine) {\n currentLineWidth += spaceWidth + parsedWordSpacingPx\n }\n currentLineWidth += segmentWidth\n firstWordOnWrappedLine = false\n }\n }\n maxWrappedLineWidth = Math.max(maxWrappedLineWidth, currentLineWidth)\n }\n requiredContentWidth = maxWrappedLineWidth\n }\n\n // Constrain width if needed\n let finalContentWidth = requiredContentWidth\n if (availableWidthForContent !== Infinity) {\n finalContentWidth = Math.min(requiredContentWidth, availableWidthForContent)\n }\n\n ctx.restore()\n return {\n width: Math.max(0, finalContentWidth),\n height: Math.max(0, calculatedContentHeight),\n }\n }\n\n /**\n * Wraps text segments into multiple lines while respecting width constraints and preserving styling.\n * Handles rich text attributes (color, weight, size, bold, italic) and proper word wrapping.\n * Also respects explicit newline characters (\\n) for forced line breaks.\n * @param ctx Canvas rendering context used for text measurements\n * @param segments Array of text segments with styling information\n * @param maxWidth Maximum allowed width for each line in pixels\n * @param parsedWordSpacingPx Additional spacing to add between words in pixels\n * @returns Array of lines, where each line contains styled text segments\n */\n private wrapTextRich(ctx: CanvasRenderingContext2D, segments: TextSegment[], maxWidth: number, parsedWordSpacingPx: number): TextSegment[][] {\n const lines: TextSegment[][] = []\n\n if (segments.length === 0 || maxWidth <= 0) return lines\n\n let currentLineSegments: TextSegment[] = []\n let currentLineWidth = 0\n const spaceWidth = this.measureSpaceWidth(ctx)\n\n // Helper to finalize current line and start new one\n const finalizeLine = (forceEmpty = false) => {\n // Remove trailing whitespace segments unless we're forcing an empty line\n if (!forceEmpty) {\n while (currentLineSegments.length > 0 && /^\\s+$/.test(currentLineSegments[currentLineSegments.length - 1].text)) {\n currentLineSegments.pop()\n }\n }\n // Always push the line, even if empty (for \\n\\n cases)\n lines.push(currentLineSegments)\n currentLineSegments = []\n currentLineWidth = 0\n }\n\n for (const segment of segments) {\n // Preserve all style attributes for consistency\n const segmentStyle = {\n color: segment.color,\n weight: segment.weight,\n size: segment.size,\n b: segment.b,\n i: segment.i,\n }\n\n // Check if segment contains newline characters\n if (segment.text.includes('\\n')) {\n // Split by newlines and process each part\n const parts = segment.text.split('\\n')\n\n for (let i = 0; i < parts.length; i++) {\n const part = parts[i]\n const isLastPart = i === parts.length - 1\n\n if (part.length > 0) {\n // Process this part normally\n const wordsAndSpaces = part.split(/(\\s+)/).filter(Boolean)\n\n for (const wordOrSpace of wordsAndSpaces) {\n const isSpace = /^\\s+$/.test(wordOrSpace)\n let wordSegment: TextSegment\n let wordWidth: number\n\n if (isSpace) {\n wordSegment = { text: wordOrSpace, ...segmentStyle, width: 0 }\n wordWidth = 0\n } else {\n ctx.font = this.getFontString(segmentStyle)\n if (this.props.fontVariant) ctx.fontVariant = this.props.fontVariant\n wordWidth = ctx.measureText(wordOrSpace).width\n wordSegment = { text: wordOrSpace, ...segmentStyle, width: wordWidth }\n }\n\n const needsSpace = currentLineSegments.length > 0 && !/^\\s+$/.test(currentLineSegments[currentLineSegments.length - 1].text)\n const spaceToAdd = needsSpace ? spaceWidth + parsedWordSpacingPx : 0\n\n if (currentLineWidth + spaceToAdd + wordWidth <= maxWidth || currentLineSegments.length === 0) {\n if (needsSpace) {\n currentLineSegments.push({ text: ' ', ...segmentStyle, width: 0 })\n currentLineWidth += spaceToAdd\n }\n currentLineSegments.push(wordSegment)\n currentLineWidth += wordWidth\n } else {\n if (currentLineSegments.length > 0) {\n finalizeLine()\n }\n\n if (!isSpace) {\n if (wordWidth > maxWidth && maxWidth > 0) {\n const brokenParts = this.breakWordRich(ctx, wordSegment, maxWidth)\n\n if (brokenParts.length > 0) {\n for (let k = 0; k < brokenParts.length - 1; k++) {\n lines.push([brokenParts[k]])\n }\n currentLineSegments = [brokenParts[brokenParts.length - 1]]\n currentLineWidth = brokenParts[brokenParts.length - 1].width ?? 0\n } else {\n currentLineSegments = [wordSegment]\n currentLineWidth = wordWidth\n }\n } else {\n currentLineSegments = [wordSegment]\n currentLineWidth = wordWidth\n }\n }\n }\n }\n }\n\n // Force line break after each part except the last\n // If part is empty, this creates an empty line (like \\n\\n)\n if (!isLastPart) {\n finalizeLine(part.length === 0)\n }\n }\n } else {\n // No newlines - process normally\n const wordsAndSpaces = segment.text.split(/(\\s+)/).filter(Boolean)\n\n for (const wordOrSpace of wordsAndSpaces) {\n const isSpace = /^\\s+$/.test(wordOrSpace)\n let wordSegment: TextSegment\n let wordWidth: number\n\n if (isSpace) {\n wordSegment = { text: wordOrSpace, ...segmentStyle, width: 0 }\n wordWidth = 0\n } else {\n ctx.font = this.getFontString(segmentStyle)\n if (this.props.fontVariant) ctx.fontVariant = this.props.fontVariant\n wordWidth = ctx.measureText(wordOrSpace).width\n wordSegment = { text: wordOrSpace, ...segmentStyle, width: wordWidth }\n }\n\n const needsSpace = currentLineSegments.length > 0 && !/^\\s+$/.test(currentLineSegments[currentLineSegments.length - 1].text)\n const spaceToAdd = needsSpace ? spaceWidth + parsedWordSpacingPx : 0\n\n if (currentLineWidth + spaceToAdd + wordWidth <= maxWidth || currentLineSegments.length === 0) {\n if (needsSpace) {\n currentLineSegments.push({ text: ' ', ...segmentStyle, width: 0 })\n currentLineWidth += spaceToAdd\n }\n currentLineSegments.push(wordSegment)\n currentLineWidth += wordWidth\n } else {\n if (currentLineSegments.length > 0) {\n finalizeLine()\n }\n\n if (!isSpace) {\n if (wordWidth > maxWidth && maxWidth > 0) {\n const brokenParts = this.breakWordRich(ctx, wordSegment, maxWidth)\n\n if (brokenParts.length > 0) {\n for (let k = 0; k < brokenParts.length - 1; k++) {\n lines.push([brokenParts[k]])\n }\n currentLineSegments = [brokenParts[brokenParts.length - 1]]\n currentLineWidth = brokenParts[brokenParts.length - 1].width ?? 0\n } else {\n currentLineSegments = [wordSegment]\n currentLineWidth = wordWidth\n }\n } else {\n currentLineSegments = [wordSegment]\n currentLineWidth = wordWidth\n }\n }\n }\n }\n }\n }\n\n finalizeLine()\n return lines\n }\n\n /**\n * Breaks a word segment into multiple segments that each fit within the specified width constraint.\n * Maintains all styling properties (color, weight, size, bold, italic) across broken segments.\n * @param ctx Canvas rendering context used for text measurements\n * @param segmentToBreak Original text segment to split\n * @param maxWidth Maximum width allowed for each resulting segment\n * @returns Array of TextSegments, each fitting maxWidth, or original segment if no breaking needed\n */\n private breakWordRich(ctx: CanvasRenderingContext2D, segmentToBreak: TextSegment, maxWidth: number): TextSegment[] {\n const word = segmentToBreak.text\n\n // Copy all style properties to maintain consistent styling across broken segments\n const style = {\n color: segmentToBreak.color,\n weight: segmentToBreak.weight,\n size: segmentToBreak.size,\n b: segmentToBreak.b,\n i: segmentToBreak.i,\n }\n\n if (maxWidth <= 0) return [segmentToBreak]\n\n const brokenSegments: TextSegment[] = []\n let currentPartText = ''\n\n // Configure context with segment style for accurate measurements\n ctx.font = this.getFontString(style)\n if (this.props.fontVariant) ctx.fontVariant = this.props.fontVariant\n\n // Process word character by character to find valid break points\n for (const char of word) {\n const testPartText = currentPartText + char\n const testPartWidth = ctx.measureText(testPartText).width\n\n if (testPartWidth > maxWidth) {\n // Current accumulated text exceeds width - create new segment\n if (currentPartText) {\n brokenSegments.push({\n text: currentPartText,\n ...style,\n width: ctx.measureText(currentPartText).width,\n })\n }\n\n // Handle current character that caused overflow\n currentPartText = char\n const currentCharWidth = ctx.measureText(currentPartText).width\n\n if (currentCharWidth > maxWidth) {\n // Single character is too wide - force break after it\n brokenSegments.push({\n text: currentPartText,\n ...style,\n width: currentCharWidth,\n })\n currentPartText = ''\n }\n } else {\n // Character fits - add to current part\n currentPartText = testPartText\n }\n }\n\n // Handle any remaining text as final segment\n if (currentPartText) {\n brokenSegments.push({\n text: currentPartText,\n ...style,\n width: ctx.measureText(currentPartText).width,\n })\n }\n\n return brokenSegments.length > 0 ? brokenSegments : [segmentToBreak]\n }\n\n /**\n * Measures width of space character using base font\n */\n private measureSpaceWidth(ctx: CanvasRenderingContext2D): number {\n const originalFont = ctx.font\n ctx.font = this.getFontString()\n const width = ctx.measureText(' ').width\n ctx.font = originalFont\n return width > 0 ? width : (this.props.fontSize || 16) * 0.3\n }\n\n /**\n * Renders multi-line text content with rich text styling and layout features\n *\n * Core features:\n * - Dynamic line heights with leading/spacing controls\n * - Vertical text alignment (top/middle/bottom)\n * - Horizontal text alignment (left/center/right/justify)\n * - Text wrapping within bounds\n * - Ellipsis truncation\n * - Rich text styling per segment (color, weight, size, etc)\n * - Performance optimizations (clipping, visibility checks)\n * @param ctx Canvas rendering context\n * @param x Content box left position in pixels\n * @param y Content box top position in pixels\n * @param width Content box total width including padding\n * @param height Content box total height including padding\n */\n protected override _renderContent(ctx: CanvasRenderingContext2D, x: number, y: number, width: number, height: number) {\n super._renderContent(ctx, x, y, width, height)\n\n const linesToRender = this.getLinesToMeasureOrRender()\n const numLinesToRender = linesToRender.length\n\n // Validate required data is available\n if (\n numLinesToRender === 0 ||\n this.segments.length === 0 ||\n this.lineHeights.length !== numLinesToRender ||\n this.lineAscents.length !== numLinesToRender ||\n this.lineContentHeights.length !== numLinesToRender\n ) {\n return\n }\n\n ctx.save()\n ctx.textBaseline = 'alphabetic'\n ctx.letterSpacing = this.formatSpacing(this.props.letterSpacing)\n ctx.wordSpacing = 'normal'\n\n const baseFontSize = this.props.fontSize || 16\n const parsedWordSpacingPx = this.parseSpacingToPx(this.props.wordSpacing, baseFontSize)\n\n // Calculate content box with padding\n const paddingLeft = this.node.getComputedPadding(Style.Edge.Left) ?? 0\n const paddingTop = this.node.getComputedPadding(Style.Edge.Top) ?? 0\n const paddingRight = this.node.getComputedPadding(Style.Edge.Right) ?? 0\n const paddingBottom = this.node.getComputedPadding(Style.Edge.Bottom) ?? 0\n const contentX = x + paddingLeft\n const contentY = y + paddingTop\n const contentWidth = Math.max(0, width - paddingLeft - paddingRight)\n const contentHeight = Math.max(0, height - paddingTop - paddingBottom)\n\n if (contentWidth <= 0 || contentHeight <= 0) {\n ctx.restore()\n return\n }\n\n // Calculate vertical alignment offset\n const lineGapValue = this.props.lineGap\n const totalCalculatedTextHeight = this.lineHeights.reduce((sum, h) => sum + h, 0) + Math.max(0, numLinesToRender - 1) * lineGapValue\n\n let blockStartY: number\n switch (this.props.verticalAlign) {\n case 'middle':\n blockStartY = contentY + (contentHeight - totalCalculatedTextHeight) / 2\n break\n case 'bottom':\n blockStartY = contentY + contentHeight - totalCalculatedTextHeight\n break\n case 'top':\n default:\n blockStartY = contentY\n }\n\n let currentLineTopY = blockStartY\n\n // Setup text content clipping region\n ctx.beginPath()\n ctx.rect(contentX, contentY, contentWidth, contentHeight)\n ctx.clip()\n\n // Configure ellipsis if needed\n const ellipsisChar = typeof this.props.ellipsis === 'string' ? this.props.ellipsis : '...'\n const needsEllipsis = this.props.ellipsis && this.lines.length > numLinesToRender\n let ellipsisWidth = 0\n let ellipsisStyle: Partial<TextSegment> | undefined = undefined\n\n if (needsEllipsis) {\n const lastRenderedLine = linesToRender[numLinesToRender - 1]\n const lastTextStyleSegment = [...lastRenderedLine].reverse().find(seg => !/^\\s+$/.test(seg.text))\n\n // Inherit styles from last non-whitespace segment\n ellipsisStyle = lastTextStyleSegment\n ? {\n color: lastTextStyleSegment.color,\n weight: lastTextStyleSegment.weight,\n size: lastTextStyleSegment.size,\n b: lastTextStyleSegment.b,\n i: lastTextStyleSegment.i,\n }\n : undefined\n\n const originalFont = ctx.font\n const originalVariant = ctx.fontVariant\n ctx.font = this.getFontString(ellipsisStyle)\n\n // Handle font variant setting and validation\n if (typeof this.props.fontVariant === 'string') {\n ctx.fontVariant = this.props.fontVariant\n } else if (this.props.fontVariant !== undefined) {\n console.warn(`[TextNode ${this.key || ''}] Invalid fontVariant prop type in _renderContent (ellipsis measure):`, this.props.fontVariant)\n if (ctx.fontVariant !== 'normal') ctx.fontVariant = 'normal'\n } else {\n if (ctx.fontVariant !== 'normal') ctx.fontVariant = 'normal'\n }\n\n ellipsisWidth = ctx.measureText(ellipsisChar).width\n ctx.font = originalFont\n\n if (originalVariant !== 'normal') {\n ctx.fontVariant = originalVariant\n } else if (ctx.fontVariant !== 'normal') {\n ctx.fontVariant = 'normal'\n }\n }\n\n const spaceWidth = this.measureSpaceWidth(ctx)\n\n // Render text content line by line\n for (let i = 0; i < numLinesToRender; i++) {\n const lineSegments = linesToRender[i]\n const currentLineFinalHeight = this.lineHeights[i]\n const currentLineMaxAscent = this.lineAscents[i]\n const currentLineContentHeight = this.lineContentHeights[i]\n\n // Calculate line spacing metrics\n const currentLineLeading = currentLineFinalHeight - currentLineContentHeight\n const currentLineSpaceAbove = Math.max(0, currentLineLeading / 2)\n const lineY = currentLineTopY + currentLineSpaceAbove + currentLineMaxAscent\n\n // Visibility culling check\n const lineTop = currentLineTopY\n const lineBottom = currentLineTopY + currentLineFinalHeight\n\n // Don't skip empty lines - they're intentional (from \\n\\n)\n // Only skip if the line is completely outside the visible area\n if (lineBottom <= contentY || lineTop >= contentY + contentHeight) {\n currentLineTopY += currentLineFinalHeight + lineGapValue\n continue\n }\n\n const isLastRenderedLine = i === numLinesToRender - 1\n\n // Calculate line width metrics for alignment\n let totalLineWidth = 0\n let totalWordsWidth = 0\n let numWordGaps = 0\n let firstWordOnLine = true\n const noSpaceBeforePunctuation = /^[.,!?;:)\\]}]/\n\n for (const segment of lineSegments) {\n const segmentWidth = segment.width ?? 0\n const isSpaceSegment = /^\\s+$/.test(segment.text)\n\n if (!isSpaceSegment) {\n if (!firstWordOnLine) {\n totalLineWidth += spaceWidth + parsedWordSpacingPx\n if (!noSpaceBeforePunctuation.test(segment.text)) {\n numWordGaps++\n }\n }\n totalLineWidth += segmentWidth\n totalWordsWidth += segmentWidth\n firstWordOnLine = false\n }\n }\n\n // Calculate horizontal alignment position\n const isJustify = this.props.textAlign === 'justify' && !isLastRenderedLine\n const lineTextAlign = isJustify ? 'left' : this.props.textAlign || 'left'\n let currentX: number\n\n switch (lineTextAlign) {\n case 'center':\n currentX = contentX + (contentWidth - totalLineWidth) / 2\n break\n case 'right':\n case 'end':\n currentX = contentX + contentWidth - totalLineWidth\n break\n case 'left':\n case 'start':\n default:\n currentX = contentX\n }\n currentX = Math.max(contentX, currentX)\n\n // Calculate justification spacing\n let spacePerWordGapPlusSpacing = spaceWidth + parsedWordSpacingPx\n if (isJustify && numWordGaps > 0 && totalLineWidth < contentWidth) {\n const totalBaseSpacingWidth = numWordGaps * (spaceWidth + parsedWordSpacingPx)\n const remainingSpace = contentWidth - totalWordsWidth - totalBaseSpacingWidth\n if (remainingSpace > 0) {\n spacePerWordGapPlusSpacing += remainingSpace / numWordGaps\n }\n }\n\n // Render line segments (skip rendering for truly empty lines)\n if (lineSegments.length > 0 && !lineSegments.every(s => s.text.trim() === '')) {\n let accumulatedWidth = 0\n let ellipsisApplied = false\n let firstWordDrawn = false\n\n for (let j = 0; j < lineSegments.length; j++) {\n const segment = lineSegments[j]\n const segmentWidth = segment.width ?? 0\n const isLastSegmentOnLine = j === lineSegments.length - 1\n const isSpaceSegment = /^\\s+$/.test(segment.text)\n\n // Calculate word spacing\n let spaceToAddBefore = 0\n if (!isSpaceSegment && firstWordDrawn && !noSpaceBeforePunctuation.test(segment.text)) {\n spaceToAddBefore = isJustify ? spacePerWordGapPlusSpacing : spaceWidth + parsedWordSpacingPx\n }\n\n // Apply segment styles\n ctx.font = this.getFontString(segment)\n ctx.fillStyle = segment.color || this.props.color || 'black'\n\n if (typeof this.props.fontVariant === 'string') {\n ctx.fontVariant = this.props.fontVariant\n } else if (this.props.fontVariant !== undefined) {\n console.warn(`[TextNode ${this.key || ''}] Invalid fontVariant prop type in _renderContent (segment render):`, this.props.fontVariant)\n if (ctx.fontVariant !== 'normal') ctx.fontVariant = 'normal'\n } else {\n if (ctx.fontVariant !== 'normal') ctx.fontVariant = 'normal'\n }\n\n // Handle text truncation and ellipsis\n let textToDraw = segment.text\n let currentSegmentRenderWidth = segmentWidth\n let applyEllipsisAfter = false\n\n if (isLastRenderedLine && needsEllipsis && !isSpaceSegment) {\n const currentTotalWidth = accumulatedWidth + spaceToAddBefore + segmentWidth\n const spaceNeededAfter = isLastSegmentOnLine ? 0 : isJustify ? spacePerWordGapPlusSpacing : spaceWidth + parsedWordSpacingPx\n\n if (currentTotalWidth > contentWidth - spaceNeededAfter) {\n const availableWidthForSegment = contentWidth - accumulatedWidth - spaceToAddBefore - ellipsisWidth\n if (availableWidthForSegment > 0) {\n let truncatedText = ''\n for (const char of segment.text) {\n if (ctx.measureText(truncatedText + char).width <= availableWidthForSegment) {\n truncatedText += char\n } else {\n break\n }\n }\n textToDraw = truncatedText\n currentSegmentRenderWidth = ctx.measureText(textToDraw).width\n } else {\n textToDraw = ''\n currentSegmentRenderWidth = 0\n }\n applyEllipsisAfter = true\n ellipsisApplied = true\n } else if (isLastSegmentOnLine) {\n applyEllipsisAfter = true\n ellipsisApplied = true\n }\n }\n\n // Render text segment\n currentX += spaceToAddBefore\n accumulatedWidth += spaceToAddBefore\n\n const remainingRenderWidth = contentX + contentWidth - currentX\n if (currentSegmentRenderWidth > 0 && remainingRenderWidth > 0 && !isSpaceSegment) {\n ctx.textAlign = 'left'\n\n const shadows = this.props.textShadow ? (Array.isArray(this.props.textShadow) ? this.props.textShadow : [this.props.textShadow]) : []\n\n ctx.save()\n\n // Draw shadows\n for (const shadow of shadows) {\n ctx.shadowColor = shadow.color || 'transparent'\n ctx.shadowBlur = shadow.blur || 0\n ctx.shadowOffsetX = shadow.offsetX || 0\n ctx.shadowOffsetY = shadow.offsetY || 0\n ctx.fillText(textToDraw, currentX, lineY, Math.max(0, remainingRenderWidth + 1))\n }\n\n // Reset shadow to draw the main text\n ctx.shadowColor = 'transparent'\n ctx.shadowBlur = 0\n ctx.shadowOffsetX = 0\n ctx.shadowOffsetY = 0\n\n ctx.fillText(textToDraw, currentX, lineY, Math.max(0, remainingRenderWidth + 1))\n\n ctx.restore()\n\n firstWordDrawn = true\n }\n\n currentX += currentSegmentRenderWidth\n accumulatedWidth += currentSegmentRenderWidth\n\n // Render ellipsis\n if (applyEllipsisAfter) {\n const ellipsisRemainingWidth = contentX + contentWidth - currentX\n if (ellipsisRemainingWidth >= ellipsisWidth) {\n const originalFont = ctx.font\n const originalVariant = ctx.fontVariant\n const originalFill = ctx.fillStyle\n\n ctx.font = this.getFontString(ellipsisStyle)\n\n if (typeof this.props.fontVariant === 'string') {\n ctx.fontVariant = this.props.fontVariant\n } else if (this.props.fontVariant !== undefined) {\n console.warn(`[TextNode ${this.key || ''}] Invalid fontVariant prop type in _renderContent (ellipsis draw):`, this.props.fontVariant)\n if (ctx.fontVariant !== 'normal') ctx.fontVariant = 'normal'\n } else {\n if (ctx.fontVariant !== 'normal') ctx.fontVariant = 'normal'\n }\n\n ctx.fillStyle = ellipsisStyle?.color || this.props.color || 'black'\n ctx.fillText(ellipsisChar, currentX, lineY, Math.max(0, ellipsisRemainingWidth + 1))\n\n ctx.font = originalFont\n if (originalVariant !== 'normal') {\n ctx.fontVariant = originalVariant\n } else if (ctx.fontVariant !== 'normal') {\n ctx.fontVariant = 'normal'\n }\n ctx.fillStyle = originalFill\n }\n break\n }\n\n if (ellipsisApplied && currentX >= contentX + contentWidth) break\n }\n }\n\n currentLineTopY += currentLineFinalHeight + lineGapValue\n }\n\n ctx.restore()\n }\n}\n\n/**\n * Creates a new TextNode instance with rich text support\n */\nexport const Text = (text: number | string, props?: TextProps) => new TextNode(text, props)\n"],"names":["BoxNode","Canvas","Style"],"mappings":";;;;;;AAAA;AAOA;;;AAGG;AACG,MAAO,QAAS,SAAQA,0BAAO,CAAA;IAClB,QAAQ,GAAkB,EAAE;IACrC,KAAK,GAAoB,EAAE;AAC3B,IAAA,OAAO,kBAAkB,GAAoC,IAAI;IACxD,aAAa,GAAG,OAAO;IAChC,WAAW,GAAa,EAAE;IAC1B,WAAW,GAAa,EAAE;IAC1B,kBAAkB,GAAa,EAAE;AAIzC,IAAA,WAAA,CAAY,IAAA,GAAwB,EAAE,EAAE,KAAA,GAAmB,EAAE,EAAA;AAC3D,QAAA,MAAM,YAAY,GAAG;AACnB,YAAA,IAAI,EAAE,UAAU;AAChB,YAAA,UAAU,EAAE,CAAC;AACb,YAAA,OAAO,EAAE,CAAC;AACV,YAAA,GAAG,KAAK;AACR,YAAA,QAAQ,EAAE,SAAS;SACpB;QACD,KAAK,CAAC,YAAY,CAAC;AACnB,QAAA,IAAI,CAAC,KAAK,GAAG,YAAY;;AAEzB,QAAA,MAAM,aAAa,GAAG,IAAI,CAAC,sBAAsB,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC;QACrE,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,aAAa,CAAC,aAAa,EAAE;AAChD,YAAA,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK;AACvB,YAAA,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU;AAC7B,YAAA,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ;AACzB,YAAA,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,KAAK,MAAM;AACnC,YAAA,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,KAAK,QAAQ;AACrC,S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GAAG,CAAC,WAAW,KAAK,QAAQ,EAAE;AACvC,gCAAA,GAAG,CAAC,WAAW,GAAG,QAAQ;4BAC5B;AACA,4BAAA,GAAG,CAAC,SAAS,GAAG,YAAY;wBAC9B;wBACA;oBACF;AAEA,oBAAA,IAAI,eAAe,IAAI,QAAQ,IAAI,QAAQ,GAAG,YAAY;wBAAE;gBAC9D;YACF;AAEA,YAAA,eAAe,IAAI,sBAAsB,GAAG,YAAY;QAC1D;QAEA,GAAG,CAAC,OAAO,EAAE;IACf;;AAGF;;AAEG;AACI,MAAM,IAAI,GAAG,CAAC,IAAqB,EAAE,KAAiB,KAAK,IAAI,QAAQ,CAAC,IAAI,EAAE,KAAK;;;;;"}
|
|
1
|
+
{"version":3,"file":"text.canvas.util.js","sources":["../../../../src/canvas/text.canvas.util.ts"],"sourcesContent":["// TODO: Add comprehensive unit tests for this file.\n\nimport type { TextProps, TextSegment } from '@/canvas/canvas.type.js'\nimport { Canvas, type CanvasRenderingContext2D, type FontVariantSetting } from 'skia-canvas'\nimport { BoxNode } from '@/canvas/layout.canvas.util.js'\nimport { Style, MeasureMode } from '@/constant/common.const.js'\n\n/**\n * Node for rendering text content with rich text styling support\n * Supports color and weight variations through HTML-like tags\n */\nexport class TextNode extends BoxNode {\n private readonly segments: TextSegment[] = []\n private lines: TextSegment[][] = []\n private static measurementContext: CanvasRenderingContext2D | null = null\n private readonly metricsString = 'Ag|``'\n private lineHeights: number[] = []\n private lineAscents: number[] = []\n private lineContentHeights: number[] = []\n\n declare props: TextProps & { lineGap: number }\n\n constructor(text: number | string = '', props: TextProps = {}) {\n const initialProps = {\n name: 'TextNode',\n flexShrink: 1,\n lineGap: 0,\n ...props,\n children: undefined,\n }\n super(initialProps)\n this.props = initialProps\n // Process escape sequences before parsing rich text\n const processedText = this.processEscapeSequences(String(text ?? ''))\n this.segments = this.parseRichText(processedText, {\n color: this.props.color,\n weight: this.props.fontWeight,\n size: this.props.fontSize,\n b: this.props.fontWeight === 'bold',\n i: this.props.fontStyle === 'italic',\n })\n this.node.setMeasureFunc(this.measureText.bind(this))\n this.applyDefaults()\n }\n\n /**\n * Renders a simple, single-line text string without complex layout calculations.\n * A lightweight, static utility for drawing text where layout is handled externally.\n * @param ctx The canvas rendering context.\n * @param text The string to render.\n * @param x The x-coordinate for rendering.\n * @param y The y-coordinate for rendering.\n * @param props Basic text styling properties.\n */\n public static renderSimpleText(\n ctx: CanvasRenderingContext2D,\n text: string,\n x: number,\n y: number,\n props: {\n fontFamily?: string\n fontSize?: number\n fontWeight?: TextProps['fontWeight']\n fontStyle?: TextProps['fontStyle']\n color?: string\n textAlign?: CanvasRenderingContext2D['textAlign']\n textBaseline?: CanvasRenderingContext2D['textBaseline']\n } = {},\n ) {\n ctx.save()\n\n const {\n fontFamily = 'sans-serif',\n fontSize = 12,\n fontWeight = 'normal',\n fontStyle = 'normal',\n color = '#333',\n textAlign = 'left',\n textBaseline = 'alphabetic',\n } = props\n\n ctx.font = `${fontStyle} ${fontWeight} ${fontSize}px ${fontFamily}`\n ctx.fillStyle = color\n ctx.textAlign = textAlign\n ctx.textBaseline = textBaseline\n\n ctx.fillText(text, x, y)\n\n ctx.restore()\n }\n\n protected override applyDefaults(): void {\n const textDefaults: Required<\n Pick<TextProps, 'fontSize' | 'fontFamily' | 'fontWeight' | 'fontStyle' | 'color' | 'textAlign' | 'verticalAlign' | 'ellipsis' | 'lineGap'>\n > & {\n lineHeight: undefined | number\n maxLines: undefined | number\n letterSpacing: undefined | number\n wordSpacing: undefined | number\n fontVariant: undefined | FontVariantSetting\n } = {\n fontSize: 16,\n fontFamily: 'sans-serif',\n fontWeight: 'normal',\n fontStyle: 'normal',\n color: 'black',\n textAlign: 'left',\n verticalAlign: 'top',\n fontVariant: undefined,\n lineHeight: undefined,\n lineGap: 0,\n maxLines: undefined,\n ellipsis: false,\n letterSpacing: undefined,\n wordSpacing: undefined,\n }\n\n let defaultsApplied = false\n for (const key of Object.keys(textDefaults) as (keyof typeof textDefaults)[]) {\n if (this.props[key] === undefined && textDefaults[key] !== undefined) {\n this.props[key as string] = textDefaults[key]\n defaultsApplied = true\n }\n }\n\n if (defaultsApplied && !this.node.isDirty()) {\n const affectsMeasurement = [\n 'fontSize',\n 'fontFamily',\n 'fontWeight',\n 'fontStyle',\n 'lineHeight',\n 'maxLines',\n 'lineGap',\n 'letterSpacing',\n 'wordSpacing',\n ].some(measureKey => this.props[measureKey] === textDefaults[measureKey])\n if (affectsMeasurement) {\n this.node.markDirty()\n }\n }\n }\n\n /**\n * Processes Unix-like escape sequences in text strings.\n * Converts escaped characters into their actual representations.\n *\n * Supported escape sequences:\n * - \\n - Newline (line feed)\n * - \\t - Tab (converted to 4 spaces)\n * - \\r - Carriage return (treated as newline)\n * - \\\\ - Literal backslash\n * - \\' - Single quote\n * - \\\" - Double quote\n * - \\0 - Null character (removed)\n * - \\b - Backspace (removed)\n * - \\f - Form feed (treated as newline)\n * - \\v - Vertical tab (treated as newline)\n * @param input Raw text string potentially containing escape sequences\n * @returns Processed string with escape sequences converted\n */\n private processEscapeSequences(input: string): string {\n return input.replace(/\\\\(.)/g, (match, char) => {\n switch (char) {\n case 'n':\n return '\\n' // Newline\n case 't':\n return ' ' // Tab as 4 spaces\n case 'r':\n return '\\n' // Carriage return treated as newline\n case '\\\\':\n return '\\\\' // Literal backslash\n case \"'\":\n return \"'\" // Single quote\n case '\"':\n return '\"' // Double quote\n case '0':\n return '' // Null character (remove)\n case 'b':\n return '' // Backspace (remove)\n case 'f':\n return '\\n' // Form feed as newline\n case 'v':\n return '\\n' // Vertical tab as newline\n default:\n // Unknown escape sequence - keep original\n return match\n }\n })\n }\n\n /**\n * Parses input text with HTML-style markup into styled text segments.\n *\n * Supported tags:\n * - <color=\"value\"> - Sets text color (hex code or CSS color name)\n * - <weight=\"value\"> - Sets font weight (100-900 or keywords like \"bold\")\n * - <size=\"value\"> - Sets font size in pixels\n * - <b> - Makes text bold (shorthand for weight=\"bold\")\n * - <i> - Makes text italic\n *\n * Tag values can use double quotes, single quotes, or no quotes:\n * <color=\"red\">, <color='red'>, <color=red>\n *\n * Tags can be nested and must be properly closed with </tag>\n * @param input Text string containing markup tags\n * @param baseStyle Default style properties to apply to all segments\n * @returns Array of styled text segments with consistent style properties\n */\n private parseRichText(input: string, baseStyle: Partial<TextSegment>): TextSegment[] {\n // Match opening/closing tags with optional quoted/unquoted values\n // Capture groups: (1) closing slash, (2) tag name, (3) double quoted value, (4) single quoted value, (5) unquoted value\n const tagRegex = /<(\\/?)(\\w+)(?:=(?:\"([^\"]*)\"|'([^']*)'|([^\\s>]+)))?>/g\n const stack: Partial<TextSegment>[] = []\n const segments: TextSegment[] = []\n let lastIndex = 0\n let currentStyle: Partial<TextSegment> = { ...baseStyle }\n\n // Helper to create a styled segment ensuring all style properties are included\n const applyStyle = (text: string) => {\n if (!text) return\n segments.push({\n text,\n color: currentStyle.color,\n weight: currentStyle.weight,\n size: currentStyle.size,\n b: currentStyle.b,\n i: currentStyle.i,\n })\n }\n\n let match: RegExpExecArray | null\n while ((match = tagRegex.exec(input))) {\n const [, closingSlash, tagNameStr, quotedVal1, quotedVal2, unquotedVal] = match\n const tagName = tagNameStr.toLowerCase()\n const value = quotedVal1 || quotedVal2 || unquotedVal\n\n // Process text content before the current tag\n applyStyle(input.slice(lastIndex, match.index))\n lastIndex = tagRegex.lastIndex\n\n if (!closingSlash) {\n // Opening tag: Save current style state and apply new style\n stack.push({ ...currentStyle })\n\n switch (tagName) {\n case 'color':\n // Support any valid CSS color value\n currentStyle.color = value as TextSegment['color']\n break\n\n case 'weight':\n // Support numeric weights (100-900) or keywords\n currentStyle.weight = value as TextSegment['weight']\n break\n\n case 'size':\n // Parse pixel size as number, revert to default if invalid\n currentStyle.size = value ? Number(value) : undefined\n if (isNaN(currentStyle.size as number)) {\n console.warn(`[TextNode ${this.key || ''}] Invalid numeric value for size tag: ${value}`)\n currentStyle.size = undefined\n }\n break\n\n case 'b':\n // Simple bold flag\n currentStyle.b = true\n break\n\n case 'i':\n // Simple italic flag\n currentStyle.i = true\n break\n }\n } else {\n // Closing tag: Restore previous style state\n currentStyle = stack.pop() || { ...baseStyle }\n }\n }\n\n // Process remaining text after last tag\n applyStyle(input.slice(lastIndex))\n\n // Don't filter out empty segments - they might represent empty lines\n return segments\n }\n\n private formatSpacing(value: TextProps['letterSpacing'] | TextProps['wordSpacing']) {\n if (typeof value === 'number') return `${value}px`\n return value || 'normal'\n }\n\n private parseSpacingToPx(spacingValue: number | string | undefined, fontSize: number): number {\n if (spacingValue === undefined || spacingValue === 'normal') {\n return 0\n }\n if (typeof spacingValue === 'number') {\n return spacingValue // Treat raw number as px\n }\n if (typeof spacingValue === 'string') {\n const trimmed = spacingValue.trim()\n if (trimmed.endsWith('px')) {\n return parseFloat(trimmed) || 0\n }\n if (trimmed.endsWith('em')) {\n // Convert em based on the current font size\n return (parseFloat(trimmed) || 0) * fontSize\n }\n // Attempt to parse as a raw number (pixels) if no unit\n const parsed = parseFloat(trimmed)\n if (!isNaN(parsed)) {\n return parsed\n }\n }\n return 0 // Default fallback\n }\n\n /**\n * Generates a CSS font string by combining base TextProps with optional TextSegment styling.\n * Follows browser font string format: \"font-style font-weight font-size font-family\"\n *\n * Priority for style properties:\n * - Weight: segment <weight> tag > segment <b> tag > base fontWeight prop\n * - Style: segment <i> > base fontStyle\n * - Size: segment size > base fontSize\n * - Family: base fontFamily\n * @param segmentStyle Optional TextSegment styling to override base props\n * @returns Formatted CSS font string for canvas context\n */\n private getFontString(segmentStyle?: Partial<TextSegment>): string {\n const baseStyle = this.props\n let effectiveWeight: TextSegment['weight'] | number | undefined\n\n // Determine italic style - segment <i> tag overrides base style\n const effectiveStyle = segmentStyle?.i ? 'italic' : baseStyle.fontStyle || 'normal'\n\n // Determine font weight with priority:\n // 1. Segment explicit weight (<weight> tag)\n // 2. Segment bold flag (<b> tag)\n // 3. Base font weight prop\n if (segmentStyle?.weight) {\n effectiveWeight = segmentStyle.weight\n } else if (segmentStyle?.b) {\n effectiveWeight = 'bold'\n } else {\n effectiveWeight = baseStyle.fontWeight || 'normal'\n }\n\n // Use segment size if specified, otherwise base size with 16px default\n const effectiveSize = segmentStyle?.size ? segmentStyle.size : baseStyle.fontSize || 16\n\n // Combine properties into CSS font string format\n const style = {\n fontStyle: effectiveStyle,\n fontWeight: effectiveWeight,\n fontSize: effectiveSize,\n fontFamily: baseStyle.fontFamily || 'sans-serif',\n }\n\n return `${style.fontStyle} ${style.fontWeight} ${style.fontSize}px ${style.fontFamily}`\n }\n\n /**\n * Gets lines to process respecting maxLines constraint\n */\n private getLinesToMeasureOrRender(): TextSegment[][] {\n const maxLines = this.props.maxLines\n if (maxLines !== undefined && maxLines > 0 && this.lines.length > maxLines) {\n return this.lines.slice(0, maxLines)\n }\n return this.lines\n }\n\n /**\n * Measures text dimensions and calculates layout metrics for the YogaLayout engine.\n * Handles text wrapping, line height calculations, and dynamic leading.\n *\n * Line heights are determined by:\n * 1. Using props.lineHeight as fixed pixel value if provided\n * 2. Otherwise calculating dynamic height based on largest font size per line\n * 3. Adding leading space above/below text content\n * 4. Including specified line gaps between lines\n * @param widthConstraint Maximum allowed width in pixels for text layout\n * @param widthMode YogaLayout mode determining how width constraint is applied\n * @returns Calculated minimum dimensions required to render text content\n * - width: Total width needed for text layout\n * - height: Total height including line heights and gaps\n */\n private measureText(widthConstraint: number, widthMode: MeasureMode): { width: number; height: number } {\n // Create measurement canvas if not exists\n if (!TextNode.measurementContext) {\n TextNode.measurementContext = new Canvas(1, 1).getContext('2d')\n }\n const baseFontSize = this.props.fontSize || 16\n const ctx = TextNode.measurementContext!\n ctx.save()\n\n // Setup text measurement context\n ctx.letterSpacing = this.formatSpacing(this.props.letterSpacing)\n ctx.wordSpacing = 'normal' // Handled manually via parsedWordSpacingPx\n const parsedWordSpacingPx = this.parseSpacingToPx(this.props.wordSpacing, baseFontSize)\n\n // Pre-measure each text segment width with its specific styling\n for (const segment of this.segments) {\n ctx.font = this.getFontString(segment)\n if (typeof this.props.fontVariant === 'string') {\n ctx.fontVariant = this.props.fontVariant\n } else if (this.props.fontVariant !== undefined) {\n console.warn(`[TextNode ${this.key || ''}] Invalid fontVariant prop type in measureText (segment width):`, this.props.fontVariant)\n if (ctx.fontVariant !== 'normal') ctx.fontVariant = 'normal'\n } else {\n if (ctx.fontVariant !== 'normal') ctx.fontVariant = 'normal'\n }\n segment.width = ctx.measureText(segment.text).width\n }\n\n // Calculate available layout width\n const availableWidthForContent = widthMode === Style.MeasureMode.Undefined ? Infinity : Math.max(0, widthConstraint)\n const epsilon = 0.001 // Float precision compensation\n\n // Wrap text into lines based on available width\n this.lines = this.wrapTextRich(ctx, this.segments, availableWidthForContent + epsilon, parsedWordSpacingPx)\n\n // Initialize line metrics arrays\n this.lineHeights = [] // Final heights including leading\n this.lineAscents = [] // Text ascent heights\n this.lineContentHeights = [] // Raw content heights (ascent + descent)\n\n let totalTextHeight = 0\n const linesToMeasure = this.getLinesToMeasureOrRender()\n const numLines = linesToMeasure.length\n const defaultLineHeightMultiplier = 1.2 // Base leading multiplier\n\n // Calculate metrics for each line\n for (const line of linesToMeasure) {\n let maxAscent = 0\n let maxDescent = 0\n let maxFontSizeOnLine = 0\n\n // Handle empty line metrics\n if (line.length === 0) {\n ctx.font = this.getFontString()\n if (typeof this.props.fontVariant === 'string') {\n ctx.fontVariant = this.props.fontVariant\n } else if (this.props.fontVariant !== undefined) {\n console.warn(`[TextNode ${this.key || ''}] Invalid fontVariant prop type in measureText (empty line):`, this.props.fontVariant)\n if (ctx.fontVariant !== 'normal') ctx.fontVariant = 'normal'\n } else {\n if (ctx.fontVariant !== 'normal') ctx.fontVariant = 'normal'\n }\n const metrics = ctx.measureText(this.metricsString)\n maxAscent = metrics.actualBoundingBoxAscent ?? baseFontSize * 0.8\n maxDescent = metrics.actualBoundingBoxDescent ?? baseFontSize * 0.2\n maxFontSizeOnLine = baseFontSize\n } else {\n // Calculate max metrics across all segments in line\n for (const segment of line) {\n if (/^\\s+$/.test(segment.text)) continue\n\n const segmentSize = segment.size || baseFontSize\n maxFontSizeOnLine = Math.max(maxFontSizeOnLine, segmentSize)\n\n ctx.font = this.getFontString(segment)\n if (typeof this.props.fontVariant === 'string') {\n ctx.fontVariant = this.props.fontVariant\n } else if (this.props.fontVariant !== undefined) {\n console.warn(`[TextNode ${this.key || ''}] Invalid fontVariant prop type in measureText (segment height):`, this.props.fontVariant)\n if (ctx.fontVariant !== 'normal') ctx.fontVariant = 'normal'\n } else {\n if (ctx.fontVariant !== 'normal') ctx.fontVariant = 'normal'\n }\n\n const metrics = ctx.measureText(this.metricsString)\n const ascent = metrics.actualBoundingBoxAscent ?? segmentSize * 0.8\n const descent = metrics.actualBoundingBoxDescent ?? segmentSize * 0.2\n\n maxAscent = Math.max(maxAscent, ascent)\n maxDescent = Math.max(maxDescent, descent)\n }\n }\n\n // Fallback metrics for lines with only whitespace\n if (maxAscent === 0 && maxDescent === 0 && line.length > 0) {\n ctx.font = this.getFontString()\n if (typeof this.props.fontVariant === 'string') {\n ctx.fontVariant = this.props.fontVariant\n } else if (this.props.fontVariant !== undefined) {\n console.warn(`[TextNode ${this.key || ''}] Invalid fontVariant prop type in measureText (fallback):`, this.props.fontVariant)\n if (ctx.fontVariant !== 'normal') ctx.fontVariant = 'normal'\n } else {\n if (ctx.fontVariant !== 'normal') ctx.fontVariant = 'normal'\n }\n const metrics = ctx.measureText(this.metricsString)\n maxAscent = metrics.actualBoundingBoxAscent ?? baseFontSize * 0.8\n maxDescent = metrics.actualBoundingBoxDescent ?? baseFontSize * 0.2\n maxFontSizeOnLine = maxFontSizeOnLine || baseFontSize\n }\n\n maxFontSizeOnLine = maxFontSizeOnLine || baseFontSize\n\n // Calculate total content height for line\n const actualContentHeight = maxAscent + maxDescent\n\n // Determine final line box height with leading\n const targetLineBoxHeight =\n typeof this.props.lineHeight === 'number' && this.props.lineHeight > 0 ? this.props.lineHeight : maxFontSizeOnLine * defaultLineHeightMultiplier\n\n // Use larger of target height or content height to prevent clipping\n const finalLineHeight = Math.max(actualContentHeight, targetLineBoxHeight)\n\n // Store line metrics for rendering\n this.lineHeights.push(finalLineHeight)\n this.lineAscents.push(maxAscent)\n this.lineContentHeights.push(actualContentHeight)\n\n totalTextHeight += finalLineHeight\n }\n\n // Add line gap spacing to total height\n const lineGapValue = this.props.lineGap\n const totalGapHeight = Math.max(0, (numLines - 1) * lineGapValue)\n const calculatedContentHeight = totalTextHeight + totalGapHeight\n\n // Calculate width required for text content\n const spaceWidth = this.measureSpaceWidth(ctx)\n let singleLineWidth = 0\n let firstWordInSingleLine = true\n for (const segment of this.segments) {\n const words = segment.text.split(/(\\s+)/).filter(Boolean)\n for (const word of words) {\n if (/^\\s+$/.test(word)) continue\n ctx.font = this.getFontString(segment)\n if (typeof this.props.fontVariant === 'string') {\n ctx.fontVariant = this.props.fontVariant\n } else if (this.props.fontVariant !== undefined) {\n console.warn(`[TextNode ${this.key || ''}] Invalid fontVariant prop type in measureText (single line width):`, this.props.fontVariant)\n if (ctx.fontVariant !== 'normal') ctx.fontVariant = 'normal'\n } else {\n if (ctx.fontVariant !== 'normal') ctx.fontVariant = 'normal'\n }\n const wordWidth = ctx.measureText(word).width\n if (!firstWordInSingleLine) {\n singleLineWidth += spaceWidth + parsedWordSpacingPx\n }\n singleLineWidth += wordWidth\n firstWordInSingleLine = false\n }\n }\n\n // Determine final content width based on wrapping\n let requiredContentWidth: number\n if (singleLineWidth <= availableWidthForContent) {\n requiredContentWidth = singleLineWidth\n if (linesToMeasure.length > 1 && this.props.maxLines !== 1 && !this.segments.some(s => s.text.includes('\\n'))) {\n console.warn(\n `[TextNode ${this.key || ''}] Rich text should fit (${singleLineWidth.toFixed(2)} <= ${availableWidthForContent.toFixed(2)}) but wrapTextRich produced ${linesToMeasure.length} lines. Width calculation might be slightly off due to complex spacing/kerning.`,\n )\n let maxWrappedLineWidth = 0\n for (const line of linesToMeasure) {\n let currentLineWidth = 0\n let firstWordOnWrappedLine = true\n for (const segment of line) {\n const segmentWidth = segment.width ?? 0\n const isSpaceSegment = /^\\s+$/.test(segment.text)\n if (!isSpaceSegment) {\n if (!firstWordOnWrappedLine) {\n currentLineWidth += spaceWidth + parsedWordSpacingPx\n }\n currentLineWidth += segmentWidth\n firstWordOnWrappedLine = false\n }\n }\n maxWrappedLineWidth = Math.max(maxWrappedLineWidth, currentLineWidth)\n }\n requiredContentWidth = Math.max(singleLineWidth, maxWrappedLineWidth)\n }\n } else {\n let maxWrappedLineWidth = 0\n for (const line of linesToMeasure) {\n let currentLineWidth = 0\n let firstWordOnWrappedLine = true\n for (const segment of line) {\n const segmentWidth = segment.width ?? 0\n const isSpaceSegment = /^\\s+$/.test(segment.text)\n if (!isSpaceSegment) {\n if (!firstWordOnWrappedLine) {\n currentLineWidth += spaceWidth + parsedWordSpacingPx\n }\n currentLineWidth += segmentWidth\n firstWordOnWrappedLine = false\n }\n }\n maxWrappedLineWidth = Math.max(maxWrappedLineWidth, currentLineWidth)\n }\n requiredContentWidth = maxWrappedLineWidth\n }\n\n // Constrain width if needed\n let finalContentWidth = requiredContentWidth\n if (availableWidthForContent !== Infinity) {\n finalContentWidth = Math.min(requiredContentWidth, availableWidthForContent)\n }\n\n ctx.restore()\n return {\n width: Math.max(0, finalContentWidth),\n height: Math.max(0, calculatedContentHeight),\n }\n }\n\n /**\n * Wraps text segments into multiple lines while respecting width constraints and preserving styling.\n * Handles rich text attributes (color, weight, size, bold, italic) and proper word wrapping.\n * Also respects explicit newline characters (\\n) for forced line breaks.\n * @param ctx Canvas rendering context used for text measurements\n * @param segments Array of text segments with styling information\n * @param maxWidth Maximum allowed width for each line in pixels\n * @param parsedWordSpacingPx Additional spacing to add between words in pixels\n * @returns Array of lines, where each line contains styled text segments\n */\n private wrapTextRich(ctx: CanvasRenderingContext2D, segments: TextSegment[], maxWidth: number, parsedWordSpacingPx: number): TextSegment[][] {\n const lines: TextSegment[][] = []\n\n if (segments.length === 0 || maxWidth <= 0) return lines\n\n let currentLineSegments: TextSegment[] = []\n let currentLineWidth = 0\n const spaceWidth = this.measureSpaceWidth(ctx)\n\n // Helper to finalize current line and start new one\n const finalizeLine = (forceEmpty = false) => {\n // Remove trailing whitespace segments unless we're forcing an empty line\n if (!forceEmpty) {\n while (currentLineSegments.length > 0 && /^\\s+$/.test(currentLineSegments[currentLineSegments.length - 1].text)) {\n currentLineSegments.pop()\n }\n }\n // Always push the line, even if empty (for \\n\\n cases)\n lines.push(currentLineSegments)\n currentLineSegments = []\n currentLineWidth = 0\n }\n\n for (const segment of segments) {\n // Preserve all style attributes for consistency\n const segmentStyle = {\n color: segment.color,\n weight: segment.weight,\n size: segment.size,\n b: segment.b,\n i: segment.i,\n }\n\n // Check if segment contains newline characters\n if (segment.text.includes('\\n')) {\n // Split by newlines and process each part\n const parts = segment.text.split('\\n')\n\n for (let i = 0; i < parts.length; i++) {\n const part = parts[i]\n const isLastPart = i === parts.length - 1\n\n if (part.length > 0) {\n // Process this part normally\n const wordsAndSpaces = part.split(/(\\s+)/).filter(Boolean)\n\n for (const wordOrSpace of wordsAndSpaces) {\n const isSpace = /^\\s+$/.test(wordOrSpace)\n let wordSegment: TextSegment\n let wordWidth: number\n\n if (isSpace) {\n wordSegment = { text: wordOrSpace, ...segmentStyle, width: 0 }\n wordWidth = 0\n } else {\n ctx.font = this.getFontString(segmentStyle)\n if (this.props.fontVariant) ctx.fontVariant = this.props.fontVariant\n wordWidth = ctx.measureText(wordOrSpace).width\n wordSegment = { text: wordOrSpace, ...segmentStyle, width: wordWidth }\n }\n\n const needsSpace = currentLineSegments.length > 0 && !/^\\s+$/.test(currentLineSegments[currentLineSegments.length - 1].text)\n const spaceToAdd = needsSpace ? spaceWidth + parsedWordSpacingPx : 0\n\n if (currentLineWidth + spaceToAdd + wordWidth <= maxWidth || currentLineSegments.length === 0) {\n if (needsSpace) {\n currentLineSegments.push({ text: ' ', ...segmentStyle, width: 0 })\n currentLineWidth += spaceToAdd\n }\n currentLineSegments.push(wordSegment)\n currentLineWidth += wordWidth\n } else {\n if (currentLineSegments.length > 0) {\n finalizeLine()\n }\n\n if (!isSpace) {\n if (wordWidth > maxWidth && maxWidth > 0) {\n const brokenParts = this.breakWordRich(ctx, wordSegment, maxWidth)\n\n if (brokenParts.length > 0) {\n for (let k = 0; k < brokenParts.length - 1; k++) {\n lines.push([brokenParts[k]])\n }\n currentLineSegments = [brokenParts[brokenParts.length - 1]]\n currentLineWidth = brokenParts[brokenParts.length - 1].width ?? 0\n } else {\n currentLineSegments = [wordSegment]\n currentLineWidth = wordWidth\n }\n } else {\n currentLineSegments = [wordSegment]\n currentLineWidth = wordWidth\n }\n }\n }\n }\n }\n\n // Force line break after each part except the last\n // If part is empty, this creates an empty line (like \\n\\n)\n if (!isLastPart) {\n finalizeLine(part.length === 0)\n }\n }\n } else {\n // No newlines - process normally\n const wordsAndSpaces = segment.text.split(/(\\s+)/).filter(Boolean)\n\n for (const wordOrSpace of wordsAndSpaces) {\n const isSpace = /^\\s+$/.test(wordOrSpace)\n let wordSegment: TextSegment\n let wordWidth: number\n\n if (isSpace) {\n wordSegment = { text: wordOrSpace, ...segmentStyle, width: 0 }\n wordWidth = 0\n } else {\n ctx.font = this.getFontString(segmentStyle)\n if (this.props.fontVariant) ctx.fontVariant = this.props.fontVariant\n wordWidth = ctx.measureText(wordOrSpace).width\n wordSegment = { text: wordOrSpace, ...segmentStyle, width: wordWidth }\n }\n\n const needsSpace = currentLineSegments.length > 0 && !/^\\s+$/.test(currentLineSegments[currentLineSegments.length - 1].text)\n const spaceToAdd = needsSpace ? spaceWidth + parsedWordSpacingPx : 0\n\n if (currentLineWidth + spaceToAdd + wordWidth <= maxWidth || currentLineSegments.length === 0) {\n if (needsSpace) {\n currentLineSegments.push({ text: ' ', ...segmentStyle, width: 0 })\n currentLineWidth += spaceToAdd\n }\n currentLineSegments.push(wordSegment)\n currentLineWidth += wordWidth\n } else {\n if (currentLineSegments.length > 0) {\n finalizeLine()\n }\n\n if (!isSpace) {\n if (wordWidth > maxWidth && maxWidth > 0) {\n const brokenParts = this.breakWordRich(ctx, wordSegment, maxWidth)\n\n if (brokenParts.length > 0) {\n for (let k = 0; k < brokenParts.length - 1; k++) {\n lines.push([brokenParts[k]])\n }\n currentLineSegments = [brokenParts[brokenParts.length - 1]]\n currentLineWidth = brokenParts[brokenParts.length - 1].width ?? 0\n } else {\n currentLineSegments = [wordSegment]\n currentLineWidth = wordWidth\n }\n } else {\n currentLineSegments = [wordSegment]\n currentLineWidth = wordWidth\n }\n }\n }\n }\n }\n }\n\n finalizeLine()\n return lines\n }\n\n /**\n * Breaks a word segment into multiple segments that each fit within the specified width constraint.\n * Maintains all styling properties (color, weight, size, bold, italic) across broken segments.\n * @param ctx Canvas rendering context used for text measurements\n * @param segmentToBreak Original text segment to split\n * @param maxWidth Maximum width allowed for each resulting segment\n * @returns Array of TextSegments, each fitting maxWidth, or original segment if no breaking needed\n */\n private breakWordRich(ctx: CanvasRenderingContext2D, segmentToBreak: TextSegment, maxWidth: number): TextSegment[] {\n const word = segmentToBreak.text\n\n // Copy all style properties to maintain consistent styling across broken segments\n const style = {\n color: segmentToBreak.color,\n weight: segmentToBreak.weight,\n size: segmentToBreak.size,\n b: segmentToBreak.b,\n i: segmentToBreak.i,\n }\n\n if (maxWidth <= 0) return [segmentToBreak]\n\n const brokenSegments: TextSegment[] = []\n let currentPartText = ''\n\n // Configure context with segment style for accurate measurements\n ctx.font = this.getFontString(style)\n if (this.props.fontVariant) ctx.fontVariant = this.props.fontVariant\n\n // Process word character by character to find valid break points\n for (const char of word) {\n const testPartText = currentPartText + char\n const testPartWidth = ctx.measureText(testPartText).width\n\n if (testPartWidth > maxWidth) {\n // Current accumulated text exceeds width - create new segment\n if (currentPartText) {\n brokenSegments.push({\n text: currentPartText,\n ...style,\n width: ctx.measureText(currentPartText).width,\n })\n }\n\n // Handle current character that caused overflow\n currentPartText = char\n const currentCharWidth = ctx.measureText(currentPartText).width\n\n if (currentCharWidth > maxWidth) {\n // Single character is too wide - force break after it\n brokenSegments.push({\n text: currentPartText,\n ...style,\n width: currentCharWidth,\n })\n currentPartText = ''\n }\n } else {\n // Character fits - add to current part\n currentPartText = testPartText\n }\n }\n\n // Handle any remaining text as final segment\n if (currentPartText) {\n brokenSegments.push({\n text: currentPartText,\n ...style,\n width: ctx.measureText(currentPartText).width,\n })\n }\n\n return brokenSegments.length > 0 ? brokenSegments : [segmentToBreak]\n }\n\n /**\n * Measures width of space character using base font\n */\n private measureSpaceWidth(ctx: CanvasRenderingContext2D): number {\n const originalFont = ctx.font\n ctx.font = this.getFontString()\n const width = ctx.measureText(' ').width\n ctx.font = originalFont\n return width > 0 ? width : (this.props.fontSize || 16) * 0.3\n }\n\n /**\n * Renders multi-line text content with rich text styling and layout features\n *\n * Core features:\n * - Dynamic line heights with leading/spacing controls\n * - Vertical text alignment (top/middle/bottom)\n * - Horizontal text alignment (left/center/right/justify)\n * - Text wrapping within bounds\n * - Ellipsis truncation\n * - Rich text styling per segment (color, weight, size, etc)\n * - Performance optimizations (clipping, visibility checks)\n * @param ctx Canvas rendering context\n * @param x Content box left position in pixels\n * @param y Content box top position in pixels\n * @param width Content box total width including padding\n * @param height Content box total height including padding\n */\n protected override _renderContent(ctx: CanvasRenderingContext2D, x: number, y: number, width: number, height: number) {\n super._renderContent(ctx, x, y, width, height)\n\n const linesToRender = this.getLinesToMeasureOrRender()\n const numLinesToRender = linesToRender.length\n\n // Validate required data is available\n if (\n numLinesToRender === 0 ||\n this.segments.length === 0 ||\n this.lineHeights.length !== numLinesToRender ||\n this.lineAscents.length !== numLinesToRender ||\n this.lineContentHeights.length !== numLinesToRender\n ) {\n return\n }\n\n ctx.save()\n ctx.textBaseline = 'alphabetic'\n ctx.letterSpacing = this.formatSpacing(this.props.letterSpacing)\n ctx.wordSpacing = 'normal'\n\n const baseFontSize = this.props.fontSize || 16\n const parsedWordSpacingPx = this.parseSpacingToPx(this.props.wordSpacing, baseFontSize)\n\n // Calculate content box with padding\n const paddingLeft = this.node.getComputedPadding(Style.Edge.Left) ?? 0\n const paddingTop = this.node.getComputedPadding(Style.Edge.Top) ?? 0\n const paddingRight = this.node.getComputedPadding(Style.Edge.Right) ?? 0\n const paddingBottom = this.node.getComputedPadding(Style.Edge.Bottom) ?? 0\n const contentX = x + paddingLeft\n const contentY = y + paddingTop\n const contentWidth = Math.max(0, width - paddingLeft - paddingRight)\n const contentHeight = Math.max(0, height - paddingTop - paddingBottom)\n\n if (contentWidth <= 0 || contentHeight <= 0) {\n ctx.restore()\n return\n }\n\n // Calculate vertical alignment offset\n const lineGapValue = this.props.lineGap\n const totalCalculatedTextHeight = this.lineHeights.reduce((sum, h) => sum + h, 0) + Math.max(0, numLinesToRender - 1) * lineGapValue\n\n let blockStartY: number\n switch (this.props.verticalAlign) {\n case 'middle':\n blockStartY = contentY + (contentHeight - totalCalculatedTextHeight) / 2\n break\n case 'bottom':\n blockStartY = contentY + contentHeight - totalCalculatedTextHeight\n break\n case 'top':\n default:\n blockStartY = contentY\n }\n\n let currentLineTopY = blockStartY\n\n // Setup text content clipping region\n ctx.beginPath()\n ctx.rect(contentX, contentY, contentWidth, contentHeight)\n ctx.clip()\n\n // Configure ellipsis if needed\n const ellipsisChar = typeof this.props.ellipsis === 'string' ? this.props.ellipsis : '...'\n const needsEllipsis = this.props.ellipsis && this.lines.length > numLinesToRender\n let ellipsisWidth = 0\n let ellipsisStyle: Partial<TextSegment> | undefined = undefined\n\n if (needsEllipsis) {\n const lastRenderedLine = linesToRender[numLinesToRender - 1]\n const lastTextStyleSegment = [...lastRenderedLine].reverse().find(seg => !/^\\s+$/.test(seg.text))\n\n // Inherit styles from last non-whitespace segment\n ellipsisStyle = lastTextStyleSegment\n ? {\n color: lastTextStyleSegment.color,\n weight: lastTextStyleSegment.weight,\n size: lastTextStyleSegment.size,\n b: lastTextStyleSegment.b,\n i: lastTextStyleSegment.i,\n }\n : undefined\n\n const originalFont = ctx.font\n const originalVariant = ctx.fontVariant\n ctx.font = this.getFontString(ellipsisStyle)\n\n // Handle font variant setting and validation\n if (typeof this.props.fontVariant === 'string') {\n ctx.fontVariant = this.props.fontVariant\n } else if (this.props.fontVariant !== undefined) {\n console.warn(`[TextNode ${this.key || ''}] Invalid fontVariant prop type in _renderContent (ellipsis measure):`, this.props.fontVariant)\n if (ctx.fontVariant !== 'normal') ctx.fontVariant = 'normal'\n } else {\n if (ctx.fontVariant !== 'normal') ctx.fontVariant = 'normal'\n }\n\n ellipsisWidth = ctx.measureText(ellipsisChar).width\n ctx.font = originalFont\n\n if (originalVariant !== 'normal') {\n ctx.fontVariant = originalVariant\n } else if (ctx.fontVariant !== 'normal') {\n ctx.fontVariant = 'normal'\n }\n }\n\n const spaceWidth = this.measureSpaceWidth(ctx)\n\n // Render text content line by line\n for (let i = 0; i < numLinesToRender; i++) {\n const lineSegments = linesToRender[i]\n const currentLineFinalHeight = this.lineHeights[i]\n const currentLineMaxAscent = this.lineAscents[i]\n const currentLineContentHeight = this.lineContentHeights[i]\n\n // Calculate line spacing metrics\n const currentLineLeading = currentLineFinalHeight - currentLineContentHeight\n const currentLineSpaceAbove = Math.max(0, currentLineLeading / 2)\n const lineY = currentLineTopY + currentLineSpaceAbove + currentLineMaxAscent\n\n // Visibility culling check\n const lineTop = currentLineTopY\n const lineBottom = currentLineTopY + currentLineFinalHeight\n\n // Don't skip empty lines - they're intentional (from \\n\\n)\n // Only skip if the line is completely outside the visible area\n if (lineBottom <= contentY || lineTop >= contentY + contentHeight) {\n currentLineTopY += currentLineFinalHeight + lineGapValue\n continue\n }\n\n const isLastRenderedLine = i === numLinesToRender - 1\n\n // Calculate line width metrics for alignment\n let totalLineWidth = 0\n let totalWordsWidth = 0\n let numWordGaps = 0\n let firstWordOnLine = true\n const noSpaceBeforePunctuation = /^[.,!?;:)\\]}]/\n\n for (const segment of lineSegments) {\n const segmentWidth = segment.width ?? 0\n const isSpaceSegment = /^\\s+$/.test(segment.text)\n\n if (!isSpaceSegment) {\n if (!firstWordOnLine) {\n totalLineWidth += spaceWidth + parsedWordSpacingPx\n if (!noSpaceBeforePunctuation.test(segment.text)) {\n numWordGaps++\n }\n }\n totalLineWidth += segmentWidth\n totalWordsWidth += segmentWidth\n firstWordOnLine = false\n }\n }\n\n // Calculate horizontal alignment position\n const isJustify = this.props.textAlign === 'justify' && !isLastRenderedLine\n const lineTextAlign = isJustify ? 'left' : this.props.textAlign || 'left'\n let currentX: number\n\n switch (lineTextAlign) {\n case 'center':\n currentX = contentX + (contentWidth - totalLineWidth) / 2\n break\n case 'right':\n case 'end':\n currentX = contentX + contentWidth - totalLineWidth\n break\n case 'left':\n case 'start':\n default:\n currentX = contentX\n }\n currentX = Math.max(contentX, currentX)\n\n // Calculate justification spacing\n let spacePerWordGapPlusSpacing = spaceWidth + parsedWordSpacingPx\n if (isJustify && numWordGaps > 0 && totalLineWidth < contentWidth) {\n const totalBaseSpacingWidth = numWordGaps * (spaceWidth + parsedWordSpacingPx)\n const remainingSpace = contentWidth - totalWordsWidth - totalBaseSpacingWidth\n if (remainingSpace > 0) {\n spacePerWordGapPlusSpacing += remainingSpace / numWordGaps\n }\n }\n\n // Render line segments (skip rendering for truly empty lines)\n if (lineSegments.length > 0 && !lineSegments.every(s => s.text.trim() === '')) {\n let accumulatedWidth = 0\n let ellipsisApplied = false\n let firstWordDrawn = false\n\n for (let j = 0; j < lineSegments.length; j++) {\n const segment = lineSegments[j]\n const segmentWidth = segment.width ?? 0\n const isLastSegmentOnLine = j === lineSegments.length - 1\n const isSpaceSegment = /^\\s+$/.test(segment.text)\n\n // Calculate word spacing\n let spaceToAddBefore = 0\n if (!isSpaceSegment && firstWordDrawn && !noSpaceBeforePunctuation.test(segment.text)) {\n spaceToAddBefore = isJustify ? spacePerWordGapPlusSpacing : spaceWidth + parsedWordSpacingPx\n }\n\n // Apply segment styles\n ctx.font = this.getFontString(segment)\n ctx.fillStyle = segment.color || this.props.color || 'black'\n\n if (typeof this.props.fontVariant === 'string') {\n ctx.fontVariant = this.props.fontVariant\n } else if (this.props.fontVariant !== undefined) {\n console.warn(`[TextNode ${this.key || ''}] Invalid fontVariant prop type in _renderContent (segment render):`, this.props.fontVariant)\n if (ctx.fontVariant !== 'normal') ctx.fontVariant = 'normal'\n } else {\n if (ctx.fontVariant !== 'normal') ctx.fontVariant = 'normal'\n }\n\n // Handle text truncation and ellipsis\n let textToDraw = segment.text\n let currentSegmentRenderWidth = segmentWidth\n let applyEllipsisAfter = false\n\n if (isLastRenderedLine && needsEllipsis && !isSpaceSegment) {\n const currentTotalWidth = accumulatedWidth + spaceToAddBefore + segmentWidth\n const spaceNeededAfter = isLastSegmentOnLine ? 0 : isJustify ? spacePerWordGapPlusSpacing : spaceWidth + parsedWordSpacingPx\n\n if (currentTotalWidth > contentWidth - spaceNeededAfter) {\n const availableWidthForSegment = contentWidth - accumulatedWidth - spaceToAddBefore - ellipsisWidth\n if (availableWidthForSegment > 0) {\n let truncatedText = ''\n for (const char of segment.text) {\n if (ctx.measureText(truncatedText + char).width <= availableWidthForSegment) {\n truncatedText += char\n } else {\n break\n }\n }\n textToDraw = truncatedText\n currentSegmentRenderWidth = ctx.measureText(textToDraw).width\n } else {\n textToDraw = ''\n currentSegmentRenderWidth = 0\n }\n applyEllipsisAfter = true\n ellipsisApplied = true\n } else if (isLastSegmentOnLine) {\n applyEllipsisAfter = true\n ellipsisApplied = true\n }\n }\n\n // Render text segment\n currentX += spaceToAddBefore\n accumulatedWidth += spaceToAddBefore\n\n const remainingRenderWidth = contentX + contentWidth - currentX\n if (currentSegmentRenderWidth > 0 && remainingRenderWidth > 0 && !isSpaceSegment) {\n ctx.textAlign = 'left'\n\n const shadows = this.props.textShadow ? (Array.isArray(this.props.textShadow) ? this.props.textShadow : [this.props.textShadow]) : []\n\n ctx.save()\n\n // Draw shadows\n for (const shadow of shadows) {\n ctx.shadowColor = shadow.color || 'transparent'\n ctx.shadowBlur = shadow.blur || 0\n ctx.shadowOffsetX = shadow.offsetX || 0\n ctx.shadowOffsetY = shadow.offsetY || 0\n ctx.fillText(textToDraw, currentX, lineY, Math.max(0, remainingRenderWidth + 1))\n }\n\n // Reset shadow to draw the main text\n ctx.shadowColor = 'transparent'\n ctx.shadowBlur = 0\n ctx.shadowOffsetX = 0\n ctx.shadowOffsetY = 0\n\n ctx.fillText(textToDraw, currentX, lineY, Math.max(0, remainingRenderWidth + 1))\n\n ctx.restore()\n\n firstWordDrawn = true\n }\n\n currentX += currentSegmentRenderWidth\n accumulatedWidth += currentSegmentRenderWidth\n\n // Render ellipsis\n if (applyEllipsisAfter) {\n const ellipsisRemainingWidth = contentX + contentWidth - currentX\n if (ellipsisRemainingWidth >= ellipsisWidth) {\n const originalFont = ctx.font\n const originalVariant = ctx.fontVariant\n const originalFill = ctx.fillStyle\n\n ctx.font = this.getFontString(ellipsisStyle)\n\n if (typeof this.props.fontVariant === 'string') {\n ctx.fontVariant = this.props.fontVariant\n } else if (this.props.fontVariant !== undefined) {\n console.warn(`[TextNode ${this.key || ''}] Invalid fontVariant prop type in _renderContent (ellipsis draw):`, this.props.fontVariant)\n if (ctx.fontVariant !== 'normal') ctx.fontVariant = 'normal'\n } else {\n if (ctx.fontVariant !== 'normal') ctx.fontVariant = 'normal'\n }\n\n ctx.fillStyle = ellipsisStyle?.color || this.props.color || 'black'\n ctx.fillText(ellipsisChar, currentX, lineY, Math.max(0, ellipsisRemainingWidth + 1))\n\n ctx.font = originalFont\n if (originalVariant !== 'normal') {\n ctx.fontVariant = originalVariant\n } else if (ctx.fontVariant !== 'normal') {\n ctx.fontVariant = 'normal'\n }\n ctx.fillStyle = originalFill\n }\n break\n }\n\n if (ellipsisApplied && currentX >= contentX + contentWidth) break\n }\n }\n\n currentLineTopY += currentLineFinalHeight + lineGapValue\n }\n\n ctx.restore()\n }\n}\n\n/**\n * Creates a new TextNode instance with rich text support\n */\nexport const Text = (text: number | string, props?: TextProps) => new TextNode(text, props)\n"],"names":["BoxNode","Canvas","Style"],"mappings":";;;;;;AAAA;AAOA;;;AAGG;AACG,MAAO,QAAS,SAAQA,0BAAO,CAAA;IAClB,QAAQ,GAAkB,EAAE;IACr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,QAAQ;AAAE,oCAAA,GAAG,CAAC,WAAW,GAAG,QAAQ;4BAC9D;AAEA,4BAAA,GAAG,CAAC,SAAS,GAAG,aAAa,EAAE,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,IAAI,OAAO;4BACnE,GAAG,CAAC,QAAQ,CAAC,YAAY,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,sBAAsB,GAAG,CAAC,CAAC,CAAC;AAEpF,4BAAA,GAAG,CAAC,IAAI,GAAG,YAAY;AACvB,4BAAA,IAAI,eAAe,KAAK,QAAQ,EAAE;AAChC,gCAAA,GAAG,CAAC,WAAW,GAAG,eAAe;4BACnC;AAAO,iCAAA,IAAI,GAAG,CAAC,WAAW,KAAK,QAAQ,EAAE;AACvC,gCAAA,GAAG,CAAC,WAAW,GAAG,QAAQ;4BAC5B;AACA,4BAAA,GAAG,CAAC,SAAS,GAAG,YAAY;wBAC9B;wBACA;oBACF;AAEA,oBAAA,IAAI,eAAe,IAAI,QAAQ,IAAI,QAAQ,GAAG,YAAY;wBAAE;gBAC9D;YACF;AAEA,YAAA,eAAe,IAAI,sBAAsB,GAAG,YAAY;QAC1D;QAEA,GAAG,CAAC,OAAO,EAAE;IACf;;AAGF;;AAEG;AACI,MAAM,IAAI,GAAG,CAAC,IAAqB,EAAE,KAAiB,KAAK,IAAI,QAAQ,CAAC,IAAI,EAAE,KAAK;;;;;"}
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -5,4 +5,5 @@ export { Image } from './canvas/image.canvas.util.js';
|
|
|
5
5
|
export { Text } from './canvas/text.canvas.util.js';
|
|
6
6
|
export { Root } from './canvas/root.canvas.util.js';
|
|
7
7
|
export { Grid } from './canvas/grid.canvas.util.js';
|
|
8
|
+
export { Chart } from './canvas/chart.canvas.util.js';
|
|
8
9
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/cjs/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAA;AAC1C,cAAc,yBAAyB,CAAA;AACvC,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,OAAO,EAAE,MAAM,gCAAgC,CAAA;AAC/E,OAAO,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAA;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAA;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAA;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAA;AAC1C,cAAc,yBAAyB,CAAA;AACvC,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,OAAO,EAAE,MAAM,gCAAgC,CAAA;AAC/E,OAAO,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAA;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAA;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAA;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAA;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAA"}
|