@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,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,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
|
|
@@ -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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["effectDescriptors","WeakMap","timelineDescriptors","splitterDescriptors","rendererDescriptors","attachTextMotionEffectDescriptor","effect","descriptor","set","readTextMotionEffectDescriptor","get","Error","flattenTextMotionEffectDescriptors","effects","flatMap","createTextMotionTimelineHandle","timeline","readTextMotionTimelineDescriptor","createTextMotionSplitterHandle","splitter","readTextMotionSplitterDescriptor","createTextMotionRendererHandle","renderer","readTextMotionRendererDescriptor"],"sourceRoot":"../../../src","sources":["recipe/descriptors.ts"],"mappings":";;AAyBA,MAAMA,iBAAiB,GAAG,IAAIC,OAAO,CAAqD,CAAC;AAC3F,MAAMC,mBAAmB,GAAG,IAAID,OAAO,CAA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AQ,GAAG,CAAC,CAA6B;EAC/ChB,mBAAmB,CAACK,GAAG,CAACW,QAAQ,EAAEZ,UAAU,CAAC;EAE7C,OAAOY,QAAQ;AACjB;AAEA,OAAO,SAASC,gCAAgCA,CAC9CD,QAAkC,EACE;EACpC,MAAMZ,UAAU,GAAGJ,mBAAmB,CAACO,GAAG,CAACS,QAAQ,CAAC;EAEpD,IAAIZ,UAAU,EAAE;IACd,OAAOA,UAAU;EACnB;EAEA,MAAM,IAAII,KAAK,CAAC,2EAA2E,CAAC;AAC9F;AAEA,OAAO,SAASU,8BAA8BA,CAK5Cd,UAA0E,EACd;EAC5D,MAAMe,QAAQ,GAAG,CAAC,CAA+D;EACjFlB,mBAAmB,CAACI,GAAG,CACrBc,QAAQ,EACRf,UACF,CAAC;EAED,OAAOe,QAAQ;AACjB;AAEA,OAAO,SAASC,gCAAgCA,CAI9CD,QAAkD,EACE;EACpD,MAAMf,UAAU,GAAGH,mBAAmB,CAACM,GAAG,CAACY,QAAQ,CAAC;EAEpD,IAAIf,UAAU,EAAE;IACd,OAAOA,UAAU;EACnB;EAEA,MAAM,IAAII,KAAK,CAAC,2EAA2E,CAAC;AAC9F","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createTextMotionComponent","defineTextMotion"],"sourceRoot":"../../../src","sources":["recipe/index.ts"],"mappings":";;AAAA,SAASA,yBAAyB,QAAQ,gBAAa;AACvD,SAASC,gBAAgB,QAAQ,uBAAoB","ignoreList":[]}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { createTextMotionComponent } from "./component.js";
|
|
4
|
+
|
|
5
|
+
/** Builder state before a renderer has been selected. */
|
|
6
|
+
|
|
7
|
+
/** Builder state after a splitter has been selected before renderer layout. */
|
|
8
|
+
|
|
9
|
+
/** Builder state after a renderer has been selected. */
|
|
10
|
+
|
|
11
|
+
/** Builder state after a splittable renderer and splitter have been selected. */
|
|
12
|
+
|
|
13
|
+
/** Builder state after a rendered-line renderer has been selected. */
|
|
14
|
+
|
|
15
|
+
function cloneTimingOptions(options) {
|
|
16
|
+
return options ? {
|
|
17
|
+
...options
|
|
18
|
+
} : undefined;
|
|
19
|
+
}
|
|
20
|
+
function cloneSpringOptions(options) {
|
|
21
|
+
if (!options) {
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
if (options.clamp) {
|
|
25
|
+
return {
|
|
26
|
+
...options,
|
|
27
|
+
clamp: {
|
|
28
|
+
...options.clamp
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
...options
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function cloneAccessibilityPolicy(accessibility) {
|
|
37
|
+
return accessibility ? {
|
|
38
|
+
...accessibility
|
|
39
|
+
} : undefined;
|
|
40
|
+
}
|
|
41
|
+
function validateMotionOptionValue(kind, path, value) {
|
|
42
|
+
if (typeof value === 'number' && Number.isFinite(value)) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
if (typeof value === 'number') {
|
|
46
|
+
throw new Error(`@react-native-motion-kit/text-motion ${kind} motion option "${path}" must be a finite number.`);
|
|
47
|
+
}
|
|
48
|
+
if (Array.isArray(value)) {
|
|
49
|
+
value.forEach((item, index) => validateMotionOptionValue(kind, `${path}[${index}]`, item));
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
if (value && typeof value === 'object') {
|
|
53
|
+
Object.entries(value).forEach(([key, nestedValue]) => validateMotionOptionValue(kind, `${path}.${key}`, nestedValue));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function validateMotionConfig(motion) {
|
|
57
|
+
if (motion.kind === 'spring') {
|
|
58
|
+
if (motion.options) {
|
|
59
|
+
validateMotionOptionValue(motion.kind, 'options', motion.options);
|
|
60
|
+
}
|
|
61
|
+
return {
|
|
62
|
+
kind: 'spring',
|
|
63
|
+
options: cloneSpringOptions(motion.options)
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
if (motion.kind === 'timing') {
|
|
67
|
+
if (motion.options) {
|
|
68
|
+
validateMotionOptionValue(motion.kind, 'options', motion.options);
|
|
69
|
+
}
|
|
70
|
+
return {
|
|
71
|
+
kind: 'timing',
|
|
72
|
+
options: cloneTimingOptions(motion.options)
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
throw new Error('@react-native-motion-kit/text-motion motion kind must be "timing" or "spring".');
|
|
76
|
+
}
|
|
77
|
+
function cloneMotionConfig(motion) {
|
|
78
|
+
return motion ? validateMotionConfig(motion) : undefined;
|
|
79
|
+
}
|
|
80
|
+
function cloneDraft(draft) {
|
|
81
|
+
return {
|
|
82
|
+
...draft,
|
|
83
|
+
accessibility: cloneAccessibilityPolicy(draft.accessibility),
|
|
84
|
+
effects: [...draft.effects],
|
|
85
|
+
motion: cloneMotionConfig(draft.motion)
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
class TextMotionRecipeBuilderImpl {
|
|
89
|
+
constructor(draft = {}) {
|
|
90
|
+
this.draft = {
|
|
91
|
+
effects: draft.effects ? [...draft.effects] : [],
|
|
92
|
+
splitter: draft.splitter,
|
|
93
|
+
renderer: draft.renderer,
|
|
94
|
+
timeline: draft.timeline,
|
|
95
|
+
motion: draft.motion,
|
|
96
|
+
accessibility: draft.accessibility
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/** Choose how the input string is split into tokens. */
|
|
101
|
+
split(splitter) {
|
|
102
|
+
return new TextMotionRecipeBuilderImpl({
|
|
103
|
+
...cloneDraft(this.draft),
|
|
104
|
+
splitter
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/** Choose the renderer responsible for measuring and drawing tokens. */
|
|
109
|
+
layout(renderer) {
|
|
110
|
+
return new TextMotionRecipeBuilderImpl({
|
|
111
|
+
...cloneDraft(this.draft),
|
|
112
|
+
renderer
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/** Choose the timing strategy for token delays. */
|
|
117
|
+
timeline(timeline) {
|
|
118
|
+
return new TextMotionRecipeBuilderImpl({
|
|
119
|
+
...cloneDraft(this.draft),
|
|
120
|
+
timeline
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/** Add an effect that is compatible with the selected renderer. */
|
|
125
|
+
effect(effect) {
|
|
126
|
+
return new TextMotionRecipeBuilderImpl({
|
|
127
|
+
...cloneDraft(this.draft),
|
|
128
|
+
effects: [...this.draft.effects, effect]
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/** Configure the Reanimated motion primitive used by the renderer. */
|
|
133
|
+
motion(motion) {
|
|
134
|
+
return new TextMotionRecipeBuilderImpl({
|
|
135
|
+
...cloneDraft(this.draft),
|
|
136
|
+
motion: validateMotionConfig(motion)
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/** Configure accessibility behavior such as reduced motion and token hiding. */
|
|
141
|
+
accessibility(accessibility) {
|
|
142
|
+
return new TextMotionRecipeBuilderImpl({
|
|
143
|
+
...cloneDraft(this.draft),
|
|
144
|
+
accessibility
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/** Return the immutable recipe config. */
|
|
149
|
+
recipe() {
|
|
150
|
+
return cloneDraft(this.draft);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/** Create a React component from the current recipe. */
|
|
154
|
+
component() {
|
|
155
|
+
return createTextMotionComponent(cloneDraft(this.draft));
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/** @internal */
|
|
160
|
+
export function createTextMotionRecipeBuilder() {
|
|
161
|
+
return new TextMotionRecipeBuilderImpl();
|
|
162
|
+
}
|
|
163
|
+
//# sourceMappingURL=recipe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createTextMotionComponent","cloneTimingOptions","options","undefined","cloneSpringOptions","clamp","cloneAccessibilityPolicy","accessibility","validateMotionOptionValue","kind","path","value","Number","isFinite","Error","Array","isArray","forEach","item","index","Object","entries","key","nestedValue","validateMotionConfig","motion","cloneMotionConfig","cloneDraft","draft","effects","TextMotionRecipeBuilderImpl","constructor","splitter","renderer","timeline","split","layout","effect","recipe","component","createTextMotionRecipeBuilder"],"sourceRoot":"../../../src","sources":["recipe/recipe.ts"],"mappings":";;AAkBA,SAASA,yBAAyB,QAAQ,gBAAa;;AAoDvD;;AAqBA;;AAgBA;;AAwBA;;AAmBA;;AAqBA,SAASC,kBAAkBA,CACzBC,OAAuE,EACvE;EACA,OAAOA,OAAO,GAAG;IAAE,GAAGA;EAAQ,CAAC,GAAGC,SAAS;AAC7C;AAEA,SAASC,kBAAkBA,CACzBF,OAAuE,EACvE;EACA,IAAI,CAACA,OAAO,EAAE;IACZ,OAAOC,SAAS;EAClB;EAEA,IAAID,OAAO,CAACG,KAAK,EAAE;IACjB,OAAO;MACL,GAAGH,OAAO;MACVG,KAAK,EAAE;QAAE,GAAGH,OAAO,CAACG;MAAM;IAC5B,CAAC;EACH;EAEA,OAAO;IAAE,GAAGH;EAAQ,CAAC;AACvB;AAEA,SAASI,wBAAwBA,CAC/BC,aAAwD,EACb;EAC3C,OAAOA,aAAa,GAAG;IAAE,GAAGA;EAAc,CAAC,GAAGJ,SAAS;AACzD;AAEA,SAASK,yBAAyBA,CAChCC,IAAoC,EACpCC,IAAY,EACZC,KAAc,EACR;EACN,IAAI,OAAOA,KAAK,KAAK,QAAQ,IAAIC,MAAM,CAACC,QAAQ,CAACF,KAAK,CAAC,EAAE;IACvD;EACF;EAEA,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IAC7B,MAAM,IAAIG,KAAK,CACb,wCAAwCL,IAAI,mBAAmBC,IAAI,4BACrE,CAAC;EACH;EAEA,IAAIK,KAAK,CAACC,OAAO,CAACL,KAAK,CAAC,E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AAU,CAAC,IAAI,CAACC,KAAK,CAAC;MACzBC,OAAO,EAAE,CAAC,GAAG,IAAI,CAACD,KAAK,CAACC,OAAO,EAAEQ,MAAM;IACzC,CAAC,CAAC;EACJ;;EAEA;EACAZ,MAAMA,CAACA,MAA8B,EAAqD;IACxF,OAAO,IAAIK,2BAA2B,CAAuB;MAC3D,GAAGH,UAAU,CAAC,IAAI,CAACC,KAAK,CAAC;MACzBH,MAAM,EAAED,oBAAoB,CAACC,MAAM;IACrC,CAAC,CAAC;EACJ;;EAEA;EACAlB,aAAaA,CACXA,aAA4C,EACO;IACnD,OAAO,IAAIuB,2BAA2B,CAAuB;MAC3D,GAAGH,UAAU,CAAC,IAAI,CAACC,KAAK,CAAC;MACzBrB;IACF,CAAC,CAAC;EACJ;;EAEA;EACA+B,MAAMA,CAAA,EAAiD;IACrD,OAAOX,UAAU,CAAC,IAAI,CAACC,KAAK,CAAC;EAC/B;;EAEA;EACAW,SAASA,CAAA,EAAwB;IAC/B,OAAOvC,yBAAyB,CAAC2B,UAAU,CAAC,IAAI,CAACC,KAAK,CAAC,CAAC;EAC1D;AACF;;AAEA;AACA,OAAO,SAASY,6BAA6BA,CAAA,EAA4B;EACvE,OAAO,IAAIV,2BAA2B,CAAC,CAAC;AAC1C","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["nativeText","overlayText"],"sourceRoot":"../../../src","sources":["renderers/index.ts"],"mappings":";;AAAA,SAASA,UAAU,QAAwC,iBAAc;AACzE,SAASC,WAAW,QAAyC,kBAAe","ignoreList":[]}
|