@react-native-motion-kit/text-motion 0.0.0-stage → 0.1.1
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.
- package/CHANGELOG.md +14 -0
- package/LICENSE +20 -0
- package/README.ko.md +104 -0
- package/README.md +103 -2
- package/lib/module/accessibility/index.js +4 -0
- package/lib/module/accessibility/index.js.map +1 -0
- package/lib/module/accessibility/policies.js +39 -0
- package/lib/module/accessibility/policies.js.map +1 -0
- package/lib/module/controls/brand.js +4 -0
- package/lib/module/controls/brand.js.map +1 -0
- package/lib/module/controls/controls.js +28 -0
- package/lib/module/controls/controls.js.map +1 -0
- package/lib/module/controls/descriptors.js +55 -0
- package/lib/module/controls/descriptors.js.map +1 -0
- package/lib/module/controls/index.js +4 -0
- package/lib/module/controls/index.js.map +1 -0
- package/lib/module/effects/compose.js +48 -0
- package/lib/module/effects/compose.js.map +1 -0
- package/lib/module/effects/fade.js +15 -0
- package/lib/module/effects/fade.js.map +1 -0
- package/lib/module/effects/index.js +12 -0
- package/lib/module/effects/index.js.map +1 -0
- package/lib/module/effects/lineReveal.js +17 -0
- package/lib/module/effects/lineReveal.js.map +1 -0
- package/lib/module/effects/pulse.js +14 -0
- package/lib/module/effects/pulse.js.map +1 -0
- package/lib/module/effects/rise.js +14 -0
- package/lib/module/effects/rise.js.map +1 -0
- package/lib/module/effects/scale.js +15 -0
- package/lib/module/effects/scale.js.map +1 -0
- package/lib/module/effects/shake.js +14 -0
- package/lib/module/effects/shake.js.map +1 -0
- package/lib/module/effects/slide.js +15 -0
- package/lib/module/effects/slide.js.map +1 -0
- package/lib/module/effects/typewriter.js +19 -0
- package/lib/module/effects/typewriter.js.map +1 -0
- package/lib/module/effects/validation.js +10 -0
- package/lib/module/effects/validation.js.map +1 -0
- package/lib/module/index.js +10 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/presets/index.js +35 -0
- package/lib/module/presets/index.js.map +1 -0
- package/lib/module/recipe/component.js +60 -0
- package/lib/module/recipe/component.js.map +1 -0
- package/lib/module/recipe/defineTextMotion.js +9 -0
- package/lib/module/recipe/defineTextMotion.js.map +1 -0
- package/lib/module/recipe/descriptors.js +60 -0
- package/lib/module/recipe/descriptors.js.map +1 -0
- package/lib/module/recipe/index.js +5 -0
- package/lib/module/recipe/index.js.map +1 -0
- package/lib/module/recipe/recipe.js +163 -0
- package/lib/module/recipe/recipe.js.map +1 -0
- package/lib/module/renderers/index.js +5 -0
- package/lib/module/renderers/index.js.map +1 -0
- package/lib/module/renderers/nativeText.js +494 -0
- package/lib/module/renderers/nativeText.js.map +1 -0
- package/lib/module/renderers/nativeTextControls.js +96 -0
- package/lib/module/renderers/nativeTextControls.js.map +1 -0
- package/lib/module/renderers/nativeTextLineLayout.js +290 -0
- package/lib/module/renderers/nativeTextLineLayout.js.map +1 -0
- package/lib/module/renderers/nativeTextPlayback.js +91 -0
- package/lib/module/renderers/nativeTextPlayback.js.map +1 -0
- package/lib/module/renderers/overlayText.js +543 -0
- package/lib/module/renderers/overlayText.js.map +1 -0
- package/lib/module/renderers/overlayTextLayout.js +182 -0
- package/lib/module/renderers/overlayTextLayout.js.map +1 -0
- package/lib/module/renderers/rendererMotion.js +264 -0
- package/lib/module/renderers/rendererMotion.js.map +1 -0
- package/lib/module/split/createToken.js +19 -0
- package/lib/module/split/createToken.js.map +1 -0
- package/lib/module/split/custom.js +57 -0
- package/lib/module/split/custom.js.map +1 -0
- package/lib/module/split/graphemes.js +25 -0
- package/lib/module/split/graphemes.js.map +1 -0
- package/lib/module/split/index.js +7 -0
- package/lib/module/split/index.js.map +1 -0
- package/lib/module/split/lines.js +43 -0
- package/lib/module/split/lines.js.map +1 -0
- package/lib/module/split/segmenter.js +74 -0
- package/lib/module/split/segmenter.js.map +1 -0
- package/lib/module/split/words.js +28 -0
- package/lib/module/split/words.js.map +1 -0
- package/lib/module/timeline/index.js +7 -0
- package/lib/module/timeline/index.js.map +1 -0
- package/lib/module/timeline/parallel.js +21 -0
- package/lib/module/timeline/parallel.js.map +1 -0
- package/lib/module/timeline/sequence.js +18 -0
- package/lib/module/timeline/sequence.js.map +1 -0
- package/lib/module/timeline/stagger.js +43 -0
- package/lib/module/timeline/stagger.js.map +1 -0
- package/lib/module/timeline/validation.js +24 -0
- package/lib/module/timeline/validation.js.map +1 -0
- package/lib/module/timeline/wave.js +25 -0
- package/lib/module/timeline/wave.js.map +1 -0
- package/lib/module/types/index.js +4 -0
- package/lib/module/types/index.js.map +1 -0
- package/lib/module/types/recipe.js +4 -0
- package/lib/module/types/recipe.js.map +1 -0
- package/lib/module/types/renderer.js +27 -0
- package/lib/module/types/renderer.js.map +1 -0
- package/lib/module/types/token.js +2 -0
- package/lib/module/types/token.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/accessibility/index.d.ts +2 -0
- package/lib/typescript/src/accessibility/index.d.ts.map +1 -0
- package/lib/typescript/src/accessibility/policies.d.ts +13 -0
- package/lib/typescript/src/accessibility/policies.d.ts.map +1 -0
- package/lib/typescript/src/controls/brand.d.ts +2 -0
- package/lib/typescript/src/controls/brand.d.ts.map +1 -0
- package/lib/typescript/src/controls/controls.d.ts +28 -0
- package/lib/typescript/src/controls/controls.d.ts.map +1 -0
- package/lib/typescript/src/controls/descriptors.d.ts +14 -0
- package/lib/typescript/src/controls/descriptors.d.ts.map +1 -0
- package/lib/typescript/src/controls/index.d.ts +3 -0
- package/lib/typescript/src/controls/index.d.ts.map +1 -0
- package/lib/typescript/src/effects/compose.d.ts +11 -0
- package/lib/typescript/src/effects/compose.d.ts.map +1 -0
- package/lib/typescript/src/effects/fade.d.ts +10 -0
- package/lib/typescript/src/effects/fade.d.ts.map +1 -0
- package/lib/typescript/src/effects/index.d.ts +10 -0
- package/lib/typescript/src/effects/index.d.ts.map +1 -0
- package/lib/typescript/src/effects/lineReveal.d.ts +11 -0
- package/lib/typescript/src/effects/lineReveal.d.ts.map +1 -0
- package/lib/typescript/src/effects/pulse.d.ts +8 -0
- package/lib/typescript/src/effects/pulse.d.ts.map +1 -0
- package/lib/typescript/src/effects/rise.d.ts +8 -0
- package/lib/typescript/src/effects/rise.d.ts.map +1 -0
- package/lib/typescript/src/effects/scale.d.ts +10 -0
- package/lib/typescript/src/effects/scale.d.ts.map +1 -0
- package/lib/typescript/src/effects/shake.d.ts +8 -0
- package/lib/typescript/src/effects/shake.d.ts.map +1 -0
- package/lib/typescript/src/effects/slide.d.ts +10 -0
- package/lib/typescript/src/effects/slide.d.ts.map +1 -0
- package/lib/typescript/src/effects/typewriter.d.ts +13 -0
- package/lib/typescript/src/effects/typewriter.d.ts.map +1 -0
- package/lib/typescript/src/effects/validation.d.ts +2 -0
- package/lib/typescript/src/effects/validation.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +15 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/presets/index.d.ts +10 -0
- package/lib/typescript/src/presets/index.d.ts.map +1 -0
- package/lib/typescript/src/recipe/component.d.ts +3 -0
- package/lib/typescript/src/recipe/component.d.ts.map +1 -0
- package/lib/typescript/src/recipe/defineTextMotion.d.ts +4 -0
- package/lib/typescript/src/recipe/defineTextMotion.d.ts.map +1 -0
- package/lib/typescript/src/recipe/descriptors.d.ts +15 -0
- package/lib/typescript/src/recipe/descriptors.d.ts.map +1 -0
- package/lib/typescript/src/recipe/index.d.ts +4 -0
- package/lib/typescript/src/recipe/index.d.ts.map +1 -0
- package/lib/typescript/src/recipe/recipe.d.ts +67 -0
- package/lib/typescript/src/recipe/recipe.d.ts.map +1 -0
- package/lib/typescript/src/renderers/index.d.ts +3 -0
- package/lib/typescript/src/renderers/index.d.ts.map +1 -0
- package/lib/typescript/src/renderers/nativeText.d.ts +13 -0
- package/lib/typescript/src/renderers/nativeText.d.ts.map +1 -0
- package/lib/typescript/src/renderers/nativeTextControls.d.ts +16 -0
- package/lib/typescript/src/renderers/nativeTextControls.d.ts.map +1 -0
- package/lib/typescript/src/renderers/nativeTextLineLayout.d.ts +84 -0
- package/lib/typescript/src/renderers/nativeTextLineLayout.d.ts.map +1 -0
- package/lib/typescript/src/renderers/nativeTextPlayback.d.ts +21 -0
- package/lib/typescript/src/renderers/nativeTextPlayback.d.ts.map +1 -0
- package/lib/typescript/src/renderers/overlayText.d.ts +13 -0
- package/lib/typescript/src/renderers/overlayText.d.ts.map +1 -0
- package/lib/typescript/src/renderers/overlayTextLayout.d.ts +36 -0
- package/lib/typescript/src/renderers/overlayTextLayout.d.ts.map +1 -0
- package/lib/typescript/src/renderers/rendererMotion.d.ts +53 -0
- package/lib/typescript/src/renderers/rendererMotion.d.ts.map +1 -0
- package/lib/typescript/src/split/createToken.d.ts +11 -0
- package/lib/typescript/src/split/createToken.d.ts.map +1 -0
- package/lib/typescript/src/split/custom.d.ts +17 -0
- package/lib/typescript/src/split/custom.d.ts.map +1 -0
- package/lib/typescript/src/split/graphemes.d.ts +4 -0
- package/lib/typescript/src/split/graphemes.d.ts.map +1 -0
- package/lib/typescript/src/split/index.d.ts +5 -0
- package/lib/typescript/src/split/index.d.ts.map +1 -0
- package/lib/typescript/src/split/lines.d.ts +4 -0
- package/lib/typescript/src/split/lines.d.ts.map +1 -0
- package/lib/typescript/src/split/segmenter.d.ts +18 -0
- package/lib/typescript/src/split/segmenter.d.ts.map +1 -0
- package/lib/typescript/src/split/words.d.ts +4 -0
- package/lib/typescript/src/split/words.d.ts.map +1 -0
- package/lib/typescript/src/timeline/index.d.ts +5 -0
- package/lib/typescript/src/timeline/index.d.ts.map +1 -0
- package/lib/typescript/src/timeline/parallel.d.ts +4 -0
- package/lib/typescript/src/timeline/parallel.d.ts.map +1 -0
- package/lib/typescript/src/timeline/sequence.d.ts +4 -0
- package/lib/typescript/src/timeline/sequence.d.ts.map +1 -0
- package/lib/typescript/src/timeline/stagger.d.ts +11 -0
- package/lib/typescript/src/timeline/stagger.d.ts.map +1 -0
- package/lib/typescript/src/timeline/validation.d.ts +4 -0
- package/lib/typescript/src/timeline/validation.d.ts.map +1 -0
- package/lib/typescript/src/timeline/wave.d.ts +11 -0
- package/lib/typescript/src/timeline/wave.d.ts.map +1 -0
- package/lib/typescript/src/types/index.d.ts +6 -0
- package/lib/typescript/src/types/index.d.ts.map +1 -0
- package/lib/typescript/src/types/recipe.d.ts +123 -0
- package/lib/typescript/src/types/recipe.d.ts.map +1 -0
- package/lib/typescript/src/types/renderer.d.ts +51 -0
- package/lib/typescript/src/types/renderer.d.ts.map +1 -0
- package/lib/typescript/src/types/token.d.ts +35 -0
- package/lib/typescript/src/types/token.d.ts.map +1 -0
- package/package.json +117 -3
- package/src/accessibility/index.ts +7 -0
- package/src/accessibility/policies.ts +60 -0
- package/src/controls/brand.ts +3 -0
- package/src/controls/controls.ts +41 -0
- package/src/controls/descriptors.ts +83 -0
- package/src/controls/index.ts +2 -0
- package/src/effects/compose.ts +98 -0
- package/src/effects/fade.ts +22 -0
- package/src/effects/index.ts +9 -0
- package/src/effects/lineReveal.ts +28 -0
- package/src/effects/pulse.ts +19 -0
- package/src/effects/rise.ts +19 -0
- package/src/effects/scale.ts +22 -0
- package/src/effects/shake.ts +19 -0
- package/src/effects/slide.ts +22 -0
- package/src/effects/typewriter.ts +16 -0
- package/src/effects/validation.ts +9 -0
- package/src/index.tsx +46 -0
- package/src/presets/index.ts +42 -0
- package/src/recipe/component.tsx +88 -0
- package/src/recipe/defineTextMotion.ts +6 -0
- package/src/recipe/descriptors.ts +158 -0
- package/src/recipe/index.ts +3 -0
- package/src/recipe/recipe.ts +359 -0
- package/src/renderers/index.ts +2 -0
- package/src/renderers/nativeText.tsx +813 -0
- package/src/renderers/nativeTextControls.ts +131 -0
- package/src/renderers/nativeTextLineLayout.ts +495 -0
- package/src/renderers/nativeTextPlayback.ts +204 -0
- package/src/renderers/overlayText.tsx +945 -0
- package/src/renderers/overlayTextLayout.ts +312 -0
- package/src/renderers/rendererMotion.ts +483 -0
- package/src/split/createToken.ts +26 -0
- package/src/split/custom.ts +92 -0
- package/src/split/graphemes.ts +27 -0
- package/src/split/index.ts +9 -0
- package/src/split/lines.ts +35 -0
- package/src/split/segmenter.ts +111 -0
- package/src/split/words.ts +28 -0
- package/src/timeline/index.ts +4 -0
- package/src/timeline/parallel.ts +30 -0
- package/src/timeline/sequence.ts +29 -0
- package/src/timeline/stagger.ts +60 -0
- package/src/timeline/validation.ts +29 -0
- package/src/timeline/wave.ts +34 -0
- package/src/types/index.ts +34 -0
- package/src/types/recipe.ts +195 -0
- package/src/types/renderer.ts +91 -0
- package/src/types/token.ts +39 -0
|
@@ -0,0 +1,494 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useLayoutEffect, useRef, createElement as _createElement } from 'react';
|
|
4
|
+
import { StyleSheet, Text, View } from 'react-native';
|
|
5
|
+
import { createAnimatedComponent, useAnimatedStyle, useReducedMotion, useSharedValue } from 'react-native-reanimated';
|
|
6
|
+
import { createHiddenTokenAccessibilityProps, createParentAccessibilityProps, parentLabelPolicy, resolveAccessibleText } from "../accessibility/index.js";
|
|
7
|
+
import { createTextMotionRendererHandle } from "../recipe/descriptors.js";
|
|
8
|
+
import { useNativeTextControlsPlayback } from "./nativeTextControls.js";
|
|
9
|
+
import { areNativeTextPlaybackRunsEqual, createNativeTextPlaybackRun } from "./nativeTextPlayback.js";
|
|
10
|
+
import { clampTextMotionProgress, createTextMotionControlledProgressPlan, createTextMotionControlledTimelineSpan, createTextMotionDelaySecondsByItemIndex, createTextMotionItemMotion, createTextMotionProgressAnimation, createTextMotionStyleTransformStatePair, readTextMotionProgressForAnimatedStyle, shouldRenderTextMotionFinalState } from "./rendererMotion.js";
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
+
const AnimatedView = createAnimatedComponent(View);
|
|
13
|
+
const TEXT_ALIGN_TO_JUSTIFY_CONTENT = {
|
|
14
|
+
auto: 'flex-start',
|
|
15
|
+
center: 'center',
|
|
16
|
+
justify: 'flex-start',
|
|
17
|
+
left: 'flex-start',
|
|
18
|
+
right: 'flex-end'
|
|
19
|
+
};
|
|
20
|
+
const NATIVE_TEXT_LINE_BREAK_PATTERN = /\r\n|\n/g;
|
|
21
|
+
const NATIVE_TEXT_LINE_BREAK_MARKER_STYLE = {
|
|
22
|
+
flexBasis: '100%',
|
|
23
|
+
height: 0,
|
|
24
|
+
width: '100%'
|
|
25
|
+
};
|
|
26
|
+
const NATIVE_TEXT_BLANK_LINE_SPACER_STYLE = {
|
|
27
|
+
flexBasis: '100%',
|
|
28
|
+
opacity: 0,
|
|
29
|
+
width: '100%'
|
|
30
|
+
};
|
|
31
|
+
const NATIVE_TEXT_BLANK_LINE_SPACER_TEXT = ' ';
|
|
32
|
+
const NATIVE_TEXT_ANIMATED_TOKEN_CONTAINER_STYLE = {
|
|
33
|
+
overflow: 'visible'
|
|
34
|
+
};
|
|
35
|
+
function shouldAnimateToken(token) {
|
|
36
|
+
return token.text.trim().length > 0;
|
|
37
|
+
}
|
|
38
|
+
function createMotionIndexByTokenId(tokens) {
|
|
39
|
+
const motionTokens = tokens.filter(shouldAnimateToken);
|
|
40
|
+
const motionIndexByTokenId = new Map(motionTokens.map((token, motionIndex) => [token.id, motionIndex]));
|
|
41
|
+
return {
|
|
42
|
+
motionCount: motionTokens.length,
|
|
43
|
+
motionIndexByTokenId
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function createTokenDelaySecondsByMotionIndex(recipe, count) {
|
|
47
|
+
return createTextMotionDelaySecondsByItemIndex(recipe, count);
|
|
48
|
+
}
|
|
49
|
+
function createTokenMotion(recipe, motionIndex, styleState, delaySecondsByMotionIndex) {
|
|
50
|
+
return createTextMotionItemMotion(recipe, styleState, delaySecondsByMotionIndex[motionIndex] ?? 0);
|
|
51
|
+
}
|
|
52
|
+
function createControlledProgressPlan(motionIndex, delaySecondsByMotionIndex, totalTimelineSpan) {
|
|
53
|
+
return createTextMotionControlledProgressPlan(motionIndex, delaySecondsByMotionIndex, totalTimelineSpan);
|
|
54
|
+
}
|
|
55
|
+
function createNativeTextTextFragment(token, text, textFragmentIndex) {
|
|
56
|
+
return {
|
|
57
|
+
kind: 'text',
|
|
58
|
+
key: textFragmentIndex === 0 ? token.id : `${token.id}:text:${textFragmentIndex}`,
|
|
59
|
+
text,
|
|
60
|
+
textFragmentIndex,
|
|
61
|
+
token
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
function createNativeTextLineBreakFragment(token, lineBreakIndex, preservesLineHeight) {
|
|
65
|
+
return {
|
|
66
|
+
kind: 'line-break',
|
|
67
|
+
key: `${token.id}:line-break:${lineBreakIndex}`,
|
|
68
|
+
preservesLineHeight
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function hasNativeTextLineContent(text) {
|
|
72
|
+
return text.replace(NATIVE_TEXT_LINE_BREAK_PATTERN, '').length > 0;
|
|
73
|
+
}
|
|
74
|
+
function hasNativeTextLineContentAfter(sourceText, sourceIndex) {
|
|
75
|
+
return hasNativeTextLineContent(sourceText.slice(sourceIndex));
|
|
76
|
+
}
|
|
77
|
+
function createNativeTextTokenRenderFragments(token, sourceText, currentLineHasText) {
|
|
78
|
+
if (!token.text.includes('\n')) {
|
|
79
|
+
return {
|
|
80
|
+
currentLineHasText: currentLineHasText || token.text.length > 0,
|
|
81
|
+
fragments: [createNativeTextTextFragment(token, token.text, 0)]
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
const lineBreaks = Array.from(token.text.matchAll(NATIVE_TEXT_LINE_BREAK_PATTERN));
|
|
85
|
+
const initialAccumulator = {
|
|
86
|
+
cursor: 0,
|
|
87
|
+
currentLineHasText,
|
|
88
|
+
fragments: [],
|
|
89
|
+
textFragmentIndex: 0
|
|
90
|
+
};
|
|
91
|
+
const result = lineBreaks.reduce((accumulator, lineBreak, lineBreakIndex) => {
|
|
92
|
+
const start = lineBreak.index ?? accumulator.cursor;
|
|
93
|
+
const lineBreakEnd = start + lineBreak[0].length;
|
|
94
|
+
const textBeforeLineBreak = token.text.slice(accumulator.cursor, start);
|
|
95
|
+
const textFragment = textBeforeLineBreak.length > 0 ? [createNativeTextTextFragment(token, textBeforeLineBreak, accumulator.textFragmentIndex)] : [];
|
|
96
|
+
const lineHasText = accumulator.currentLineHasText || textBeforeLineBreak.length > 0;
|
|
97
|
+
const hasTextAfterLineBreak = hasNativeTextLineContentAfter(sourceText, token.sourceRange.start + lineBreakEnd);
|
|
98
|
+
return {
|
|
99
|
+
cursor: lineBreakEnd,
|
|
100
|
+
currentLineHasText: false,
|
|
101
|
+
fragments: [...accumulator.fragments, ...textFragment, createNativeTextLineBreakFragment(token, lineBreakIndex, !lineHasText || !hasTextAfterLineBreak)],
|
|
102
|
+
textFragmentIndex: accumulator.textFragmentIndex + textFragment.length
|
|
103
|
+
};
|
|
104
|
+
}, initialAccumulator);
|
|
105
|
+
const trailingText = token.text.slice(result.cursor);
|
|
106
|
+
if (trailingText.length === 0) {
|
|
107
|
+
return {
|
|
108
|
+
currentLineHasText: result.currentLineHasText,
|
|
109
|
+
fragments: result.fragments
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
return {
|
|
113
|
+
currentLineHasText: true,
|
|
114
|
+
fragments: [...result.fragments, createNativeTextTextFragment(token, trailingText, result.textFragmentIndex)]
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
function createNativeTextRenderFragments(tokens, sourceText) {
|
|
118
|
+
const result = tokens.reduce((accumulator, token) => {
|
|
119
|
+
const tokenResult = createNativeTextTokenRenderFragments(token, sourceText, accumulator.currentLineHasText);
|
|
120
|
+
return {
|
|
121
|
+
currentLineHasText: tokenResult.currentLineHasText,
|
|
122
|
+
fragments: [...accumulator.fragments, ...tokenResult.fragments]
|
|
123
|
+
};
|
|
124
|
+
}, {
|
|
125
|
+
currentLineHasText: false,
|
|
126
|
+
fragments: []
|
|
127
|
+
});
|
|
128
|
+
return result.fragments.map((fragment, renderIndex) => ({
|
|
129
|
+
...fragment,
|
|
130
|
+
renderIndex
|
|
131
|
+
}));
|
|
132
|
+
}
|
|
133
|
+
function createNativeTextFragmentTestID(prefix, fragment) {
|
|
134
|
+
if (!prefix) {
|
|
135
|
+
return undefined;
|
|
136
|
+
}
|
|
137
|
+
if (fragment.textFragmentIndex === 0) {
|
|
138
|
+
return `${prefix}-${fragment.token.index}`;
|
|
139
|
+
}
|
|
140
|
+
return `${prefix}-${fragment.token.index}-${fragment.textFragmentIndex}`;
|
|
141
|
+
}
|
|
142
|
+
function createNativeTextLineBreakTestID(prefix, fragment) {
|
|
143
|
+
return prefix ? `${prefix}-line-break-${fragment.renderIndex}` : undefined;
|
|
144
|
+
}
|
|
145
|
+
function StaticNativeTextToken({
|
|
146
|
+
children,
|
|
147
|
+
style,
|
|
148
|
+
...tokenProps
|
|
149
|
+
}) {
|
|
150
|
+
return /*#__PURE__*/_jsx(Text, {
|
|
151
|
+
...tokenProps,
|
|
152
|
+
style: style,
|
|
153
|
+
children: children
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
function splitAnimatedTokenProps({
|
|
157
|
+
accessibilityElementsHidden,
|
|
158
|
+
accessible,
|
|
159
|
+
importantForAccessibility,
|
|
160
|
+
testID,
|
|
161
|
+
...textProps
|
|
162
|
+
}) {
|
|
163
|
+
return {
|
|
164
|
+
containerProps: {
|
|
165
|
+
accessibilityElementsHidden,
|
|
166
|
+
accessible,
|
|
167
|
+
importantForAccessibility,
|
|
168
|
+
testID
|
|
169
|
+
},
|
|
170
|
+
textProps
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
function AnimatedNativeTextTokenContent({
|
|
174
|
+
children,
|
|
175
|
+
style,
|
|
176
|
+
...tokenProps
|
|
177
|
+
}) {
|
|
178
|
+
return /*#__PURE__*/_jsx(Text, {
|
|
179
|
+
...tokenProps,
|
|
180
|
+
style: style,
|
|
181
|
+
children: children
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
function useNativeTextAnimatedStyle(options) {
|
|
185
|
+
const {
|
|
186
|
+
controlled,
|
|
187
|
+
progress,
|
|
188
|
+
renderFinalState,
|
|
189
|
+
tokenMotion
|
|
190
|
+
} = options;
|
|
191
|
+
const initialOpacity = tokenMotion.initial.opacity;
|
|
192
|
+
const initialScale = tokenMotion.initial.scale;
|
|
193
|
+
const initialTranslateX = tokenMotion.initial.translateX;
|
|
194
|
+
const initialTranslateY = tokenMotion.initial.translateY;
|
|
195
|
+
const targetOpacity = tokenMotion.target.opacity;
|
|
196
|
+
const targetScale = tokenMotion.target.scale;
|
|
197
|
+
const targetTranslateX = tokenMotion.target.translateX;
|
|
198
|
+
const targetTranslateY = tokenMotion.target.translateY;
|
|
199
|
+
const pulseScale = tokenMotion.pulseScale;
|
|
200
|
+
const revealOnStart = tokenMotion.revealOnStart === true;
|
|
201
|
+
const itemDelaySeconds = controlled ? options.controlledProgressPlan.itemDelaySeconds : 0;
|
|
202
|
+
const totalTimelineSpan = controlled ? options.controlledProgressPlan.totalTimelineSpan : 1;
|
|
203
|
+
return useAnimatedStyle(() => {
|
|
204
|
+
const current = readTextMotionProgressForAnimatedStyle({
|
|
205
|
+
controlledProgressPlan: controlled ? {
|
|
206
|
+
itemDelaySeconds,
|
|
207
|
+
totalTimelineSpan
|
|
208
|
+
} : undefined,
|
|
209
|
+
progress,
|
|
210
|
+
renderFinalState
|
|
211
|
+
});
|
|
212
|
+
const clampedCurrent = clampTextMotionProgress(current);
|
|
213
|
+
const baseScale = initialScale + (targetScale - initialScale) * current;
|
|
214
|
+
const pulseProgress = 1 - Math.abs(clampedCurrent * 2 - 1);
|
|
215
|
+
const pulseMultiplier = 1 + (pulseScale - 1) * pulseProgress;
|
|
216
|
+
return {
|
|
217
|
+
opacity: revealOnStart && current <= 0 ? 0 : initialOpacity + (targetOpacity - initialOpacity) * current,
|
|
218
|
+
transform: [{
|
|
219
|
+
translateX: initialTranslateX + (targetTranslateX - initialTranslateX) * current
|
|
220
|
+
}, {
|
|
221
|
+
translateY: initialTranslateY + (targetTranslateY - initialTranslateY) * current
|
|
222
|
+
}, {
|
|
223
|
+
scale: baseScale * pulseMultiplier
|
|
224
|
+
}]
|
|
225
|
+
};
|
|
226
|
+
}, [initialOpacity, initialScale, initialTranslateX, initialTranslateY, controlled, progress, pulseScale, renderFinalState, revealOnStart, targetOpacity, targetScale, targetTranslateX, targetTranslateY, itemDelaySeconds, totalTimelineSpan]);
|
|
227
|
+
}
|
|
228
|
+
function ControlledAnimatedNativeTextToken({
|
|
229
|
+
children,
|
|
230
|
+
controlledProgress,
|
|
231
|
+
controlledProgressPlan,
|
|
232
|
+
style,
|
|
233
|
+
tokenMotion,
|
|
234
|
+
...tokenProps
|
|
235
|
+
}) {
|
|
236
|
+
const reducedMotion = tokenMotion.reducedMotion;
|
|
237
|
+
const reducedMotionEnabled = useReducedMotion();
|
|
238
|
+
const renderFinalState = shouldRenderTextMotionFinalState(reducedMotionEnabled, reducedMotion);
|
|
239
|
+
const {
|
|
240
|
+
containerProps,
|
|
241
|
+
textProps
|
|
242
|
+
} = splitAnimatedTokenProps(tokenProps);
|
|
243
|
+
const animatedStyle = useNativeTextAnimatedStyle({
|
|
244
|
+
controlled: true,
|
|
245
|
+
controlledProgressPlan,
|
|
246
|
+
progress: controlledProgress,
|
|
247
|
+
renderFinalState,
|
|
248
|
+
tokenMotion
|
|
249
|
+
});
|
|
250
|
+
return /*#__PURE__*/_jsx(AnimatedView, {
|
|
251
|
+
...containerProps,
|
|
252
|
+
style: [NATIVE_TEXT_ANIMATED_TOKEN_CONTAINER_STYLE, animatedStyle],
|
|
253
|
+
children: /*#__PURE__*/_jsx(AnimatedNativeTextTokenContent, {
|
|
254
|
+
...textProps,
|
|
255
|
+
style: style,
|
|
256
|
+
children: children
|
|
257
|
+
})
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
function UncontrolledAnimatedNativeTextToken({
|
|
261
|
+
children,
|
|
262
|
+
controls,
|
|
263
|
+
playbackText,
|
|
264
|
+
style,
|
|
265
|
+
tokenMotion,
|
|
266
|
+
...tokenProps
|
|
267
|
+
}) {
|
|
268
|
+
const reducedMotion = tokenMotion.reducedMotion;
|
|
269
|
+
const reducedMotionEnabled = useReducedMotion();
|
|
270
|
+
const renderFinalState = shouldRenderTextMotionFinalState(reducedMotionEnabled, reducedMotion);
|
|
271
|
+
const progress = useSharedValue(renderFinalState ? 1 : 0);
|
|
272
|
+
const playbackRun = createNativeTextPlaybackRun(tokenMotion, renderFinalState, playbackText);
|
|
273
|
+
const previousPlaybackRun = useRef(undefined);
|
|
274
|
+
const {
|
|
275
|
+
containerProps,
|
|
276
|
+
textProps
|
|
277
|
+
} = splitAnimatedTokenProps(tokenProps);
|
|
278
|
+
const animatedStyle = useNativeTextAnimatedStyle({
|
|
279
|
+
controlled: false,
|
|
280
|
+
progress,
|
|
281
|
+
renderFinalState,
|
|
282
|
+
tokenMotion
|
|
283
|
+
});
|
|
284
|
+
useLayoutEffect(() => {
|
|
285
|
+
if (areNativeTextPlaybackRunsEqual(previousPlaybackRun.current, playbackRun)) {
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
previousPlaybackRun.current = playbackRun;
|
|
289
|
+
if (playbackRun.renderFinalState) {
|
|
290
|
+
progress.value = 1;
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
progress.value = 0;
|
|
294
|
+
progress.value = createTextMotionProgressAnimation(playbackRun);
|
|
295
|
+
});
|
|
296
|
+
useNativeTextControlsPlayback({
|
|
297
|
+
controls,
|
|
298
|
+
createProgressAnimation: createTextMotionProgressAnimation,
|
|
299
|
+
progress,
|
|
300
|
+
renderFinalState,
|
|
301
|
+
tokenMotion
|
|
302
|
+
});
|
|
303
|
+
return /*#__PURE__*/_jsx(AnimatedView, {
|
|
304
|
+
...containerProps,
|
|
305
|
+
style: [NATIVE_TEXT_ANIMATED_TOKEN_CONTAINER_STYLE, animatedStyle],
|
|
306
|
+
children: /*#__PURE__*/_jsx(AnimatedNativeTextTokenContent, {
|
|
307
|
+
...textProps,
|
|
308
|
+
style: style,
|
|
309
|
+
children: children
|
|
310
|
+
})
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
function NativeTextToken(props) {
|
|
314
|
+
if (!props.tokenMotion) {
|
|
315
|
+
const {
|
|
316
|
+
tokenMotion: _tokenMotion,
|
|
317
|
+
...tokenProps
|
|
318
|
+
} = props;
|
|
319
|
+
return /*#__PURE__*/_jsx(StaticNativeTextToken, {
|
|
320
|
+
...tokenProps
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
if ('controlledProgress' in props) {
|
|
324
|
+
const {
|
|
325
|
+
controlledProgress,
|
|
326
|
+
controlledProgressPlan,
|
|
327
|
+
tokenMotion,
|
|
328
|
+
...tokenProps
|
|
329
|
+
} = props;
|
|
330
|
+
return /*#__PURE__*/_jsx(ControlledAnimatedNativeTextToken, {
|
|
331
|
+
...tokenProps,
|
|
332
|
+
controlledProgress: controlledProgress,
|
|
333
|
+
controlledProgressPlan: controlledProgressPlan,
|
|
334
|
+
tokenMotion: tokenMotion
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
const {
|
|
338
|
+
controls,
|
|
339
|
+
playbackText,
|
|
340
|
+
tokenMotion,
|
|
341
|
+
...tokenProps
|
|
342
|
+
} = props;
|
|
343
|
+
return /*#__PURE__*/_jsx(UncontrolledAnimatedNativeTextToken, {
|
|
344
|
+
...tokenProps,
|
|
345
|
+
controls: controls,
|
|
346
|
+
playbackText: playbackText,
|
|
347
|
+
tokenMotion: tokenMotion
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
function NativeTextLineBreak({
|
|
351
|
+
preservesLineHeight,
|
|
352
|
+
testID,
|
|
353
|
+
textStyle,
|
|
354
|
+
tokenTextProps
|
|
355
|
+
}) {
|
|
356
|
+
if (preservesLineHeight) {
|
|
357
|
+
return /*#__PURE__*/_jsx(Text, {
|
|
358
|
+
...tokenTextProps,
|
|
359
|
+
accessibilityElementsHidden: true,
|
|
360
|
+
accessible: false,
|
|
361
|
+
importantForAccessibility: "no-hide-descendants",
|
|
362
|
+
style: [textStyle, NATIVE_TEXT_BLANK_LINE_SPACER_STYLE],
|
|
363
|
+
testID: testID,
|
|
364
|
+
children: NATIVE_TEXT_BLANK_LINE_SPACER_TEXT
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
return /*#__PURE__*/_jsx(View, {
|
|
368
|
+
accessibilityElementsHidden: true,
|
|
369
|
+
accessible: false,
|
|
370
|
+
importantForAccessibility: "no-hide-descendants",
|
|
371
|
+
style: NATIVE_TEXT_LINE_BREAK_MARKER_STYLE,
|
|
372
|
+
testID: testID
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
function resolveJustifyContent(style) {
|
|
376
|
+
const textAlign = StyleSheet.flatten(style)?.textAlign;
|
|
377
|
+
return textAlign ? TEXT_ALIGN_TO_JUSTIFY_CONTENT[textAlign] : 'flex-start';
|
|
378
|
+
}
|
|
379
|
+
function createContainerStyle(style) {
|
|
380
|
+
return {
|
|
381
|
+
flexDirection: 'row',
|
|
382
|
+
flexWrap: 'wrap',
|
|
383
|
+
justifyContent: resolveJustifyContent(style)
|
|
384
|
+
};
|
|
385
|
+
}
|
|
386
|
+
function createContainerProps(textProps, parentAccessibilityProps) {
|
|
387
|
+
return {
|
|
388
|
+
accessibilityActions: textProps?.accessibilityActions,
|
|
389
|
+
accessibilityHint: textProps?.accessibilityHint,
|
|
390
|
+
accessibilityLabel: textProps?.accessibilityLabel ?? parentAccessibilityProps.accessibilityLabel,
|
|
391
|
+
accessibilityLanguage: textProps?.accessibilityLanguage,
|
|
392
|
+
accessibilityRole: textProps?.accessibilityRole,
|
|
393
|
+
accessibilityState: textProps?.accessibilityState,
|
|
394
|
+
accessibilityValue: textProps?.accessibilityValue,
|
|
395
|
+
accessible: parentAccessibilityProps.accessible,
|
|
396
|
+
nativeID: textProps?.nativeID,
|
|
397
|
+
onAccessibilityAction: textProps?.onAccessibilityAction,
|
|
398
|
+
testID: textProps?.testID
|
|
399
|
+
};
|
|
400
|
+
}
|
|
401
|
+
function createTokenTextProps(textProps) {
|
|
402
|
+
return {
|
|
403
|
+
allowFontScaling: textProps?.allowFontScaling,
|
|
404
|
+
maxFontSizeMultiplier: textProps?.maxFontSizeMultiplier
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
function createNativeTextRendererComponent(options) {
|
|
408
|
+
function NativeTextRenderer({
|
|
409
|
+
children,
|
|
410
|
+
recipe,
|
|
411
|
+
textProps,
|
|
412
|
+
tokens
|
|
413
|
+
}) {
|
|
414
|
+
const text = typeof children === 'string' ? children : '';
|
|
415
|
+
const textStyle = textProps?.style;
|
|
416
|
+
const policy = recipe.accessibility ?? parentLabelPolicy();
|
|
417
|
+
const accessibilityLabel = resolveAccessibleText(text, tokens);
|
|
418
|
+
const parentAccessibilityProps = createParentAccessibilityProps(policy, accessibilityLabel);
|
|
419
|
+
const tokenAccessibilityProps = createHiddenTokenAccessibilityProps(policy);
|
|
420
|
+
const containerProps = createContainerProps(textProps, parentAccessibilityProps);
|
|
421
|
+
const tokenTextProps = createTokenTextProps(textProps);
|
|
422
|
+
const styleState = createTextMotionStyleTransformStatePair(recipe.effects, 'nativeText()');
|
|
423
|
+
const {
|
|
424
|
+
motionCount,
|
|
425
|
+
motionIndexByTokenId
|
|
426
|
+
} = createMotionIndexByTokenId(tokens);
|
|
427
|
+
const delaySecondsByMotionIndex = createTokenDelaySecondsByMotionIndex(recipe, motionCount);
|
|
428
|
+
const totalTimelineSpan = createTextMotionControlledTimelineSpan(delaySecondsByMotionIndex);
|
|
429
|
+
const externalProgress = textProps?.progress;
|
|
430
|
+
const controls = textProps?.controls;
|
|
431
|
+
const fragments = createNativeTextRenderFragments(tokens, text);
|
|
432
|
+
if (externalProgress && controls) {
|
|
433
|
+
throw new Error('@react-native-motion-kit/text-motion cannot receive both progress and controls. Use progress for raw app-owned values, or controls for event-driven playback.');
|
|
434
|
+
}
|
|
435
|
+
return /*#__PURE__*/_jsx(View, {
|
|
436
|
+
...containerProps,
|
|
437
|
+
style: createContainerStyle(textStyle),
|
|
438
|
+
children: fragments.map(fragment => {
|
|
439
|
+
if (fragment.kind === 'line-break') {
|
|
440
|
+
return /*#__PURE__*/_jsx(NativeTextLineBreak, {
|
|
441
|
+
preservesLineHeight: fragment.preservesLineHeight,
|
|
442
|
+
testID: createNativeTextLineBreakTestID(options.testIDPrefix, fragment),
|
|
443
|
+
textStyle: textStyle,
|
|
444
|
+
tokenTextProps: tokenTextProps
|
|
445
|
+
}, fragment.key);
|
|
446
|
+
}
|
|
447
|
+
const token = fragment.token;
|
|
448
|
+
const motionIndex = motionIndexByTokenId.get(token.id);
|
|
449
|
+
const commonTokenProps = {
|
|
450
|
+
...tokenAccessibilityProps,
|
|
451
|
+
...tokenTextProps,
|
|
452
|
+
style: textStyle,
|
|
453
|
+
testID: createNativeTextFragmentTestID(options.testIDPrefix, fragment)
|
|
454
|
+
};
|
|
455
|
+
if (typeof motionIndex !== 'number') {
|
|
456
|
+
return /*#__PURE__*/_createElement(NativeTextToken, {
|
|
457
|
+
...commonTokenProps,
|
|
458
|
+
key: fragment.key
|
|
459
|
+
}, fragment.text);
|
|
460
|
+
}
|
|
461
|
+
const tokenMotion = createTokenMotion(recipe, motionIndex, styleState, delaySecondsByMotionIndex);
|
|
462
|
+
if (!externalProgress) {
|
|
463
|
+
return /*#__PURE__*/_createElement(NativeTextToken, {
|
|
464
|
+
...commonTokenProps,
|
|
465
|
+
controls: controls,
|
|
466
|
+
key: fragment.key,
|
|
467
|
+
playbackText: fragment.text,
|
|
468
|
+
tokenMotion: tokenMotion
|
|
469
|
+
}, fragment.text);
|
|
470
|
+
}
|
|
471
|
+
return /*#__PURE__*/_createElement(NativeTextToken, {
|
|
472
|
+
...commonTokenProps,
|
|
473
|
+
controlledProgress: externalProgress,
|
|
474
|
+
controlledProgressPlan: createControlledProgressPlan(motionIndex, delaySecondsByMotionIndex, totalTimelineSpan),
|
|
475
|
+
key: fragment.key,
|
|
476
|
+
tokenMotion: tokenMotion
|
|
477
|
+
}, fragment.text);
|
|
478
|
+
})
|
|
479
|
+
});
|
|
480
|
+
}
|
|
481
|
+
NativeTextRenderer.displayName = 'NativeTextRenderer';
|
|
482
|
+
return NativeTextRenderer;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
/** Render text as wrapping React Native Text tokens animated by Reanimated. */
|
|
486
|
+
export function nativeText(options = {}) {
|
|
487
|
+
return createTextMotionRendererHandle({
|
|
488
|
+
kind: 'nativeText',
|
|
489
|
+
capabilities: ['native-text', 'style-transform'],
|
|
490
|
+
motionUnit: 'source-token',
|
|
491
|
+
Component: createNativeTextRendererComponent(options)
|
|
492
|
+
});
|
|
493
|
+
}
|
|
494
|
+
//# sourceMappingURL=nativeText.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useLayoutEffect","useRef","createElement","_createElement","StyleSheet","Text","View","createAnimatedComponent","useAnimatedStyle","useReducedMotion","useSharedValue","createHiddenTokenAccessibilityProps","createParentAccessibilityProps","parentLabelPolicy","resolveAccessibleText","createTextMotionRendererHandle","useNativeTextControlsPlayback","areNativeTextPlaybackRunsEqual","createNativeTextPlaybackRun","clampTextMotionProgress","createTextMotionControlledProgressPlan","createTextMotionControlledTimelineSpan","createTextMotionDelaySecondsByItemIndex","createTextMotionItemMotion","createTextMotionProgressAnimation","createTextMotionStyleTransformStatePair","readTextMotionProgressForAnimatedStyle","shouldRenderTextMotionFinalState","jsx","_jsx","AnimatedView","TEXT_ALIGN_TO_JUSTIFY_CONTENT","auto","center","justify","left","right","NATIVE_TEXT_LINE_BREAK_PATTERN","NATIVE_TEXT_LINE_BREAK_MARKER_STYLE","flexBasis","height","width","NATIVE_TEXT_BLANK_LINE_SPACER_STYLE","opacity","NATIVE_TEXT_BLANK_LINE_SPACER_TEXT","NATIVE_TEXT_ANIMATED_TOKEN_CONTAINER_STYLE","overflow","shouldAnimateToken","token","text","trim","length","createMotionIndexByTokenId","tokens","motionTokens","filter","motionIndexByTokenId","Map","map","motionIndex","id","motionCount","createTokenDelaySecondsByMotionIndex","recipe","count","createTokenMotion","styleState","delaySecondsByMotionIndex","createControlledProgressPlan","totalTimelineSpan","createNativeTextTextFragment","textFragmentIndex","kind","key","createNativeTextLineBreakFragment","lineBreakIndex","preservesLineHeight","hasNativeTextLineContent","replace","hasNativeTextLineContentAfter","sourceText","sourceIndex","slice","createNativeTextTokenRenderFragments","currentLineHasText","includes","fragments","lineBreaks","Array","from","matchAll","initialAccumulator","cursor","result","reduce","accumulator","lineBreak","start","index","lineBreakEnd","textBeforeLineBreak","textFragment","lineHasText","hasTextAfterLineBreak","sourceRange","trailingText","createNativeTextRenderFragments","tokenResult","fragment","renderIndex","createNativeTextFragmentTestID","prefix","undefined","createNativeTextLineBreakTestID","StaticNativeTextToken","children","style","tokenProps","splitAnimatedTokenProps","accessibilityElementsHidden","accessible","importantForAccessibility","testID","textProps","containerProps","AnimatedNativeTextTokenContent","useNativeTextAnimatedStyle","options","controlled","progress","renderFinalState","tokenMotion","initialOpacity","initial","initialScale","scale","initialTranslateX","translateX","initialTranslateY","translateY","targetOpacity","target","targetScale","targetTranslateX","targetTranslateY","pulseScale","revealOnStart","itemDelaySeconds","controlledProgressPlan","current","clampedCurrent","baseScale","pulseProgress","Math","abs","pulseMultiplier","transform","ControlledAnimatedNativeTextToken","controlledProgress","reducedMotion","reducedMotionEnabled","animatedStyle","UncontrolledAnimatedNativeTextToken","controls","playbackText","playbackRun","previousPlaybackRun","value","createProgressAnimation","NativeTextToken","props","_tokenMotion","NativeTextLineBreak","textStyle","tokenTextProps","resolveJustifyContent","textAlign","flatten","createContainerStyle","flexDirection","flexWrap","justifyContent","createContainerProps","parentAccessibilityProps","accessibilityActions","accessibilityHint","accessibilityLabel","accessibilityLanguage","accessibilityRole","accessibilityState","accessibilityValue","nativeID","onAccessibilityAction","createTokenTextProps","allowFontScaling","maxFontSizeMultiplier","createNativeTextRendererComponent","NativeTextRenderer","policy","accessibility","tokenAccessibilityProps","effects","externalProgress","Error","testIDPrefix","get","commonTokenProps","displayName","nativeText","capabilities","motionUnit","Component"],"sourceRoot":"../../../src","sources":["renderers/nativeText.tsx"],"mappings":";;AAAA,SAASA,eAAe,EAAEC,MAAM,EAAAC,aAAA,IAAAC,cAAA,QAA4C,OAAO;AACnF,SACEC,UAAU,EACVC,IAAI,EACJC,IAAI,QAKC,cAAc;AACrB,SACEC,uBAAuB,EACvBC,gBAAgB,EAChBC,gBAAgB,EAChBC,cAAc,QAET,yBAAyB;AAOhC,SACEC,mCAAmC,EACnCC,8BAA8B,EAC9BC,iBAAiB,EACjBC,qBAAqB,QAChB,2BAAkB;AACzB,SAASC,8BAA8B,QAAQ,0BAAuB;AACtE,SAASC,6BAA6B,QAAQ,yBAAsB;AACpE,SACEC,8BAA8B,EAC9BC,2BAA2B,QAEtB,yBAAsB;AAC7B,SACEC,uBAAuB,EACvBC,sCAAsC,EACtCC,sCAAsC,EACtCC,uCAAuC,EACvCC,0BAA0B,EAC1BC,iCAAiC,EACjCC,uCAAuC,EACvCC,sCAAsC,EACtCC,gCAAgC,QAI3B,qBAAkB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAkH1B,MAAMC,YAAY,GAAGvB,uBAAuB,CAACD,IAAI,CAAC;AAElD,MAAMyB,6BAA6B,GAAG;EACpCC,IAAI,EAAE,YAAY;EAClBC,MAAM,EAAE,QAAQ;EAChBC,OAAO,EAAE,YAAY;EACrBC,IAAI,EAAE,YAAY;EAClBC,KAAK,EAAE;AACT,CAA6F;AAE7F,MAAMC,8BAA8B,GAAG,UAAU;AACjD,MAAMC,mCAAmC,GAAG;EAC1CC,SAAS,EAAE,MAAM;EACjBC,MAAM,EAAE,CAAC;EACTC,KAAK,EAAE;AACT,CAA8B;AAC9B,MAAMC,mCAAmC,GAAG;EAC1CH,SAAS,EAAE,MAAM;EACjBI,OAAO,EAAE,CAAC;EACVF,KAAK,EAAE;AACT,CAA8B;AAC9B,MAAMG,kCAAkC,GAAG,GAAG;AAC9C,MAAMC,0CAA0C,GAAG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,WAAW,EACXO,UAAU,EACVC,yBACF,CAAC;QAED,IAAI,CAACuI,gBAAgB,EAAE;UACrB,oBACEvM,cAAA,CAACsK,eAAe;YAAA,GACVqC,gBAAgB;YACpB3C,QAAQ,EAAEA,QAAS;YACnB1F,GAAG,EAAEmC,QAAQ,CAACnC,GAAI;YAClB2F,YAAY,EAAExD,QAAQ,CAAC3D,IAAK;YAC5BkF,WAAW,EAAEA;UAAY,GAExBvB,QAAQ,CAAC3D,IACK,CAAC;QAEtB;QAEA,oBACE9C,cAAA,CAACsK,eAAe;UAAA,GACVqC,gBAAgB;UACpBhD,kBAAkB,EAAE4C,gBAAiB;UACrCtD,sBAAsB,EAAEhF,4BAA4B,CAClDT,WAAW,EACXQ,yBAAyB,EACzBE,iBACF,CAAE;UACFI,GAAG,EAAEmC,QAAQ,CAACnC,GAAI;UAClB0D,WAAW,EAAEA;QAAY,GAExBvB,QAAQ,CAAC3D,IACK,CAAC;MAEtB,CAAC;IAAC,CACE,CAAC;EAEX;EAEAoJ,kBAAkB,CAACU,WAAW,GAAG,oBAAoB;EAErD,OAAOV,kBAAkB;AAC3B;;AAEA;AACA,OAAO,SAASW,UAAUA,CACxBjF,OAAkC,GAAG,CAAC,CAAC,EAIvC;EACA,OAAOhH,8BAA8B,CAAC;IACpCyD,IAAI,EAAE,YAAY;IAClByI,YAAY,EAAE,CAAC,aAAa,EAAE,iBAAiB,CAAC;IAChDC,UAAU,EAAE,cAAc;IAC1BC,SAAS,EAAEf,iCAAiC,CAACrE,OAAO;EACtD,CAAC,CAAC;AACJ","ignoreList":[]}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useLayoutEffect, useRef } from 'react';
|
|
4
|
+
import { cancelAnimation } from 'react-native-reanimated';
|
|
5
|
+
import { readTextMotionControlsDescriptor } from "../controls/descriptors.js";
|
|
6
|
+
import { clampTextMotionProgress } from "./rendererMotion.js";
|
|
7
|
+
function resetOwnedProgress(progress, renderFinalState) {
|
|
8
|
+
cancelAnimation(progress);
|
|
9
|
+
progress.value = renderFinalState ? 1 : 0;
|
|
10
|
+
}
|
|
11
|
+
function stopOwnedProgress(progress, renderFinalState) {
|
|
12
|
+
cancelAnimation(progress);
|
|
13
|
+
if (renderFinalState) {
|
|
14
|
+
progress.value = 1;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function replayOwnedProgress({
|
|
18
|
+
createProgressAnimation,
|
|
19
|
+
progress,
|
|
20
|
+
renderFinalState,
|
|
21
|
+
tokenMotion
|
|
22
|
+
}) {
|
|
23
|
+
resetOwnedProgress(progress, renderFinalState);
|
|
24
|
+
if (renderFinalState) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
progress.value = createProgressAnimation(tokenMotion);
|
|
28
|
+
}
|
|
29
|
+
function playOwnedProgress({
|
|
30
|
+
createProgressAnimation,
|
|
31
|
+
progress,
|
|
32
|
+
renderFinalState,
|
|
33
|
+
tokenMotion
|
|
34
|
+
}) {
|
|
35
|
+
stopOwnedProgress(progress, renderFinalState);
|
|
36
|
+
if (renderFinalState) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const currentProgress = clampTextMotionProgress(progress.value);
|
|
40
|
+
const delayMs = currentProgress <= 0 ? tokenMotion.delayMs : 0;
|
|
41
|
+
progress.value = createProgressAnimation({
|
|
42
|
+
...tokenMotion,
|
|
43
|
+
delayMs
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
const playbackCommandHandlers = {
|
|
47
|
+
play: playOwnedProgress,
|
|
48
|
+
replay: replayOwnedProgress,
|
|
49
|
+
reset({
|
|
50
|
+
progress,
|
|
51
|
+
renderFinalState
|
|
52
|
+
}) {
|
|
53
|
+
resetOwnedProgress(progress, renderFinalState);
|
|
54
|
+
},
|
|
55
|
+
stop({
|
|
56
|
+
progress,
|
|
57
|
+
renderFinalState
|
|
58
|
+
}) {
|
|
59
|
+
stopOwnedProgress(progress, renderFinalState);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
function applyNativeTextOwnedPlaybackCommand(command, options) {
|
|
63
|
+
playbackCommandHandlers[command.kind](options);
|
|
64
|
+
}
|
|
65
|
+
export function useNativeTextControlsPlayback({
|
|
66
|
+
controls,
|
|
67
|
+
createProgressAnimation,
|
|
68
|
+
progress,
|
|
69
|
+
renderFinalState,
|
|
70
|
+
tokenMotion
|
|
71
|
+
}) {
|
|
72
|
+
const playbackState = useRef({
|
|
73
|
+
createProgressAnimation,
|
|
74
|
+
progress,
|
|
75
|
+
renderFinalState,
|
|
76
|
+
tokenMotion
|
|
77
|
+
});
|
|
78
|
+
useLayoutEffect(() => {
|
|
79
|
+
playbackState.current = {
|
|
80
|
+
createProgressAnimation,
|
|
81
|
+
progress,
|
|
82
|
+
renderFinalState,
|
|
83
|
+
tokenMotion
|
|
84
|
+
};
|
|
85
|
+
}, [createProgressAnimation, progress, renderFinalState, tokenMotion]);
|
|
86
|
+
useLayoutEffect(() => {
|
|
87
|
+
if (!controls) {
|
|
88
|
+
return undefined;
|
|
89
|
+
}
|
|
90
|
+
const descriptor = readTextMotionControlsDescriptor(controls);
|
|
91
|
+
return descriptor.subscribe(command => {
|
|
92
|
+
applyNativeTextOwnedPlaybackCommand(command, playbackState.current);
|
|
93
|
+
});
|
|
94
|
+
}, [controls]);
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=nativeTextControls.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useLayoutEffect","useRef","cancelAnimation","readTextMotionControlsDescriptor","clampTextMotionProgress","resetOwnedProgress","progress","renderFinalState","value","stopOwnedProgress","replayOwnedProgress","createProgressAnimation","tokenMotion","playOwnedProgress","currentProgress","delayMs","playbackCommandHandlers","play","replay","reset","stop","applyNativeTextOwnedPlaybackCommand","command","options","kind","useNativeTextControlsPlayback","controls","playbackState","current","undefined","descriptor","subscribe"],"sourceRoot":"../../../src","sources":["renderers/nativeTextControls.ts"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