ugcinc 4.5.62 → 4.5.64
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.
|
@@ -338,6 +338,20 @@ function TextElement({ segment, scale = 1 }) {
|
|
|
338
338
|
}, [autoWidth, calculatedWidth, width, backgroundColor, backgroundOpacity, borderRadiusStyle]);
|
|
339
339
|
const hasStroke = strokeWidth > 0 && !!strokeColor;
|
|
340
340
|
const filterId = `te-stroke-${react_1.default.useId().replace(/:/g, '')}`;
|
|
341
|
+
if (hasStroke) {
|
|
342
|
+
console.log('[TextElement] STROKE_DEBUG:', JSON.stringify({
|
|
343
|
+
text: segment.text.substring(0, 50),
|
|
344
|
+
strokeWidth,
|
|
345
|
+
strokeColor,
|
|
346
|
+
filterId,
|
|
347
|
+
paddingTop, paddingRight, paddingBottom, paddingLeft,
|
|
348
|
+
fontSize,
|
|
349
|
+
strokePadPct: Math.max(50, Math.ceil((strokeWidth / fontSize) * 200)),
|
|
350
|
+
autoWidth,
|
|
351
|
+
width,
|
|
352
|
+
calculatedWidth,
|
|
353
|
+
}));
|
|
354
|
+
}
|
|
341
355
|
// Text style (fill layer)
|
|
342
356
|
const textStyle = (0, react_1.useMemo)(() => ({
|
|
343
357
|
fontFamily,
|
|
@@ -357,7 +371,7 @@ function TextElement({ segment, scale = 1 }) {
|
|
|
357
371
|
flex: 1,
|
|
358
372
|
minHeight: 0,
|
|
359
373
|
}),
|
|
360
|
-
...(hasStroke && { position: 'relative' }),
|
|
374
|
+
...(hasStroke && { position: 'relative', zIndex: 1 }),
|
|
361
375
|
}), [
|
|
362
376
|
fontFamily, fontSize, fontWeight, color, lineHeight, letterSpacing, alignment,
|
|
363
377
|
paddingTop, paddingRight, paddingBottom, paddingLeft,
|
|
@@ -369,17 +383,26 @@ function TextElement({ segment, scale = 1 }) {
|
|
|
369
383
|
const strokeTextStyle = (0, react_1.useMemo)(() => {
|
|
370
384
|
if (!hasStroke)
|
|
371
385
|
return undefined;
|
|
372
|
-
|
|
386
|
+
const style = {
|
|
373
387
|
...textStyle,
|
|
374
388
|
color: strokeColor,
|
|
375
389
|
filter: `url(#${filterId})`,
|
|
376
390
|
position: 'absolute',
|
|
377
|
-
top:
|
|
378
|
-
left:
|
|
379
|
-
right:
|
|
380
|
-
bottom:
|
|
381
|
-
padding: `${paddingTop + strokeWidth}px ${paddingRight + strokeWidth}px ${paddingBottom + strokeWidth}px ${paddingLeft + strokeWidth}px`,
|
|
391
|
+
top: 0,
|
|
392
|
+
left: 0,
|
|
393
|
+
right: 0,
|
|
394
|
+
bottom: 0,
|
|
382
395
|
};
|
|
396
|
+
console.log('[TextElement] STROKE_STYLE:', JSON.stringify({
|
|
397
|
+
filter: style.filter,
|
|
398
|
+
top: style.top,
|
|
399
|
+
left: style.left,
|
|
400
|
+
right: style.right,
|
|
401
|
+
bottom: style.bottom,
|
|
402
|
+
padding: style.padding,
|
|
403
|
+
color: style.color,
|
|
404
|
+
}));
|
|
405
|
+
return style;
|
|
383
406
|
}, [hasStroke, textStyle, strokeColor, filterId, strokeWidth, paddingTop, paddingRight, paddingBottom, paddingLeft]);
|
|
384
407
|
// SVG filter for smooth text outline (avoids miter spikes from -webkit-text-stroke)
|
|
385
408
|
const strokePadPct = Math.max(50, Math.ceil((strokeWidth / fontSize) * 200));
|
|
@@ -389,10 +412,15 @@ function TextElement({ segment, scale = 1 }) {
|
|
|
389
412
|
// keep layout identical to the fill layer.
|
|
390
413
|
const renderStrokeText = (text) => {
|
|
391
414
|
const parts = (0, emoji_1.splitTextAndEmojis)(text);
|
|
415
|
+
console.log('[TextElement] EMOJI_DEBUG:', JSON.stringify({
|
|
416
|
+
text: text.substring(0, 50),
|
|
417
|
+
partsCount: parts.length,
|
|
418
|
+
parts: parts.map(p => ({ type: p.type, content: p.content.substring(0, 10) })),
|
|
419
|
+
}));
|
|
392
420
|
if (parts.every(p => p.type === 'text'))
|
|
393
421
|
return text;
|
|
394
422
|
return parts.map((part, i) => part.type === 'emoji'
|
|
395
|
-
? (0, jsx_runtime_1.jsx)("span", { style: {
|
|
423
|
+
? (0, jsx_runtime_1.jsx)("span", { style: { visibility: 'hidden' }, children: part.content }, i)
|
|
396
424
|
: (0, jsx_runtime_1.jsx)(react_1.default.Fragment, { children: part.content }, i));
|
|
397
425
|
};
|
|
398
426
|
if (autoWidth) {
|