@react-native-motion-kit/text-motion 0.0.0-stage → 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 (252) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/LICENSE +20 -0
  3. package/README.ko.md +698 -0
  4. package/README.md +696 -2
  5. package/lib/module/accessibility/index.js +4 -0
  6. package/lib/module/accessibility/index.js.map +1 -0
  7. package/lib/module/accessibility/policies.js +39 -0
  8. package/lib/module/accessibility/policies.js.map +1 -0
  9. package/lib/module/controls/brand.js +4 -0
  10. package/lib/module/controls/brand.js.map +1 -0
  11. package/lib/module/controls/controls.js +28 -0
  12. package/lib/module/controls/controls.js.map +1 -0
  13. package/lib/module/controls/descriptors.js +55 -0
  14. package/lib/module/controls/descriptors.js.map +1 -0
  15. package/lib/module/controls/index.js +4 -0
  16. package/lib/module/controls/index.js.map +1 -0
  17. package/lib/module/effects/compose.js +48 -0
  18. package/lib/module/effects/compose.js.map +1 -0
  19. package/lib/module/effects/fade.js +15 -0
  20. package/lib/module/effects/fade.js.map +1 -0
  21. package/lib/module/effects/index.js +12 -0
  22. package/lib/module/effects/index.js.map +1 -0
  23. package/lib/module/effects/lineReveal.js +17 -0
  24. package/lib/module/effects/lineReveal.js.map +1 -0
  25. package/lib/module/effects/pulse.js +14 -0
  26. package/lib/module/effects/pulse.js.map +1 -0
  27. package/lib/module/effects/rise.js +14 -0
  28. package/lib/module/effects/rise.js.map +1 -0
  29. package/lib/module/effects/scale.js +15 -0
  30. package/lib/module/effects/scale.js.map +1 -0
  31. package/lib/module/effects/shake.js +14 -0
  32. package/lib/module/effects/shake.js.map +1 -0
  33. package/lib/module/effects/slide.js +15 -0
  34. package/lib/module/effects/slide.js.map +1 -0
  35. package/lib/module/effects/typewriter.js +19 -0
  36. package/lib/module/effects/typewriter.js.map +1 -0
  37. package/lib/module/effects/validation.js +10 -0
  38. package/lib/module/effects/validation.js.map +1 -0
  39. package/lib/module/index.js +10 -0
  40. package/lib/module/index.js.map +1 -0
  41. package/lib/module/package.json +1 -0
  42. package/lib/module/presets/index.js +35 -0
  43. package/lib/module/presets/index.js.map +1 -0
  44. package/lib/module/recipe/component.js +60 -0
  45. package/lib/module/recipe/component.js.map +1 -0
  46. package/lib/module/recipe/defineTextMotion.js +9 -0
  47. package/lib/module/recipe/defineTextMotion.js.map +1 -0
  48. package/lib/module/recipe/descriptors.js +60 -0
  49. package/lib/module/recipe/descriptors.js.map +1 -0
  50. package/lib/module/recipe/index.js +5 -0
  51. package/lib/module/recipe/index.js.map +1 -0
  52. package/lib/module/recipe/recipe.js +163 -0
  53. package/lib/module/recipe/recipe.js.map +1 -0
  54. package/lib/module/renderers/index.js +5 -0
  55. package/lib/module/renderers/index.js.map +1 -0
  56. package/lib/module/renderers/nativeText.js +494 -0
  57. package/lib/module/renderers/nativeText.js.map +1 -0
  58. package/lib/module/renderers/nativeTextControls.js +96 -0
  59. package/lib/module/renderers/nativeTextControls.js.map +1 -0
  60. package/lib/module/renderers/nativeTextLineLayout.js +290 -0
  61. package/lib/module/renderers/nativeTextLineLayout.js.map +1 -0
  62. package/lib/module/renderers/nativeTextPlayback.js +91 -0
  63. package/lib/module/renderers/nativeTextPlayback.js.map +1 -0
  64. package/lib/module/renderers/overlayText.js +543 -0
  65. package/lib/module/renderers/overlayText.js.map +1 -0
  66. package/lib/module/renderers/overlayTextLayout.js +182 -0
  67. package/lib/module/renderers/overlayTextLayout.js.map +1 -0
  68. package/lib/module/renderers/rendererMotion.js +264 -0
  69. package/lib/module/renderers/rendererMotion.js.map +1 -0
  70. package/lib/module/split/createToken.js +19 -0
  71. package/lib/module/split/createToken.js.map +1 -0
  72. package/lib/module/split/custom.js +57 -0
  73. package/lib/module/split/custom.js.map +1 -0
  74. package/lib/module/split/graphemes.js +25 -0
  75. package/lib/module/split/graphemes.js.map +1 -0
  76. package/lib/module/split/index.js +7 -0
  77. package/lib/module/split/index.js.map +1 -0
  78. package/lib/module/split/lines.js +43 -0
  79. package/lib/module/split/lines.js.map +1 -0
  80. package/lib/module/split/segmenter.js +74 -0
  81. package/lib/module/split/segmenter.js.map +1 -0
  82. package/lib/module/split/words.js +28 -0
  83. package/lib/module/split/words.js.map +1 -0
  84. package/lib/module/timeline/index.js +7 -0
  85. package/lib/module/timeline/index.js.map +1 -0
  86. package/lib/module/timeline/parallel.js +21 -0
  87. package/lib/module/timeline/parallel.js.map +1 -0
  88. package/lib/module/timeline/sequence.js +18 -0
  89. package/lib/module/timeline/sequence.js.map +1 -0
  90. package/lib/module/timeline/stagger.js +43 -0
  91. package/lib/module/timeline/stagger.js.map +1 -0
  92. package/lib/module/timeline/validation.js +24 -0
  93. package/lib/module/timeline/validation.js.map +1 -0
  94. package/lib/module/timeline/wave.js +25 -0
  95. package/lib/module/timeline/wave.js.map +1 -0
  96. package/lib/module/types/index.js +4 -0
  97. package/lib/module/types/index.js.map +1 -0
  98. package/lib/module/types/recipe.js +4 -0
  99. package/lib/module/types/recipe.js.map +1 -0
  100. package/lib/module/types/renderer.js +27 -0
  101. package/lib/module/types/renderer.js.map +1 -0
  102. package/lib/module/types/token.js +2 -0
  103. package/lib/module/types/token.js.map +1 -0
  104. package/lib/typescript/package.json +1 -0
  105. package/lib/typescript/src/accessibility/index.d.ts +2 -0
  106. package/lib/typescript/src/accessibility/index.d.ts.map +1 -0
  107. package/lib/typescript/src/accessibility/policies.d.ts +13 -0
  108. package/lib/typescript/src/accessibility/policies.d.ts.map +1 -0
  109. package/lib/typescript/src/controls/brand.d.ts +2 -0
  110. package/lib/typescript/src/controls/brand.d.ts.map +1 -0
  111. package/lib/typescript/src/controls/controls.d.ts +28 -0
  112. package/lib/typescript/src/controls/controls.d.ts.map +1 -0
  113. package/lib/typescript/src/controls/descriptors.d.ts +14 -0
  114. package/lib/typescript/src/controls/descriptors.d.ts.map +1 -0
  115. package/lib/typescript/src/controls/index.d.ts +3 -0
  116. package/lib/typescript/src/controls/index.d.ts.map +1 -0
  117. package/lib/typescript/src/effects/compose.d.ts +11 -0
  118. package/lib/typescript/src/effects/compose.d.ts.map +1 -0
  119. package/lib/typescript/src/effects/fade.d.ts +10 -0
  120. package/lib/typescript/src/effects/fade.d.ts.map +1 -0
  121. package/lib/typescript/src/effects/index.d.ts +10 -0
  122. package/lib/typescript/src/effects/index.d.ts.map +1 -0
  123. package/lib/typescript/src/effects/lineReveal.d.ts +11 -0
  124. package/lib/typescript/src/effects/lineReveal.d.ts.map +1 -0
  125. package/lib/typescript/src/effects/pulse.d.ts +8 -0
  126. package/lib/typescript/src/effects/pulse.d.ts.map +1 -0
  127. package/lib/typescript/src/effects/rise.d.ts +8 -0
  128. package/lib/typescript/src/effects/rise.d.ts.map +1 -0
  129. package/lib/typescript/src/effects/scale.d.ts +10 -0
  130. package/lib/typescript/src/effects/scale.d.ts.map +1 -0
  131. package/lib/typescript/src/effects/shake.d.ts +8 -0
  132. package/lib/typescript/src/effects/shake.d.ts.map +1 -0
  133. package/lib/typescript/src/effects/slide.d.ts +10 -0
  134. package/lib/typescript/src/effects/slide.d.ts.map +1 -0
  135. package/lib/typescript/src/effects/typewriter.d.ts +13 -0
  136. package/lib/typescript/src/effects/typewriter.d.ts.map +1 -0
  137. package/lib/typescript/src/effects/validation.d.ts +2 -0
  138. package/lib/typescript/src/effects/validation.d.ts.map +1 -0
  139. package/lib/typescript/src/index.d.ts +15 -0
  140. package/lib/typescript/src/index.d.ts.map +1 -0
  141. package/lib/typescript/src/presets/index.d.ts +10 -0
  142. package/lib/typescript/src/presets/index.d.ts.map +1 -0
  143. package/lib/typescript/src/recipe/component.d.ts +3 -0
  144. package/lib/typescript/src/recipe/component.d.ts.map +1 -0
  145. package/lib/typescript/src/recipe/defineTextMotion.d.ts +4 -0
  146. package/lib/typescript/src/recipe/defineTextMotion.d.ts.map +1 -0
  147. package/lib/typescript/src/recipe/descriptors.d.ts +15 -0
  148. package/lib/typescript/src/recipe/descriptors.d.ts.map +1 -0
  149. package/lib/typescript/src/recipe/index.d.ts +4 -0
  150. package/lib/typescript/src/recipe/index.d.ts.map +1 -0
  151. package/lib/typescript/src/recipe/recipe.d.ts +67 -0
  152. package/lib/typescript/src/recipe/recipe.d.ts.map +1 -0
  153. package/lib/typescript/src/renderers/index.d.ts +3 -0
  154. package/lib/typescript/src/renderers/index.d.ts.map +1 -0
  155. package/lib/typescript/src/renderers/nativeText.d.ts +13 -0
  156. package/lib/typescript/src/renderers/nativeText.d.ts.map +1 -0
  157. package/lib/typescript/src/renderers/nativeTextControls.d.ts +16 -0
  158. package/lib/typescript/src/renderers/nativeTextControls.d.ts.map +1 -0
  159. package/lib/typescript/src/renderers/nativeTextLineLayout.d.ts +84 -0
  160. package/lib/typescript/src/renderers/nativeTextLineLayout.d.ts.map +1 -0
  161. package/lib/typescript/src/renderers/nativeTextPlayback.d.ts +21 -0
  162. package/lib/typescript/src/renderers/nativeTextPlayback.d.ts.map +1 -0
  163. package/lib/typescript/src/renderers/overlayText.d.ts +13 -0
  164. package/lib/typescript/src/renderers/overlayText.d.ts.map +1 -0
  165. package/lib/typescript/src/renderers/overlayTextLayout.d.ts +36 -0
  166. package/lib/typescript/src/renderers/overlayTextLayout.d.ts.map +1 -0
  167. package/lib/typescript/src/renderers/rendererMotion.d.ts +53 -0
  168. package/lib/typescript/src/renderers/rendererMotion.d.ts.map +1 -0
  169. package/lib/typescript/src/split/createToken.d.ts +11 -0
  170. package/lib/typescript/src/split/createToken.d.ts.map +1 -0
  171. package/lib/typescript/src/split/custom.d.ts +17 -0
  172. package/lib/typescript/src/split/custom.d.ts.map +1 -0
  173. package/lib/typescript/src/split/graphemes.d.ts +4 -0
  174. package/lib/typescript/src/split/graphemes.d.ts.map +1 -0
  175. package/lib/typescript/src/split/index.d.ts +5 -0
  176. package/lib/typescript/src/split/index.d.ts.map +1 -0
  177. package/lib/typescript/src/split/lines.d.ts +4 -0
  178. package/lib/typescript/src/split/lines.d.ts.map +1 -0
  179. package/lib/typescript/src/split/segmenter.d.ts +18 -0
  180. package/lib/typescript/src/split/segmenter.d.ts.map +1 -0
  181. package/lib/typescript/src/split/words.d.ts +4 -0
  182. package/lib/typescript/src/split/words.d.ts.map +1 -0
  183. package/lib/typescript/src/timeline/index.d.ts +5 -0
  184. package/lib/typescript/src/timeline/index.d.ts.map +1 -0
  185. package/lib/typescript/src/timeline/parallel.d.ts +4 -0
  186. package/lib/typescript/src/timeline/parallel.d.ts.map +1 -0
  187. package/lib/typescript/src/timeline/sequence.d.ts +4 -0
  188. package/lib/typescript/src/timeline/sequence.d.ts.map +1 -0
  189. package/lib/typescript/src/timeline/stagger.d.ts +11 -0
  190. package/lib/typescript/src/timeline/stagger.d.ts.map +1 -0
  191. package/lib/typescript/src/timeline/validation.d.ts +4 -0
  192. package/lib/typescript/src/timeline/validation.d.ts.map +1 -0
  193. package/lib/typescript/src/timeline/wave.d.ts +11 -0
  194. package/lib/typescript/src/timeline/wave.d.ts.map +1 -0
  195. package/lib/typescript/src/types/index.d.ts +6 -0
  196. package/lib/typescript/src/types/index.d.ts.map +1 -0
  197. package/lib/typescript/src/types/recipe.d.ts +123 -0
  198. package/lib/typescript/src/types/recipe.d.ts.map +1 -0
  199. package/lib/typescript/src/types/renderer.d.ts +51 -0
  200. package/lib/typescript/src/types/renderer.d.ts.map +1 -0
  201. package/lib/typescript/src/types/token.d.ts +35 -0
  202. package/lib/typescript/src/types/token.d.ts.map +1 -0
  203. package/package.json +116 -3
  204. package/src/accessibility/index.ts +7 -0
  205. package/src/accessibility/policies.ts +60 -0
  206. package/src/controls/brand.ts +3 -0
  207. package/src/controls/controls.ts +41 -0
  208. package/src/controls/descriptors.ts +83 -0
  209. package/src/controls/index.ts +2 -0
  210. package/src/effects/compose.ts +98 -0
  211. package/src/effects/fade.ts +22 -0
  212. package/src/effects/index.ts +9 -0
  213. package/src/effects/lineReveal.ts +28 -0
  214. package/src/effects/pulse.ts +19 -0
  215. package/src/effects/rise.ts +19 -0
  216. package/src/effects/scale.ts +22 -0
  217. package/src/effects/shake.ts +19 -0
  218. package/src/effects/slide.ts +22 -0
  219. package/src/effects/typewriter.ts +16 -0
  220. package/src/effects/validation.ts +9 -0
  221. package/src/index.tsx +46 -0
  222. package/src/presets/index.ts +42 -0
  223. package/src/recipe/component.tsx +88 -0
  224. package/src/recipe/defineTextMotion.ts +6 -0
  225. package/src/recipe/descriptors.ts +158 -0
  226. package/src/recipe/index.ts +3 -0
  227. package/src/recipe/recipe.ts +359 -0
  228. package/src/renderers/index.ts +2 -0
  229. package/src/renderers/nativeText.tsx +813 -0
  230. package/src/renderers/nativeTextControls.ts +131 -0
  231. package/src/renderers/nativeTextLineLayout.ts +495 -0
  232. package/src/renderers/nativeTextPlayback.ts +204 -0
  233. package/src/renderers/overlayText.tsx +945 -0
  234. package/src/renderers/overlayTextLayout.ts +312 -0
  235. package/src/renderers/rendererMotion.ts +483 -0
  236. package/src/split/createToken.ts +26 -0
  237. package/src/split/custom.ts +92 -0
  238. package/src/split/graphemes.ts +27 -0
  239. package/src/split/index.ts +9 -0
  240. package/src/split/lines.ts +35 -0
  241. package/src/split/segmenter.ts +111 -0
  242. package/src/split/words.ts +28 -0
  243. package/src/timeline/index.ts +4 -0
  244. package/src/timeline/parallel.ts +30 -0
  245. package/src/timeline/sequence.ts +29 -0
  246. package/src/timeline/stagger.ts +60 -0
  247. package/src/timeline/validation.ts +29 -0
  248. package/src/timeline/wave.ts +34 -0
  249. package/src/types/index.ts +34 -0
  250. package/src/types/recipe.ts +195 -0
  251. package/src/types/renderer.ts +91 -0
  252. package/src/types/token.ts +39 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parallel.d.ts","sourceRoot":"","sources":["../../../../src/timeline/parallel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,mBAAU,CAAC;AAW1E,oEAAoE;AACpE,wBAAgB,QAAQ,CACtB,GAAG,SAAS,EAAE,SAAS,qBAAqB,EAAE,GAC7C,kBAAkB,CAAC,UAAU,CAAC,CAehC"}
@@ -0,0 +1,4 @@
1
+ import type { TextMotionAnyTimeline, TextMotionTimeline } from '../types/index.js';
2
+ /** Combine timelines by adding each timeline delay for a token. */
3
+ export declare function sequence(...timelines: readonly TextMotionAnyTimeline[]): TextMotionTimeline<'sequence'>;
4
+ //# sourceMappingURL=sequence.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sequence.d.ts","sourceRoot":"","sources":["../../../../src/timeline/sequence.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,mBAAU,CAAC;AAW1E,mEAAmE;AACnE,wBAAgB,QAAQ,CACtB,GAAG,SAAS,EAAE,SAAS,qBAAqB,EAAE,GAC7C,kBAAkB,CAAC,UAAU,CAAC,CAchC"}
@@ -0,0 +1,11 @@
1
+ import type { TextMotionTimeline } from '../types/index.js';
2
+ /** Origin used when calculating stagger delays. */
3
+ export type TextMotionStaggerFrom = 'start' | 'center' | 'end' | 'edges' | number;
4
+ /** Options for {@link stagger}. */
5
+ export type TextMotionStaggerOptions = {
6
+ /** Token index origin for the stagger. Defaults to `start`. */
7
+ from?: TextMotionStaggerFrom;
8
+ };
9
+ /** Delay each token by a fixed step from the chosen origin. */
10
+ export declare function stagger(step: number, options?: TextMotionStaggerOptions): TextMotionTimeline<'stagger'>;
11
+ //# sourceMappingURL=stagger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stagger.d.ts","sourceRoot":"","sources":["../../../../src/timeline/stagger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAU,CAAC;AAKnD,mDAAmD;AACnD,MAAM,MAAM,qBAAqB,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,OAAO,GAAG,MAAM,CAAC;AAElF,mCAAmC;AACnC,MAAM,MAAM,wBAAwB,GAAG;IACrC,+DAA+D;IAC/D,IAAI,CAAC,EAAE,qBAAqB,CAAC;CAC9B,CAAC;AA2BF,+DAA+D;AAC/D,wBAAgB,OAAO,CACrB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,wBAA6B,GACrC,kBAAkB,CAAC,SAAS,CAAC,CAgB/B"}
@@ -0,0 +1,4 @@
1
+ export declare function validateFiniteTimelineNumber(value: number, label: string): number;
2
+ export declare function validateNonNegativeTimelineNumber(value: number, label: string): number;
3
+ export declare function validatePositiveTimelineNumber(value: number, label: string): number;
4
+ //# sourceMappingURL=validation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../../src/timeline/validation.ts"],"names":[],"mappings":"AAEA,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAMjF;AAED,wBAAgB,iCAAiC,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAQtF;AAED,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAQnF"}
@@ -0,0 +1,11 @@
1
+ import type { TextMotionTimeline } from '../types/index.js';
2
+ /** Options for {@link wave}. */
3
+ export type TextMotionWaveOptions = {
4
+ /** Maximum delay in seconds. Defaults to `0.08`. */
5
+ amplitude?: number;
6
+ /** Number of tokens per sine-wave cycle. Defaults to `4`. */
7
+ wavelength?: number;
8
+ };
9
+ /** Create sine-wave token delays for soft rolling text motion. */
10
+ export declare function wave(options?: TextMotionWaveOptions): TextMotionTimeline<'wave'>;
11
+ //# sourceMappingURL=wave.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wave.d.ts","sourceRoot":"","sources":["../../../../src/timeline/wave.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAU,CAAC;AAKnD,gCAAgC;AAChC,MAAM,MAAM,qBAAqB,GAAG;IAClC,oDAAoD;IACpD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6DAA6D;IAC7D,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAOF,kEAAkE;AAClE,wBAAgB,IAAI,CAAC,OAAO,GAAE,qBAA0B,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAcpF"}
@@ -0,0 +1,6 @@
1
+ export type { TextMotionAccessibilityPolicy, TextMotionAnyEffect, TextMotionAnyTimeline, TextMotionComponent, TextMotionComponentAccessibilityProps, TextMotionComponentProps, TextMotionComponentTextProps, TextMotionEffect, TextMotionEffectForRenderer, TextMotionInternalRecipeConfig, TextMotionMotionConfig, TextMotionRecipeConfig, TextMotionSpringOptions, TextMotionTimeline, TextMotionTimingOptions, } from './recipe.js';
2
+ export type { TextMotionControls } from '../controls/index.js';
3
+ export type { TextMotionCompatibleEffect, TextMotionMissingCapabilities, TextMotionRenderer, TextMotionRendererCapability, TextMotionRendererCapabilityExtension, TextMotionRendererProps, } from './renderer.js';
4
+ export { createTextMotionRendererCapability } from './renderer.js';
5
+ export type { TextMotionSourceRange, TextMotionSplitContext, TextMotionSplitter, TextMotionToken, TextMotionTokenUnit, } from './token.js';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/types/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,6BAA6B,EAC7B,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,EACnB,qCAAqC,EACrC,wBAAwB,EACxB,4BAA4B,EAC5B,gBAAgB,EAChB,2BAA2B,EAC3B,8BAA8B,EAC9B,sBAAsB,EACtB,sBAAsB,EACtB,uBAAuB,EACvB,kBAAkB,EAClB,uBAAuB,GACxB,MAAM,aAAU,CAAC;AAClB,YAAY,EAAE,kBAAkB,EAAE,MAAM,sBAAa,CAAC;AACtD,YAAY,EACV,0BAA0B,EAC1B,6BAA6B,EAC7B,kBAAkB,EAClB,4BAA4B,EAC5B,qCAAqC,EACrC,uBAAuB,GACxB,MAAM,eAAY,CAAC;AACpB,OAAO,EAAE,kCAAkC,EAAE,MAAM,eAAY,CAAC;AAChE,YAAY,EACV,qBAAqB,EACrB,sBAAsB,EACtB,kBAAkB,EAClB,eAAe,EACf,mBAAmB,GACpB,MAAM,YAAS,CAAC"}
@@ -0,0 +1,123 @@
1
+ import type { ComponentType } from 'react';
2
+ import type { StyleProp, TextProps, TextStyle } from 'react-native';
3
+ import type { SharedValue, WithSpringConfig, WithTimingConfig } from 'react-native-reanimated';
4
+ import type { TextMotionControls } from '../controls/index.js';
5
+ import type { TextMotionCompatibleEffect, TextMotionRenderer, TextMotionRendererCapability } from './renderer.js';
6
+ import type { TextMotionSplitter } from './token.js';
7
+ type DistributiveOmit<T, Keys extends PropertyKey> = T extends unknown ? Omit<T, Keys> : never;
8
+ declare const textMotionEffectBrand: unique symbol;
9
+ declare const textMotionTimelineBrand: unique symbol;
10
+ /** @internal Serializable metadata attached to effect descriptors. */
11
+ export type TextMotionEffectDescriptorOptions = Readonly<Record<string, unknown>>;
12
+ /** @internal Serializable metadata attached to timeline descriptors. */
13
+ export type TextMotionTimelineDescriptorOptions = Readonly<Record<string, unknown>>;
14
+ /** @internal Timeline descriptor consumed by recipe and renderer internals. */
15
+ export type TextMotionTimelineDescriptor<Options extends TextMotionTimelineDescriptorOptions = TextMotionTimelineDescriptorOptions, Name extends string = string> = {
16
+ kind: 'timeline';
17
+ name: Name;
18
+ options?: Options;
19
+ delayFor(index: number, count: number): number;
20
+ };
21
+ /** @internal Timeline descriptor with extension-level options for recipe internals. */
22
+ export type TextMotionAnyTimelineDescriptor = TextMotionTimelineDescriptor;
23
+ /** Opaque timeline handle accepted by `.timeline(...)`. */
24
+ export type TextMotionTimeline<Name extends string = string> = {
25
+ readonly [textMotionTimelineBrand]: {
26
+ readonly name: Name;
27
+ };
28
+ };
29
+ /** Opaque timeline handle with any timeline name. */
30
+ export type TextMotionAnyTimeline = TextMotionTimeline;
31
+ /** @internal Effect descriptor consumed by renderers. */
32
+ export type TextMotionEffectDescriptor<RequiredCapabilities extends TextMotionRendererCapability = TextMotionRendererCapability, Options extends TextMotionEffectDescriptorOptions = TextMotionEffectDescriptorOptions, Name extends string = string> = {
33
+ kind: 'effect';
34
+ name: Name;
35
+ options?: Options;
36
+ requiredCapabilities: readonly RequiredCapabilities[];
37
+ effects?: readonly TextMotionAnyEffect[];
38
+ };
39
+ /** @internal Effect descriptor with extension-level options for renderer internals. */
40
+ export type TextMotionAnyEffectDescriptor = TextMotionEffectDescriptor;
41
+ /** Opaque effect handle accepted by `.effect(...)`. */
42
+ export type TextMotionEffect<RequiredCapabilities extends TextMotionRendererCapability = 'native-text', Name extends string = string> = {
43
+ readonly [textMotionEffectBrand]: {
44
+ readonly requiredCapabilities: RequiredCapabilities;
45
+ readonly name: Name;
46
+ };
47
+ and<NextCapabilities extends TextMotionRendererCapability, NextName extends string>(effect: TextMotionEffect<NextCapabilities, NextName>): TextMotionEffect<RequiredCapabilities | NextCapabilities>;
48
+ };
49
+ /** Opaque effect handle with any required capability. */
50
+ export type TextMotionAnyEffect = TextMotionEffect<TextMotionRendererCapability>;
51
+ /** Timing options accepted by text motion renderers. Reduced motion is controlled by accessibility policy. */
52
+ export type TextMotionTimingOptions = DistributiveOmit<WithTimingConfig, 'reduceMotion'>;
53
+ /** Spring options accepted by text motion renderers. Reduced motion is controlled by accessibility policy. */
54
+ export type TextMotionSpringOptions = DistributiveOmit<WithSpringConfig, 'reduceMotion'>;
55
+ /** Motion primitive used by Reanimated renderers. */
56
+ export type TextMotionMotionConfig = {
57
+ kind: 'timing';
58
+ options?: TextMotionTimingOptions;
59
+ } | {
60
+ kind: 'spring';
61
+ options?: TextMotionSpringOptions;
62
+ };
63
+ /** Accessibility behavior for a text motion recipe. */
64
+ export type TextMotionAccessibilityPolicy = {
65
+ kind: string;
66
+ parentLabel: boolean;
67
+ hideTokensFromAccessibility: boolean;
68
+ reducedMotion: 'final-state' | 'system';
69
+ };
70
+ /** Immutable recipe config produced by {@link TextMotionRecipeBuilder}. */
71
+ export type TextMotionRecipeConfig<_RendererCapabilities extends TextMotionRendererCapability = TextMotionRendererCapability, Timeline extends TextMotionAnyTimeline = TextMotionTimeline, Effects extends readonly TextMotionAnyEffect[] = readonly TextMotionAnyEffect[]> = {
72
+ splitter?: TextMotionSplitter;
73
+ renderer?: TextMotionRenderer;
74
+ timeline?: Timeline;
75
+ effects: Effects;
76
+ motion?: TextMotionMotionConfig;
77
+ accessibility?: TextMotionAccessibilityPolicy;
78
+ };
79
+ /** Internal recipe shape used by runtime renderers after recipe composition. */
80
+ export type TextMotionInternalRecipeConfig<RendererCapabilities extends TextMotionRendererCapability = TextMotionRendererCapability> = TextMotionRecipeConfig<RendererCapabilities, TextMotionAnyTimeline, readonly TextMotionAnyEffect[]>;
81
+ /** Accessibility props intentionally supported by text motion components. */
82
+ export type TextMotionComponentAccessibilityProps = Pick<TextProps, 'accessibilityActions' | 'accessibilityHint' | 'accessibilityLabel' | 'accessibilityLanguage' | 'accessibilityRole' | 'accessibilityState' | 'accessibilityValue' | 'onAccessibilityAction'>;
83
+ /** Non-child props intentionally supported by text motion components. */
84
+ export type TextMotionComponentTextProps = TextMotionComponentAccessibilityProps & Pick<TextProps, 'allowFontScaling' | 'maxFontSizeMultiplier' | 'nativeID' | 'testID'> & {
85
+ /** Text style applied to each rendered token. Layout-only text props are not supported. */
86
+ style?: StyleProp<TextStyle>;
87
+ };
88
+ type TextMotionRawProgressPlaybackProps = {
89
+ /**
90
+ * Raw app-owned normalized progress for externally driven playback.
91
+ *
92
+ * `0` renders the initial text motion state and `1` renders the final state. Finite values
93
+ * outside `0..1` are clamped by the renderer; non-finite values are treated as `0`. When
94
+ * provided, `.motion()` does not drive playback. Use this for scroll, gesture, or synchronized
95
+ * shared values where the app owns the exact progress.
96
+ */
97
+ progress?: SharedValue<number>;
98
+ controls?: never;
99
+ };
100
+ type TextMotionControlsPlaybackProps = {
101
+ progress?: never;
102
+ /**
103
+ * Command channel for event-driven playback.
104
+ *
105
+ * The component owns playback execution and uses its recipe `.motion()` config. Use this for
106
+ * buttons, screen focus, onboarding steps, and replay/reset/stop interactions.
107
+ */
108
+ controls?: TextMotionControls;
109
+ };
110
+ type TextMotionComponentPlaybackProps = TextMotionRawProgressPlaybackProps | TextMotionControlsPlaybackProps;
111
+ /** Props forwarded from a text motion component to its renderer. */
112
+ export type TextMotionComponentRendererProps = TextMotionComponentTextProps & TextMotionComponentPlaybackProps;
113
+ /** Props accepted by components created from text motion recipes. */
114
+ export type TextMotionComponentProps = TextMotionComponentRendererProps & {
115
+ /** Plain string rendered and split by the recipe splitter. */
116
+ children: string;
117
+ };
118
+ /** React component produced by a text motion recipe. */
119
+ export type TextMotionComponent = ComponentType<TextMotionComponentProps>;
120
+ /** Type helper used by `.effect(...)` to enforce renderer capability compatibility. */
121
+ export type TextMotionEffectForRenderer<RendererCapabilities extends TextMotionRendererCapability, RequiredCapabilities extends TextMotionRendererCapability, Effect extends TextMotionEffect<RequiredCapabilities> = TextMotionEffect<RequiredCapabilities>> = TextMotionCompatibleEffect<RendererCapabilities, RequiredCapabilities, Effect>;
122
+ export {};
123
+ //# sourceMappingURL=recipe.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recipe.d.ts","sourceRoot":"","sources":["../../../../src/types/recipe.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE/F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAa,CAAC;AACtD,OAAO,KAAK,EACV,0BAA0B,EAC1B,kBAAkB,EAClB,4BAA4B,EAC7B,MAAM,eAAY,CAAC;AACpB,OAAO,KAAK,EAAE,kBAAkB,E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,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B,CAAC;AAEJ,KAAK,kCAAkC,GAAG;IACxC;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC/B,QAAQ,CAAC,EAAE,KAAK,CAAC;CAClB,CAAC;AAEF,KAAK,+BAA+B,GAAG;IACrC,QAAQ,CAAC,EAAE,KAAK,CAAC;IACjB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,kBAAkB,CAAC;CAC/B,CAAC;AAEF,KAAK,gCAAgC,GACjC,kCAAkC,GAClC,+BAA+B,CAAC;AAEpC,oEAAoE;AACpE,MAAM,MAAM,gCAAgC,GAAG,4BAA4B,GACzE,gCAAgC,CAAC;AAEnC,qEAAqE;AACrE,MAAM,MAAM,wBAAwB,GAAG,gCAAgC,GAAG;IACxE,8DAA8D;IAC9D,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,wDAAwD;AACxD,MAAM,MAAM,mBAAmB,GAAG,aAAa,CAAC,wBAAwB,CAAC,CAAC;AAE1E,uFAAuF;AACvF,MAAM,MAAM,2BAA2B,CACrC,oBAAoB,SAAS,4BAA4B,EACzD,oBAAoB,SAAS,4BAA4B,EACzD,MAAM,SAAS,gBAAgB,CAAC,oBAAoB,CAAC,GAAG,gBAAgB,CAAC,oBAAoB,CAAC,IAC5F,0BAA0B,CAAC,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,CAAC,CAAC"}
@@ -0,0 +1,51 @@
1
+ import type { ComponentType, ReactNode } from 'react';
2
+ import type { TextMotionComponentRendererProps, TextMotionRecipeConfig } from './recipe.js';
3
+ import type { TextMotionToken } from './token.js';
4
+ declare const textMotionRendererCapabilityBrand: unique symbol;
5
+ declare const textMotionRendererBrand: unique symbol;
6
+ declare const textMotionRenderedLineRendererBrand: unique symbol;
7
+ /** Branded renderer capability name for custom renderer packages. */
8
+ export type TextMotionRendererCapabilityExtension<Name extends string = string> = Name & {
9
+ readonly [textMotionRendererCapabilityBrand]: 'TextMotionRendererCapabilityExtension';
10
+ };
11
+ /** Capability supported by a renderer and required by effects. */
12
+ export type TextMotionRendererCapability = 'native-text' | 'style-transform' | TextMotionRendererCapabilityExtension;
13
+ /** @internal Built-in capability used by overlayText line-mask effects. */
14
+ export type TextMotionLineMaskCapability = TextMotionRendererCapabilityExtension<'line-mask'>;
15
+ /** Create a branded capability name for a custom renderer. */
16
+ export declare function createTextMotionRendererCapability<Name extends string>(name: Name): TextMotionRendererCapabilityExtension<Name>;
17
+ /** Props passed from the recipe component into a renderer component. */
18
+ export type TextMotionRendererProps<Recipe = TextMotionRecipeConfig> = {
19
+ children: ReactNode;
20
+ tokens: readonly TextMotionToken[];
21
+ recipe: Recipe;
22
+ textProps?: TextMotionComponentRendererProps;
23
+ };
24
+ /** @internal Renderer descriptor consumed by recipe internals. */
25
+ export type TextMotionRendererDescriptor<Capabilities extends TextMotionRendererCapability = TextMotionRendererCapability, Recipe = TextMotionRecipeConfig, MotionUnit extends 'source-token' | 'rendered-line' = 'source-token' | 'rendered-line'> = {
26
+ kind: string;
27
+ capabilities: readonly Capabilities[];
28
+ motionUnit?: MotionUnit;
29
+ Component: ComponentType<TextMotionRendererProps<Recipe>>;
30
+ };
31
+ /** Renderer handle used by `.layout(...)`. */
32
+ export type TextMotionRenderer<Capabilities extends TextMotionRendererCapability = TextMotionRendererCapability, Recipe = unknown> = {
33
+ readonly [textMotionRendererBrand]: {
34
+ readonly capabilities: Capabilities;
35
+ readonly recipe: Recipe;
36
+ };
37
+ };
38
+ /** @internal Renderer handle for source-token renderers accepted after `.split(...)`. */
39
+ export type TextMotionSourceTokenRenderer<Capabilities extends TextMotionRendererCapability = TextMotionRendererCapability, Recipe = unknown> = TextMotionRenderer<Capabilities, Recipe> & {
40
+ readonly [textMotionRenderedLineRendererBrand]?: never;
41
+ };
42
+ /** @internal Renderer handle for renderers that own rendered-line layout. */
43
+ export type TextMotionRenderedLineRenderer<Capabilities extends TextMotionRendererCapability = TextMotionRendererCapability, Recipe = unknown> = TextMotionRenderer<Capabilities, Recipe> & {
44
+ readonly [textMotionRenderedLineRendererBrand]: 'rendered-line';
45
+ };
46
+ /** Capabilities required by an effect but missing from a renderer. */
47
+ export type TextMotionMissingCapabilities<RendererCapabilities extends TextMotionRendererCapability, RequiredCapabilities extends TextMotionRendererCapability> = Exclude<RequiredCapabilities, RendererCapabilities>;
48
+ /** Effect type gate that rejects effects incompatible with the selected renderer. */
49
+ export type TextMotionCompatibleEffect<RendererCapabilities extends TextMotionRendererCapability, RequiredCapabilities extends TextMotionRendererCapability, Effect> = [TextMotionMissingCapabilities<RendererCapabilities, RequiredCapabilities>] extends [never] ? Effect : never;
50
+ export {};
51
+ //# sourceMappingURL=renderer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../../../../src/types/renderer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEtD,OAAO,KAAK,EAAE,gCAAgC,EAAE,sBAAsB,EAAE,MAAM,aAAU,CAAC;AACzF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAS,CAAC;AAE/C,OAAO,CAAC,MAAM,iCAAiC,EAAE,OAAO,MAAM,CAAC;AAC/D,OAAO,CAAC,MAAM,uBAAuB,EAAE,OAAO,MAAM,CAAC;AACrD,OAAO,CAAC,MAAM,mCAAmC,EAAE,OAAO,MAAM,CAAC;AAEjE,qEAAqE;AACrE,MAAM,MAAM,qCAAqC,CAAC,IAAI,SAAS,MAAM,GAAG,MAAM,IAAI,IAAI,GAAG;IACvF,QAAQ,CAAC,CAAC,iCAAiC,CAAC,EAAE,uCAAuC,CAAC;CACvF,CAAC;AAEF,kEAAkE;AAClE,MAAM,MAAM,4BAA4B,GACpC,aAAa,GACb,iBAAiB,GACjB,qCAAqC,CAAC;AAE1C,2EAA2E;AAC3E,MAAM,MAAM,4BAA4B,GAA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CAAC;CACxD,CAAC;AAEF,6EAA6E;AAC7E,MAAM,MAAM,8BAA8B,CACxC,YAAY,SAAS,4BAA4B,GAAG,4BAA4B,EAChF,MAAM,GAAG,OAAO,IACd,kBAAkB,CAAC,YAAY,EAAE,MAAM,CAAC,GAAG;IAC7C,QAAQ,CAAC,CAAC,mCAAmC,CAAC,EAAE,eAAe,CAAC;CACjE,CAAC;AAEF,sEAAsE;AACtE,MAAM,MAAM,6BAA6B,CACvC,oBAAoB,SAAS,4BAA4B,EACzD,oBAAoB,SAAS,4BAA4B,IACvD,OAAO,CAAC,oBAAoB,EAAE,oBAAoB,CAAC,CAAC;AAExD,qFAAqF;AACrF,MAAM,MAAM,0BAA0B,CACpC,oBAAoB,SAAS,4BAA4B,EACzD,oBAAoB,SAAS,4BAA4B,EACzD,MAAM,IACJ,CAAC,6BAA6B,CAAC,oBAAoB,EAAE,oBAAoB,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GAC3F,MAAM,GACN,KAAK,CAAC"}
@@ -0,0 +1,35 @@
1
+ /** Unit of text produced by a splitter. */
2
+ export type TextMotionTokenUnit = 'grapheme' | 'word' | 'line' | 'custom';
3
+ /** Source character range for a token in the original string. */
4
+ export type TextMotionSourceRange = {
5
+ start: number;
6
+ end: number;
7
+ };
8
+ /** Token emitted by splitters and consumed by renderers. */
9
+ export type TextMotionToken<Unit extends TextMotionTokenUnit = TextMotionTokenUnit> = {
10
+ id: string;
11
+ text: string;
12
+ index: number;
13
+ unit: Unit;
14
+ sourceRange: TextMotionSourceRange;
15
+ metadata?: Record<string, unknown>;
16
+ };
17
+ /** Optional context passed to splitters. */
18
+ export type TextMotionSplitContext = {
19
+ /** Locale forwarded to native `Intl.Segmenter` when the runtime provides it. */
20
+ locale?: string | string[];
21
+ };
22
+ declare const textMotionSplitterBrand: unique symbol;
23
+ /** @internal Splitter descriptor consumed by recipe internals. */
24
+ export type TextMotionSplitterDescriptor<Unit extends TextMotionTokenUnit = TextMotionTokenUnit> = {
25
+ kind: Unit;
26
+ split(input: string, context?: TextMotionSplitContext): readonly TextMotionToken<Unit>[];
27
+ };
28
+ /** Opaque splitter handle accepted by `.split(...)`. */
29
+ export type TextMotionSplitter<Unit extends TextMotionTokenUnit = TextMotionTokenUnit> = {
30
+ readonly [textMotionSplitterBrand]: {
31
+ readonly unit: Unit;
32
+ };
33
+ };
34
+ export {};
35
+ //# sourceMappingURL=token.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token.d.ts","sourceRoot":"","sources":["../../../../src/types/token.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAC3C,MAAM,MAAM,mBAAmB,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE1E,iEAAiE;AACjE,MAAM,MAAM,qBAAqB,GAAG;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,4DAA4D;AAC5D,MAAM,MAAM,eAAe,CAAC,IAAI,SAAS,mBAAmB,GAAG,mBAAmB,IAAI;IACpF,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,IAAI,CAAC;IACX,WAAW,EAAE,qBAAqB,CAAC;IACnC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC,CAAC;AAEF,4CAA4C;AAC5C,MAAM,MAAM,sBAAsB,GAAG;IACnC,gFAAgF;IAChF,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAC5B,CAAC;AAEF,OAAO,CAAC,MAAM,uBAAuB,EAAE,OAAO,MAAM,CAAC;AAErD,kEAAkE;AAClE,MAAM,MAAM,4BAA4B,CAAC,IAAI,SAAS,mBAAmB,GAAG,mBAAmB,IAAI;IACjG,IAAI,EAAE,IAAI,CAAC;IACX,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,sBAAsB,GAAG,SAAS,eAAe,CAAC,IAAI,CAAC,EAAE,CAAC;CAC1F,CAAC;AAEF,wDAAwD;AACxD,MAAM,MAAM,kBAAkB,CAAC,IAAI,SAAS,mBAAmB,GAAG,mBAAmB,IAAI;IACvF,QAAQ,CAAC,CAAC,uBAAuB,CAAC,EAAE;QAClC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;KACrB,CAAC;CACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,119 @@
1
1
  {
2
2
  "name": "@react-native-motion-kit/text-motion",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.0",
4
+ "description": "High-performance split text animations for React Native, powered by Reanimated and extensible renderers.",
5
+ "keywords": [
6
+ "android",
7
+ "ios",
8
+ "react-native"
9
+ ],
10
+ "homepage": "https://github.com/react-native-motion-kit/react-native-text-motion#readme",
11
+ "bugs": {
12
+ "url": "https://github.com/react-native-motion-kit/react-native-text-motion/issues"
13
+ },
14
+ "license": "MIT",
15
+ "author": "harang <dbd02169@naver.com> (https://github.com/saseungmin)",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/react-native-motion-kit/react-native-text-motion.git"
19
+ },
20
+ "files": [
21
+ "src",
22
+ "lib",
23
+ "android",
24
+ "ios",
25
+ "cpp",
26
+ "*.podspec",
27
+ "react-native.config.js",
28
+ "README.md",
29
+ "CHANGELOG.md",
30
+ "LICENSE",
31
+ "!ios/build",
32
+ "!android/build",
33
+ "!android/gradle",
34
+ "!android/gradlew",
35
+ "!android/gradlew.bat",
36
+ "!android/local.properties",
37
+ "!**/__tests__",
38
+ "!**/__fixtures__",
39
+ "!**/__mocks__",
40
+ "!**/.*"
41
+ ],
42
+ "main": "./lib/module/index.js",
43
+ "types": "./lib/typescript/src/index.d.ts",
44
+ "exports": {
45
+ ".": {
46
+ "react-native-motion-kit-text-motion-source": "./src/index.tsx",
47
+ "types": "./lib/typescript/src/index.d.ts",
48
+ "default": "./lib/module/index.js"
49
+ },
50
+ "./presets": {
51
+ "react-native-motion-kit-text-motion-source": "./src/presets/index.ts",
52
+ "types": "./lib/typescript/src/presets/index.d.ts",
53
+ "default": "./lib/module/presets/index.js"
54
+ },
55
+ "./package.json": "./package.json"
56
+ },
57
+ "publishConfig": {
58
+ "access": "public",
59
+ "registry": "https://registry.npmjs.org/"
60
+ },
61
+ "devDependencies": {
62
+ "@babel/core": "^7.28.5",
63
+ "@react-native/babel-preset": "0.85.3",
64
+ "@react-native/jest-preset": "0.85.3",
65
+ "@react-native/metro-config": "0.85.3",
66
+ "@testing-library/react-native": "^14.0.1",
67
+ "@types/jest": "^29.5.14",
68
+ "@types/react": "^19.2.0",
69
+ "babel-jest": "^29.7.0",
70
+ "del-cli": "^7.0.0",
71
+ "jest": "^29.7.0",
72
+ "react": "19.2.3",
73
+ "react-native": "0.85.3",
74
+ "react-native-builder-bob": "^0.43.0",
75
+ "react-native-reanimated": "4.3.1",
76
+ "react-native-worklets": "0.8.3",
77
+ "test-renderer": "^1.2.0",
78
+ "typescript": "~6.0.3"
79
+ },
80
+ "peerDependencies": {
81
+ "react": ">=18.0.0",
82
+ "react-native": ">=0.76.0",
83
+ "react-native-reanimated": ">=4.0.0",
84
+ "react-native-worklets": ">=0.5.0"
85
+ },
86
+ "create-react-native-library": {
87
+ "type": "library",
88
+ "languages": "js",
89
+ "tools": [
90
+ "jest",
91
+ "lefthook"
92
+ ],
93
+ "version": "0.63.0"
94
+ },
95
+ "react-native-builder-bob": {
96
+ "source": "src",
97
+ "output": "lib",
98
+ "targets": [
99
+ [
100
+ "module",
101
+ {
102
+ "esm": true
103
+ }
104
+ ],
105
+ [
106
+ "typescript",
107
+ {
108
+ "project": "tsconfig.build.json"
109
+ }
110
+ ]
111
+ ]
112
+ },
113
+ "scripts": {
114
+ "build": "bob build && node scripts/check-declarations.mjs",
115
+ "clean": "del-cli lib",
116
+ "test": "jest",
117
+ "typecheck": "tsc --noEmit"
118
+ }
6
119
  }
@@ -0,0 +1,7 @@
1
+ export {
2
+ createHiddenTokenAccessibilityProps,
3
+ createParentAccessibilityProps,
4
+ parentLabelPolicy,
5
+ resolveAccessibleText,
6
+ type ParentLabelPolicyOptions,
7
+ } from './policies';
@@ -0,0 +1,60 @@
1
+ import type { TextProps } from 'react-native';
2
+
3
+ import type { TextMotionAccessibilityPolicy, TextMotionToken } from '../types';
4
+
5
+ /** Options for {@link parentLabelPolicy}. */
6
+ export type ParentLabelPolicyOptions = {
7
+ /** Reduced-motion behavior. Defaults to `system`. */
8
+ reducedMotion?: TextMotionAccessibilityPolicy['reducedMotion'];
9
+ };
10
+
11
+ /** Make the parent text node accessible and hide decorative animated token nodes. */
12
+ export function parentLabelPolicy(
13
+ options: ParentLabelPolicyOptions = {},
14
+ ): TextMotionAccessibilityPolicy {
15
+ return {
16
+ kind: 'parent-label',
17
+ parentLabel: true,
18
+ hideTokensFromAccessibility: true,
19
+ reducedMotion: options.reducedMotion ?? 'system',
20
+ };
21
+ }
22
+
23
+ export function resolveAccessibleText(
24
+ children: string,
25
+ tokens: readonly TextMotionToken[],
26
+ ): string {
27
+ if (children.length > 0) {
28
+ return children;
29
+ }
30
+
31
+ return tokens.map((token) => token.text).join('');
32
+ }
33
+
34
+ export function createParentAccessibilityProps(
35
+ policy: TextMotionAccessibilityPolicy,
36
+ label: string,
37
+ ): Pick<TextProps, 'accessibilityLabel' | 'accessible'> {
38
+ if (!policy.parentLabel) {
39
+ return {};
40
+ }
41
+
42
+ return {
43
+ accessibilityLabel: label,
44
+ accessible: true,
45
+ };
46
+ }
47
+
48
+ export function createHiddenTokenAccessibilityProps(
49
+ policy: TextMotionAccessibilityPolicy,
50
+ ): Pick<TextProps, 'accessibilityElementsHidden' | 'accessible' | 'importantForAccessibility'> {
51
+ if (!policy.hideTokensFromAccessibility) {
52
+ return {};
53
+ }
54
+
55
+ return {
56
+ accessibilityElementsHidden: true,
57
+ accessible: false,
58
+ importantForAccessibility: 'no-hide-descendants',
59
+ };
60
+ }
@@ -0,0 +1,3 @@
1
+ export const textMotionControlsBrand: unique symbol = Symbol(
2
+ '@react-native-motion-kit/text-motion.controls',
3
+ );
@@ -0,0 +1,41 @@
1
+ import { useRef } from 'react';
2
+
3
+ import type { textMotionControlsBrand } from './brand';
4
+
5
+ import { createTextMotionControlsHandle } from './descriptors';
6
+
7
+ /**
8
+ * Command channel for event-driven text playback.
9
+ *
10
+ * Pass the returned controls object to a text motion component with
11
+ * `controls={controls}`. The controls object emits playback commands; the component still owns
12
+ * its recipe, timeline, effects, and `.motion()` transition.
13
+ */
14
+ export type TextMotionControls = {
15
+ readonly [textMotionControlsBrand]: true;
16
+ /** Play the current text motion from its current progress toward the final state. */
17
+ play(): void;
18
+ /** Reset to the initial state and play again with the recipe timeline and `.motion()` config. */
19
+ replay(): void;
20
+ /** Stop any in-flight playback and return to the initial state. */
21
+ reset(): void;
22
+ /** Stop any in-flight playback while preserving the current visual progress. */
23
+ stop(): void;
24
+ };
25
+
26
+ /**
27
+ * Create a stable text motion command channel for event-driven playback.
28
+ *
29
+ * Use controls for button presses, screen focus, onboarding steps, and other discrete events.
30
+ * Use the `progress` prop instead when text should follow a raw scroll, gesture, or synchronized
31
+ * Reanimated shared value.
32
+ */
33
+ export function useTextMotionControls(): TextMotionControls {
34
+ const controls = useRef<TextMotionControls | undefined>(undefined);
35
+
36
+ if (!controls.current) {
37
+ controls.current = createTextMotionControlsHandle();
38
+ }
39
+
40
+ return controls.current;
41
+ }
@@ -0,0 +1,83 @@
1
+ import type { TextMotionControls } from './controls';
2
+
3
+ import { textMotionControlsBrand } from './brand';
4
+
5
+ export type TextMotionControlCommandKind = 'play' | 'replay' | 'reset' | 'stop';
6
+
7
+ export type TextMotionControlCommand = {
8
+ id: number;
9
+ kind: TextMotionControlCommandKind;
10
+ };
11
+
12
+ export type TextMotionControlCommandListener = (command: TextMotionControlCommand) => void;
13
+
14
+ export type TextMotionControlsDescriptor = {
15
+ getListenerCount(): number;
16
+ subscribe(listener: TextMotionControlCommandListener): () => void;
17
+ };
18
+
19
+ const controlsDescriptors = new WeakMap<TextMotionControls, TextMotionControlsDescriptor>();
20
+
21
+ export function createTextMotionControlsHandle(): TextMotionControls {
22
+ const listeners = new Set<TextMotionControlCommandListener>();
23
+ const descriptor: TextMotionControlsDescriptor = {
24
+ getListenerCount() {
25
+ return listeners.size;
26
+ },
27
+ subscribe(listener) {
28
+ listeners.add(listener);
29
+
30
+ return () => {
31
+ listeners.delete(listener);
32
+ };
33
+ },
34
+ };
35
+ const emit = createTextMotionControlEmitter(listeners);
36
+ const controls: TextMotionControls = {
37
+ [textMotionControlsBrand]: true,
38
+ play() {
39
+ emit('play');
40
+ },
41
+ replay() {
42
+ emit('replay');
43
+ },
44
+ reset() {
45
+ emit('reset');
46
+ },
47
+ stop() {
48
+ emit('stop');
49
+ },
50
+ };
51
+
52
+ controlsDescriptors.set(controls, descriptor);
53
+
54
+ return controls;
55
+ }
56
+
57
+ export function readTextMotionControlsDescriptor(
58
+ controls: TextMotionControls,
59
+ ): TextMotionControlsDescriptor {
60
+ const descriptor = controlsDescriptors.get(controls);
61
+
62
+ if (descriptor) {
63
+ return descriptor;
64
+ }
65
+
66
+ throw new Error('@react-native-motion-kit/text-motion received an unknown controls handle.');
67
+ }
68
+
69
+ function createTextMotionControlEmitter(
70
+ listeners: Set<TextMotionControlCommandListener>,
71
+ ): (kind: TextMotionControlCommandKind) => void {
72
+ let nextCommandId = 0;
73
+
74
+ return (kind) => {
75
+ const command = {
76
+ id: nextCommandId + 1,
77
+ kind,
78
+ };
79
+
80
+ nextCommandId = command.id;
81
+ listeners.forEach((listener) => listener(command));
82
+ };
83
+ }
@@ -0,0 +1,2 @@
1
+ export { useTextMotionControls } from './controls';
2
+ export type { TextMotionControls } from './controls';