fetta 1.3.1 → 1.3.2
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.
|
@@ -618,6 +618,28 @@ function performSplit(element, measuredWords, charClass, wordClass, lineClass, s
|
|
|
618
618
|
}
|
|
619
619
|
}
|
|
620
620
|
}
|
|
621
|
+
for (let wordIdx = 1; wordIdx < allWords.length; wordIdx++) {
|
|
622
|
+
if (noSpaceBeforeSet.has(allWords[wordIdx])) continue;
|
|
623
|
+
const prevWord = allWords[wordIdx - 1];
|
|
624
|
+
const currWord = allWords[wordIdx];
|
|
625
|
+
const prevChars = Array.from(prevWord.querySelectorAll(`.${charClass}`));
|
|
626
|
+
const currChars = Array.from(currWord.querySelectorAll(`.${charClass}`));
|
|
627
|
+
if (prevChars.length === 0 || currChars.length === 0) continue;
|
|
628
|
+
const lastCharSpan = prevChars[prevChars.length - 1];
|
|
629
|
+
const firstCharSpan = currChars[0];
|
|
630
|
+
const lastChar = lastCharSpan.textContent || "";
|
|
631
|
+
const firstChar = firstCharSpan.textContent || "";
|
|
632
|
+
if (!lastChar || !firstChar) continue;
|
|
633
|
+
const styles = getComputedStyle(firstCharSpan);
|
|
634
|
+
const kerningMap = measureKerning(element, firstCharSpan, [lastChar, " ", firstChar], styles);
|
|
635
|
+
let totalKerning = 0;
|
|
636
|
+
if (kerningMap.has(1)) totalKerning += kerningMap.get(1);
|
|
637
|
+
if (kerningMap.has(2)) totalKerning += kerningMap.get(2);
|
|
638
|
+
if (Math.abs(totalKerning) > 0.01 && Math.abs(totalKerning) < 20) {
|
|
639
|
+
const targetElement = (options == null ? void 0 : options.mask) === "chars" && firstCharSpan.parentElement ? firstCharSpan.parentElement : firstCharSpan;
|
|
640
|
+
targetElement.style.marginLeft = `${totalKerning}px`;
|
|
641
|
+
}
|
|
642
|
+
}
|
|
621
643
|
}
|
|
622
644
|
if (splitLines) {
|
|
623
645
|
const lineGroups = groupIntoLines(allWords, element);
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { splitText } from './chunk-
|
|
1
|
+
export { splitText } from './chunk-INF3II55.js';
|
package/dist/react.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { splitText, __spreadProps, __spreadValues, normalizeToPromise } from './chunk-
|
|
1
|
+
import { splitText, __spreadProps, __spreadValues, normalizeToPromise } from './chunk-INF3II55.js';
|
|
2
2
|
import { forwardRef, useRef, useCallback, useState, useLayoutEffect, useEffect, isValidElement, cloneElement } from 'react';
|
|
3
3
|
import { jsx } from 'react/jsx-runtime';
|
|
4
4
|
|