@rocapine/react-native-onboarding 1.55.1 → 1.56.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.
@@ -0,0 +1,89 @@
1
+ import { z } from "zod";
2
+ import {
3
+ BaseBoxProps,
4
+ BaseBoxPropsSchema,
5
+ type AnimationEasing,
6
+ type EnteringPreset,
7
+ type SpringConfig,
8
+ AnimationEasingSchema,
9
+ EnteringPresetSchema,
10
+ SpringConfigSchema,
11
+ } from "./BaseBoxProps";
12
+
13
+ /**
14
+ * Reveals its text content **one character at a time** with a staggered
15
+ * entering animation — the classic typewriter / staggered-headline effect.
16
+ *
17
+ * Each character mounts its own reanimated entering animation; the per-character
18
+ * `delay` is `delay + charIndex * stagger`, so characters appear in sequence.
19
+ * This is distinct from the whole-block `animation.entering` every element
20
+ * already gets via `BaseBoxProps` (which fades the *entire* string at once), and
21
+ * from `AnimatedText` (an animated number counter).
22
+ *
23
+ * `preset`/`duration`/`delay`/`easing`/`spring` map 1:1 to the reanimated
24
+ * entering-builder modifiers, exactly like `BaseBoxProps.animation.entering`.
25
+ * `stagger` is the typewriter knob — the gap (ms) between consecutive characters.
26
+ */
27
+ export type TypewriterTextElementProps = BaseBoxProps & {
28
+ /**
29
+ * The text to reveal. In `expression` mode `{{variable}}` interpolation runs
30
+ * before the string is split into characters. Plain string only (no spans).
31
+ */
32
+ content: string;
33
+ mode?: "plain" | "expression";
34
+ /** Reanimated entering builder applied per character. Default `"FadeInDown"`. */
35
+ preset?: EnteringPreset;
36
+ /** Per-character animation length in ms (reanimated `.duration()`). Default 400. */
37
+ duration?: number;
38
+ /** Lead-in delay (ms) before the first character animates. Default 0. */
39
+ delay?: number;
40
+ /** Gap in ms between consecutive characters — the stagger step. Default 45. */
41
+ stagger?: number;
42
+ /** Easing for the per-character animation. Ignored when `spring` is set. */
43
+ easing?: AnimationEasing;
44
+ /** Spring config (reanimated `.springify()`); wins over `easing` when present. */
45
+ spring?: SpringConfig;
46
+ /** Replay the reveal on a loop (remounts the characters each cycle). Default false. */
47
+ loop?: boolean;
48
+ /** Pause in ms between loop cycles (only when `loop`). Default 1200. */
49
+ loopDelay?: number;
50
+ /** Show a blinking typewriter caret after the text. Default false. */
51
+ cursor?: boolean;
52
+ /** Caret glyph when `cursor` is on. Default "|". */
53
+ cursorChar?: string;
54
+ fontSize?: number;
55
+ fontWeight?: string;
56
+ /**
57
+ * Font family name. Omit or set to `"inherit"` to inherit from
58
+ * `theme.typography.defaultFontFamily`.
59
+ */
60
+ fontFamily?: string | "inherit";
61
+ fontStyle?: "normal" | "italic";
62
+ color?: string;
63
+ textAlign?: "left" | "center" | "right";
64
+ letterSpacing?: number;
65
+ lineHeight?: number;
66
+ };
67
+
68
+ export const TypewriterTextElementPropsSchema = BaseBoxPropsSchema.extend({
69
+ content: z.string(),
70
+ mode: z.enum(["plain", "expression"]).optional(),
71
+ preset: EnteringPresetSchema.optional(),
72
+ duration: z.number().min(0).optional(),
73
+ delay: z.number().min(0).optional(),
74
+ stagger: z.number().min(0).optional(),
75
+ easing: AnimationEasingSchema.optional(),
76
+ spring: SpringConfigSchema.optional(),
77
+ loop: z.boolean().optional(),
78
+ loopDelay: z.number().min(0).optional(),
79
+ cursor: z.boolean().optional(),
80
+ cursorChar: z.string().optional(),
81
+ fontSize: z.number().optional(),
82
+ fontWeight: z.string().optional(),
83
+ fontFamily: z.string().optional(),
84
+ fontStyle: z.enum(["normal", "italic"]).optional(),
85
+ color: z.string().optional(),
86
+ textAlign: z.enum(["left", "center", "right"]).optional(),
87
+ letterSpacing: z.number().optional(),
88
+ lineHeight: z.number().optional(),
89
+ });
@@ -34,6 +34,7 @@ import {
34
34
  } from "./elements/KeyboardAvoidingViewElement";
35
35
  import { type ProgressIndicatorElementProps, ProgressIndicatorElementPropsSchema } from "./elements/ProgressIndicatorElement";
36
36
  import { type AnimatedTextElementProps, AnimatedTextElementPropsSchema } from "./elements/AnimatedTextElement";
37
+ import { type TypewriterTextElementProps, TypewriterTextElementPropsSchema } from "./elements/TypewriterTextElement";
37
38
  import { type DrawingPadElementProps, DrawingPadElementPropsSchema } from "./elements/DrawingPadElement";
38
39
  import { type SliderElementProps, SliderElementPropsSchema } from "./elements/SliderElement";
39
40
 
@@ -88,6 +89,7 @@ export type {
88
89
  } from "./elements/KeyboardAvoidingViewElement";
89
90
  export type { ProgressIndicatorElementProps, ProgressEasing } from "./elements/ProgressIndicatorElement";
90
91
  export type { AnimatedTextElementProps } from "./elements/AnimatedTextElement";
92
+ export type { TypewriterTextElementProps } from "./elements/TypewriterTextElement";
91
93
  export type { DrawingPadElementProps } from "./elements/DrawingPadElement";
92
94
  export type { SliderElementProps } from "./elements/SliderElement";
93
95
 
@@ -272,6 +274,13 @@ type UIElement =
272
274
  type: "AnimatedText";
273
275
  props: AnimatedTextElementProps;
274
276
  }
277
+ | {
278
+ id: string;
279
+ name?: string;
280
+ renderWhen?: LeafCondition | ConditionGroup;
281
+ type: "TypewriterText";
282
+ props: TypewriterTextElementProps;
283
+ }
275
284
  | {
276
285
  id: string;
277
286
  name?: string;
@@ -455,6 +464,13 @@ const UIElementSchema: z.ZodType<UIElement> = z.lazy(() =>
455
464
  type: z.literal("AnimatedText"),
456
465
  props: AnimatedTextElementPropsSchema,
457
466
  }),
467
+ z.object({
468
+ id: z.string(),
469
+ name: z.string().optional(),
470
+ renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
471
+ type: z.literal("TypewriterText"),
472
+ props: TypewriterTextElementPropsSchema,
473
+ }),
458
474
  z.object({
459
475
  id: z.string(),
460
476
  name: z.string().optional(),