fetta 1.3.3 → 1.3.4

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.
@@ -580,7 +580,7 @@ function performSplit(element, measuredWords, charClass, wordClass, lineClass, s
580
580
  i++;
581
581
  }
582
582
  }
583
- if (splitChars && allWords.length > 0) {
583
+ if (!(options == null ? void 0 : options.disableKerning) && splitChars && allWords.length > 0) {
584
584
  for (const wordSpan of allWords) {
585
585
  const wordChars = Array.from(wordSpan.querySelectorAll(`.${charClass}`));
586
586
  if (wordChars.length < 2) continue;
@@ -640,7 +640,7 @@ function performSplit(element, measuredWords, charClass, wordClass, lineClass, s
640
640
  targetElement.style.marginLeft = `${totalKerning}px`;
641
641
  }
642
642
  }
643
- } else if (splitWords && allWords.length > 1) {
643
+ } else if (!(options == null ? void 0 : options.disableKerning) && splitWords && allWords.length > 1) {
644
644
  for (let wordIdx = 1; wordIdx < allWords.length; wordIdx++) {
645
645
  if (noSpaceBeforeSet.has(allWords[wordIdx])) continue;
646
646
  const prevWord = allWords[wordIdx - 1];
@@ -805,7 +805,8 @@ function splitText(element, {
805
805
  onResize,
806
806
  onSplit,
807
807
  revertOnComplete = false,
808
- propIndex = false
808
+ propIndex = false,
809
+ disableKerning = false
809
810
  } = {}) {
810
811
  var _a;
811
812
  if (!(element instanceof HTMLElement)) {
@@ -856,7 +857,7 @@ function splitText(element, {
856
857
  splitChars,
857
858
  splitWords,
858
859
  splitLines,
859
- { propIndex, mask, ariaHidden: !trackAncestors }
860
+ { propIndex, mask, ariaHidden: !trackAncestors, disableKerning }
860
861
  );
861
862
  currentChars = chars;
862
863
  currentWords = words;
@@ -931,7 +932,7 @@ function splitText(element, {
931
932
  splitChars,
932
933
  splitWords,
933
934
  splitLines,
934
- { propIndex, mask, ariaHidden: !trackAncestors }
935
+ { propIndex, mask, ariaHidden: !trackAncestors, disableKerning }
935
936
  );
936
937
  currentChars = result.chars;
937
938
  currentWords = result.words;
package/dist/index.d.ts CHANGED
@@ -42,6 +42,10 @@ interface SplitTextOptions {
42
42
  revertOnComplete?: boolean;
43
43
  /** Add CSS custom properties (--char-index, --word-index, --line-index) */
44
44
  propIndex?: boolean;
45
+ /** Skip kerning compensation (no margin adjustments applied).
46
+ * Kerning is naturally lost when splitting into inline-block spans.
47
+ * Use this if you prefer no compensation over imperfect Safari compensation. */
48
+ disableKerning?: boolean;
45
49
  }
46
50
  /**
47
51
  * Result returned by splitText containing arrays of split elements and a revert function.
@@ -108,6 +112,6 @@ interface SplitTextResult {
108
112
  * });
109
113
  * ```
110
114
  */
111
- declare function splitText(element: HTMLElement, { type, charClass, wordClass, lineClass, mask, autoSplit, onResize, onSplit, revertOnComplete, propIndex, }?: SplitTextOptions): SplitTextResult;
115
+ declare function splitText(element: HTMLElement, { type, charClass, wordClass, lineClass, mask, autoSplit, onResize, onSplit, revertOnComplete, propIndex, disableKerning, }?: SplitTextOptions): SplitTextResult;
112
116
 
113
117
  export { type SplitTextOptions, type SplitTextResult, splitText };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- export { splitText } from './chunk-RJ7GQ53Y.js';
1
+ export { splitText } from './chunk-BXFBPQNP.js';
package/dist/react.d.ts CHANGED
@@ -10,6 +10,10 @@ interface SplitTextOptions {
10
10
  /** Apply overflow mask wrapper to elements for reveal animations */
11
11
  mask?: "lines" | "words" | "chars";
12
12
  propIndex?: boolean;
13
+ /** Skip kerning compensation (no margin adjustments applied).
14
+ * Kerning is naturally lost when splitting into inline-block spans.
15
+ * Use this if you prefer no compensation over imperfect Safari compensation. */
16
+ disableKerning?: boolean;
13
17
  }
14
18
  interface InViewOptions {
15
19
  /** How much of the element must be visible (0-1). Default: 0 */
package/dist/react.js CHANGED
@@ -1,4 +1,4 @@
1
- import { splitText, __spreadProps, __spreadValues, normalizeToPromise } from './chunk-RJ7GQ53Y.js';
1
+ import { splitText, __spreadProps, __spreadValues, normalizeToPromise } from './chunk-BXFBPQNP.js';
2
2
  import { forwardRef, useRef, useCallback, useState, useLayoutEffect, useEffect, isValidElement, cloneElement } from 'react';
3
3
  import { jsx } from 'react/jsx-runtime';
4
4
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fetta",
3
- "version": "1.3.3",
3
+ "version": "1.3.4",
4
4
  "description": "Text splitting library with kerning compensation for animations",
5
5
  "type": "module",
6
6
  "sideEffects": false,