number-flow-react-native 0.1.0

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.
Files changed (245) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +44 -0
  3. package/lib/module/core/constants.js +21 -0
  4. package/lib/module/core/constants.js.map +1 -0
  5. package/lib/module/core/intlHelpers.js +310 -0
  6. package/lib/module/core/intlHelpers.js.map +1 -0
  7. package/lib/module/core/layout.js +71 -0
  8. package/lib/module/core/layout.js.map +1 -0
  9. package/lib/module/core/mask.js +50 -0
  10. package/lib/module/core/mask.js.map +1 -0
  11. package/lib/module/core/numerals/detection.js +105 -0
  12. package/lib/module/core/numerals/detection.js.map +1 -0
  13. package/lib/module/core/numerals/digits.js +128 -0
  14. package/lib/module/core/numerals/digits.js.map +1 -0
  15. package/lib/module/core/numerals/index.js +5 -0
  16. package/lib/module/core/numerals/index.js.map +1 -0
  17. package/lib/module/core/numerals/tables.js +114 -0
  18. package/lib/module/core/numerals/tables.js.map +1 -0
  19. package/lib/module/core/superscript.js +31 -0
  20. package/lib/module/core/superscript.js.map +1 -0
  21. package/lib/module/core/timeLayout.js +98 -0
  22. package/lib/module/core/timeLayout.js.map +1 -0
  23. package/lib/module/core/timeTypes.js +4 -0
  24. package/lib/module/core/timeTypes.js.map +1 -0
  25. package/lib/module/core/timing.js +45 -0
  26. package/lib/module/core/timing.js.map +1 -0
  27. package/lib/module/core/types.js +58 -0
  28. package/lib/module/core/types.js.map +1 -0
  29. package/lib/module/core/useAccessibilityAnnouncement.js +27 -0
  30. package/lib/module/core/useAccessibilityAnnouncement.js.map +1 -0
  31. package/lib/module/core/useAnimatedX.js +25 -0
  32. package/lib/module/core/useAnimatedX.js.map +1 -0
  33. package/lib/module/core/useAnimationLifecycle.js +37 -0
  34. package/lib/module/core/useAnimationLifecycle.js.map +1 -0
  35. package/lib/module/core/useCanAnimate.js +22 -0
  36. package/lib/module/core/useCanAnimate.js.map +1 -0
  37. package/lib/module/core/useContinuousSpin.js +89 -0
  38. package/lib/module/core/useContinuousSpin.js.map +1 -0
  39. package/lib/module/core/useDebouncedWidths.js +74 -0
  40. package/lib/module/core/useDebouncedWidths.js.map +1 -0
  41. package/lib/module/core/useDigitAnimation.js +138 -0
  42. package/lib/module/core/useDigitAnimation.js.map +1 -0
  43. package/lib/module/core/useFlowPipeline.js +85 -0
  44. package/lib/module/core/useFlowPipeline.js.map +1 -0
  45. package/lib/module/core/useFormattedValue.js +28 -0
  46. package/lib/module/core/useFormattedValue.js.map +1 -0
  47. package/lib/module/core/useLayoutDiff.js +59 -0
  48. package/lib/module/core/useLayoutDiff.js.map +1 -0
  49. package/lib/module/core/useNumberFormatting.js +158 -0
  50. package/lib/module/core/useNumberFormatting.js.map +1 -0
  51. package/lib/module/core/useSlotOpacity.js +53 -0
  52. package/lib/module/core/useSlotOpacity.js.map +1 -0
  53. package/lib/module/core/useTimeFormatting.js +74 -0
  54. package/lib/module/core/useTimeFormatting.js.map +1 -0
  55. package/lib/module/core/useTimingResolution.js +21 -0
  56. package/lib/module/core/useTimingResolution.js.map +1 -0
  57. package/lib/module/core/useWorkletFormatting.js +49 -0
  58. package/lib/module/core/useWorkletFormatting.js.map +1 -0
  59. package/lib/module/core/utils.js +132 -0
  60. package/lib/module/core/utils.js.map +1 -0
  61. package/lib/module/core/warnings.js +10 -0
  62. package/lib/module/core/warnings.js.map +1 -0
  63. package/lib/module/index.js +7 -0
  64. package/lib/module/index.js.map +1 -0
  65. package/lib/module/native/DigitSlot.js +163 -0
  66. package/lib/module/native/DigitSlot.js.map +1 -0
  67. package/lib/module/native/NumberFlow.js +244 -0
  68. package/lib/module/native/NumberFlow.js.map +1 -0
  69. package/lib/module/native/SymbolSlot.js +52 -0
  70. package/lib/module/native/SymbolSlot.js.map +1 -0
  71. package/lib/module/native/TimeFlow.js +270 -0
  72. package/lib/module/native/TimeFlow.js.map +1 -0
  73. package/lib/module/native/index.js +5 -0
  74. package/lib/module/native/index.js.map +1 -0
  75. package/lib/module/native/renderSlots.js +108 -0
  76. package/lib/module/native/renderSlots.js.map +1 -0
  77. package/lib/module/native/types.js +4 -0
  78. package/lib/module/native/types.js.map +1 -0
  79. package/lib/module/native/useMeasuredGlyphMetrics.js +156 -0
  80. package/lib/module/native/useMeasuredGlyphMetrics.js.map +1 -0
  81. package/lib/module/package.json +1 -0
  82. package/lib/module/skia/DigitSlot.js +171 -0
  83. package/lib/module/skia/DigitSlot.js.map +1 -0
  84. package/lib/module/skia/SkiaNumberFlow.js +430 -0
  85. package/lib/module/skia/SkiaNumberFlow.js.map +1 -0
  86. package/lib/module/skia/SkiaTimeFlow.js +226 -0
  87. package/lib/module/skia/SkiaTimeFlow.js.map +1 -0
  88. package/lib/module/skia/SymbolSlot.js +92 -0
  89. package/lib/module/skia/SymbolSlot.js.map +1 -0
  90. package/lib/module/skia/index.js +6 -0
  91. package/lib/module/skia/index.js.map +1 -0
  92. package/lib/module/skia/renderSlots.js +131 -0
  93. package/lib/module/skia/renderSlots.js.map +1 -0
  94. package/lib/module/skia/useGlyphMetrics.js +72 -0
  95. package/lib/module/skia/useGlyphMetrics.js.map +1 -0
  96. package/lib/module/skia/useScrubbing.js +165 -0
  97. package/lib/module/skia/useScrubbing.js.map +1 -0
  98. package/lib/module/skia/useSkiaFont.js +23 -0
  99. package/lib/module/skia/useSkiaFont.js.map +1 -0
  100. package/lib/typescript/core/constants.d.ts +15 -0
  101. package/lib/typescript/core/constants.d.ts.map +1 -0
  102. package/lib/typescript/core/intlHelpers.d.ts +10 -0
  103. package/lib/typescript/core/intlHelpers.d.ts.map +1 -0
  104. package/lib/typescript/core/layout.d.ts +22 -0
  105. package/lib/typescript/core/layout.d.ts.map +1 -0
  106. package/lib/typescript/core/mask.d.ts +18 -0
  107. package/lib/typescript/core/mask.d.ts.map +1 -0
  108. package/lib/typescript/core/numerals/detection.d.ts +17 -0
  109. package/lib/typescript/core/numerals/detection.d.ts.map +1 -0
  110. package/lib/typescript/core/numerals/digits.d.ts +43 -0
  111. package/lib/typescript/core/numerals/digits.d.ts.map +1 -0
  112. package/lib/typescript/core/numerals/index.d.ts +3 -0
  113. package/lib/typescript/core/numerals/index.d.ts.map +1 -0
  114. package/lib/typescript/core/numerals/tables.d.ts +32 -0
  115. package/lib/typescript/core/numerals/tables.d.ts.map +1 -0
  116. package/lib/typescript/core/superscript.d.ts +16 -0
  117. package/lib/typescript/core/superscript.d.ts.map +1 -0
  118. package/lib/typescript/core/timeLayout.d.ts +19 -0
  119. package/lib/typescript/core/timeLayout.d.ts.map +1 -0
  120. package/lib/typescript/core/timeTypes.d.ts +80 -0
  121. package/lib/typescript/core/timeTypes.d.ts.map +1 -0
  122. package/lib/typescript/core/timing.d.ts +6 -0
  123. package/lib/typescript/core/timing.d.ts.map +1 -0
  124. package/lib/typescript/core/types.d.ts +165 -0
  125. package/lib/typescript/core/types.d.ts.map +1 -0
  126. package/lib/typescript/core/useAccessibilityAnnouncement.d.ts +10 -0
  127. package/lib/typescript/core/useAccessibilityAnnouncement.d.ts.map +1 -0
  128. package/lib/typescript/core/useAnimatedX.d.ts +9 -0
  129. package/lib/typescript/core/useAnimatedX.d.ts.map +1 -0
  130. package/lib/typescript/core/useAnimationLifecycle.d.ts +14 -0
  131. package/lib/typescript/core/useAnimationLifecycle.d.ts.map +1 -0
  132. package/lib/typescript/core/useCanAnimate.d.ts +14 -0
  133. package/lib/typescript/core/useCanAnimate.d.ts.map +1 -0
  134. package/lib/typescript/core/useContinuousSpin.d.ts +23 -0
  135. package/lib/typescript/core/useContinuousSpin.d.ts.map +1 -0
  136. package/lib/typescript/core/useDebouncedWidths.d.ts +17 -0
  137. package/lib/typescript/core/useDebouncedWidths.d.ts.map +1 -0
  138. package/lib/typescript/core/useDigitAnimation.d.ts +38 -0
  139. package/lib/typescript/core/useDigitAnimation.d.ts.map +1 -0
  140. package/lib/typescript/core/useFlowPipeline.d.ts +46 -0
  141. package/lib/typescript/core/useFlowPipeline.d.ts.map +1 -0
  142. package/lib/typescript/core/useFormattedValue.d.ts +14 -0
  143. package/lib/typescript/core/useFormattedValue.d.ts.map +1 -0
  144. package/lib/typescript/core/useLayoutDiff.d.ts +18 -0
  145. package/lib/typescript/core/useLayoutDiff.d.ts.map +1 -0
  146. package/lib/typescript/core/useNumberFormatting.d.ts +18 -0
  147. package/lib/typescript/core/useNumberFormatting.d.ts.map +1 -0
  148. package/lib/typescript/core/useSlotOpacity.d.ts +18 -0
  149. package/lib/typescript/core/useSlotOpacity.d.ts.map +1 -0
  150. package/lib/typescript/core/useTimeFormatting.d.ts +22 -0
  151. package/lib/typescript/core/useTimeFormatting.d.ts.map +1 -0
  152. package/lib/typescript/core/useTimingResolution.d.ts +13 -0
  153. package/lib/typescript/core/useTimingResolution.d.ts.map +1 -0
  154. package/lib/typescript/core/useWorkletFormatting.d.ts +14 -0
  155. package/lib/typescript/core/useWorkletFormatting.d.ts.map +1 -0
  156. package/lib/typescript/core/utils.d.ts +44 -0
  157. package/lib/typescript/core/utils.d.ts.map +1 -0
  158. package/lib/typescript/core/warnings.d.ts +2 -0
  159. package/lib/typescript/core/warnings.d.ts.map +1 -0
  160. package/lib/typescript/index.d.ts +8 -0
  161. package/lib/typescript/index.d.ts.map +1 -0
  162. package/lib/typescript/native/DigitSlot.d.ts +27 -0
  163. package/lib/typescript/native/DigitSlot.d.ts.map +1 -0
  164. package/lib/typescript/native/NumberFlow.d.ts +3 -0
  165. package/lib/typescript/native/NumberFlow.d.ts.map +1 -0
  166. package/lib/typescript/native/SymbolSlot.d.ts +19 -0
  167. package/lib/typescript/native/SymbolSlot.d.ts.map +1 -0
  168. package/lib/typescript/native/TimeFlow.d.ts +3 -0
  169. package/lib/typescript/native/TimeFlow.d.ts.map +1 -0
  170. package/lib/typescript/native/index.d.ts +3 -0
  171. package/lib/typescript/native/index.d.ts.map +1 -0
  172. package/lib/typescript/native/renderSlots.d.ts +31 -0
  173. package/lib/typescript/native/renderSlots.d.ts.map +1 -0
  174. package/lib/typescript/native/types.d.ts +36 -0
  175. package/lib/typescript/native/types.d.ts.map +1 -0
  176. package/lib/typescript/native/useMeasuredGlyphMetrics.d.ts +8 -0
  177. package/lib/typescript/native/useMeasuredGlyphMetrics.d.ts.map +1 -0
  178. package/lib/typescript/package.json +1 -0
  179. package/lib/typescript/skia/DigitSlot.d.ts +35 -0
  180. package/lib/typescript/skia/DigitSlot.d.ts.map +1 -0
  181. package/lib/typescript/skia/SkiaNumberFlow.d.ts +3 -0
  182. package/lib/typescript/skia/SkiaNumberFlow.d.ts.map +1 -0
  183. package/lib/typescript/skia/SkiaTimeFlow.d.ts +3 -0
  184. package/lib/typescript/skia/SkiaTimeFlow.d.ts.map +1 -0
  185. package/lib/typescript/skia/SymbolSlot.d.ts +26 -0
  186. package/lib/typescript/skia/SymbolSlot.d.ts.map +1 -0
  187. package/lib/typescript/skia/index.d.ts +6 -0
  188. package/lib/typescript/skia/index.d.ts.map +1 -0
  189. package/lib/typescript/skia/renderSlots.d.ts +40 -0
  190. package/lib/typescript/skia/renderSlots.d.ts.map +1 -0
  191. package/lib/typescript/skia/useGlyphMetrics.d.ts +16 -0
  192. package/lib/typescript/skia/useGlyphMetrics.d.ts.map +1 -0
  193. package/lib/typescript/skia/useScrubbing.d.ts +59 -0
  194. package/lib/typescript/skia/useScrubbing.d.ts.map +1 -0
  195. package/lib/typescript/skia/useSkiaFont.d.ts +13 -0
  196. package/lib/typescript/skia/useSkiaFont.d.ts.map +1 -0
  197. package/package.json +104 -0
  198. package/src/core/constants.ts +20 -0
  199. package/src/core/intlHelpers.ts +351 -0
  200. package/src/core/layout.ts +108 -0
  201. package/src/core/mask.ts +72 -0
  202. package/src/core/numerals/detection.ts +112 -0
  203. package/src/core/numerals/digits.ts +102 -0
  204. package/src/core/numerals/index.ts +9 -0
  205. package/src/core/numerals/tables.ts +112 -0
  206. package/src/core/superscript.ts +27 -0
  207. package/src/core/timeLayout.ts +119 -0
  208. package/src/core/timeTypes.ts +88 -0
  209. package/src/core/timing.ts +60 -0
  210. package/src/core/types.ts +189 -0
  211. package/src/core/useAccessibilityAnnouncement.ts +27 -0
  212. package/src/core/useAnimatedX.ts +30 -0
  213. package/src/core/useAnimationLifecycle.ts +54 -0
  214. package/src/core/useCanAnimate.ts +21 -0
  215. package/src/core/useContinuousSpin.ts +112 -0
  216. package/src/core/useDebouncedWidths.ts +93 -0
  217. package/src/core/useDigitAnimation.ts +192 -0
  218. package/src/core/useFlowPipeline.ts +126 -0
  219. package/src/core/useFormattedValue.ts +32 -0
  220. package/src/core/useLayoutDiff.ts +71 -0
  221. package/src/core/useNumberFormatting.ts +164 -0
  222. package/src/core/useSlotOpacity.ts +66 -0
  223. package/src/core/useTimeFormatting.ts +95 -0
  224. package/src/core/useTimingResolution.ts +47 -0
  225. package/src/core/useWorkletFormatting.ts +59 -0
  226. package/src/core/utils.ts +149 -0
  227. package/src/core/warnings.ts +8 -0
  228. package/src/index.ts +15 -0
  229. package/src/native/DigitSlot.tsx +203 -0
  230. package/src/native/NumberFlow.tsx +287 -0
  231. package/src/native/SymbolSlot.tsx +68 -0
  232. package/src/native/TimeFlow.tsx +287 -0
  233. package/src/native/index.ts +2 -0
  234. package/src/native/renderSlots.tsx +150 -0
  235. package/src/native/types.ts +40 -0
  236. package/src/native/useMeasuredGlyphMetrics.tsx +205 -0
  237. package/src/skia/DigitSlot.tsx +221 -0
  238. package/src/skia/SkiaNumberFlow.tsx +506 -0
  239. package/src/skia/SkiaTimeFlow.tsx +257 -0
  240. package/src/skia/SymbolSlot.tsx +120 -0
  241. package/src/skia/index.ts +5 -0
  242. package/src/skia/renderSlots.tsx +180 -0
  243. package/src/skia/useGlyphMetrics.ts +79 -0
  244. package/src/skia/useScrubbing.ts +223 -0
  245. package/src/skia/useSkiaFont.ts +25 -0
@@ -0,0 +1,165 @@
1
+ "use strict";
2
+
3
+ import { useCallback, useMemo, useState } from "react";
4
+ import { makeMutable, runOnJS, useAnimatedReaction, useDerivedValue } from "react-native-reanimated";
5
+ import { assignXPositions } from "../core/layout.js";
6
+ import { useDebouncedWidths } from "../core/useDebouncedWidths.js";
7
+ import { useWorkletFormatting } from "../core/useWorkletFormatting.js";
8
+ import { countDigits } from "../core/numerals/index.js";
9
+
10
+ // ---------------------------------------------------------------------------
11
+ // useScrubbingBridge
12
+ // ---------------------------------------------------------------------------
13
+
14
+ /**
15
+ * Digit-count bridging for worklet-driven scrubbing.
16
+ *
17
+ * When the worklet-driven sharedValue crosses a digit boundary (e.g.
18
+ * 99.9 → 100.0), the React-side layout must re-render with the correct
19
+ * number of digit slots. This hook watches the worklet's digit count and
20
+ * schedules a JS-side state update when it changes.
21
+ *
22
+ * Must be called **before** `useNumberFormatting` so the returned
23
+ * `effectiveValue` can feed into the formatter.
24
+ */
25
+ export function useScrubbingBridge({
26
+ sharedValue,
27
+ value,
28
+ prefix,
29
+ suffix,
30
+ zeroCodePoint
31
+ }) {
32
+ const [scrubbingValue, setScrubbingValue] = useState(undefined);
33
+ const handleScrubbingValueUpdate = useCallback(numericValue => {
34
+ if (numericValue < 0) {
35
+ setScrubbingValue(undefined);
36
+ } else {
37
+ setScrubbingValue(numericValue);
38
+ }
39
+ }, []);
40
+ const effectiveValue = scrubbingValue !== undefined ? scrubbingValue : value;
41
+ const [prevWorkletDigitCount] = useState(() => makeMutable(-1));
42
+ useAnimatedReaction(() => sharedValue?.value ?? "", (current, previous) => {
43
+ if (current === previous) return;
44
+ if (!current) {
45
+ if (prevWorkletDigitCount.value !== -1) {
46
+ prevWorkletDigitCount.value = -1;
47
+ runOnJS(handleScrubbingValueUpdate)(-1);
48
+ }
49
+ return;
50
+ }
51
+ const fullText = prefix + current + suffix;
52
+ const digitCount = countDigits(fullText, zeroCodePoint);
53
+ if (digitCount !== prevWorkletDigitCount.value) {
54
+ prevWorkletDigitCount.value = digitCount;
55
+ const numericValue = parseFloat(current);
56
+ if (!Number.isNaN(numericValue)) {
57
+ runOnJS(handleScrubbingValueUpdate)(numericValue);
58
+ }
59
+ }
60
+ }, [prefix, suffix, handleScrubbingValueUpdate]);
61
+ return {
62
+ effectiveValue
63
+ };
64
+ }
65
+
66
+ // ---------------------------------------------------------------------------
67
+ // useScrubbingLayout
68
+ // ---------------------------------------------------------------------------
69
+
70
+ /**
71
+ * Worklet-driven layout and digit extraction for scrubbing mode.
72
+ *
73
+ * Encapsulates:
74
+ * - `useWorkletFormatting`: per-digit SharedValues from the sharedValue string
75
+ * - Tabular digit widths: fixed-width digits during scrubbing to prevent jitter
76
+ * - `useDebouncedWidths`: animated transition between tabular and proportional
77
+ * - `workletLayout`: UI-thread-computed per-slot x/width using debounced widths
78
+ *
79
+ * Must be called **after** the layout is computed from `computeKeyedLayout`.
80
+ */
81
+ export function useScrubbingLayout({
82
+ sharedValue,
83
+ prefix,
84
+ suffix,
85
+ zeroCodePoint,
86
+ metrics,
87
+ digitStringsArr,
88
+ scrubDigitWidthPercentile,
89
+ layout,
90
+ layoutDigitCount,
91
+ width,
92
+ textAlign
93
+ }) {
94
+ const workletDigitValues = useWorkletFormatting(sharedValue, prefix, suffix, zeroCodePoint);
95
+ const digitWidths = useMemo(() => {
96
+ if (!metrics) return null;
97
+ return Array.from({
98
+ length: 10
99
+ }, (_, d) => metrics.charWidths[digitStringsArr[d]] ?? metrics.maxDigitWidth);
100
+ }, [metrics, digitStringsArr]);
101
+
102
+ /**
103
+ * Tabular digit width for scrubbing mode.
104
+ * Interpolates between min and max digit width using the percentile.
105
+ * 0 = narrowest, 0.5 = midpoint, 1 = widest.
106
+ */
107
+ const scrubDigitWidth = useMemo(() => {
108
+ if (!digitWidths) return 0;
109
+ let minWidth = Infinity;
110
+ let maxWidth = 0;
111
+ for (let i = 0; i < 10; i++) {
112
+ if (digitWidths[i] < minWidth) minWidth = digitWidths[i];
113
+ if (digitWidths[i] > maxWidth) maxWidth = digitWidths[i];
114
+ }
115
+ return minWidth + (maxWidth - minWidth) * scrubDigitWidthPercentile;
116
+ }, [digitWidths, scrubDigitWidthPercentile]);
117
+ const debouncedWidths = useDebouncedWidths(digitWidths, scrubDigitWidth, sharedValue, prefix, suffix, zeroCodePoint);
118
+
119
+ /**
120
+ * Worklet-computed layout for proportional per-digit widths during scrubbing.
121
+ * Uses the prop layout's slot structure but substitutes digit widths based on
122
+ * the actual workletDigitValues. This ensures the worklet layout always has
123
+ * the same number of entries as the prop layout (no slotIndex mismatch).
124
+ */
125
+ const workletLayout = useDerivedValue(() => {
126
+ if (!sharedValue || !digitWidths || layout.length === 0) return [];
127
+ if (!sharedValue.value) return [];
128
+
129
+ /**
130
+ * Verify digit count alignment — during the 1-frame gap between
131
+ * a worklet digit-count change and the React re-render, the layout
132
+ * slot count doesn't match the worklet's digits. Fall back to prop
133
+ * layout positions to avoid index misalignment artifacts.
134
+ */
135
+ const fullText = prefix + sharedValue.value + suffix;
136
+ const workletDigitCount = countDigits(fullText, zeroCodePoint);
137
+ if (workletDigitCount !== layoutDigitCount) return [];
138
+ const entries = [];
139
+ let contentWidth = 0;
140
+ let digitIdx = 0;
141
+ for (let i = 0; i < layout.length; i++) {
142
+ const slot = layout[i];
143
+ let slotWidth;
144
+ if (slot.isDigit) {
145
+ const dw = debouncedWidths[digitIdx].value;
146
+ slotWidth = dw > 0 ? dw : slot.width;
147
+ digitIdx++;
148
+ } else {
149
+ slotWidth = slot.width;
150
+ }
151
+ contentWidth += slotWidth;
152
+ entries.push({
153
+ x: 0,
154
+ width: slotWidth
155
+ });
156
+ }
157
+ assignXPositions(entries, width, textAlign, contentWidth);
158
+ return entries;
159
+ });
160
+ return {
161
+ workletDigitValues,
162
+ workletLayout
163
+ };
164
+ }
165
+ //# sourceMappingURL=useScrubbing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useCallback","useMemo","useState","makeMutable","runOnJS","useAnimatedReaction","useDerivedValue","assignXPositions","useDebouncedWidths","useWorkletFormatting","countDigits","useScrubbingBridge","sharedValue","value","prefix","suffix","zeroCodePoint","scrubbingValue","setScrubbingValue","undefined","handleScrubbingValueUpdate","numericValue","effectiveValue","prevWorkletDigitCount","current","previous","fullText","digitCount","parseFloat","Number","isNaN","useScrubbingLayout","metrics","digitStringsArr","scrubDigitWidthPercentile","layout","layoutDigitCount","width","textAlign","workletDigitValues","digitWidths","Array","from","length","_","d","charWidths","maxDigitWidth","scrubDigitWidth","minWidth","Infinity","maxWidth","i","debouncedWidths","workletLayout","workletDigitCount","entries","contentWidth","digitIdx","slot","slotWidth","isDigit","dw","push","x"],"sourceRoot":"../../../src","sources":["skia/useScrubbing.ts"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AACtD,SACEC,WAAW,EACXC,OAAO,EAEPC,mBAAmB,EACnBC,eAAe,QACV,yBAAyB;AAChC,SAASC,gBAAgB,QAAyB,mBAAgB;AAElE,SAASC,kBAAkB,QAAQ,+BAA4B;AAC/D,SAASC,oBAAoB,QAAQ,iCAA8B;AACnE,SAASC,WAAW,QAAQ,2BAAkB;;AAE9C;AACA;AACA;;AAcA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,kBAAkBA,CAAC;EACjCC,WAAW;EACXC,KAAK;EACLC,MAAM;EACNC,MAAM;EACNC;AACwB,CAAC,EAA4B;EACrD,MAAM,CAACC,cAAc,EAAEC,iBAAiB,CAAC,GAAGhB,QAAQ,CAAqBiB,SAAS,CAAC;EAEnF,MAAMC,0BAA0B,GAAGpB,WAAW,CAAEqB,YAAoB,IAAK;IACvE,IAAIA,YAAY,GAAG,CAAC,EAAE;MACpBH,iBAAiB,CAACC,SAAS,CAAC;IAC9B,CAAC,MAAM;MACLD,iBAAiB,CAACG,YAAY,CAAC;IACjC;EACF,CAAC,EAAE,EAAE,CAAC;EAEN,MAAMC,cAAc,GAAGL,cAAc,KAAKE,SAAS,GAAGF,cAAc,GAAGJ,KAAK;EAE5E,MAAM,CAACU,qBAAqB,CAAC,GAAGrB,QAAQ,CAAC,MAAMC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;EAE/DE,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5
+
6
+ /**
7
+ * Loads a custom Skia font asynchronously while providing a synchronous
8
+ * system-font fallback via `matchFont`. This guarantees a non-null `SkFont`
9
+ * from the very first render, so components can run the full animated pipeline
10
+ * immediately instead of showing a blank canvas or static placeholder.
11
+ *
12
+ * Once the custom font finishes loading, the returned value swaps to the
13
+ * custom font — triggering a smooth animated transition in SkiaNumberFlow /
14
+ * SkiaTimeFlow (the value re-renders with new glyph metrics).
15
+ */
16
+ export function useSkiaFont(source, size, onError) {
17
+ const font = useFont(source, size, onError);
18
+ const fallback = useMemo(() => matchFont({
19
+ fontSize: size
20
+ }), [size]);
21
+ return font ?? fallback;
22
+ }
23
+ //# sourceMappingURL=useSkiaFont.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["matchFont","useFont","useMemo","useSkiaFont","source","size","onError","font","fallback","fontSize"],"sourceRoot":"../../../src","sources":["skia/useSkiaFont.ts"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,OAAO,QAAQ,4BAA4B;AAE/D,SAASC,OAAO,QAAQ,OAAO;;AAE/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,WAAWA,CACzBC,MAAuB,EACvBC,IAAY,EACZC,OAA8B,EACtB;EACR,MAAMC,IAAI,GAAGN,OAAO,CAACG,MAAM,EAAEC,IAAI,EAAEC,OAAO,CAAC;EAE3C,MAAME,QAAQ,GAAGN,OAAO,CAAC,MAAMF,SAAS,CAAC;IAAES,QAAQ,EAAEJ;EAAK,CAAC,CAAC,EAAE,CAACA,IAAI,CAAC,CAAC;EAErE,OAAOE,IAAI,IAAIC,QAAQ;AACzB","ignoreList":[]}
@@ -0,0 +1,15 @@
1
+ export declare const MAX_SLOTS = 20;
2
+ export declare const DIGIT_COUNT = 10;
3
+ export declare const MEASURABLE_CHARS = "0123456789.,%+-$/:! \u20AC\u00A3\u00A5\u20A9abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ~\u00B0";
4
+ /**
5
+ * Horizontal mask fade width as a ratio of lineHeight.
6
+ * Matches web NumberFlow's --number-flow-mask-width: 0.5em
7
+ */
8
+ export declare const MASK_WIDTH_RATIO = 0.5;
9
+ /**
10
+ * Superscript exponent rendering scale derived from OpenType font metrics.
11
+ * Inter font OS/2 table: ySuperscriptYSize = 1229/2048 ≈ 0.60.
12
+ * Consistent with TeX (\defaultscriptratio=0.7) and general typography convention (60-70%).
13
+ */
14
+ export declare const SUPERSCRIPT_SCALE = 0.6;
15
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/core/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,KAAK,CAAC;AAE5B,eAAO,MAAM,WAAW,KAAK,CAAC;AAG9B,eAAO,MAAM,gBAAgB,4GACqD,CAAC;AAEnF;;;GAGG;AACH,eAAO,MAAM,gBAAgB,MAAM,CAAC;AAEpC;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,MAAM,CAAC"}
@@ -0,0 +1,10 @@
1
+ export declare function getOrCreateFormatter(locales?: Intl.LocalesArgument, format?: Intl.NumberFormatOptions): Intl.NumberFormat;
2
+ export declare function getFormatCharacters(locales?: Intl.LocalesArgument, format?: Intl.NumberFormatOptions, prefix?: string, suffix?: string): string;
3
+ /**
4
+ * Safe wrapper around formatToParts that handles:
5
+ * 1. Missing formatToParts (Hermes fallback)
6
+ * 2. Broken formatToParts that returns all "literal" parts (non-Latin locales on Hermes)
7
+ * 3. Missing engineering notation support (iOS Hermes)
8
+ */
9
+ export declare function safeFormatToParts(formatter: Intl.NumberFormat, value: number, locales?: Intl.LocalesArgument): Intl.NumberFormatPart[];
10
+ //# sourceMappingURL=intlHelpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"intlHelpers.d.ts","sourceRoot":"","sources":["../../../src/core/intlHelpers.ts"],"names":[],"mappings":"AAeA,wBAAgB,oBAAoB,CAClC,OAAO,CAAC,EAAE,IAAI,CAAC,eAAe,EAC9B,MAAM,CAAC,EAAE,IAAI,CAAC,mBAAmB,GAChC,IAAI,CAAC,YAAY,CAQnB;AAUD,wBAAgB,mBAAmB,CACjC,OAAO,CAAC,EAAE,IAAI,CAAC,eAAe,EAC9B,MAAM,CAAC,EAAE,IAAI,CAAC,mBAAmB,EACjC,MAAM,SAAK,EACX,MAAM,SAAK,GACV,MAAM,CA4CR;AA0ND;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,IAAI,CAAC,YAAY,EAC5B,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,IAAI,CAAC,eAAe,GAC7B,IAAI,CAAC,gBAAgB,EAAE,CAqCzB"}
@@ -0,0 +1,22 @@
1
+ import type { GlyphMetrics, KeyedPart, TextAlign } from "./types";
2
+ /**
3
+ * Assigns x positions to each entry based on text alignment.
4
+ * Mutates the `x` field of each entry in place.
5
+ * Worklet-safe. When `precomputedContentWidth` is provided, skips the sum loop.
6
+ */
7
+ export declare function assignXPositions(chars: {
8
+ x: number;
9
+ width: number;
10
+ }[], totalWidth: number, textAlign: TextAlign, precomputedContentWidth?: number): void;
11
+ export interface CharLayout {
12
+ key: string;
13
+ char: string;
14
+ isDigit: boolean;
15
+ digitValue: number;
16
+ x: number;
17
+ width: number;
18
+ superscript?: boolean;
19
+ }
20
+ export declare function computeKeyedLayout(parts: KeyedPart[], metrics: GlyphMetrics, totalWidth: number, textAlign: TextAlign, localeDigitStrings?: string[]): CharLayout[];
21
+ export declare function computeStringLayout(text: string, metrics: GlyphMetrics, totalWidth: number, textAlign: TextAlign, zeroCodePoint?: number): CharLayout[];
22
+ //# sourceMappingURL=layout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../src/core/layout.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAGlE;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAAE,EACrC,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,SAAS,EACpB,uBAAuB,CAAC,EAAE,MAAM,GAC/B,IAAI,CAgBN;AAED,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,SAAS,EAAE,EAClB,OAAO,EAAE,YAAY,EACrB,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,SAAS,EACpB,kBAAkB,CAAC,EAAE,MAAM,EAAE,GAC5B,UAAU,EAAE,CA+Bd;AAED,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,YAAY,EACrB,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,SAAS,EACpB,aAAa,SAAK,GACjB,UAAU,EAAE,CAoBd"}
@@ -0,0 +1,18 @@
1
+ import type { CharLayout } from "./layout";
2
+ import type { GlyphMetrics } from "./types";
3
+ export interface MaskHeights {
4
+ top: number;
5
+ bottom: number;
6
+ expansionTop: number;
7
+ expansionBottom: number;
8
+ }
9
+ /**
10
+ * Computes adaptive vertical mask heights based on the actual characters
11
+ * currently displayed.
12
+ *
13
+ * The gradient starts at the edge of the visible glyph content and extends
14
+ * outward. If the "dead zone" inside lineHeight is smaller than the target
15
+ * gradient size, the container expands beyond lineHeight.
16
+ */
17
+ export declare function computeAdaptiveMaskHeights(layout: CharLayout[], exitingEntries: Map<string, CharLayout>, metrics: GlyphMetrics): MaskHeights;
18
+ //# sourceMappingURL=mask.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mask.d.ts","sourceRoot":"","sources":["../../../src/core/mask.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAS5C,MAAM,WAAW,WAAW;IAE1B,GAAG,EAAE,MAAM,CAAC;IAEZ,MAAM,EAAE,MAAM,CAAC;IAEf,YAAY,EAAE,MAAM,CAAC;IAErB,eAAe,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,UAAU,EAAE,EACpB,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,EACvC,OAAO,EAAE,YAAY,GACpB,WAAW,CAsCb"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Scans a formatted number string and detects which numbering system's
3
+ * digits are actually present. Returns the zero codepoint of the detected
4
+ * system, or LATIN_ZERO if only Latin digits (or no digits) are found.
5
+ *
6
+ * Handles hanidec (non-contiguous ideographs) separately from contiguous systems.
7
+ */
8
+ export declare function detectOutputZeroCodePoint(formattedStr: string): number;
9
+ /**
10
+ * Detects the numbering system for a locale/format combination.
11
+ *
12
+ * Strategy: query the platform first (resolvedOptions), then verify by
13
+ * formatting a probe. If the platform reports "latn" but the CLDR table
14
+ * says otherwise (common on Hermes), use the CLDR value.
15
+ */
16
+ export declare function detectNumberingSystem(locales?: Intl.LocalesArgument, format?: Intl.NumberFormatOptions): string;
17
+ //# sourceMappingURL=detection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"detection.d.ts","sourceRoot":"","sources":["../../../../src/core/numerals/detection.ts"],"names":[],"mappings":"AAkCA;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAmBtE;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,CAAC,EAAE,IAAI,CAAC,eAAe,EAC9B,MAAM,CAAC,EAAE,IAAI,CAAC,mBAAmB,GAChC,MAAM,CAuCR"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Returns the numeric value (0-9) of a hanidec character code,
3
+ * or -1 if the code is not a hanidec digit.
4
+ *
5
+ * Uses a switch with literal hex values (not the HANIDEC_CODEPOINTS array)
6
+ * to guarantee safe serialization in Reanimated worklets.
7
+ */
8
+ export declare function hanidecDigitValue(charCode: number): number;
9
+ /**
10
+ * Returns the Unicode codepoint of digit zero for a numbering system.
11
+ * Falls back to Latin (48) for unknown or supplementary-plane systems.
12
+ * For hanidec, returns 0x3007 as a sentinel (digits are non-contiguous).
13
+ */
14
+ export declare function getZeroCodePoint(numberingSystem: string): number;
15
+ /**
16
+ * Builds an array of 10 digit strings for a numbering system.
17
+ * digitStrings[0] = zero character, digitStrings[9] = nine character.
18
+ */
19
+ export declare function getDigitStrings(numberingSystem: string): string[];
20
+ /**
21
+ * Returns the numeric value (0-9) of a character code in the given system,
22
+ * or -1 if the code is not a digit in that system.
23
+ *
24
+ * Worklet-safe. Handles hanidec (non-contiguous) via sentinel zeroCodePoint = 0x3007.
25
+ */
26
+ export declare function localeDigitValue(charCode: number, zeroCodePoint: number): number;
27
+ /**
28
+ * Checks if a character code is a digit in the given numbering system.
29
+ * Worklet-safe. Handles hanidec via sentinel zeroCodePoint = 0x3007.
30
+ */
31
+ export declare function isLocaleDigit(charCode: number, zeroCodePoint: number): boolean;
32
+ /**
33
+ * Checks if a single character is a digit in the given numbering system.
34
+ * Convenience wrapper over localeDigitValue for string-based callers.
35
+ * Worklet-safe.
36
+ */
37
+ export declare function isDigitChar(char: string, zeroCodePoint?: number): boolean;
38
+ /**
39
+ * Counts the number of digit characters in a string for a given numbering system.
40
+ * Worklet-safe.
41
+ */
42
+ export declare function countDigits(text: string, zeroCodePoint: number): number;
43
+ //# sourceMappingURL=digits.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"digits.d.ts","sourceRoot":"","sources":["../../../../src/core/numerals/digits.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAe1D;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,eAAe,EAAE,MAAM,GAAG,MAAM,CAEhE;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,eAAe,EAAE,MAAM,GAAG,MAAM,EAAE,CAcjE;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,MAAM,CAMhF;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAG9E;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,aAAa,SAAK,GAAG,OAAO,CAGrE;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,MAAM,CAOvE"}
@@ -0,0 +1,3 @@
1
+ export { detectNumberingSystem, detectOutputZeroCodePoint } from "./detection";
2
+ export { countDigits, getDigitStrings, getZeroCodePoint, isDigitChar, isLocaleDigit, localeDigitValue, } from "./digits";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/numerals/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAC/E,OAAO,EACL,WAAW,EACX,eAAe,EACf,gBAAgB,EAChB,WAAW,EACX,aAAa,EACb,gBAAgB,GACjB,MAAM,UAAU,CAAC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Lookup tables for numeral system support.
3
+ *
4
+ * Most Unicode decimal digit systems use 10 contiguous codepoints (0-9),
5
+ * enabling digit detection via: digitValue = charCode - zeroCodePoint.
6
+ *
7
+ * Exception: hanidec (〇一二三四五六七八九) uses non-contiguous ideographs.
8
+ * Functions that accept a zeroCodePoint use 0x3007 as a sentinel to trigger
9
+ * the hanidec lookup path.
10
+ *
11
+ * Only BMP (Basic Multilingual Plane, U+0000-U+FFFF) systems are supported
12
+ * because the codebase uses charCodeAt-based indexing in worklets.
13
+ * Supplementary plane systems (adlm) fall back to Latin digits.
14
+ */
15
+ export declare const LATIN_ZERO = 48;
16
+ export declare const HANIDEC_ZERO = 12295;
17
+ export declare const HANIDEC_DIGITS: string[];
18
+ /**
19
+ * Map of CLDR numbering system name → Unicode codepoint of digit zero.
20
+ * Only includes BMP systems (codepoint <= 0xFFFF).
21
+ * hanidec uses 0x3007 as a sentinel — the remaining digits are non-contiguous.
22
+ */
23
+ export declare const ZERO_CODEPOINTS: Record<string, number>;
24
+ /**
25
+ * CLDR default numbering systems for locales where the platform (Hermes)
26
+ * may fall back to "latn" despite the locale specifying a different system.
27
+ *
28
+ * Only includes locales whose CLDR default differs from "latn".
29
+ * Key format: language subtag or language-region (e.g. "ar", "ar-EG").
30
+ */
31
+ export declare const CLDR_DEFAULT_NUMBERING: Record<string, string>;
32
+ //# sourceMappingURL=tables.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tables.d.ts","sourceRoot":"","sources":["../../../../src/core/numerals/tables.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,eAAO,MAAM,UAAU,KAAS,CAAC;AACjC,eAAO,MAAM,YAAY,QAAS,CAAC;AAEnC,eAAO,MAAM,cAAc,UAAqD,CAAC;AAEjF;;;;GAIG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAsClD,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAuCzD,CAAC"}
@@ -0,0 +1,16 @@
1
+ import type { TextStyle } from "react-native";
2
+ /**
3
+ * Returns the scaled TextStyle for superscript rendering in native slots.
4
+ * Reduces fontSize and lineHeight by SUPERSCRIPT_SCALE.
5
+ */
6
+ export declare function getSuperscriptTextStyle(textStyle: TextStyle, lineHeight: number): TextStyle;
7
+ /**
8
+ * Returns the pivot-scale transform array for superscript rendering in Skia slots.
9
+ * Pivots around the text top so the digit shrinks downward within the mask region.
10
+ */
11
+ export declare function getSuperscriptTransform(baseY: number, ascent: number): ({
12
+ translateY: number;
13
+ } | {
14
+ scale: number;
15
+ })[];
16
+ //# sourceMappingURL=superscript.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"superscript.d.ts","sourceRoot":"","sources":["../../../src/core/superscript.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAG9C;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,GAAG,SAAS,CAM3F;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,GACb,CAAC;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,EAAE,CAIhD"}
@@ -0,0 +1,19 @@
1
+ import { type CharLayout } from "./layout";
2
+ import type { GlyphMetrics, TextAlign } from "./types";
3
+ /**
4
+ * Computes time-aware string layout with fixed semantic keys.
5
+ *
6
+ * Unlike `computeStringLayout` which uses positional keys (`pos:0`, `pos:1`),
7
+ * this function assigns the same fixed keys (h10, h1, sep, m10, m1, etc.)
8
+ * that `useTimeFormatting` produces. This ensures worklet-driven updates
9
+ * produce stable keys that match prop-driven updates.
10
+ *
11
+ * @param timeString - Formatted time string like "14:30", "9:30", "2:30 PM", "05:30"
12
+ * @param metrics - Glyph measurement data
13
+ * @param totalWidth - Available width for alignment
14
+ * @param textAlign - Text alignment within totalWidth
15
+ * @param hasHours - Whether the hours segment is shown (determines how to interpret segments)
16
+ * @param hasSeconds - Whether the seconds segment is shown
17
+ */
18
+ export declare function computeTimeStringLayout(timeString: string, metrics: GlyphMetrics, totalWidth: number, textAlign: TextAlign, hasHours: boolean, hasSeconds: boolean): CharLayout[];
19
+ //# sourceMappingURL=timeLayout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timeLayout.d.ts","sourceRoot":"","sources":["../../../src/core/timeLayout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,UAAU,EAAE,MAAM,UAAU,CAAC;AAC7D,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAgDvD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,YAAY,EACrB,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,OAAO,EACjB,UAAU,EAAE,OAAO,GAClB,UAAU,EAAE,CA+Cd"}
@@ -0,0 +1,80 @@
1
+ import type { SkFont } from "@shopify/react-native-skia";
2
+ import type { ViewStyle } from "react-native";
3
+ import type { SharedValue } from "react-native-reanimated";
4
+ import type { NumberFlowStyle } from "../native/types";
5
+ import type { AnimationBehaviorProps, TextAlign } from "./types";
6
+ interface TimeFlowBaseProps extends AnimationBehaviorProps {
7
+ /** Use 24-hour format. Default: true. Only applies when hours are shown. */
8
+ is24Hour?: boolean;
9
+ /** Pad hours with leading zero. Default: true. "09:30" vs "9:30". */
10
+ padHours?: boolean;
11
+ /** Text styling. fontSize is required; fontFamily defaults to the platform system font. */
12
+ style: NumberFlowStyle;
13
+ /** Text alignment. Defaults to "left". */
14
+ textAlign?: TextAlign;
15
+ /** Style applied to the outer container View */
16
+ containerStyle?: ViewStyle;
17
+ }
18
+ interface TimeFlowValueProps {
19
+ /** Hours value (0-23). Omit to hide the hours segment (countdown MM:SS mode). */
20
+ hours?: number;
21
+ /** Minutes value (0-59). Required. */
22
+ minutes: number;
23
+ /** Seconds value (0-59). Omit to hide the seconds segment. */
24
+ seconds?: number;
25
+ /** Unix timestamp in ms. Extracts hours/minutes/seconds automatically. Takes priority over direct values. */
26
+ timestamp?: number;
27
+ /** Timezone offset in ms for timestamp mode. */
28
+ timezoneOffset?: number;
29
+ }
30
+ /** Props for TimeFlow. Accessibility is built-in: accessibilityRole="text" and accessibilityLabel are set automatically. */
31
+ export type TimeFlowProps = TimeFlowBaseProps & TimeFlowValueProps;
32
+ interface SkiaTimeFlowBaseProps extends AnimationBehaviorProps {
33
+ /** Use 24-hour format. Default: true. Only applies when hours are shown. */
34
+ is24Hour?: boolean;
35
+ /** Pad hours with leading zero. Default: true. "09:30" vs "9:30". */
36
+ padHours?: boolean;
37
+ /** SkFont instance from useFont(). Required — renders empty until font loads. */
38
+ font: SkFont | null;
39
+ /** Text color (Skia color string). Defaults to "#000000". */
40
+ color?: string;
41
+ /** X position within the Canvas. Defaults to 0. */
42
+ x?: number;
43
+ /** Y position within the Canvas (baseline). Defaults to 0. */
44
+ y?: number;
45
+ /** Available width for alignment calculations. Defaults to 0. */
46
+ width?: number;
47
+ /** Text alignment within the available width. Defaults to "left". */
48
+ textAlign?: TextAlign;
49
+ /** Parent opacity (SharedValue for animation coordination) */
50
+ opacity?: SharedValue<number>;
51
+ }
52
+ type SkiaTimeFlowValueProps = {
53
+ /** Hours value (0-23). Omit to hide the hours segment. */
54
+ hours?: number;
55
+ /** Minutes value (0-59). Required when using direct time values. */
56
+ minutes: number;
57
+ /** Seconds value (0-59). Omit to hide the seconds segment. */
58
+ seconds?: number;
59
+ /** Unix timestamp in ms. Extracts hours/minutes/seconds automatically. */
60
+ timestamp?: number;
61
+ /** Timezone offset in ms for timestamp mode. */
62
+ timezoneOffset?: number;
63
+ sharedValue?: never;
64
+ } | {
65
+ hours?: never;
66
+ minutes?: never;
67
+ seconds?: never;
68
+ timestamp?: never;
69
+ timezoneOffset?: never;
70
+ /** Worklet-driven pre-formatted time string (e.g. "14:30", "2:30 PM"). */
71
+ sharedValue: SharedValue<string>;
72
+ };
73
+ /**
74
+ * Props for SkiaTimeFlow.
75
+ * Value changes are auto-announced for screen reader users.
76
+ * For VoiceOver/TalkBack focus-based reading, set `accessibilityLabel` on the parent Canvas.
77
+ */
78
+ export type SkiaTimeFlowProps = SkiaTimeFlowBaseProps & SkiaTimeFlowValueProps;
79
+ export {};
80
+ //# sourceMappingURL=timeTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timeTypes.d.ts","sourceRoot":"","sources":["../../../src/core/timeTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,KAAK,EAAE,sBAAsB,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEjE,UAAU,iBAAkB,SAAQ,sBAAsB;IACxD,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qEAAqE;IACrE,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,2FAA2F;IAC3F,KAAK,EAAE,eAAe,CAAC;IACvB,0CAA0C;IAC1C,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,gDAAgD;IAChD,cAAc,CAAC,EAAE,SAAS,CAAC;CAC5B;AAED,UAAU,kBAAkB;IAC1B,iFAAiF;IACjF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sCAAsC;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,8DAA8D;IAC9D,OAAO,CAAC,EAAE,MAAM,CAAC;I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W,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAClC,CAAC;AAEN;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG,qBAAqB,GAAG,sBAAsB,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { TimingConfig } from "./types";
2
+ export declare const DEFAULT_TRANSFORM_TIMING: TimingConfig;
3
+ export declare const DEFAULT_SPIN_TIMING: TimingConfig;
4
+ export declare const DEFAULT_OPACITY_TIMING: TimingConfig;
5
+ export declare const ZERO_TIMING: TimingConfig;
6
+ //# sourceMappingURL=timing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timing.d.ts","sourceRoot":"","sources":["../../../src/core/timing.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAuC5C,eAAO,MAAM,wBAAwB,EAAE,YAGtC,CAAC;AAGF,eAAO,MAAM,mBAAmB,EAAE,YAAuC,CAAC;AAE1E,eAAO,MAAM,sBAAsB,EAAE,YAGpC,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,YAMzB,CAAC"}