ugcinc 4.5.69 → 4.5.71
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.
|
@@ -163,17 +163,17 @@ function calculateAutoWidthAndLines({ text, maxWidth, paddingLeft, paddingRight,
|
|
|
163
163
|
return { width: calculatedWidth, lines };
|
|
164
164
|
}
|
|
165
165
|
/**
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
*
|
|
166
|
+
* Replace emoji characters with em-spaces for the stroke layer.
|
|
167
|
+
* Em-space (U+2003) is 1em wide, close to emoji width (~1-1.2em),
|
|
168
|
+
* preserving line width for correct text-align centering.
|
|
169
|
+
* The em-space renders as whitespace (no alpha for feMorphology to dilate).
|
|
169
170
|
*/
|
|
170
|
-
function
|
|
171
|
+
function getStrokeText(text) {
|
|
171
172
|
if (!(0, emoji_1.hasEmoji)(text))
|
|
172
173
|
return text;
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
: part.content);
|
|
174
|
+
return (0, emoji_1.splitTextAndEmojis)(text)
|
|
175
|
+
.map(part => part.type === 'emoji' ? '\u2003' : part.content)
|
|
176
|
+
.join('');
|
|
177
177
|
}
|
|
178
178
|
/**
|
|
179
179
|
* TextElement renders text with full styling support including:
|
|
@@ -380,7 +380,7 @@ function TextElement({ segment, scale = 1 }) {
|
|
|
380
380
|
const strokeFilterSvg = hasStroke ? ((0, jsx_runtime_1.jsx)("svg", { style: { position: 'absolute', width: 0, height: 0, overflow: 'hidden' }, "aria-hidden": "true", children: (0, jsx_runtime_1.jsx)("defs", { children: (0, jsx_runtime_1.jsxs)("filter", { id: filterId, x: `-${strokePadPct}%`, y: `-${strokePadPct}%`, width: `${100 + 2 * strokePadPct}%`, height: `${100 + 2 * strokePadPct}%`, children: [(0, jsx_runtime_1.jsx)("feMorphology", { in: "SourceAlpha", operator: "dilate", radius: strokeWidth, result: "dilated" }), (0, jsx_runtime_1.jsx)("feFlood", { floodColor: strokeColor, result: "color" }), (0, jsx_runtime_1.jsx)("feComposite", { in: "color", in2: "dilated", operator: "in" })] }) }) })) : null;
|
|
381
381
|
if (autoWidth) {
|
|
382
382
|
const textContent = calculatedLines.map((line, index) => ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [line, index < calculatedLines.length - 1 && (0, jsx_runtime_1.jsx)("br", {})] }, index)));
|
|
383
|
-
const strokeContent = calculatedLines.map((line, index) => ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [
|
|
383
|
+
const strokeContent = calculatedLines.map((line, index) => ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [getStrokeText(line), index < calculatedLines.length - 1 && (0, jsx_runtime_1.jsx)("br", {})] }, index)));
|
|
384
384
|
if (backgroundColor) {
|
|
385
385
|
return ((0, jsx_runtime_1.jsx)("div", { style: positioningContainerStyle, children: (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
386
386
|
width: calculatedWidth,
|
|
@@ -392,6 +392,6 @@ function TextElement({ segment, scale = 1 }) {
|
|
|
392
392
|
}
|
|
393
393
|
return ((0, jsx_runtime_1.jsx)("div", { style: positioningContainerStyle, children: (0, jsx_runtime_1.jsxs)("div", { style: { width: calculatedWidth, maxWidth: width, ...(hasStroke && { position: 'relative' }) }, children: [strokeFilterSvg, strokeTextStyle && (0, jsx_runtime_1.jsx)("div", { style: strokeTextStyle, "aria-hidden": "true", children: strokeContent }), (0, jsx_runtime_1.jsx)("div", { style: textStyle, children: textContent })] }) }));
|
|
394
394
|
}
|
|
395
|
-
return ((0, jsx_runtime_1.jsx)("div", { style: positioningContainerStyle, children: (0, jsx_runtime_1.jsxs)("div", { style: { ...backgroundBoxStyle, ...(hasStroke && { position: 'relative' }) }, children: [strokeFilterSvg, strokeTextStyle && (0, jsx_runtime_1.jsx)("div", { style: strokeTextStyle, "aria-hidden": "true", children:
|
|
395
|
+
return ((0, jsx_runtime_1.jsx)("div", { style: positioningContainerStyle, children: (0, jsx_runtime_1.jsxs)("div", { style: { ...backgroundBoxStyle, ...(hasStroke && { position: 'relative' }) }, children: [strokeFilterSvg, strokeTextStyle && (0, jsx_runtime_1.jsx)("div", { style: strokeTextStyle, "aria-hidden": "true", children: getStrokeText(segment.text) }), (0, jsx_runtime_1.jsx)("div", { style: textStyle, children: segment.text })] }) }));
|
|
396
396
|
}
|
|
397
397
|
exports.default = TextElement;
|