@pdfme/ui 3.4.2 → 3.4.3

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/dist/index.es.js CHANGED
@@ -75028,16 +75028,21 @@ const getBrowserVerticalFontAdjustments = (a, s, $, _) => {
75028
75028
  if (isTextExceedingBoxWidth(a.slice(0, $ + 1), s))
75029
75029
  return $;
75030
75030
  return null;
75031
- }, getSplitPosition = (a, s) => {
75031
+ }, isLineBreakableChar = (a) => [" ", "-", "—", "–"].includes(a), getSplitPosition = (a, s) => {
75032
75032
  const $ = getOverPosition(a, s);
75033
75033
  if ($ === null)
75034
75034
  return a.length;
75035
- let _ = $;
75036
- for (; a[_] !== " " && _ >= 0; )
75035
+ if (a[$] === " ")
75036
+ return $;
75037
+ let _ = $ - 1;
75038
+ for (; _ >= 0; ) {
75039
+ if (isLineBreakableChar(a[_]))
75040
+ return _ + 1;
75037
75041
  _--;
75038
- return _ > 0 ? _ : $;
75042
+ }
75043
+ return $;
75039
75044
  }, getSplittedLines = (a, s) => {
75040
- const $ = getSplitPosition(a, s), _ = a.substring(0, $), _e = a.substring($).trimStart();
75045
+ const $ = getSplitPosition(a, s), _ = a.substring(0, $).trimEnd(), _e = a.substring($).trimStart();
75041
75046
  return _e === a ? [a] : _e.length === 0 ? [_] : [_, ...getSplittedLines(_e, s)];
75042
75047
  }, calculateDynamicFontSize = async ({ textSchema: a, font: s, value: $, startingFontSize: _, _cache: _e }) => {
75043
75048
  const { fontSize: tt, dynamicFontSize: nt, characterSpacing: at, width: ot, height: rt, lineHeight: st = DEFAULT_LINE_HEIGHT } = a, lt = _ || tt || DEFAULT_FONT_SIZE;