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 @@
1
+ {"version":3,"names":["hanidecDigitValue","CLDR_DEFAULT_NUMBERING","HANIDEC_ZERO","LATIN_ZERO","ZERO_CODEPOINTS","numberingSystemCache","Map","getExpectedNumberingSystem","locales","undefined","tag","String","nuMatch","match","exact","dashIdx","indexOf","slice","detectOutputZeroCodePoint","formattedStr","i","length","code","charCodeAt","system","zeroCp","detectNumberingSystem","format","key","JSON","stringify","cached","get","formatter","Intl","NumberFormat","platformSystem","resolvedOptions","numberingSystem","set","expected","probe","outputZeroCp"],"sourceRoot":"../../../../src","sources":["core/numerals/detection.ts"],"mappings":";;AAAA,SAASA,iBAAiB,QAAQ,aAAU;AAC5C,SAASC,sBAAsB,EAAEC,YAAY,EAAEC,UAAU,EAAEC,eAAe,QAAQ,aAAU;AAE5F,MAAMC,oBAAoB,GAAG,IAAIC,GAAG,CAAiB,CAAC;;AAEtD;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,0BAA0BA,CAACC,OAA8B,EAAsB;EACtF,IAAI,CAACA,OAAO,EAAE,OAAOC,SAAS;EAE9B,MAAMC,GAAG,GAAGC,MAAM,CAACH,OAAO,CAAC;;EAE3B;EACA,MAAMI,OAAO,GAAGF,GAAG,CAACG,KAAK,CAAC,gBAAgB,CAAC;EAC3C,IAAID,OAAO,EAAE;IACX,OAAOA,OAAO,CAAC,CAAC,CAAC,KAAK,MAAM,GAAGH,SAAS,GAAGG,OAAO,CAAC,CAAC,CAAC;EACvD;EAEA,MAAME,KAAK,GAAGb,sBAAsB,CAACS,GAAG,CAAC;EACzC,IAAII,KAAK,EAAE,OAAOA,KAAK;;EAEvB;EACA,MAAMC,OAAO,GAAGL,GAAG,CAACM,OAAO,CAAC,GAAG,CAAC;EAChC,IAAID,OAAO,GAAG,CAAC,EAAE;IACf,OAAOd,sBAAsB,CAACS,GAAG,CAACO,KAAK,CAAC,CAAC,EAAEF,OAAO,CAAC,CAAC;EACtD;EAEA,OAAON,SAAS;AAClB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASS,yBAAyBA,CAACC,YAAoB,EAAU;EACtE,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGD,YAAY,CAACE,MAAM,EAAED,C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ACgC,QAAQ,EAAE;IACbnC,oBAAoB,CAACkC,GAAG,CAACX,GAAG,EAAE,MAAM,CAAC;IACrC,OAAO,MAAM;EACf;;EAEA;EACA,MAAMa,KAAK,GAAGR,SAAS,CAACN,MAAM,CAAC,UAAU,CAAC;EAC1C,MAAMe,YAAY,GAAGxB,yBAAyB,CAACuB,KAAK,CAAC;EAErD,IAAIC,YAAY,KAAKvC,UAAU,EAAE;IAC/B;IACA,KAAK,MAAMqB,MAAM,IAAIpB,eAAe,EAAE;MACpC,IAAIA,eAAe,CAACoB,MAAM,CAAC,KAAKkB,YAAY,EAAE;QAC5CrC,oBAAoB,CAACkC,GAAG,CAACX,GAAG,EAAEJ,MAAM,CAAC;QACrC,OAAOA,MAAM;MACf;IACF;EACF;;EAEA;EACA;EACAnB,oBAAoB,CAACkC,GAAG,CAACX,GAAG,EAAEY,QAAQ,CAAC;EACvC,OAAOA,QAAQ;AACjB","ignoreList":[]}
@@ -0,0 +1,128 @@
1
+ "use strict";
2
+
3
+ import { HANIDEC_DIGITS, LATIN_ZERO, ZERO_CODEPOINTS } from "./tables.js";
4
+ const digitStringsCache = new Map();
5
+
6
+ /**
7
+ * Returns the numeric value (0-9) of a hanidec character code,
8
+ * or -1 if the code is not a hanidec digit.
9
+ *
10
+ * Uses a switch with literal hex values (not the HANIDEC_CODEPOINTS array)
11
+ * to guarantee safe serialization in Reanimated worklets.
12
+ */
13
+ export function hanidecDigitValue(charCode) {
14
+ "worklet";
15
+
16
+ switch (charCode) {
17
+ case 0x3007:
18
+ return 0;
19
+ // 〇
20
+ case 0x4e00:
21
+ return 1;
22
+ // 一
23
+ case 0x4e8c:
24
+ return 2;
25
+ // 二
26
+ case 0x4e09:
27
+ return 3;
28
+ // 三
29
+ case 0x56db:
30
+ return 4;
31
+ // 四
32
+ case 0x4e94:
33
+ return 5;
34
+ // 五
35
+ case 0x516d:
36
+ return 6;
37
+ // 六
38
+ case 0x4e03:
39
+ return 7;
40
+ // 七
41
+ case 0x516b:
42
+ return 8;
43
+ // 八
44
+ case 0x4e5d:
45
+ return 9;
46
+ // 九
47
+ default:
48
+ return -1;
49
+ }
50
+ }
51
+
52
+ /**
53
+ * Returns the Unicode codepoint of digit zero for a numbering system.
54
+ * Falls back to Latin (48) for unknown or supplementary-plane systems.
55
+ * For hanidec, returns 0x3007 as a sentinel (digits are non-contiguous).
56
+ */
57
+ export function getZeroCodePoint(numberingSystem) {
58
+ return ZERO_CODEPOINTS[numberingSystem] ?? LATIN_ZERO;
59
+ }
60
+
61
+ /**
62
+ * Builds an array of 10 digit strings for a numbering system.
63
+ * digitStrings[0] = zero character, digitStrings[9] = nine character.
64
+ */
65
+ export function getDigitStrings(numberingSystem) {
66
+ const cached = digitStringsCache.get(numberingSystem);
67
+ if (cached) return cached;
68
+ if (numberingSystem === "hanidec") {
69
+ digitStringsCache.set("hanidec", HANIDEC_DIGITS);
70
+ return HANIDEC_DIGITS;
71
+ }
72
+ const zeroCP = getZeroCodePoint(numberingSystem);
73
+ const strings = Array.from({
74
+ length: 10
75
+ }, (_, i) => String.fromCharCode(zeroCP + i));
76
+ digitStringsCache.set(numberingSystem, strings);
77
+ return strings;
78
+ }
79
+
80
+ /**
81
+ * Returns the numeric value (0-9) of a character code in the given system,
82
+ * or -1 if the code is not a digit in that system.
83
+ *
84
+ * Worklet-safe. Handles hanidec (non-contiguous) via sentinel zeroCodePoint = 0x3007.
85
+ */
86
+ export function localeDigitValue(charCode, zeroCodePoint) {
87
+ "worklet";
88
+
89
+ if (zeroCodePoint === 0x3007) return hanidecDigitValue(charCode);
90
+ const value = charCode - zeroCodePoint;
91
+ return value >= 0 && value <= 9 ? value : -1;
92
+ }
93
+
94
+ /**
95
+ * Checks if a character code is a digit in the given numbering system.
96
+ * Worklet-safe. Handles hanidec via sentinel zeroCodePoint = 0x3007.
97
+ */
98
+ export function isLocaleDigit(charCode, zeroCodePoint) {
99
+ "worklet";
100
+
101
+ return localeDigitValue(charCode, zeroCodePoint) >= 0;
102
+ }
103
+
104
+ /**
105
+ * Checks if a single character is a digit in the given numbering system.
106
+ * Convenience wrapper over localeDigitValue for string-based callers.
107
+ * Worklet-safe.
108
+ */
109
+ export function isDigitChar(char, zeroCodePoint = 48) {
110
+ "worklet";
111
+
112
+ return localeDigitValue(char.charCodeAt(0), zeroCodePoint) >= 0;
113
+ }
114
+
115
+ /**
116
+ * Counts the number of digit characters in a string for a given numbering system.
117
+ * Worklet-safe.
118
+ */
119
+ export function countDigits(text, zeroCodePoint) {
120
+ "worklet";
121
+
122
+ let count = 0;
123
+ for (let i = 0; i < text.length; i++) {
124
+ if (localeDigitValue(text.charCodeAt(i), zeroCodePoint) >= 0) count++;
125
+ }
126
+ return count;
127
+ }
128
+ //# sourceMappingURL=digits.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["HANIDEC_DIGITS","LATIN_ZERO","ZERO_CODEPOINTS","digitStringsCache","Map","hanidecDigitValue","charCode","getZeroCodePoint","numberingSystem","getDigitStrings","cached","get","set","zeroCP","strings","Array","from","length","_","i","String","fromCharCode","localeDigitValue","zeroCodePoint","value","isLocaleDigit","isDigitChar","char","charCodeAt","countDigits","text","count"],"sourceRoot":"../../../../src","sources":["core/numerals/digits.ts"],"mappings":";;AAAA,SAASA,cAAc,EAAEC,UAAU,EAAEC,eAAe,QAAQ,aAAU;AAEtE,MAAMC,iBAAiB,GAAG,IAAIC,GAAG,CAAmB,CAAC;;AAErD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,iBAAiBA,CAACC,QAAgB,EAAU;EAC1D,SAAS;;EACT,QAAQA,QAAQ;IACd,KAAK,MAAM;MAAE,OAAO,CAAC;IAAG;IACxB,KAAK,MAAM;MAAE,OAAO,CAAC;IAAG;IACxB,KAAK,MAAM;MAAE,OAAO,CAAC;IAAG;IACxB,KAAK,MAAM;MAAE,OAAO,CAAC;IAAG;IACxB,KAAK,MAAM;MAAE,OAAO,CAAC;IAAG;IACxB,KAAK,MAAM;MAAE,OAAO,CAAC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AAI,CAAC,GAAGA,KAAK,GAAG,CAAC,CAAC;AAC9C;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASC,aAAaA,CAACnB,QAAgB,EAAEiB,aAAqB,EAAW;EAC9E,SAAS;;EACT,OAAOD,gBAAgB,CAAChB,QAAQ,EAAEiB,aAAa,CAAC,IAAI,CAAC;AACvD;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASG,WAAWA,CAACC,IAAY,EAAEJ,aAAa,GAAG,EAAE,EAAW;EACrE,SAAS;;EACT,OAAOD,gBAAgB,CAACK,IAAI,CAACC,UAAU,CAAC,CAAC,CAAC,EAAEL,aAAa,CAAC,IAAI,CAAC;AACjE;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASM,WAAWA,CAACC,IAAY,EAAEP,aAAqB,EAAU;EACvE,SAAS;;EACT,IAAIQ,KAAK,GAAG,CAAC;EACb,KAAK,IAAIZ,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGW,IAAI,CAACb,MAAM,EAAEE,CAAC,EAAE,EAAE;IACpC,IAAIG,gBAAgB,CAACQ,IAAI,CAACF,UAAU,CAACT,CAAC,CAAC,EAAEI,aAAa,CAAC,IAAI,CAAC,EAAEQ,KAAK,EAAE;EACvE;EACA,OAAOA,KAAK;AACd","ignoreList":[]}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ export { detectNumberingSystem, detectOutputZeroCodePoint } from "./detection.js";
4
+ export { countDigits, getDigitStrings, getZeroCodePoint, isDigitChar, isLocaleDigit, localeDigitValue } from "./digits.js";
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["detectNumberingSystem","detectOutputZeroCodePoint","countDigits","getDigitStrings","getZeroCodePoint","isDigitChar","isLocaleDigit","localeDigitValue"],"sourceRoot":"../../../../src","sources":["core/numerals/index.ts"],"mappings":";;AAAA,SAASA,qBAAqB,EAAEC,yBAAyB,QAAQ,gBAAa;AAC9E,SACEC,WAAW,EACXC,eAAe,EACfC,gBAAgB,EAChBC,WAAW,EACXC,aAAa,EACbC,gBAAgB,QACX,aAAU","ignoreList":[]}
@@ -0,0 +1,114 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Lookup tables for numeral system support.
5
+ *
6
+ * Most Unicode decimal digit systems use 10 contiguous codepoints (0-9),
7
+ * enabling digit detection via: digitValue = charCode - zeroCodePoint.
8
+ *
9
+ * Exception: hanidec (〇一二三四五六七八九) uses non-contiguous ideographs.
10
+ * Functions that accept a zeroCodePoint use 0x3007 as a sentinel to trigger
11
+ * the hanidec lookup path.
12
+ *
13
+ * Only BMP (Basic Multilingual Plane, U+0000-U+FFFF) systems are supported
14
+ * because the codebase uses charCodeAt-based indexing in worklets.
15
+ * Supplementary plane systems (adlm) fall back to Latin digits.
16
+ */
17
+
18
+ export const LATIN_ZERO = 0x0030; // 48
19
+ export const HANIDEC_ZERO = 0x3007;
20
+ export const HANIDEC_DIGITS = ["〇", "一", "二", "三", "四", "五", "六", "七", "八", "九"];
21
+
22
+ /**
23
+ * Map of CLDR numbering system name → Unicode codepoint of digit zero.
24
+ * Only includes BMP systems (codepoint <= 0xFFFF).
25
+ * hanidec uses 0x3007 as a sentinel — the remaining digits are non-contiguous.
26
+ */
27
+ export const ZERO_CODEPOINTS = {
28
+ latn: 0x0030,
29
+ arab: 0x0660,
30
+ arabext: 0x06f0,
31
+ bali: 0x1b50,
32
+ beng: 0x09e6,
33
+ cham: 0xaa50,
34
+ deva: 0x0966,
35
+ fullwide: 0xff10,
36
+ gujr: 0x0ae6,
37
+ guru: 0x0a66,
38
+ hanidec: 0x3007,
39
+ java: 0xa9d0,
40
+ kali: 0xa900,
41
+ khmr: 0x17e0,
42
+ knda: 0x0ce6,
43
+ lana: 0x1a80,
44
+ lanatham: 0x1a90,
45
+ laoo: 0x0ed0,
46
+ lepc: 0x1c40,
47
+ limb: 0x1946,
48
+ mlym: 0x0d66,
49
+ mong: 0x1810,
50
+ mtei: 0xabf0,
51
+ mymr: 0x1040,
52
+ mymrshan: 0x1090,
53
+ nkoo: 0x07c0,
54
+ olck: 0x1c50,
55
+ orya: 0x0b66,
56
+ saur: 0xa8d0,
57
+ sinh: 0x0de6,
58
+ sund: 0x1bb0,
59
+ talu: 0x19d0,
60
+ tamldec: 0x0be6,
61
+ telu: 0x0c66,
62
+ thai: 0x0e50,
63
+ tibt: 0x0f20,
64
+ vaii: 0xa620
65
+ };
66
+
67
+ /**
68
+ * CLDR default numbering systems for locales where the platform (Hermes)
69
+ * may fall back to "latn" despite the locale specifying a different system.
70
+ *
71
+ * Only includes locales whose CLDR default differs from "latn".
72
+ * Key format: language subtag or language-region (e.g. "ar", "ar-EG").
73
+ */
74
+ export const CLDR_DEFAULT_NUMBERING = {
75
+ ar: "arab",
76
+ "ar-AE": "arab",
77
+ "ar-BH": "arab",
78
+ "ar-EG": "arab",
79
+ "ar-IQ": "arab",
80
+ "ar-JO": "arab",
81
+ "ar-KW": "arab",
82
+ "ar-LB": "arab",
83
+ "ar-OM": "arab",
84
+ "ar-QA": "arab",
85
+ "ar-SA": "arab",
86
+ "ar-SD": "arab",
87
+ "ar-SY": "arab",
88
+ "ar-YE": "arab",
89
+ as: "beng",
90
+ "as-IN": "beng",
91
+ bn: "beng",
92
+ "bn-BD": "beng",
93
+ "bn-IN": "beng",
94
+ ckb: "arab",
95
+ "ckb-IQ": "arab",
96
+ dz: "tibt",
97
+ "dz-BT": "tibt",
98
+ fa: "arabext",
99
+ "fa-IR": "arabext",
100
+ ks: "arabext",
101
+ "ks-IN": "arabext",
102
+ mr: "deva",
103
+ "mr-IN": "deva",
104
+ my: "mymr",
105
+ "my-MM": "mymr",
106
+ ne: "deva",
107
+ "ne-NP": "deva",
108
+ ps: "arabext",
109
+ "ps-AF": "arabext",
110
+ sat: "olck",
111
+ "sat-IN": "olck",
112
+ "ur-IN": "arabext"
113
+ };
114
+ //# sourceMappingURL=tables.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["LATIN_ZERO","HANIDEC_ZERO","HANIDEC_DIGITS","ZERO_CODEPOINTS","latn","arab","arabext","bali","beng","cham","deva","fullwide","gujr","guru","hanidec","java","kali","khmr","knda","lana","lanatham","laoo","lepc","limb","mlym","mong","mtei","mymr","mymrshan","nkoo","olck","orya","saur","sinh","sund","talu","tamldec","telu","thai","tibt","vaii","CLDR_DEFAULT_NUMBERING","ar","as","bn","ckb","dz","fa","ks","mr","my","ne","ps","sat"],"sourceRoot":"../../../../src","sources":["core/numerals/tables.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,MAAMA,UAAU,GAAG,MAAM,CAAC,CAAC;AAClC,OAAO,MAAMC,YAAY,GAAG,MAAM;AAElC,OAAO,MAAMC,cAAc,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;;AAEhF;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,eAAuC,GAAG;EACrDC,IAAI,EAAE,MAAM;EACZC,IAAI,EAAE,MAAM;EACZC,OAAO,EAAE,MAAM;EACfC,IAAI,EAAE,MAAM;EACZC,IAAI,EAAE,MAAM;EACZC,IAAI,EAAE,MAAM;EACZC,IAAI,EAAE,MAAM;EACZC,QAAQ,EAAE,MAAM;EAChBC,IAAI,EAAE,MAAM;EACZC,IAAI,EAAE,MAAM;EACZC,OAAO,EAAE,MAAM;EACfC,IAAI,EAAE,MAAM;EACZC,IAAI,EAAE,MAAM;EACZC,IAAI,EAAE,MAAM;EACZC,IAAI,EAAE,MAAM;EACZC,IAAI,EAAE,MAAM;EACZC,QAAQ,EAAE,MAAM;EAChBC,IAAI,EAAE,MAAM;EACZC,IAAI,EAAE,MAAM;EACZC,IAAI,EAAE,MAAM;EACZC,IAAI,EAAE,MAAM;EACZC,IAAI,EAAE,MAAM;EACZC,IA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AO,EAAE,SAAS;EAClBC,GAAG,EAAE,MAAM;EACX,QAAQ,EAAE,MAAM;EAChB,OAAO,EAAE;AACX,CAAC","ignoreList":[]}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ import { SUPERSCRIPT_SCALE } from "./constants.js";
4
+
5
+ /**
6
+ * Returns the scaled TextStyle for superscript rendering in native slots.
7
+ * Reduces fontSize and lineHeight by SUPERSCRIPT_SCALE.
8
+ */
9
+ export function getSuperscriptTextStyle(textStyle, lineHeight) {
10
+ return {
11
+ ...textStyle,
12
+ fontSize: (textStyle.fontSize ?? 16) * SUPERSCRIPT_SCALE,
13
+ lineHeight
14
+ };
15
+ }
16
+
17
+ /**
18
+ * Returns the pivot-scale transform array for superscript rendering in Skia slots.
19
+ * Pivots around the text top so the digit shrinks downward within the mask region.
20
+ */
21
+ export function getSuperscriptTransform(baseY, ascent) {
22
+ const textTop = baseY + ascent;
23
+ return [{
24
+ translateY: textTop
25
+ }, {
26
+ scale: SUPERSCRIPT_SCALE
27
+ }, {
28
+ translateY: -textTop
29
+ }];
30
+ }
31
+ //# sourceMappingURL=superscript.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["SUPERSCRIPT_SCALE","getSuperscriptTextStyle","textStyle","lineHeight","fontSize","getSuperscriptTransform","baseY","ascent","textTop","translateY","scale"],"sourceRoot":"../../../src","sources":["core/superscript.ts"],"mappings":";;AACA,SAASA,iBAAiB,QAAQ,gBAAa;;AAE/C;AACA;AACA;AACA;AACA,OAAO,SAASC,uBAAuBA,CAACC,SAAoB,EAAEC,UAAkB,EAAa;EAC3F,OAAO;IACL,GAAGD,SAAS;IACZE,QAAQ,EAAE,CAACF,SAAS,CAACE,QAAQ,IAAI,EAAE,IAAIJ,iBAAiB;IACxDG;EACF,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASE,uBAAuBA,CACrCC,KAAa,EACbC,MAAc,EACkC;EAChD,MAAMC,OAAO,GAAGF,KAAK,GAAGC,MAAM;EAE9B,OAAO,CAAC;IAAEE,UAAU,EAAED;EAAQ,CAAC,EAAE;IAAEE,KAAK,EAAEV;EAAkB,CAAC,EAAE;IAAES,UAAU,EAAE,CAACD;EAAQ,CAAC,CAAC;AAC1F","ignoreList":[]}
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+
3
+ import { assignXPositions } from "./layout.js";
4
+ import { isDigitChar, localeDigitValue } from "./numerals/index.js";
5
+
6
+ /**
7
+ * Keys for each digit position within a time segment.
8
+ * Index 0 = tens digit, index 1 = ones digit.
9
+ */
10
+ const HOUR_KEYS = ["h10", "h1"];
11
+ const MINUTE_KEYS = ["m10", "m1"];
12
+ const SECOND_KEYS = ["s10", "s1"];
13
+ function pushChar(chars, key, char, metrics, zeroCodePoint = 48) {
14
+ const isDigit = isDigitChar(char, zeroCodePoint);
15
+ const width = metrics.charWidths[char] ?? metrics.maxDigitWidth;
16
+ chars.push({
17
+ key,
18
+ char,
19
+ isDigit,
20
+ digitValue: isDigit ? localeDigitValue(char.charCodeAt(0), zeroCodePoint) : -1,
21
+ x: 0,
22
+ width
23
+ });
24
+ }
25
+
26
+ /**
27
+ * Pushes a group of digit characters with the given key array.
28
+ * If the digit string is shorter than the keys array (e.g. single-digit hour),
29
+ * only the last N keys are used (matching the useTimeFormatting behavior where
30
+ * h10 is omitted for single-digit hours).
31
+ */
32
+ function pushDigitGroup(chars, digits, keys, metrics) {
33
+ const offset = keys.length - digits.length;
34
+ for (let i = 0; i < digits.length; i++) {
35
+ pushChar(chars, keys[offset + i], digits[i], metrics);
36
+ }
37
+ }
38
+
39
+ /**
40
+ * Computes time-aware string layout with fixed semantic keys.
41
+ *
42
+ * Unlike `computeStringLayout` which uses positional keys (`pos:0`, `pos:1`),
43
+ * this function assigns the same fixed keys (h10, h1, sep, m10, m1, etc.)
44
+ * that `useTimeFormatting` produces. This ensures worklet-driven updates
45
+ * produce stable keys that match prop-driven updates.
46
+ *
47
+ * @param timeString - Formatted time string like "14:30", "9:30", "2:30 PM", "05:30"
48
+ * @param metrics - Glyph measurement data
49
+ * @param totalWidth - Available width for alignment
50
+ * @param textAlign - Text alignment within totalWidth
51
+ * @param hasHours - Whether the hours segment is shown (determines how to interpret segments)
52
+ * @param hasSeconds - Whether the seconds segment is shown
53
+ */
54
+ export function computeTimeStringLayout(timeString, metrics, totalWidth, textAlign, hasHours, hasSeconds) {
55
+ const chars = [];
56
+ let ampmLabel = null;
57
+ let timePart = timeString;
58
+ if (timePart.endsWith(" AM")) {
59
+ ampmLabel = "AM";
60
+ timePart = timePart.slice(0, -3);
61
+ } else if (timePart.endsWith(" PM")) {
62
+ ampmLabel = "PM";
63
+ timePart = timePart.slice(0, -3);
64
+ }
65
+ const segments = timePart.split(":");
66
+ if (hasHours && hasSeconds && segments.length === 3) {
67
+ // HH:MM:SS
68
+ pushDigitGroup(chars, segments[0], HOUR_KEYS, metrics);
69
+ pushChar(chars, "sep", ":", metrics);
70
+ pushDigitGroup(chars, segments[1], MINUTE_KEYS, metrics);
71
+ pushChar(chars, "sep2", ":", metrics);
72
+ pushDigitGroup(chars, segments[2], SECOND_KEYS, metrics);
73
+ } else if (hasHours && !hasSeconds && segments.length >= 2) {
74
+ // HH:MM
75
+ pushDigitGroup(chars, segments[0], HOUR_KEYS, metrics);
76
+ pushChar(chars, "sep", ":", metrics);
77
+ pushDigitGroup(chars, segments[1], MINUTE_KEYS, metrics);
78
+ } else if (!hasHours && hasSeconds && segments.length >= 2) {
79
+ // MM:SS (countdown mode)
80
+ pushDigitGroup(chars, segments[0], MINUTE_KEYS, metrics);
81
+ pushChar(chars, "sep2", ":", metrics);
82
+ pushDigitGroup(chars, segments[1], SECOND_KEYS, metrics);
83
+ } else {
84
+ // Fallback: just minutes (shouldn't normally happen)
85
+ pushDigitGroup(chars, segments[0], MINUTE_KEYS, metrics);
86
+ }
87
+
88
+ // AM/PM suffix — individual characters with value-dependent keys
89
+ if (ampmLabel) {
90
+ pushChar(chars, "ampm-sp", " ", metrics);
91
+ for (let i = 0; i < ampmLabel.length; i++) {
92
+ pushChar(chars, `ampm:${ampmLabel}:${i}`, ampmLabel[i], metrics);
93
+ }
94
+ }
95
+ assignXPositions(chars, totalWidth, textAlign);
96
+ return chars;
97
+ }
98
+ //# sourceMappingURL=timeLayout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["assignXPositions","isDigitChar","localeDigitValue","HOUR_KEYS","MINUTE_KEYS","SECOND_KEYS","pushChar","chars","key","char","metrics","zeroCodePoint","isDigit","width","charWidths","maxDigitWidth","push","digitValue","charCodeAt","x","pushDigitGroup","digits","keys","offset","length","i","computeTimeStringLayout","timeString","totalWidth","textAlign","hasHours","hasSeconds","ampmLabel","timePart","endsWith","slice","segments","split"],"sourceRoot":"../../../src","sources":["core/timeLayout.ts"],"mappings":";;AAAA,SAASA,gBAAgB,QAAyB,aAAU;AAE5D,SAASC,WAAW,EAAEC,gBAAgB,QAAQ,qBAAY;;AAE1D;AACA;AACA;AACA;AACA,MAAMC,SAAS,GAAG,CAAC,KAAK,EAAE,IAAI,CAAU;AACxC,MAAMC,WAAW,GAAG,CAAC,KAAK,EAAE,IAAI,CAAU;AAC1C,MAAMC,WAAW,GAAG,CAAC,KAAK,EAAE,IAAI,CAAU;AAE1C,SAASC,QAAQA,CACfC,KAAmB,EACnBC,GAAW,EACXC,IAAY,EACZC,OAAqB,EACrBC,aAAa,GAAG,EAAE,EACZ;EACN,MAAMC,OAAO,GAAGX,WAAW,CAACQ,IAAI,EAAEE,aAAa,CAAC;EAChD,MAAME,KAAK,GAAGH,OAAO,CAACI,UAAU,CAACL,IAAI,CAAC,IAAIC,OAAO,CAACK,aAAa;EAC/DR,KAAK,CAACS,IAAI,CAAC;IACTR,GAAG;IACHC,IAAI;IACJG,OAAO;IACPK,UAAU,EAAEL,OAAO,GAAGV,gBAAgB,CAACO,IAAI,CAACS,UAAU,CAAC,CAAC,CAAC,EAAEP,aAAa,CAAC,GAAG,CAAC,CAAC;IAC9EQ,CAAC,EAAE,CAAC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AEhC,WAAW,EAAEM,OAAO,CAAC;EAC1D;;EAEA;EACA,IAAIsB,SAAS,EAAE;IACb1B,QAAQ,CAACC,KAAK,EAAE,SAAS,EAAE,GAAG,EAAEG,OAAO,CAAC;IACxC,KAAK,IAAIe,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGO,SAAS,CAACR,MAAM,EAAEC,CAAC,EAAE,EAAE;MACzCnB,QAAQ,CAACC,KAAK,EAAE,QAAQyB,SAAS,IAAIP,CAAC,EAAE,EAAEO,SAAS,CAACP,CAAC,CAAC,EAAEf,OAAO,CAAC;IAClE;EACF;EAEAV,gBAAgB,CAACO,KAAK,EAAEqB,UAAU,EAAEC,SAAS,CAAC;EAC9C,OAAOtB,KAAK;AACd","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+
3
+ export {};
4
+ //# sourceMappingURL=timeTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../src","sources":["core/timeTypes.ts"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+
3
+ import { Easing } from "react-native-reanimated";
4
+ /**
5
+ * NumberFlow's CSS linear() easing function — exact reproduction.
6
+ * A smooth deceleration curve defined by 90 evenly-spaced control points.
7
+ */
8
+ const NUMBER_FLOW_EASING_POINTS = [0, 0.005, 0.019, 0.039, 0.066, 0.096, 0.129, 0.165, 0.202, 0.24, 0.278, 0.316, 0.354, 0.39, 0.426, 0.461, 0.494, 0.526, 0.557, 0.586, 0.614, 0.64, 0.665, 0.689, 0.711, 0.731, 0.751, 0.769, 0.786, 0.802, 0.817, 0.831, 0.844, 0.856, 0.867, 0.877, 0.887, 0.896, 0.904, 0.912, 0.919, 0.925, 0.931, 0.937, 0.942, 0.947, 0.951, 0.955, 0.959, 0.962, 0.965, 0.968, 0.971, 0.973, 0.976, 0.978, 0.98, 0.981, 0.983, 0.984, 0.986, 0.987, 0.988, 0.989, 0.99, 0.991, 0.992, 0.992, 0.993, 0.994, 0.994, 0.995, 0.995, 0.996, 0.996, 0.9963, 0.9967, 0.9969, 0.9972, 0.9975, 0.9977, 0.9979, 0.9981, 0.9982, 0.9984, 0.9985, 0.9987, 0.9988, 0.9989, 1];
9
+
10
+ /**
11
+ * NumberFlow's default transform easing — smooth deceleration curve.
12
+ * Piecewise linear interpolation over the control points above,
13
+ * recreating CSS linear() easing from the Web Animations API.
14
+ */
15
+ const numberFlowEasing = t => {
16
+ "worklet";
17
+
18
+ const lastIndex = NUMBER_FLOW_EASING_POINTS.length - 1;
19
+ if (t <= 0) return NUMBER_FLOW_EASING_POINTS[0];
20
+ if (t >= 1) return NUMBER_FLOW_EASING_POINTS[lastIndex];
21
+ const scaledT = t * lastIndex;
22
+ const index = Math.floor(scaledT);
23
+ const fraction = scaledT - index;
24
+ return NUMBER_FLOW_EASING_POINTS[index] + (NUMBER_FLOW_EASING_POINTS[index + 1] - NUMBER_FLOW_EASING_POINTS[index]) * fraction;
25
+ };
26
+ export const DEFAULT_TRANSFORM_TIMING = {
27
+ duration: 900,
28
+ easing: numberFlowEasing
29
+ };
30
+
31
+ // How long a digit spins before settling into its final position
32
+ export const DEFAULT_SPIN_TIMING = DEFAULT_TRANSFORM_TIMING;
33
+ export const DEFAULT_OPACITY_TIMING = {
34
+ duration: 450,
35
+ easing: Easing.out(Easing.ease)
36
+ };
37
+ export const ZERO_TIMING = {
38
+ duration: 0,
39
+ easing: t => {
40
+ "worklet";
41
+
42
+ return t;
43
+ }
44
+ };
45
+ //# sourceMappingURL=timing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Easing","NUMBER_FLOW_EASING_POINTS","numberFlowEasing","t","lastIndex","length","scaledT","index","Math","floor","fraction","DEFAULT_TRANSFORM_TIMING","duration","easing","DEFAULT_SPIN_TIMING","DEFAULT_OPACITY_TIMING","out","ease","ZERO_TIMING"],"sourceRoot":"../../../src","sources":["core/timing.ts"],"mappings":";;AAAA,SAASA,MAAM,QAAQ,yBAAyB;AAGh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S,GAAGH,yBAAyB,CAACI,MAAM,GAAG,CAAC;EAEtD,IAAIF,CAAC,IAAI,CAAC,EAAE,OAAOF,yBAAyB,CAAC,CAAC,CAAC;EAC/C,IAAIE,CAAC,IAAI,CAAC,EAAE,OAAOF,yBAAyB,CAACG,SAAS,CAAC;EAEvD,MAAME,OAAO,GAAGH,CAAC,GAAGC,SAAS;EAC7B,MAAMG,KAAK,GAAGC,IAAI,CAACC,KAAK,CAACH,OAAO,CAAC;EACjC,MAAMI,QAAQ,GAAGJ,OAAO,GAAGC,KAAK;EAEhC,OACEN,yBAAyB,CAACM,KAAK,CAAC,GAChC,CAACN,yBAAyB,CAACM,KAAK,GAAG,CAAC,CAAC,GAAGN,yBAAyB,CAACM,KAAK,CAAC,IAAIG,QAAQ;AAExF,CAAC;AAED,OAAO,MAAMC,wBAAsC,GAAG;EACpDC,QAAQ,EAAE,GAAG;EACbC,MAAM,EAAEX;AACV,CAAC;;AAED;AACA,OAAO,MAAMY,mBAAiC,GAAGH,wBAAwB;AAEzE,OAAO,MAAMI,sBAAoC,GAAG;EAClDH,QAAQ,EAAE,GAAG;EACbC,MAAM,EAAEb,MAAM,CAACgB,GAAG,CAAChB,MAAM,CAACiB,IAAI;AAChC,CAAC;AAED,OAAO,MAAMC,WAAyB,GAAG;EACvCN,QAAQ,EAAE,CAAC;EACXC,MAAM,EAAGV,CAAS,IAAK;IACrB,SAAS;;IACT,OAAOA,CAAC;EACV;AACF,CAAC","ignoreList":[]}
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Controls digit spin direction:
5
+ * - `1`: always spin upward
6
+ * - `-1`: always spin downward
7
+ * - `0`: each digit takes the shortest path
8
+ */
9
+
10
+ /**
11
+ * Trend prop accepted by components: either a static direction
12
+ * or a function that receives (prevValue, nextValue) and returns the direction.
13
+ */
14
+
15
+ /**
16
+ * Animation behavior props shared by all Flow components (NumberFlow, TimeFlow,
17
+ * SkiaNumberFlow, SkiaTimeFlow). Controls how digit transitions behave.
18
+ */
19
+
20
+ /** A single character with a stable key from formatToParts RTL/LTR keying */
21
+
22
+ export function digitPart(key, value) {
23
+ return {
24
+ key,
25
+ type: "digit",
26
+ char: String(value),
27
+ digitValue: value
28
+ };
29
+ }
30
+ export function symbolPart(key, char) {
31
+ return {
32
+ key,
33
+ type: "symbol",
34
+ char,
35
+ digitValue: -1
36
+ };
37
+ }
38
+
39
+ /**
40
+ * Per-position digit constraint. `max` defines the highest value the
41
+ * digit can display (inclusive), creating a wheel of (max + 1) values.
42
+ * Example: { max: 5 } creates a 0-5 wheel (6 elements).
43
+ */
44
+
45
+ /**
46
+ * Maps integer positions to their constraints.
47
+ * Position 0 = ones, 1 = tens, 2 = hundreds, etc.
48
+ * Positions not listed default to { max: 9 } (standard 0-9 wheel).
49
+ */
50
+
51
+ /** Value props — mutually exclusive: provide `value` (JS-driven) or `sharedValue` (worklet-driven), not both. */
52
+
53
+ /**
54
+ * Props for SkiaNumberFlow.
55
+ * Value changes are auto-announced for screen reader users.
56
+ * For VoiceOver/TalkBack focus-based reading, set `accessibilityLabel` on the parent Canvas.
57
+ */
58
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["digitPart","key","value","type","char","String","digitValue","symbolPart"],"sourceRoot":"../../../src","sources":["core/types.ts"],"mappings":";;AAmBA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;;AAgCA;;AAYA,OAAO,SAASA,SAASA,CAACC,GAAW,EAAEC,KAAa,EAAa;EAC/D,OAAO;IAAED,GAAG;IAAEE,IAAI,EAAE,OAAO;IAAEC,IAAI,EAAEC,MAAM,CAACH,KAAK,CAAC;IAAEI,UAAU,EAAEJ;EAAM,CAAC;AACvE;AAEA,OAAO,SAASK,UAAUA,CAACN,GAAW,EAAEG,IAAY,EAAa;EAC/D,OAAO;IAAEH,GAAG;IAAEE,IAAI,EAAE,QAAQ;IAAEC,IAAI;IAAEE,UAAU,EAAE,CAAC;EAAE,CAAC;AACtD;;AAuBA;AACA;AACA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;;AAGA;;AA0DA;AACA;AACA;AACA;AACA","ignoreList":[]}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ import { useEffect, useRef } from "react";
4
+ import { AccessibilityInfo } from "react-native";
5
+
6
+ /**
7
+ * Announces label changes to screen readers for Skia components.
8
+ *
9
+ * Skia renders inside <Canvas>, which is opaque to the accessibility tree.
10
+ * This hook auto-announces value changes when a screen reader is active
11
+ * so users get audio feedback. The first render is skipped to avoid
12
+ * announcing the initial value.
13
+ */
14
+ export function useAccessibilityAnnouncement(label) {
15
+ const isFirstRender = useRef(true);
16
+ useEffect(() => {
17
+ if (isFirstRender.current) {
18
+ isFirstRender.current = false;
19
+ return;
20
+ }
21
+ if (!label) return;
22
+ AccessibilityInfo.isScreenReaderEnabled().then(enabled => {
23
+ if (enabled) AccessibilityInfo.announceForAccessibility(label);
24
+ });
25
+ }, [label]);
26
+ }
27
+ //# sourceMappingURL=useAccessibilityAnnouncement.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useEffect","useRef","AccessibilityInfo","useAccessibilityAnnouncement","label","isFirstRender","current","isScreenReaderEnabled","then","enabled","announceForAccessibility"],"sourceRoot":"../../../src","sources":["core/useAccessibilityAnnouncement.ts"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,MAAM,QAAQ,OAAO;AACzC,SAASC,iBAAiB,QAAQ,cAAc;;AAEhD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,4BAA4BA,CAACC,KAAyB,EAAQ;EAC5E,MAAMC,aAAa,GAAGJ,MAAM,CAAC,IAAI,CAAC;EAElCD,SAAS,CAAC,MAAM;IACd,IAAIK,aAAa,CAACC,OAAO,EAAE;MACzBD,aAAa,CAACC,OAAO,GAAG,KAAK;MAC7B;IACF;IAEA,IAAI,CAACF,KAAK,EAAE;IAEZF,iBAAiB,CAACK,qBAAqB,CAAC,CAAC,CAACC,IAAI,CAAEC,OAAO,IAAK;MAC1D,IAAIA,OAAO,EAAEP,iBAAiB,CAACQ,wBAAwB,CAACN,KAAK,CAAC;IAChE,CAAC,CAAC;EACJ,CAAC,EAAE,CAACA,KAAK,CAAC,CAAC;AACb","ignoreList":[]}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ import { useLayoutEffect, useRef, useState } from "react";
4
+ import { makeMutable, withTiming } from "react-native-reanimated";
5
+ /**
6
+ * We use makeMutable (via useState) instead of useSharedValue because
7
+ * useSharedValue's cleanup calls cancelAnimation, which kills in-flight
8
+ * animations when the component re-renders in StrictMode.
9
+ */
10
+
11
+ export function useAnimatedX(targetX, exiting, transformTiming) {
12
+ const [animatedX] = useState(() => makeMutable(targetX));
13
+ const prevXRef = useRef(targetX);
14
+ useLayoutEffect(() => {
15
+ if (!exiting && prevXRef.current !== targetX) {
16
+ prevXRef.current = targetX;
17
+ animatedX.value = withTiming(targetX, {
18
+ duration: transformTiming.duration,
19
+ easing: transformTiming.easing
20
+ });
21
+ }
22
+ }, [targetX, exiting, transformTiming, animatedX]);
23
+ return animatedX;
24
+ }
25
+ //# sourceMappingURL=useAnimatedX.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useLayoutEffect","useRef","useState","makeMutable","withTiming","useAnimatedX","targetX","exiting","transformTiming","animatedX","prevXRef","current","value","duration","easing"],"sourceRoot":"../../../src","sources":["core/useAnimatedX.ts"],"mappings":";;AAAA,SAASA,eAAe,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AACzD,SAASC,WAAW,EAAoBC,UAAU,QAAQ,yBAAyB;AAGnF;AACA;AACA;AACA;AACA;;AAEA,OAAO,SAASC,YAAYA,CAC1BC,OAAe,EACfC,OAAgB,EAChBC,eAA6B,EACR;EACrB,MAAM,CAACC,SAAS,CAAC,GAAGP,QAAQ,CAAC,MAAMC,WAAW,CAACG,OAAO,CAAC,CAAC;EACxD,MAAMI,QAAQ,GAAGT,MAAM,CAACK,OAAO,CAAC;EAEhCN,eAAe,CAAC,MAAM;IACpB,IAAI,CAACO,OAAO,IAAIG,QAAQ,CAACC,OAAO,KAAKL,OAAO,EAAE;MAC5CI,QAAQ,CAACC,OAAO,GAAGL,OAAO;MAC1BG,SAAS,CAACG,KAAK,GAAGR,UAAU,CAACE,OAAO,EAAE;QACpCO,QAAQ,EAAEL,eAAe,CAACK,QAAQ;QAClCC,MAAM,EAAEN,eAAe,CAACM;MAC1B,CAAC,CAAC;IACJ;EACF,CAAC,EAAE,CAACR,OAAO,EAAEC,OAAO,EAAEC,eAAe,EAAEC,SAAS,CAAC,CAAC;EAElD,OAAOA,SAAS;AAClB","ignoreList":[]}
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+
3
+ import { useEffect, useRef } from "react";
4
+ /**
5
+ * Fires animation lifecycle callbacks (start/finish) when the layout changes.
6
+ *
7
+ * Uses refs for callbacks to avoid stale closures in the setTimeout,
8
+ * and tracks previous layout to detect actual changes (not initial mount).
9
+ */
10
+ export function useAnimationLifecycle(layout, timings, onAnimationsStart, onAnimationsFinish) {
11
+ // Keep callback refs fresh so the setTimeout always calls the latest version
12
+ const onStartRef = useRef(onAnimationsStart);
13
+ onStartRef.current = onAnimationsStart;
14
+ const onFinishRef = useRef(onAnimationsFinish);
15
+ onFinishRef.current = onAnimationsFinish;
16
+
17
+ // Track previous layout to distinguish real changes from initial mount
18
+ const prevLayoutRef = useRef(layout);
19
+ const prevLayoutLenRef = useRef(layout.length);
20
+ const animTimerRef = useRef(undefined);
21
+ useEffect(() => {
22
+ const layoutChanged = layout !== prevLayoutRef.current;
23
+ const bothNonEmpty = layout.length > 0 && prevLayoutLenRef.current > 0;
24
+ if (layoutChanged && bothNonEmpty) {
25
+ onStartRef.current?.();
26
+ if (animTimerRef.current) clearTimeout(animTimerRef.current);
27
+ const maxDur = Math.max(timings.spin.duration, timings.opacity.duration, timings.transform.duration);
28
+ animTimerRef.current = setTimeout(() => onFinishRef.current?.(), maxDur);
29
+ }
30
+ prevLayoutRef.current = layout;
31
+ prevLayoutLenRef.current = layout.length;
32
+ return () => {
33
+ if (animTimerRef.current) clearTimeout(animTimerRef.current);
34
+ };
35
+ }, [layout, timings.spin, timings.opacity, timings.transform]);
36
+ }
37
+ //# sourceMappingURL=useAnimationLifecycle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useEffect","useRef","useAnimationLifecycle","layout","timings","onAnimationsStart","onAnimationsFinish","onStartRef","current","onFinishRef","prevLayoutRef","prevLayoutLenRef","length","animTimerRef","undefined","layoutChanged","bothNonEmpty","clearTimeout","maxDur","Math","max","spin","duration","opacity","transform","setTimeout"],"sourceRoot":"../../../src","sources":["core/useAnimationLifecycle.ts"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,MAAM,QAAQ,OAAO;AAIzC;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,qBAAqBA,CACnCC,MAAoB,EACpBC,OAA+E,EAC/EC,iBAA8B,EAC9BC,kBAA+B,EACzB;EACN;EACA,MAAMC,UAAU,GAAGN,MAAM,CAACI,iBAAiB,CAAC;EAC5CE,UAAU,CAACC,OAAO,GAAGH,iBAAiB;EAEtC,MAAMI,WAAW,GAAGR,MAAM,CAACK,kBAAkB,CAAC;EAC9CG,WAAW,CAACD,OAAO,GAAGF,kBAAkB;;EAExC;EACA,MAAMI,aAAa,GAAGT,MAAM,CAACE,MAAM,CAAC;EACpC,MAAMQ,gBAAgB,GAAGV,MAAM,CAACE,MAAM,CAACS,MAAM,CAAC;EAC9C,MAAMC,YAAY,GAAGZ,MAAM,CAA4Ca,SAAS,CAAC;EAEjFd,SAAS,CAAC,MAAM;IACd,MAAMe,aAAa,GAAGZ,MAAM,KAAKO,aAAa,CAACF,OAAO;IACtD,MAAMQ,YAAY,GAAGb,MAAM,CAACS,MAAM,GAAG,CAAC,IAAID,gBAAgB,CAACH,OAAO,GAAG,CAAC;IAEtE,IAAIO,aAAa,IAAIC,Y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