@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,4 @@
1
+ "use strict";
2
+
3
+ export { createHiddenTokenAccessibilityProps, createParentAccessibilityProps, parentLabelPolicy, resolveAccessibleText } from "./policies.js";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createHiddenTokenAccessibilityProps","createParentAccessibilityProps","parentLabelPolicy","resolveAccessibleText"],"sourceRoot":"../../../src","sources":["accessibility/index.ts"],"mappings":";;AAAA,SACEA,mCAAmC,EACnCC,8BAA8B,EAC9BC,iBAAiB,EACjBC,qBAAqB,QAEhB,eAAY","ignoreList":[]}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+
3
+ /** Options for {@link parentLabelPolicy}. */
4
+
5
+ /** Make the parent text node accessible and hide decorative animated token nodes. */
6
+ export function parentLabelPolicy(options = {}) {
7
+ return {
8
+ kind: 'parent-label',
9
+ parentLabel: true,
10
+ hideTokensFromAccessibility: true,
11
+ reducedMotion: options.reducedMotion ?? 'system'
12
+ };
13
+ }
14
+ export function resolveAccessibleText(children, tokens) {
15
+ if (children.length > 0) {
16
+ return children;
17
+ }
18
+ return tokens.map(token => token.text).join('');
19
+ }
20
+ export function createParentAccessibilityProps(policy, label) {
21
+ if (!policy.parentLabel) {
22
+ return {};
23
+ }
24
+ return {
25
+ accessibilityLabel: label,
26
+ accessible: true
27
+ };
28
+ }
29
+ export function createHiddenTokenAccessibilityProps(policy) {
30
+ if (!policy.hideTokensFromAccessibility) {
31
+ return {};
32
+ }
33
+ return {
34
+ accessibilityElementsHidden: true,
35
+ accessible: false,
36
+ importantForAccessibility: 'no-hide-descendants'
37
+ };
38
+ }
39
+ //# sourceMappingURL=policies.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["parentLabelPolicy","options","kind","parentLabel","hideTokensFromAccessibility","reducedMotion","resolveAccessibleText","children","tokens","length","map","token","text","join","createParentAccessibilityProps","policy","label","accessibilityLabel","accessible","createHiddenTokenAccessibilityProps","accessibilityElementsHidden","importantForAccessibility"],"sourceRoot":"../../../src","sources":["accessibility/policies.ts"],"mappings":";;AAIA;;AAMA;AACA,OAAO,SAASA,iBAAiBA,CAC/BC,OAAiC,GAAG,CAAC,CAAC,EACP;EAC/B,OAAO;IACLC,IAAI,EAAE,cAAc;IACpBC,WAAW,EAAE,IAAI;IACjBC,2BAA2B,EAAE,IAAI;IACjCC,aAAa,EAAEJ,OAAO,CAACI,aAAa,IAAI;EAC1C,CAAC;AACH;AAEA,OAAO,SAASC,qBAAqBA,CACnCC,QAAgB,EAChBC,MAAkC,EAC1B;EACR,IAAID,QAAQ,CAACE,MAAM,GAAG,CAAC,EAAE;IACvB,OAAOF,QAAQ;EACjB;EAEA,OAAOC,MAAM,CAACE,GAAG,CAAEC,KAAK,IAAKA,KAAK,CAACC,IAAI,CAAC,CAACC,IAAI,CAAC,EAAE,CAAC;AACnD;AAEA,OAAO,SAASC,8BAA8BA,CAC5CC,MAAqC,EACrCC,KAAa,EACyC;EACtD,IAAI,CAACD,MAAM,CAACZ,WAAW,EAAE;IACvB,OAAO,CAAC,CAAC;EACX;EAEA,OAAO;IACLc,kBAAkB,EAAED,KAAK;IACzBE,UAAU,EAAE;EACd,CAAC;AACH;AAEA,OAAO,SAASC,mCAAmCA,CACjDJ,MAAqC,EACwD;EAC7F,IAAI,CAACA,MAAM,CAACX,2BAA2B,EAAE;IACvC,OAAO,CAAC,CAAC;EACX;EAEA,OAAO;IACLgB,2BAA2B,EAAE,IAAI;IACjCF,UAAU,EAAE,KAAK;IACjBG,yBAAyB,EAAE;EAC7B,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+
3
+ export const textMotionControlsBrand = Symbol('@react-native-motion-kit/text-motion.controls');
4
+ //# sourceMappingURL=brand.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["textMotionControlsBrand","Symbol"],"sourceRoot":"../../../src","sources":["controls/brand.ts"],"mappings":";;AAAA,OAAO,MAAMA,uBAAsC,GAAGC,MAAM,CAC1D,+CACF,CAAC","ignoreList":[]}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ import { useRef } from 'react';
4
+ import { createTextMotionControlsHandle } from "./descriptors.js";
5
+
6
+ /**
7
+ * Command channel for event-driven text playback.
8
+ *
9
+ * Pass the returned controls object to a text motion component with
10
+ * `controls={controls}`. The controls object emits playback commands; the component still owns
11
+ * its recipe, timeline, effects, and `.motion()` transition.
12
+ */
13
+
14
+ /**
15
+ * Create a stable text motion command channel for event-driven playback.
16
+ *
17
+ * Use controls for button presses, screen focus, onboarding steps, and other discrete events.
18
+ * Use the `progress` prop instead when text should follow a raw scroll, gesture, or synchronized
19
+ * Reanimated shared value.
20
+ */
21
+ export function useTextMotionControls() {
22
+ const controls = useRef(undefined);
23
+ if (!controls.current) {
24
+ controls.current = createTextMotionControlsHandle();
25
+ }
26
+ return controls.current;
27
+ }
28
+ //# sourceMappingURL=controls.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useRef","createTextMotionControlsHandle","useTextMotionControls","controls","undefined","current"],"sourceRoot":"../../../src","sources":["controls/controls.ts"],"mappings":";;AAAA,SAASA,MAAM,QAAQ,OAAO;AAI9B,SAASC,8BAA8B,QAAQ,kBAAe;;AAE9D;AACA;AACA;AACA;AACA;AACA;AACA;;AAaA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,qBAAqBA,CAAA,EAAuB;EAC1D,MAAMC,QAAQ,GAAGH,MAAM,CAAiCI,SAAS,CAAC;EAElE,IAAI,CAACD,QAAQ,CAACE,OAAO,EAAE;IACrBF,QAAQ,CAACE,OAAO,GAAGJ,8BAA8B,CAAC,CAAC;EACrD;EAEA,OAAOE,QAAQ,CAACE,OAAO;AACzB","ignoreList":[]}
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+
3
+ import { textMotionControlsBrand } from "./brand.js";
4
+ const controlsDescriptors = new WeakMap();
5
+ export function createTextMotionControlsHandle() {
6
+ const listeners = new Set();
7
+ const descriptor = {
8
+ getListenerCount() {
9
+ return listeners.size;
10
+ },
11
+ subscribe(listener) {
12
+ listeners.add(listener);
13
+ return () => {
14
+ listeners.delete(listener);
15
+ };
16
+ }
17
+ };
18
+ const emit = createTextMotionControlEmitter(listeners);
19
+ const controls = {
20
+ [textMotionControlsBrand]: true,
21
+ play() {
22
+ emit('play');
23
+ },
24
+ replay() {
25
+ emit('replay');
26
+ },
27
+ reset() {
28
+ emit('reset');
29
+ },
30
+ stop() {
31
+ emit('stop');
32
+ }
33
+ };
34
+ controlsDescriptors.set(controls, descriptor);
35
+ return controls;
36
+ }
37
+ export function readTextMotionControlsDescriptor(controls) {
38
+ const descriptor = controlsDescriptors.get(controls);
39
+ if (descriptor) {
40
+ return descriptor;
41
+ }
42
+ throw new Error('@react-native-motion-kit/text-motion received an unknown controls handle.');
43
+ }
44
+ function createTextMotionControlEmitter(listeners) {
45
+ let nextCommandId = 0;
46
+ return kind => {
47
+ const command = {
48
+ id: nextCommandId + 1,
49
+ kind
50
+ };
51
+ nextCommandId = command.id;
52
+ listeners.forEach(listener => listener(command));
53
+ };
54
+ }
55
+ //# sourceMappingURL=descriptors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["textMotionControlsBrand","controlsDescriptors","WeakMap","createTextMotionControlsHandle","listeners","Set","descriptor","getListenerCount","size","subscribe","listener","add","delete","emit","createTextMotionControlEmitter","controls","play","replay","reset","stop","set","readTextMotionControlsDescriptor","get","Error","nextCommandId","kind","command","id","forEach"],"sourceRoot":"../../../src","sources":["controls/descriptors.ts"],"mappings":";;AAEA,SAASA,uBAAuB,QAAQ,YAAS;AAgBjD,MAAMC,mBAAmB,GAAG,IAAIC,OAAO,CAAmD,CAAC;AAE3F,OAAO,SAASC,8BAA8BA,CAAA,EAAuB;EACnE,MAAMC,SAAS,GAAG,IAAIC,GAAG,CAAmC,CAAC;EAC7D,MAAMC,UAAwC,GAAG;IAC/CC,gBAAgBA,CAAA,EAAG;MACjB,OAAOH,SAAS,CAACI,IAAI;IACvB,CAAC;IACDC,SAASA,CAACC,QAAQ,EAAE;MAClBN,SAAS,CAACO,GAAG,CAACD,QAAQ,CAAC;MAEvB,OAAO,MAAM;QACXN,SAAS,CAACQ,MAAM,CAACF,QAAQ,CAAC;MAC5B,CAAC;IACH;EACF,CAAC;EACD,MAAMG,IAAI,GAAGC,8BAA8B,CAACV,SAAS,CAAC;EACtD,MAAMW,QAA4B,GAAG;IACnC,CAACf,uBAAuB,GAAG,IAAI;IAC/BgB,IAAIA,CAAA,EAAG;MACLH,IAAI,CAAC,MAAM,CAAC;IACd,CAAC;IACDI,MAAMA,CAAA,EAAG;MACPJ,IAAI,CAAC,QAAQ,CAAC;IAChB,CAAC;IACDK,KAAKA,CAAA,EAAG;MACNL,IAAI,CAAC,OAAO,CAAC;IACf,CAAC;IACDM,IAAIA,CAAA,EAAG;MACLN,IAAI,CAAC,MAAM,CAAC;IACd;EACF,CAAC;EAEDZ,mBAAmB,CAACmB,GAAG,CAACL,QAAQ,EAAET,UAAU,CAAC;EAE7C,OAAOS,QAAQ;AACjB;AAEA,OAAO,SAASM,gCAAgCA,CAC9CN,QAA4B,EACE;EAC9B,MAAMT,UAAU,GAAGL,mBAAmB,CAACqB,GAAG,CAACP,QAAQ,CAAC;EAEpD,IAAIT,UAAU,EAAE;IACd,OAAOA,UAAU;EACnB;EAEA,MAAM,IAAIiB,KAAK,CAAC,2EAA2E,CAAC;AAC9F;AAEA,SAAST,8BAA8BA,CACrCV,SAAgD,EACF;EAC9C,IAAIoB,aAAa,GAAG,CAAC;EAErB,OAAQC,IAAI,IAAK;IACf,MAAMC,OAAO,GAAG;MACdC,EAAE,EAAEH,aAAa,GAAG,CAAC;MACrBC;IACF,CAAC;IAEDD,aAAa,GAAGE,OAAO,CAACC,EAAE;IAC1BvB,SAAS,CAACwB,OAAO,CAAElB,QAAQ,IAAKA,QAAQ,CAACgB,OAAO,CAAC,CAAC;EACpD,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+
3
+ export { useTextMotionControls } from "./controls.js";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useTextMotionControls"],"sourceRoot":"../../../src","sources":["controls/index.ts"],"mappings":";;AAAA,SAASA,qBAAqB,QAAQ,eAAY","ignoreList":[]}
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+
3
+ import { attachTextMotionEffectDescriptor, readTextMotionEffectDescriptor } from "../recipe/descriptors.js";
4
+ const DEFAULT_EFFECT_OPTIONS = {};
5
+ const NATIVE_TEXT_CAPABILITIES = ['native-text'];
6
+ function uniqueCapabilities(capabilities) {
7
+ return Array.from(new Set(capabilities));
8
+ }
9
+
10
+ /** Compose multiple effects into one ordered effect. */
11
+ export function composeTextMotionEffects(effects) {
12
+ const descriptors = effects.map(readTextMotionEffectDescriptor);
13
+ const requiredCapabilities = uniqueCapabilities(descriptors.flatMap(descriptor => descriptor.requiredCapabilities));
14
+ const composed = {
15
+ and(effect) {
16
+ return composeTextMotionEffects([...effects, effect]);
17
+ }
18
+ };
19
+ return attachTextMotionEffectDescriptor(composed, {
20
+ kind: 'effect',
21
+ name: descriptors.map(descriptor => descriptor.name).join('+'),
22
+ requiredCapabilities,
23
+ effects
24
+ });
25
+ }
26
+
27
+ /** Create a custom native-text effect without descriptor options. */
28
+
29
+ /** Create a custom native-text effect with typed descriptor options. */
30
+
31
+ /** Create a custom effect with typed descriptor options and renderer capabilities. */
32
+
33
+ /** Create a custom text-motion effect for built-in or custom renderers. */
34
+ export function createTextMotionEffect(name, options = DEFAULT_EFFECT_OPTIONS, requiredCapabilities = NATIVE_TEXT_CAPABILITIES) {
35
+ const effect = {
36
+ and(nextEffect) {
37
+ return composeTextMotionEffects([effect, nextEffect]);
38
+ }
39
+ };
40
+ const descriptor = {
41
+ kind: 'effect',
42
+ name,
43
+ options,
44
+ requiredCapabilities
45
+ };
46
+ return attachTextMotionEffectDescriptor(effect, descriptor);
47
+ }
48
+ //# sourceMappingURL=compose.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["attachTextMotionEffectDescriptor","readTextMotionEffectDescriptor","DEFAULT_EFFECT_OPTIONS","NATIVE_TEXT_CAPABILITIES","uniqueCapabilities","capabilities","Array","from","Set","composeTextMotionEffects","effects","descriptors","map","requiredCapabilities","flatMap","descriptor","composed","and","effect","kind","name","join","createTextMotionEffect","options","nextEffect"],"sourceRoot":"../../../src","sources":["effects/compose.ts"],"mappings":";;AAQA,SACEA,gCAAgC,EAChCC,8BAA8B,QACzB,0BAAuB;AAE9B,MAAMC,sBAAyD,GAAG,CAAC,CAAC;AACpE,MAAMC,wBAAkD,GAAG,CAAC,aAAa,CAAC;AAE1E,SAASC,kBAAkBA,CACzBC,YAAqC,EACZ;EACzB,OAAOC,KAAK,CAACC,IAAI,CAAC,IAAIC,GAAG,CAACH,YAAY,CAAC,CAAC;AAC1C;;AAEA;AACA,OAAO,SAASI,wBAAwBA,CACtCC,OAAkD,EAClB;EAChC,MAAMC,WAAW,GAAGD,OAAO,CAACE,GAAG,CAACX,8BAA8B,CAAC;EAC/D,MAAMY,oBAAoB,GAAGT,kBAAkB,CAC7CO,WAAW,CAACG,OAAO,CAAEC,UAAU,IAAKA,UAAU,CAACF,oBAAoB,CACrE,CAAC;EAED,MAAMG,QAAQ,GAAG;IACfC,GAAGA,CACDC,MAAoD,EACpD;MACA,OAAOT,wBAAwB,CAAkC,CAAC,GAAGC,OAAO,EAAEQ,MAAM,CAAC,CAAC;IACxF;EACF,CAAmC;EAEnC,OAAOlB,gCAAgC,CACrCgB,QAAQ,EACR;IACEG,IAAI,EAAE,QAAQ;IACdC,IAAI,EAAET,WAAW,CAACC,GAAG,CAAEG,UAAU,IAAKA,UAAU,CAACK,IAAI,CAAC,CAACC,IAAI,CAAC,GAAG,CAAC;IAChER,oBAAoB;IACpBH;EACF,CACF,CAAC;AACH;;AAEA;;AAKA;;AAMA;;AAWA;AACA,OAAO,SAASY,sBAAsBA,CACpCF,IAAY,EACZG,OAA0C,GAAGrB,sBAAsB,EACnEW,oBAA6D,GAAGV,wBAAwB,EACnE;EACrB,MAAMe,MAAM,GAAG;IACbD,GAAGA,CACDO,UAAwD,EACxD;MACA,OAAOf,wBAAwB,CAAkD,CAC/ES,MAAM,EACNM,UAAU,CACX,CAAC;IACJ;EACF,CAAwB;EAExB,MAAMT,UAAyC,GAAG;IAChDI,IAAI,EAAE,QAAQ;IACdC,IAAI;IACJG,OAAO;IACPV;EACF,CAAC;EAED,OAAOb,gCAAgC,CAACkB,MAAM,EAAEH,UAAU,CAAC;AAC7D","ignoreList":[]}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ import { createTextMotionEffect } from "./compose.js";
4
+ import { validateFiniteEffectNumber } from "./validation.js";
5
+
6
+ /** Options for {@link fade}. */
7
+
8
+ /** Fade each token between opacity values. */
9
+ export function fade(options = {}) {
10
+ return createTextMotionEffect('fade', {
11
+ from: validateFiniteEffectNumber(options.from ?? 0, 'fade from'),
12
+ to: validateFiniteEffectNumber(options.to ?? 1, 'fade to')
13
+ }, ['style-transform']);
14
+ }
15
+ //# sourceMappingURL=fade.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createTextMotionEffect","validateFiniteEffectNumber","fade","options","from","to"],"sourceRoot":"../../../src","sources":["effects/fade.ts"],"mappings":";;AAAA,SAASA,sBAAsB,QAAQ,cAAW;AAClD,SAASC,0BAA0B,QAAQ,iBAAc;;AAEzD;;AAQA;AACA,OAAO,SAASC,IAAIA,CAACC,OAAoB,GAAG,CAAC,CAAC,EAAE;EAC9C,OAAOH,sBAAsB,CAC3B,MAAM,EACN;IACEI,IAAI,EAAEH,0BAA0B,CAACE,OAAO,CAACC,IAAI,IAAI,CAAC,EAAE,WAAW,CAAC;IAChEC,EAAE,EAAEJ,0BAA0B,CAACE,OAAO,CAACE,EAAE,IAAI,CAAC,EAAE,SAAS;EAC3D,CAAC,EACD,CAAC,iBAAiB,CACpB,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ export { composeTextMotionEffects, createTextMotionEffect } from "./compose.js";
4
+ export { fade } from "./fade.js";
5
+ export { lineReveal } from "./lineReveal.js";
6
+ export { pulse } from "./pulse.js";
7
+ export { rise } from "./rise.js";
8
+ export { scale } from "./scale.js";
9
+ export { shake } from "./shake.js";
10
+ export { slide } from "./slide.js";
11
+ export { typewriter } from "./typewriter.js";
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["composeTextMotionEffects","createTextMotionEffect","fade","lineReveal","pulse","rise","scale","shake","slide","typewriter"],"sourceRoot":"../../../src","sources":["effects/index.ts"],"mappings":";;AAAA,SAASA,wBAAwB,EAAEC,sBAAsB,QAAQ,cAAW;AAC5E,SAASC,IAAI,QAA0B,WAAQ;AAC/C,SAASC,UAAU,QAAgC,iBAAc;AACjE,SAASC,KAAK,QAA2B,YAAS;AAClD,SAASC,IAAI,QAA0B,WAAQ;AAC/C,SAASC,KAAK,QAA2B,YAAS;AAClD,SAASC,KAAK,QAA2B,YAAS;AAClD,SAASC,KAAK,QAA2B,YAAS;AAClD,SAASC,UAAU,QAAQ,iBAAc","ignoreList":[]}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ import { createTextMotionRendererCapability } from "../types/renderer.js";
4
+ import { createTextMotionEffect } from "./compose.js";
5
+ import { validateFiniteEffectNumber } from "./validation.js";
6
+ const LINE_MASK_CAPABILITY = createTextMotionRendererCapability('line-mask');
7
+
8
+ /** Options for {@link lineReveal}. */
9
+
10
+ /** Reveal each React Native rendered line through an `overlayText()` line mask. */
11
+ export function lineReveal(options = {}) {
12
+ return createTextMotionEffect('lineReveal', {
13
+ fromOpacity: validateFiniteEffectNumber(options.fromOpacity ?? 0, 'lineReveal fromOpacity'),
14
+ y: validateFiniteEffectNumber(options.y ?? 16, 'lineReveal y')
15
+ }, [LINE_MASK_CAPABILITY, 'style-transform']);
16
+ }
17
+ //# sourceMappingURL=lineReveal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createTextMotionRendererCapability","createTextMotionEffect","validateFiniteEffectNumber","LINE_MASK_CAPABILITY","lineReveal","options","fromOpacity","y"],"sourceRoot":"../../../src","sources":["effects/lineReveal.ts"],"mappings":";;AAEA,SAASA,kCAAkC,QAAQ,sBAAmB;AACtE,SAASC,sBAAsB,QAAQ,cAAW;AAClD,SAASC,0BAA0B,QAAQ,iBAAc;AAEzD,MAAMC,oBAAkD,GACtDH,kCAAkC,CAAC,WAAW,CAAC;;AAEjD;;AAQA;AACA,OAAO,SAASI,UAAUA,CAACC,OAA0B,GAAG,CAAC,CAAC,EAAE;EAC1D,OAAOJ,sBAAsB,CAC3B,YAAY,EACZ;IACEK,WAAW,EAAEJ,0BAA0B,CAACG,OAAO,CAACC,WAAW,IAAI,CAAC,EAAE,wBAAwB,CAAC;IAC3FC,CAAC,EAAEL,0BAA0B,CAACG,OAAO,CAACE,CAAC,IAAI,EAAE,EAAE,cAAc;EAC/D,CAAC,EACD,CAACJ,oBAAoB,EAAE,iBAAiB,CAC1C,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ import { createTextMotionEffect } from "./compose.js";
4
+ import { validateFiniteEffectNumber } from "./validation.js";
5
+
6
+ /** Options for {@link pulse}. */
7
+
8
+ /** Briefly emphasize each token by scaling it up and returning to its final scale. */
9
+ export function pulse(options = {}) {
10
+ return createTextMotionEffect('pulse', {
11
+ scale: validateFiniteEffectNumber(options.scale ?? 1.04, 'pulse scale')
12
+ }, ['style-transform']);
13
+ }
14
+ //# sourceMappingURL=pulse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createTextMotionEffect","validateFiniteEffectNumber","pulse","options","scale"],"sourceRoot":"../../../src","sources":["effects/pulse.ts"],"mappings":";;AAAA,SAASA,sBAAsB,QAAQ,cAAW;AAClD,SAASC,0BAA0B,QAAQ,iBAAc;;AAEzD;;AAMA;AACA,OAAO,SAASC,KAAKA,CAACC,OAAqB,GAAG,CAAC,CAAC,EAAE;EAChD,OAAOH,sBAAsB,CAC3B,OAAO,EACP;IACEI,KAAK,EAAEH,0BAA0B,CAACE,OAAO,CAACC,KAAK,IAAI,IAAI,EAAE,aAAa;EACxE,CAAC,EACD,CAAC,iBAAiB,CACpB,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ import { createTextMotionEffect } from "./compose.js";
4
+ import { validateFiniteEffectNumber } from "./validation.js";
5
+
6
+ /** Options for {@link rise}. */
7
+
8
+ /** Move each token upward from a vertical offset. */
9
+ export function rise(options = {}) {
10
+ return createTextMotionEffect('rise', {
11
+ y: validateFiniteEffectNumber(options.y ?? 12, 'rise y')
12
+ }, ['style-transform']);
13
+ }
14
+ //# sourceMappingURL=rise.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createTextMotionEffect","validateFiniteEffectNumber","rise","options","y"],"sourceRoot":"../../../src","sources":["effects/rise.ts"],"mappings":";;AAAA,SAASA,sBAAsB,QAAQ,cAAW;AAClD,SAASC,0BAA0B,QAAQ,iBAAc;;AAEzD;;AAMA;AACA,OAAO,SAASC,IAAIA,CAACC,OAAoB,GAAG,CAAC,CAAC,EAAE;EAC9C,OAAOH,sBAAsB,CAC3B,MAAM,EACN;IACEI,CAAC,EAAEH,0BAA0B,CAACE,OAAO,CAACC,CAAC,IAAI,EAAE,EAAE,QAAQ;EACzD,CAAC,EACD,CAAC,iBAAiB,CACpB,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ import { createTextMotionEffect } from "./compose.js";
4
+ import { validateFiniteEffectNumber } from "./validation.js";
5
+
6
+ /** Options for {@link scale}. */
7
+
8
+ /** Scale each token between two scale values. */
9
+ export function scale(options = {}) {
10
+ return createTextMotionEffect('scale', {
11
+ from: validateFiniteEffectNumber(options.from ?? 0.96, 'scale from'),
12
+ to: validateFiniteEffectNumber(options.to ?? 1, 'scale to')
13
+ }, ['style-transform']);
14
+ }
15
+ //# sourceMappingURL=scale.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createTextMotionEffect","validateFiniteEffectNumber","scale","options","from","to"],"sourceRoot":"../../../src","sources":["effects/scale.ts"],"mappings":";;AAAA,SAASA,sBAAsB,QAAQ,cAAW;AAClD,SAASC,0BAA0B,QAAQ,iBAAc;;AAEzD;;AAQA;AACA,OAAO,SAASC,KAAKA,CAACC,OAAqB,GAAG,CAAC,CAAC,EAAE;EAChD,OAAOH,sBAAsB,CAC3B,OAAO,EACP;IACEI,IAAI,EAAEH,0BAA0B,CAACE,OAAO,CAACC,IAAI,IAAI,IAAI,EAAE,YAAY,CAAC;IACpEC,EAAE,EAAEJ,0BAA0B,CAACE,OAAO,CAACE,EAAE,IAAI,CAAC,EAAE,UAAU;EAC5D,CAAC,EACD,CAAC,iBAAiB,CACpB,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ import { createTextMotionEffect } from "./compose.js";
4
+ import { validateFiniteEffectNumber } from "./validation.js";
5
+
6
+ /** Options for {@link shake}. */
7
+
8
+ /** Offset each token horizontally for a shake-like entrance. */
9
+ export function shake(options = {}) {
10
+ return createTextMotionEffect('shake', {
11
+ x: validateFiniteEffectNumber(options.x ?? 4, 'shake x')
12
+ }, ['style-transform']);
13
+ }
14
+ //# sourceMappingURL=shake.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createTextMotionEffect","validateFiniteEffectNumber","shake","options","x"],"sourceRoot":"../../../src","sources":["effects/shake.ts"],"mappings":";;AAAA,SAASA,sBAAsB,QAAQ,cAAW;AAClD,SAASC,0BAA0B,QAAQ,iBAAc;;AAEzD;;AAMA;AACA,OAAO,SAASC,KAAKA,CAACC,OAAqB,GAAG,CAAC,CAAC,EAAE;EAChD,OAAOH,sBAAsB,CAC3B,OAAO,EACP;IACEI,CAAC,EAAEH,0BAA0B,CAACE,OAAO,CAACC,CAAC,IAAI,CAAC,EAAE,SAAS;EACzD,CAAC,EACD,CAAC,iBAAiB,CACpB,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ import { createTextMotionEffect } from "./compose.js";
4
+ import { validateFiniteEffectNumber } from "./validation.js";
5
+
6
+ /** Options for {@link slide}. */
7
+
8
+ /** Move each token from an x/y offset into place. */
9
+ export function slide(options = {}) {
10
+ return createTextMotionEffect('slide', {
11
+ x: validateFiniteEffectNumber(options.x ?? 0, 'slide x'),
12
+ y: validateFiniteEffectNumber(options.y ?? 12, 'slide y')
13
+ }, ['style-transform']);
14
+ }
15
+ //# sourceMappingURL=slide.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createTextMotionEffect","validateFiniteEffectNumber","slide","options","x","y"],"sourceRoot":"../../../src","sources":["effects/slide.ts"],"mappings":";;AAAA,SAASA,sBAAsB,QAAQ,cAAW;AAClD,SAASC,0BAA0B,QAAQ,iBAAc;;AAEzD;;AAQA;AACA,OAAO,SAASC,KAAKA,CAACC,OAAqB,GAAG,CAAC,CAAC,EAAE;EAChD,OAAOH,sBAAsB,CAC3B,OAAO,EACP;IACEI,CAAC,EAAEH,0BAA0B,CAACE,OAAO,CAACC,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC;IACxDC,CAAC,EAAEJ,0BAA0B,CAACE,OAAO,CAACE,CAAC,IAAI,EAAE,EAAE,SAAS;EAC1D,CAAC,EACD,CAAC,iBAAiB,CACpB,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ import { createTextMotionEffect } from "./compose.js";
4
+
5
+ /**
6
+ * Reveal each native-text token when its local progress becomes positive.
7
+ *
8
+ * Keeps the final token layout in place. Combine with `graphemes()`, `stagger(seconds)`,
9
+ * and `.motion({ kind: 'timing', options: { duration: 0 } })` for instant character reveals.
10
+ * The splitter and timeline determine the reveal units and order; whitespace does not
11
+ * consume a motion index. Other effects retain their own opacity and transforms.
12
+ *
13
+ * External `progress` follows the recipe timeline, not the fraction of visible characters.
14
+ * Decreasing progress can hide tokens again. Requires `nativeText()`.
15
+ */
16
+ export function typewriter() {
17
+ return createTextMotionEffect('typewriter');
18
+ }
19
+ //# sourceMappingURL=typewriter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createTextMotionEffect","typewriter"],"sourceRoot":"../../../src","sources":["effects/typewriter.ts"],"mappings":";;AAAA,SAASA,sBAAsB,QAAQ,cAAW;;AAElD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,UAAUA,CAAA,EAAG;EAC3B,OAAOD,sBAAsB,CAAC,YAAY,CAAC;AAC7C","ignoreList":[]}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ const ERROR_PREFIX = '@react-native-motion-kit/text-motion';
4
+ export function validateFiniteEffectNumber(value, label) {
5
+ if (Number.isFinite(value)) {
6
+ return value;
7
+ }
8
+ throw new Error(`${ERROR_PREFIX} ${label} must be a finite number.`);
9
+ }
10
+ //# sourceMappingURL=validation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ERROR_PREFIX","validateFiniteEffectNumber","value","label","Number","isFinite","Error"],"sourceRoot":"../../../src","sources":["effects/validation.ts"],"mappings":";;AAAA,MAAMA,YAAY,GAAG,sCAAsC;AAE3D,OAAO,SAASC,0BAA0BA,CAACC,KAAa,EAAEC,KAAa,EAAU;EAC/E,IAAIC,MAAM,CAACC,QAAQ,CAACH,KAAK,CAAC,EAAE;IAC1B,OAAOA,KAAK;EACd;EAEA,MAAM,IAAII,KAAK,CAAC,GAAGN,YAAY,IAAIG,KAAK,2BAA2B,CAAC;AACtE","ignoreList":[]}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ export { parentLabelPolicy } from "./accessibility/index.js";
4
+ export { useTextMotionControls } from "./controls/index.js";
5
+ export { fade, lineReveal, pulse, rise, scale, shake, slide, typewriter } from "./effects/index.js";
6
+ export { defineTextMotion } from "./recipe/index.js";
7
+ export { nativeText, overlayText } from "./renderers/index.js";
8
+ export { custom, graphemes, lines, words } from "./split/index.js";
9
+ export { parallel, sequence, stagger, wave } from "./timeline/index.js";
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["parentLabelPolicy","useTextMotionControls","fade","lineReveal","pulse","rise","scale","shake","slide","typewriter","defineTextMotion","nativeText","overlayText","custom","graphemes","lines","words","parallel","sequence","stagger","wave"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,iBAAiB,QAAQ,0BAAiB;AACnD,SAASC,qBAAqB,QAAQ,qBAAY;AAClD,SAASC,IAAI,EAAEC,UAAU,EAAEC,KAAK,EAAEC,IAAI,EAAEC,KAAK,EAAEC,KAAK,EAAEC,KAAK,EAAEC,UAAU,QAAQ,oBAAW;AAC1F,SAASC,gBAAgB,QAAQ,mBAAU;AAC3C,SAASC,UAAU,EAAEC,WAAW,QAAQ,sBAAa;AACrD,SAASC,MAAM,EAAEC,SAAS,EAAEC,KAAK,EAAEC,KAAK,QAAQ,kBAAS;AACzD,SAASC,QAAQ,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,IAAI,QAAQ,qBAAY","ignoreList":[]}
@@ -0,0 +1 @@
1
+ {"type":"module"}
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+
3
+ import { fade, pulse, rise, scale } from "../effects/index.js";
4
+ import { defineTextMotion } from "../recipe/index.js";
5
+ import { nativeText } from "../renderers/index.js";
6
+ import { words } from "../split/index.js";
7
+ import { stagger, wave } from "../timeline/index.js";
8
+ /** Editorial title reveal with centered stagger, rise, fade, and subtle scale. */
9
+ export function editorialRise() {
10
+ return defineTextMotion().split(words()).layout(nativeText()).timeline(stagger(0.032, {
11
+ from: 'center'
12
+ })).effect(rise({
13
+ y: 14
14
+ }).and(fade()).and(scale({
15
+ from: 0.98
16
+ })));
17
+ }
18
+
19
+ /** Soft wave reveal for friendly product copy. */
20
+ export function softWave() {
21
+ return defineTextMotion().split(words()).layout(nativeText()).timeline(wave({
22
+ amplitude: 0.06,
23
+ wavelength: 5
24
+ })).effect(fade().and(rise({
25
+ y: 8
26
+ })));
27
+ }
28
+
29
+ /** Gentle emphasis preset for small labels and inline highlight copy. */
30
+ export function gentleEmphasis() {
31
+ return defineTextMotion().split(words()).layout(nativeText()).timeline(stagger(0.024)).effect(pulse({
32
+ scale: 1.06
33
+ }).and(fade()));
34
+ }
35
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["fade","pulse","rise","scale","defineTextMotion","nativeText","words","stagger","wave","editorialRise","split","layout","timeline","from","effect","y","and","softWave","amplitude","wavelength","gentleEmphasis"],"sourceRoot":"../../../src","sources":["presets/index.ts"],"mappings":";;AAEA,SAASA,IAAI,EAAEC,KAAK,EAAEC,IAAI,EAAEC,KAAK,QAAQ,qBAAY;AACrD,SAASC,gBAAgB,QAAQ,oBAAW;AAC5C,SAASC,UAAU,QAAQ,uBAAc;AACzC,SAASC,KAAK,QAAQ,mBAAU;AAChC,SAASC,OAAO,EAAEC,IAAI,QAAQ,sBAAa;AAM3C;AACA,OAAO,SAASC,aAAaA,CAAA,EAA4B;EACvD,OAAOL,gBAAgB,CAAC,CAAC,CACtBM,KAAK,CAACJ,KAAK,CAAC,CAAC,CAAC,CACdK,MAAM,CAACN,UAAU,CAAC,CAAC,CAAC,CACpBO,QAAQ,CAACL,OAAO,CAAC,KAAK,EAAE;IAAEM,IAAI,EAAE;EAAS,CAAC,CAAC,CAAC,CAC5CC,MAAM,CACLZ,IAAI,CAAC;IAAEa,CAAC,EAAE;EAAG,CAAC,CAAC,CACZC,GAAG,CAAChB,IAAI,CAAC,CAAC,CAAC,CACXgB,GAAG,CAACb,KAAK,CAAC;IAAEU,IAAI,EAAE;EAAK,CAAC,CAAC,CAC9B,CAAC;AACL;;AAEA;AACA,OAAO,SAASI,QAAQA,CAAA,EAA4B;EAClD,OAAOb,gBAAgB,CAAC,CAAC,CACtBM,KAAK,CAACJ,KAAK,CAAC,CAAC,CAAC,CACdK,MAAM,CAACN,UAAU,CAAC,CAAC,CAAC,CACpBO,QAAQ,CAACJ,IAAI,CAAC;IAAEU,SAAS,EAAE,IAAI;IAAEC,UAAU,EAAE;EAAE,CAAC,CAAC,CAAC,CAClDL,MAAM,CAACd,IAAI,CAAC,CAAC,CAACgB,GAAG,CAACd,IAAI,CAAC;IAAEa,CAAC,EAAE;EAAE,CAAC,CAAC,CAAC,CAAC;AACvC;;AAEA;AACA,OAAO,SAASK,cAAcA,CAAA,EAA4B;EACxD,OAAOhB,gBAAgB,CAAC,CAAC,CACtBM,KAAK,CAACJ,KAAK,CAAC,CAAC,CAAC,CACdK,MAAM,CAACN,UAAU,CAAC,CAAC,CAAC,CACpBO,QAAQ,CAACL,OAAO,CAAC,KAAK,CAAC,CAAC,CACxBO,MAAM,CAACb,KAAK,CAAC;IAAEE,KAAK,EAAE;EAAK,CAAC,CAAC,CAACa,GAAG,CAAChB,IAAI,CAAC,CAAC,CAAC,CAAC;AAC/C","ignoreList":[]}
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+
3
+ import { flattenTextMotionEffectDescriptors, readTextMotionRendererDescriptor, readTextMotionSplitterDescriptor } from "./descriptors.js";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ function validateTextMotionRendererCapabilities(recipe, renderer) {
6
+ flattenTextMotionEffectDescriptors(recipe.effects).forEach(effect => {
7
+ effect.requiredCapabilities.forEach(capability => {
8
+ if (renderer.capabilities.includes(capability)) {
9
+ return;
10
+ }
11
+ throw new Error(`@react-native-motion-kit/text-motion effect "${effect.name}" requires capability "${capability}", but renderer "${renderer.kind}" does not provide it.`);
12
+ });
13
+ });
14
+ }
15
+ function createDefaultToken(text) {
16
+ return {
17
+ id: 'token-0',
18
+ index: 0,
19
+ metadata: {
20
+ reason: 'default-unsplit-token'
21
+ },
22
+ sourceRange: {
23
+ start: 0,
24
+ end: text.length
25
+ },
26
+ text,
27
+ unit: 'custom'
28
+ };
29
+ }
30
+ export function createTextMotionComponent(recipe) {
31
+ function TextMotionComponent({
32
+ children,
33
+ ...textProps
34
+ }) {
35
+ if (typeof children !== 'string') {
36
+ throw new Error('@react-native-motion-kit/text-motion expects a string child. Pass plain text or split non-string content before rendering.');
37
+ }
38
+ const splitter = recipe.splitter ? readTextMotionSplitterDescriptor(recipe.splitter) : undefined;
39
+ const renderer = recipe.renderer ? readTextMotionRendererDescriptor(recipe.renderer) : undefined;
40
+ const rendererMotionUnit = renderer?.motionUnit ?? 'source-token';
41
+ if (recipe.splitter && rendererMotionUnit === 'rendered-line') {
42
+ throw new Error('@react-native-motion-kit/text-motion rendered-line renderers cannot be combined with .split(...). Remove the splitter or choose a source-token renderer such as nativeText().');
43
+ }
44
+ const tokens = splitter ? splitter.split(children) : [createDefaultToken(children)];
45
+ const Renderer = renderer?.Component;
46
+ if (!Renderer) {
47
+ throw new Error('@react-native-motion-kit/text-motion requires a renderer. Add .layout(nativeText()) or another renderer before .component().');
48
+ }
49
+ validateTextMotionRendererCapabilities(recipe, renderer);
50
+ return /*#__PURE__*/_jsx(Renderer, {
51
+ recipe: recipe,
52
+ textProps: textProps,
53
+ tokens: tokens,
54
+ children: children
55
+ });
56
+ }
57
+ TextMotionComponent.displayName = 'TextMotionComponent';
58
+ return TextMotionComponent;
59
+ }
60
+ //# sourceMappingURL=component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["flattenTextMotionEffectDescriptors","readTextMotionRendererDescriptor","readTextMotionSplitterDescriptor","jsx","_jsx","validateTextMotionRendererCapabilities","recipe","renderer","effects","forEach","effect","requiredCapabilities","capability","capabilities","includes","Error","name","kind","createDefaultToken","text","id","index","metadata","reason","sourceRange","start","end","length","unit","createTextMotionComponent","TextMotionComponent","children","textProps","splitter","undefined","rendererMotionUnit","motionUnit","tokens","split","Renderer","Component","displayName"],"sourceRoot":"../../../src","sources":["recipe/component.tsx"],"mappings":";;AAQA,SACEA,kCAAkC,EAClCC,gCAAgC,EAChCC,gCAAgC,QAC3B,kBAAe;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEvB,SAASC,sCAAsCA,CAC7CC,MAAoE,EACpEC,QAA6D,EACvD;EACNP,kCAAkC,CAACM,MAAM,CAACE,OAAO,CAAC,CAACC,OAAO,CAAEC,MAAM,IAAK;IACrEA,MAAM,CAACC,oBAAoB,CAACF,OAAO,CAAEG,UAAU,IAAK;MAClD,IAAIL,QAAQ,CAACM,YAAY,CAACC,QAAQ,CAACF,UAAU,CAAC,EAAE;QAC9C;MACF;MAEA,MAAM,IAAIG,KAAK,CACb,gDAAgDL,MAAM,CAACM,IAAI,0BAA0BJ,UAAU,oBAAoBL,QAAQ,CAACU,IAAI,wBAClI,CAAC;IACH,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ;AAEA,SAASC,kBAAkBA,CAACC,IAAY,EAA6B;EACnE,OAAO;IACLC,EAAE,EAAE,SAAS;IACbC,KAAK,EAAE,CAAC;IACRC,QAAQ,EAAE;MAAEC,MAAM,EAAE;IAAwB,CAAC;IAC7CC,WAAW,EAAE;MAAEC,KAAK,EAAE,CAAC;MAAEC,GAAG,EAAEP,IAAI,CAACQ;IAAO,CAAC;IAC3CR,IAAI;IACJS,IAAI,EAAE;EACR,CAAC;AACH;AAEA,OAAO,SAASC,yBAAyBA,CACvCvB,MAAoE,EAC/C;EACrB,SAASwB,mBAAmBA,CAAC;IAAEC,QAAQ;IAAE,GAAGC;EAAoC,CAAC,EAAE;IACjF,IAAI,OAAOD,QAAQ,KAAK,QAAQ,EAAE;MAChC,MAAM,IAAIhB,KAAK,CACb,4HACF,CAAC;IACH;IAEA,MAAMkB,QAAQ,GAAG3B,MAAM,CAAC2B,QAAQ,GAC5B/B,gCAAgC,CAACI,MAAM,CAAC2B,QAAQ,CAAC,GACjDC,SAAS;IACb,MAAM3B,QAAQ,GAAGD,MAAM,CAACC,QAAQ,GAC5BN,gCAAgC,CAACK,MAAM,CAACC,QAAQ,CAAC,GACjD2B,SAAS;IACb,MAAMC,kBAAkB,GAAG5B,QAAQ,EAAE6B,UAAU,IAAI,cAAc;IAEjE,IAAI9B,MAAM,CAAC2B,QAAQ,IAAIE,kBAAkB,KAAK,eAAe,EAAE;MAC7D,MAAM,IAAIpB,KAAK,CACb,+KACF,CAAC;IACH;IAEA,MAAMsB,MAAM,GAAGJ,QAAQ,GAAGA,QAAQ,CAACK,KAAK,CAACP,QAAQ,CAAC,GAAG,CAACb,kBAAkB,CAACa,QAAQ,CAAC,CAAC;IACnF,MAAMQ,QAAQ,GAAGhC,QAAQ,EAAEiC,SAAS;IAEpC,IAAI,CAACD,QAAQ,EAAE;MACb,MAAM,IAAIxB,KAAK,CACb,8HACF,CAAC;IACH;IAEAV,sCAAsC,CAACC,MAAM,EAAEC,QAAQ,CAAC;IAExD,oBACEH,IAAA,CAACmC,QAAQ;MAACjC,MAAM,EAAEA,MAAO;MAAC0B,SAAS,EAAEA,SAAU;MAACK,MAAM,EAAEA,MAAO;MAAAN,QAAA,EAC5DA;IAAQ,CACD,CAAC;EAEf;EAEAD,mBAAmB,CAACW,WAAW,GAAG,qBAAqB;EAEvD,OAAOX,mBAAmB;AAC5B","ignoreList":[]}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ import { createTextMotionRecipeBuilder } from "./recipe.js";
4
+
5
+ /** Start a composable text motion recipe. */
6
+ export function defineTextMotion() {
7
+ return createTextMotionRecipeBuilder();
8
+ }
9
+ //# sourceMappingURL=defineTextMotion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createTextMotionRecipeBuilder","defineTextMotion"],"sourceRoot":"../../../src","sources":["recipe/defineTextMotion.ts"],"mappings":";;AAAA,SAASA,6BAA6B,QAAsC,aAAU;;AAEtF;AACA,OAAO,SAASC,gBAAgBA,CAAA,EAA4B;EAC1D,OAAOD,6BAA6B,CAAC,CAAC;AACxC","ignoreList":[]}
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+
3
+ const effectDescriptors = new WeakMap();
4
+ const timelineDescriptors = new WeakMap();
5
+ const splitterDescriptors = new WeakMap();
6
+ const rendererDescriptors = new WeakMap();
7
+ export function attachTextMotionEffectDescriptor(effect, descriptor) {
8
+ effectDescriptors.set(effect, descriptor);
9
+ return effect;
10
+ }
11
+ export function readTextMotionEffectDescriptor(effect) {
12
+ const descriptor = effectDescriptors.get(effect);
13
+ if (descriptor) {
14
+ return descriptor;
15
+ }
16
+ throw new Error('@react-native-motion-kit/text-motion received an unknown effect handle.');
17
+ }
18
+ export function flattenTextMotionEffectDescriptors(effects) {
19
+ return effects.flatMap(effect => {
20
+ const descriptor = readTextMotionEffectDescriptor(effect);
21
+ return descriptor.effects ? flattenTextMotionEffectDescriptors(descriptor.effects) : [descriptor];
22
+ });
23
+ }
24
+ export function createTextMotionTimelineHandle(descriptor) {
25
+ const timeline = {};
26
+ timelineDescriptors.set(timeline, descriptor);
27
+ return timeline;
28
+ }
29
+ export function readTextMotionTimelineDescriptor(timeline) {
30
+ const descriptor = timelineDescriptors.get(timeline);
31
+ if (descriptor) {
32
+ return descriptor;
33
+ }
34
+ throw new Error('@react-native-motion-kit/text-motion received an unknown timeline handle.');
35
+ }
36
+ export function createTextMotionSplitterHandle(descriptor) {
37
+ const splitter = {};
38
+ splitterDescriptors.set(splitter, descriptor);
39
+ return splitter;
40
+ }
41
+ export function readTextMotionSplitterDescriptor(splitter) {
42
+ const descriptor = splitterDescriptors.get(splitter);
43
+ if (descriptor) {
44
+ return descriptor;
45
+ }
46
+ throw new Error('@react-native-motion-kit/text-motion received an unknown splitter handle.');
47
+ }
48
+ export function createTextMotionRendererHandle(descriptor) {
49
+ const renderer = {};
50
+ rendererDescriptors.set(renderer, descriptor);
51
+ return renderer;
52
+ }
53
+ export function readTextMotionRendererDescriptor(renderer) {
54
+ const descriptor = rendererDescriptors.get(renderer);
55
+ if (descriptor) {
56
+ return descriptor;
57
+ }
58
+ throw new Error('@react-native-motion-kit/text-motion received an unknown renderer handle.');
59
+ }
60
+ //# sourceMappingURL=descriptors.js.map