@rocapine/react-native-onboarding 1.59.2 → 1.61.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.
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/infra/navigation/expoRouterAdapter.js +1 -1
- package/dist/infra/navigation/expoRouterAdapter.js.map +1 -1
- package/dist/infra/provider/OnboardingProvider.d.ts +12 -1
- package/dist/infra/provider/OnboardingProvider.d.ts.map +1 -1
- package/dist/infra/provider/OnboardingProvider.js +15 -1
- package/dist/infra/provider/OnboardingProvider.js.map +1 -1
- package/dist/products/adapters/expoIap.d.ts +4 -0
- package/dist/products/adapters/expoIap.d.ts.map +1 -0
- package/dist/products/adapters/expoIap.js +95 -0
- package/dist/products/adapters/expoIap.js.map +1 -0
- package/dist/products/adapters/revenueCat.d.ts +7 -0
- package/dist/products/adapters/revenueCat.d.ts.map +1 -0
- package/dist/products/adapters/revenueCat.js +116 -0
- package/dist/products/adapters/revenueCat.js.map +1 -0
- package/dist/products/adapters/stub.d.ts +8 -0
- package/dist/products/adapters/stub.d.ts.map +1 -0
- package/dist/products/adapters/stub.js +21 -0
- package/dist/products/adapters/stub.js.map +1 -0
- package/dist/products/derive.d.ts +19 -0
- package/dist/products/derive.d.ts.map +1 -0
- package/dist/products/derive.js +79 -0
- package/dist/products/derive.js.map +1 -0
- package/dist/products/duration.d.ts +3 -0
- package/dist/products/duration.d.ts.map +1 -0
- package/dist/products/duration.js +25 -0
- package/dist/products/duration.js.map +1 -0
- package/dist/products/index.d.ts +9 -0
- package/dist/products/index.d.ts.map +1 -0
- package/dist/products/index.js +20 -0
- package/dist/products/index.js.map +1 -0
- package/dist/products/toVariables.d.ts +18 -0
- package/dist/products/toVariables.d.ts.map +1 -0
- package/dist/products/toVariables.js +52 -0
- package/dist/products/toVariables.js.map +1 -0
- package/dist/products/types.d.ts +96 -0
- package/dist/products/types.d.ts.map +1 -0
- package/dist/products/types.js +3 -0
- package/dist/products/types.js.map +1 -0
- package/dist/products/useProducts.d.ts +12 -0
- package/dist/products/useProducts.d.ts.map +1 -0
- package/dist/products/useProducts.js +90 -0
- package/dist/products/useProducts.js.map +1 -0
- package/dist/{steps/ComposableScreen → screens}/elements/AnimatedTextElement.d.ts +1 -24
- package/dist/screens/elements/AnimatedTextElement.d.ts.map +1 -0
- package/dist/screens/elements/AnimatedTextElement.js.map +1 -0
- package/dist/{steps/ComposableScreen → screens}/elements/BaseBoxProps.d.ts +2 -25
- package/dist/screens/elements/BaseBoxProps.d.ts.map +1 -0
- package/dist/{steps/ComposableScreen → screens}/elements/BaseBoxProps.js +1 -1
- package/dist/screens/elements/BaseBoxProps.js.map +1 -0
- package/dist/{steps/ComposableScreen → screens}/elements/ButtonElement.d.ts +8 -123
- package/dist/screens/elements/ButtonElement.d.ts.map +1 -0
- package/dist/{steps/ComposableScreen → screens}/elements/ButtonElement.js +2 -2
- package/dist/screens/elements/ButtonElement.js.map +1 -0
- package/dist/{steps/ComposableScreen → screens}/elements/CarouselElement.d.ts +1 -24
- package/dist/screens/elements/CarouselElement.d.ts.map +1 -0
- package/dist/screens/elements/CarouselElement.js.map +1 -0
- package/dist/{steps/ComposableScreen → screens}/elements/CheckboxGroupElement.d.ts +2 -25
- package/dist/screens/elements/CheckboxGroupElement.d.ts.map +1 -0
- package/dist/{steps/ComposableScreen → screens}/elements/CheckboxGroupElement.js +1 -1
- package/dist/screens/elements/CheckboxGroupElement.js.map +1 -0
- package/dist/{steps/ComposableScreen → screens}/elements/DatePickerElement.d.ts +1 -24
- package/dist/screens/elements/DatePickerElement.d.ts.map +1 -0
- package/dist/screens/elements/DatePickerElement.js.map +1 -0
- package/dist/{steps/ComposableScreen → screens}/elements/DrawingPadElement.d.ts +1 -24
- package/dist/screens/elements/DrawingPadElement.d.ts.map +1 -0
- package/dist/screens/elements/DrawingPadElement.js.map +1 -0
- package/dist/{steps/ComposableScreen → screens}/elements/IconElement.d.ts +1 -24
- package/dist/screens/elements/IconElement.d.ts.map +1 -0
- package/dist/screens/elements/IconElement.js.map +1 -0
- package/dist/{steps/ComposableScreen → screens}/elements/ImageElement.d.ts +1 -24
- package/dist/screens/elements/ImageElement.d.ts.map +1 -0
- package/dist/screens/elements/ImageElement.js.map +1 -0
- package/dist/{steps/ComposableScreen → screens}/elements/InputElement.d.ts +1 -24
- package/dist/screens/elements/InputElement.d.ts.map +1 -0
- package/dist/screens/elements/InputElement.js.map +1 -0
- package/dist/{steps/ComposableScreen → screens}/elements/KeyboardAvoidingViewElement.d.ts +1 -24
- package/dist/screens/elements/KeyboardAvoidingViewElement.d.ts.map +1 -0
- package/dist/screens/elements/KeyboardAvoidingViewElement.js.map +1 -0
- package/dist/{steps/ComposableScreen → screens}/elements/LottieElement.d.ts +1 -24
- package/dist/screens/elements/LottieElement.d.ts.map +1 -0
- package/dist/screens/elements/LottieElement.js.map +1 -0
- package/dist/{steps/ComposableScreen → screens}/elements/ProgressIndicatorElement.d.ts +1 -24
- package/dist/screens/elements/ProgressIndicatorElement.d.ts.map +1 -0
- package/dist/screens/elements/ProgressIndicatorElement.js.map +1 -0
- package/dist/{steps/ComposableScreen → screens}/elements/ProgressiveBlurImageElement.d.ts +1 -24
- package/dist/screens/elements/ProgressiveBlurImageElement.d.ts.map +1 -0
- package/dist/screens/elements/ProgressiveBlurImageElement.js.map +1 -0
- package/dist/{steps/ComposableScreen → screens}/elements/RadioGroupElement.d.ts +2 -25
- package/dist/screens/elements/RadioGroupElement.d.ts.map +1 -0
- package/dist/{steps/ComposableScreen → screens}/elements/RadioGroupElement.js +1 -1
- package/dist/screens/elements/RadioGroupElement.js.map +1 -0
- package/dist/{steps/ComposableScreen → screens}/elements/RichTextElement.d.ts +1 -24
- package/dist/screens/elements/RichTextElement.d.ts.map +1 -0
- package/dist/screens/elements/RichTextElement.js.map +1 -0
- package/dist/{steps/ComposableScreen → screens}/elements/RiveElement.d.ts +1 -24
- package/dist/screens/elements/RiveElement.d.ts.map +1 -0
- package/dist/screens/elements/RiveElement.js.map +1 -0
- package/dist/{steps/ComposableScreen → screens}/elements/SafeAreaViewElement.d.ts +1 -24
- package/dist/screens/elements/SafeAreaViewElement.d.ts.map +1 -0
- package/dist/screens/elements/SafeAreaViewElement.js.map +1 -0
- package/dist/{steps/ComposableScreen → screens}/elements/ScrollViewElement.d.ts +1 -24
- package/dist/screens/elements/ScrollViewElement.d.ts.map +1 -0
- package/dist/screens/elements/ScrollViewElement.js.map +1 -0
- package/dist/{steps/ComposableScreen → screens}/elements/SliderElement.d.ts +1 -24
- package/dist/screens/elements/SliderElement.d.ts.map +1 -0
- package/dist/screens/elements/SliderElement.js.map +1 -0
- package/dist/{steps/ComposableScreen → screens}/elements/StackElement.d.ts +1 -24
- package/dist/screens/elements/StackElement.d.ts.map +1 -0
- package/dist/screens/elements/StackElement.js.map +1 -0
- package/dist/{steps/ComposableScreen → screens}/elements/TextElement.d.ts +1 -24
- package/dist/screens/elements/TextElement.d.ts.map +1 -0
- package/dist/screens/elements/TextElement.js.map +1 -0
- package/dist/{steps/ComposableScreen → screens}/elements/TypewriterTextElement.d.ts +1 -24
- package/dist/screens/elements/TypewriterTextElement.d.ts.map +1 -0
- package/dist/screens/elements/TypewriterTextElement.js.map +1 -0
- package/dist/{steps/ComposableScreen → screens}/elements/VideoElement.d.ts +1 -24
- package/dist/screens/elements/VideoElement.d.ts.map +1 -0
- package/dist/screens/elements/VideoElement.js.map +1 -0
- package/dist/{steps/ComposableScreen → screens}/elements/WheelPickerElement.d.ts +1 -24
- package/dist/screens/elements/WheelPickerElement.d.ts.map +1 -0
- package/dist/screens/elements/WheelPickerElement.js.map +1 -0
- package/dist/{steps/ComposableScreen → screens}/elements/ZStackElement.d.ts +1 -24
- package/dist/screens/elements/ZStackElement.d.ts.map +1 -0
- package/dist/screens/elements/ZStackElement.js.map +1 -0
- package/dist/screens/types.d.ts +242 -0
- package/dist/screens/types.d.ts.map +1 -0
- package/dist/screens/types.js +272 -0
- package/dist/screens/types.js.map +1 -0
- package/dist/steps/Carousel/types.d.ts +1 -1
- package/dist/steps/Commitment/types.d.ts +1 -1
- package/dist/steps/ComposableScreen/types.d.ts +5 -236
- package/dist/steps/ComposableScreen/types.d.ts.map +1 -1
- package/dist/steps/ComposableScreen/types.js +23 -262
- package/dist/steps/ComposableScreen/types.js.map +1 -1
- package/dist/steps/Loader/types.d.ts +1 -1
- package/dist/steps/MediaContent/types.d.ts +1 -1
- package/dist/steps/Picker/types.d.ts +1 -1
- package/dist/steps/Question/types.d.ts +1 -1
- package/dist/steps/Ratings/types.d.ts +1 -1
- package/dist/steps/common.types.d.ts +23 -30
- package/dist/steps/common.types.d.ts.map +1 -1
- package/dist/steps/common.types.js +18 -3
- package/dist/steps/common.types.js.map +1 -1
- package/package.json +3 -3
- package/src/__tests__/productAdapters.test.ts +58 -0
- package/src/__tests__/productDerive.test.ts +111 -0
- package/src/__tests__/productVariables.test.ts +109 -0
- package/src/__tests__/screenTypesBackCompat.test.ts +58 -0
- package/src/index.ts +2 -0
- package/src/infra/navigation/expoRouterAdapter.ts +1 -1
- package/src/infra/provider/OnboardingProvider.tsx +29 -0
- package/src/products/adapters/expoIap.ts +93 -0
- package/src/products/adapters/revenueCat.ts +108 -0
- package/src/products/adapters/stub.ts +20 -0
- package/src/products/derive.ts +93 -0
- package/src/products/duration.ts +21 -0
- package/src/products/index.ts +19 -0
- package/src/products/toVariables.ts +54 -0
- package/src/products/types.ts +88 -0
- package/src/products/useProducts.ts +106 -0
- package/src/{steps/ComposableScreen → screens}/elements/BaseBoxProps.ts +1 -1
- package/src/{steps/ComposableScreen → screens}/elements/ButtonElement.ts +2 -2
- package/src/{steps/ComposableScreen → screens}/elements/CheckboxGroupElement.ts +1 -1
- package/src/{steps/ComposableScreen → screens}/elements/RadioGroupElement.ts +1 -1
- package/src/screens/types.ts +535 -0
- package/src/steps/ComposableScreen/types.ts +9 -528
- package/src/steps/common.types.ts +50 -6
- package/dist/steps/ComposableScreen/elements/AnimatedTextElement.d.ts.map +0 -1
- package/dist/steps/ComposableScreen/elements/AnimatedTextElement.js.map +0 -1
- package/dist/steps/ComposableScreen/elements/BaseBoxProps.d.ts.map +0 -1
- package/dist/steps/ComposableScreen/elements/BaseBoxProps.js.map +0 -1
- package/dist/steps/ComposableScreen/elements/ButtonElement.d.ts.map +0 -1
- package/dist/steps/ComposableScreen/elements/ButtonElement.js.map +0 -1
- package/dist/steps/ComposableScreen/elements/CarouselElement.d.ts.map +0 -1
- package/dist/steps/ComposableScreen/elements/CarouselElement.js.map +0 -1
- package/dist/steps/ComposableScreen/elements/CheckboxGroupElement.d.ts.map +0 -1
- package/dist/steps/ComposableScreen/elements/CheckboxGroupElement.js.map +0 -1
- package/dist/steps/ComposableScreen/elements/DatePickerElement.d.ts.map +0 -1
- package/dist/steps/ComposableScreen/elements/DatePickerElement.js.map +0 -1
- package/dist/steps/ComposableScreen/elements/DrawingPadElement.d.ts.map +0 -1
- package/dist/steps/ComposableScreen/elements/DrawingPadElement.js.map +0 -1
- package/dist/steps/ComposableScreen/elements/IconElement.d.ts.map +0 -1
- package/dist/steps/ComposableScreen/elements/IconElement.js.map +0 -1
- package/dist/steps/ComposableScreen/elements/ImageElement.d.ts.map +0 -1
- package/dist/steps/ComposableScreen/elements/ImageElement.js.map +0 -1
- package/dist/steps/ComposableScreen/elements/InputElement.d.ts.map +0 -1
- package/dist/steps/ComposableScreen/elements/InputElement.js.map +0 -1
- package/dist/steps/ComposableScreen/elements/KeyboardAvoidingViewElement.d.ts.map +0 -1
- package/dist/steps/ComposableScreen/elements/KeyboardAvoidingViewElement.js.map +0 -1
- package/dist/steps/ComposableScreen/elements/LottieElement.d.ts.map +0 -1
- package/dist/steps/ComposableScreen/elements/LottieElement.js.map +0 -1
- package/dist/steps/ComposableScreen/elements/ProgressIndicatorElement.d.ts.map +0 -1
- package/dist/steps/ComposableScreen/elements/ProgressIndicatorElement.js.map +0 -1
- package/dist/steps/ComposableScreen/elements/ProgressiveBlurImageElement.d.ts.map +0 -1
- package/dist/steps/ComposableScreen/elements/ProgressiveBlurImageElement.js.map +0 -1
- package/dist/steps/ComposableScreen/elements/RadioGroupElement.d.ts.map +0 -1
- package/dist/steps/ComposableScreen/elements/RadioGroupElement.js.map +0 -1
- package/dist/steps/ComposableScreen/elements/RichTextElement.d.ts.map +0 -1
- package/dist/steps/ComposableScreen/elements/RichTextElement.js.map +0 -1
- package/dist/steps/ComposableScreen/elements/RiveElement.d.ts.map +0 -1
- package/dist/steps/ComposableScreen/elements/RiveElement.js.map +0 -1
- package/dist/steps/ComposableScreen/elements/SafeAreaViewElement.d.ts.map +0 -1
- package/dist/steps/ComposableScreen/elements/SafeAreaViewElement.js.map +0 -1
- package/dist/steps/ComposableScreen/elements/ScrollViewElement.d.ts.map +0 -1
- package/dist/steps/ComposableScreen/elements/ScrollViewElement.js.map +0 -1
- package/dist/steps/ComposableScreen/elements/SliderElement.d.ts.map +0 -1
- package/dist/steps/ComposableScreen/elements/SliderElement.js.map +0 -1
- package/dist/steps/ComposableScreen/elements/StackElement.d.ts.map +0 -1
- package/dist/steps/ComposableScreen/elements/StackElement.js.map +0 -1
- package/dist/steps/ComposableScreen/elements/TextElement.d.ts.map +0 -1
- package/dist/steps/ComposableScreen/elements/TextElement.js.map +0 -1
- package/dist/steps/ComposableScreen/elements/TypewriterTextElement.d.ts.map +0 -1
- package/dist/steps/ComposableScreen/elements/TypewriterTextElement.js.map +0 -1
- package/dist/steps/ComposableScreen/elements/VideoElement.d.ts.map +0 -1
- package/dist/steps/ComposableScreen/elements/VideoElement.js.map +0 -1
- package/dist/steps/ComposableScreen/elements/WheelPickerElement.d.ts.map +0 -1
- package/dist/steps/ComposableScreen/elements/WheelPickerElement.js.map +0 -1
- package/dist/steps/ComposableScreen/elements/ZStackElement.d.ts.map +0 -1
- package/dist/steps/ComposableScreen/elements/ZStackElement.js.map +0 -1
- /package/dist/{steps/ComposableScreen → screens}/elements/AnimatedTextElement.js +0 -0
- /package/dist/{steps/ComposableScreen → screens}/elements/CarouselElement.js +0 -0
- /package/dist/{steps/ComposableScreen → screens}/elements/DatePickerElement.js +0 -0
- /package/dist/{steps/ComposableScreen → screens}/elements/DrawingPadElement.js +0 -0
- /package/dist/{steps/ComposableScreen → screens}/elements/IconElement.js +0 -0
- /package/dist/{steps/ComposableScreen → screens}/elements/ImageElement.js +0 -0
- /package/dist/{steps/ComposableScreen → screens}/elements/InputElement.js +0 -0
- /package/dist/{steps/ComposableScreen → screens}/elements/KeyboardAvoidingViewElement.js +0 -0
- /package/dist/{steps/ComposableScreen → screens}/elements/LottieElement.js +0 -0
- /package/dist/{steps/ComposableScreen → screens}/elements/ProgressIndicatorElement.js +0 -0
- /package/dist/{steps/ComposableScreen → screens}/elements/ProgressiveBlurImageElement.js +0 -0
- /package/dist/{steps/ComposableScreen → screens}/elements/RichTextElement.js +0 -0
- /package/dist/{steps/ComposableScreen → screens}/elements/RiveElement.js +0 -0
- /package/dist/{steps/ComposableScreen → screens}/elements/SafeAreaViewElement.js +0 -0
- /package/dist/{steps/ComposableScreen → screens}/elements/ScrollViewElement.js +0 -0
- /package/dist/{steps/ComposableScreen → screens}/elements/SliderElement.js +0 -0
- /package/dist/{steps/ComposableScreen → screens}/elements/StackElement.js +0 -0
- /package/dist/{steps/ComposableScreen → screens}/elements/TextElement.js +0 -0
- /package/dist/{steps/ComposableScreen → screens}/elements/TypewriterTextElement.js +0 -0
- /package/dist/{steps/ComposableScreen → screens}/elements/VideoElement.js +0 -0
- /package/dist/{steps/ComposableScreen → screens}/elements/WheelPickerElement.js +0 -0
- /package/dist/{steps/ComposableScreen → screens}/elements/ZStackElement.js +0 -0
- /package/src/{steps/ComposableScreen → screens}/elements/AnimatedTextElement.ts +0 -0
- /package/src/{steps/ComposableScreen → screens}/elements/CarouselElement.ts +0 -0
- /package/src/{steps/ComposableScreen → screens}/elements/DatePickerElement.ts +0 -0
- /package/src/{steps/ComposableScreen → screens}/elements/DrawingPadElement.ts +0 -0
- /package/src/{steps/ComposableScreen → screens}/elements/IconElement.ts +0 -0
- /package/src/{steps/ComposableScreen → screens}/elements/ImageElement.ts +0 -0
- /package/src/{steps/ComposableScreen → screens}/elements/InputElement.ts +0 -0
- /package/src/{steps/ComposableScreen → screens}/elements/KeyboardAvoidingViewElement.ts +0 -0
- /package/src/{steps/ComposableScreen → screens}/elements/LottieElement.ts +0 -0
- /package/src/{steps/ComposableScreen → screens}/elements/ProgressIndicatorElement.ts +0 -0
- /package/src/{steps/ComposableScreen → screens}/elements/ProgressiveBlurImageElement.ts +0 -0
- /package/src/{steps/ComposableScreen → screens}/elements/RichTextElement.ts +0 -0
- /package/src/{steps/ComposableScreen → screens}/elements/RiveElement.ts +0 -0
- /package/src/{steps/ComposableScreen → screens}/elements/SafeAreaViewElement.ts +0 -0
- /package/src/{steps/ComposableScreen → screens}/elements/ScrollViewElement.ts +0 -0
- /package/src/{steps/ComposableScreen → screens}/elements/SliderElement.ts +0 -0
- /package/src/{steps/ComposableScreen → screens}/elements/StackElement.ts +0 -0
- /package/src/{steps/ComposableScreen → screens}/elements/TextElement.ts +0 -0
- /package/src/{steps/ComposableScreen → screens}/elements/TypewriterTextElement.ts +0 -0
- /package/src/{steps/ComposableScreen → screens}/elements/VideoElement.ts +0 -0
- /package/src/{steps/ComposableScreen → screens}/elements/WheelPickerElement.ts +0 -0
- /package/src/{steps/ComposableScreen → screens}/elements/ZStackElement.ts +0 -0
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
ConditionGroupSchema,
|
|
10
10
|
HapticStyleSchema,
|
|
11
11
|
ButtonActionSchema,
|
|
12
|
-
} from "../../common.types";
|
|
12
|
+
} from "../../steps/common.types";
|
|
13
13
|
|
|
14
14
|
// `ButtonAction` and its variants moved to `common.types.ts` (now shared with the
|
|
15
15
|
// generic `onPress` on BaseBoxProps). Re-exported here for back-compat.
|
|
@@ -18,7 +18,7 @@ export {
|
|
|
18
18
|
CustomButtonActionSchema,
|
|
19
19
|
type SetVariableButtonAction,
|
|
20
20
|
SetVariableButtonActionSchema,
|
|
21
|
-
} from "../../common.types";
|
|
21
|
+
} from "../../steps/common.types";
|
|
22
22
|
export type { ButtonAction };
|
|
23
23
|
export { ButtonActionSchema };
|
|
24
24
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { BaseBoxProps, BaseBoxPropsSchema, type ShadowOffset, ShadowOffsetSchema } from "./BaseBoxProps";
|
|
3
|
-
import { type HapticStyle, HapticStyleSchema } from "../../common.types";
|
|
3
|
+
import { type HapticStyle, HapticStyleSchema } from "../../steps/common.types";
|
|
4
4
|
|
|
5
5
|
export type CheckboxGroupElementProps = BaseBoxProps & {
|
|
6
6
|
variableName?: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { BaseBoxProps, BaseBoxPropsSchema, type ShadowOffset, ShadowOffsetSchema } from "./BaseBoxProps";
|
|
3
|
-
import { type HapticStyle, HapticStyleSchema } from "../../common.types";
|
|
3
|
+
import { type HapticStyle, HapticStyleSchema } from "../../steps/common.types";
|
|
4
4
|
|
|
5
5
|
export type RadioGroupElementProps = BaseBoxProps & {
|
|
6
6
|
variableName?: string;
|
|
@@ -0,0 +1,535 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import {
|
|
3
|
+
type LeafCondition,
|
|
4
|
+
type ConditionGroup,
|
|
5
|
+
LeafConditionSchema,
|
|
6
|
+
ConditionGroupSchema,
|
|
7
|
+
} from "../steps/common.types";
|
|
8
|
+
import { type StackElementProps, StackElementPropsSchema } from "./elements/StackElement";
|
|
9
|
+
import { type TextElementProps, TextElementPropsSchema } from "./elements/TextElement";
|
|
10
|
+
import { type RichTextElementProps, RichTextElementPropsSchema } from "./elements/RichTextElement";
|
|
11
|
+
import { type ImageElementProps, ImageElementPropsSchema } from "./elements/ImageElement";
|
|
12
|
+
import {
|
|
13
|
+
type ProgressiveBlurImageElementProps,
|
|
14
|
+
ProgressiveBlurImageElementPropsSchema,
|
|
15
|
+
} from "./elements/ProgressiveBlurImageElement";
|
|
16
|
+
import { type LottieElementProps, LottieElementPropsSchema } from "./elements/LottieElement";
|
|
17
|
+
import { type RiveElementProps, RiveElementPropsSchema } from "./elements/RiveElement";
|
|
18
|
+
import { type IconElementProps, IconElementPropsSchema } from "./elements/IconElement";
|
|
19
|
+
import { type VideoElementProps, VideoElementPropsSchema } from "./elements/VideoElement";
|
|
20
|
+
import { type InputElementProps, InputElementPropsSchema } from "./elements/InputElement";
|
|
21
|
+
import { type ButtonElementProps, ButtonElementPropsSchema } from "./elements/ButtonElement";
|
|
22
|
+
import { type RadioGroupElementProps, RadioGroupElementPropsSchema } from "./elements/RadioGroupElement";
|
|
23
|
+
import { type CheckboxGroupElementProps, CheckboxGroupElementPropsSchema } from "./elements/CheckboxGroupElement";
|
|
24
|
+
import { type DatePickerElementProps, DatePickerElementPropsSchema } from "./elements/DatePickerElement";
|
|
25
|
+
import { type WheelPickerElementProps, WheelPickerElementPropsSchema } from "./elements/WheelPickerElement";
|
|
26
|
+
import { type CarouselElementProps, CarouselElementPropsSchema } from "./elements/CarouselElement";
|
|
27
|
+
import { type ZStackElementProps, ZStackElementPropsSchema } from "./elements/ZStackElement";
|
|
28
|
+
import { type SafeAreaViewElementProps, SafeAreaViewElementPropsSchema } from "./elements/SafeAreaViewElement";
|
|
29
|
+
import { type ScrollViewElementProps, ScrollViewElementPropsSchema } from "./elements/ScrollViewElement";
|
|
30
|
+
import {
|
|
31
|
+
type KeyboardAvoidingViewElementProps,
|
|
32
|
+
KeyboardAvoidingViewElementPropsSchema,
|
|
33
|
+
} from "./elements/KeyboardAvoidingViewElement";
|
|
34
|
+
import { type ProgressIndicatorElementProps, ProgressIndicatorElementPropsSchema } from "./elements/ProgressIndicatorElement";
|
|
35
|
+
import { type AnimatedTextElementProps, AnimatedTextElementPropsSchema } from "./elements/AnimatedTextElement";
|
|
36
|
+
import { type TypewriterTextElementProps, TypewriterTextElementPropsSchema } from "./elements/TypewriterTextElement";
|
|
37
|
+
import { type DrawingPadElementProps, DrawingPadElementPropsSchema } from "./elements/DrawingPadElement";
|
|
38
|
+
import { type SliderElementProps, SliderElementPropsSchema } from "./elements/SliderElement";
|
|
39
|
+
|
|
40
|
+
export type { BaseBoxProps, GradientBackground, GradientEdge, GradientStop, LinearGradientConfig } from "./elements/BaseBoxProps";
|
|
41
|
+
export type {
|
|
42
|
+
AnimationEasing,
|
|
43
|
+
SpringConfig,
|
|
44
|
+
EnteringPreset,
|
|
45
|
+
ExitingPreset,
|
|
46
|
+
LayoutPreset,
|
|
47
|
+
EffectPreset,
|
|
48
|
+
EnteringAnimation,
|
|
49
|
+
ExitingAnimation,
|
|
50
|
+
LayoutAnimation,
|
|
51
|
+
ElementEffect,
|
|
52
|
+
ElementAnimation,
|
|
53
|
+
ElementTransform,
|
|
54
|
+
} from "./elements/BaseBoxProps";
|
|
55
|
+
export { BaseBoxPropsSchema, GradientBackgroundSchema } from "./elements/BaseBoxProps";
|
|
56
|
+
export type { StackElementProps } from "./elements/StackElement";
|
|
57
|
+
export type { TextElementProps, TextSpan } from "./elements/TextElement";
|
|
58
|
+
export { TextSpanSchema } from "./elements/TextElement";
|
|
59
|
+
export type { RichTextElementProps } from "./elements/RichTextElement";
|
|
60
|
+
export type { ImageElementProps } from "./elements/ImageElement";
|
|
61
|
+
export type {
|
|
62
|
+
ProgressiveBlurImageElementProps,
|
|
63
|
+
BlurMask,
|
|
64
|
+
LinearBlurMask,
|
|
65
|
+
RadialBlurMask,
|
|
66
|
+
BlurMaskStop,
|
|
67
|
+
BlurAppear,
|
|
68
|
+
} from "./elements/ProgressiveBlurImageElement";
|
|
69
|
+
export type { LottieElementProps } from "./elements/LottieElement";
|
|
70
|
+
export type { RiveElementProps } from "./elements/RiveElement";
|
|
71
|
+
export type { IconElementProps } from "./elements/IconElement";
|
|
72
|
+
export type { VideoElementProps } from "./elements/VideoElement";
|
|
73
|
+
export type { InputElementProps } from "./elements/InputElement";
|
|
74
|
+
export type { ButtonElementProps, ButtonAction, CustomButtonAction, SetVariableButtonAction } from "./elements/ButtonElement";
|
|
75
|
+
export { ButtonActionSchema, CustomButtonActionSchema, SetVariableButtonActionSchema } from "./elements/ButtonElement";
|
|
76
|
+
export type { RadioGroupElementProps } from "./elements/RadioGroupElement";
|
|
77
|
+
export type { CheckboxGroupElementProps } from "./elements/CheckboxGroupElement";
|
|
78
|
+
export type { DatePickerElementProps } from "./elements/DatePickerElement";
|
|
79
|
+
export type { WheelPickerElementProps, WheelPickerItem, WheelPickerRange } from "./elements/WheelPickerElement";
|
|
80
|
+
export { WheelPickerElementPropsSchema, generateWheelPickerRangeItems, resolveWheelPickerItems } from "./elements/WheelPickerElement";
|
|
81
|
+
export type { CarouselElementProps } from "./elements/CarouselElement";
|
|
82
|
+
export type { ZStackElementProps } from "./elements/ZStackElement";
|
|
83
|
+
export type { SafeAreaViewElementProps, SafeAreaEdge, SafeAreaEdgeMode } from "./elements/SafeAreaViewElement";
|
|
84
|
+
export type { ScrollViewElementProps, ScrollViewContentInset } from "./elements/ScrollViewElement";
|
|
85
|
+
export type {
|
|
86
|
+
KeyboardAvoidingViewElementProps,
|
|
87
|
+
KeyboardAvoidingBehavior,
|
|
88
|
+
} from "./elements/KeyboardAvoidingViewElement";
|
|
89
|
+
export type { ProgressIndicatorElementProps, ProgressEasing } from "./elements/ProgressIndicatorElement";
|
|
90
|
+
export type { AnimatedTextElementProps } from "./elements/AnimatedTextElement";
|
|
91
|
+
export type { TypewriterTextElementProps } from "./elements/TypewriterTextElement";
|
|
92
|
+
export type { DrawingPadElementProps } from "./elements/DrawingPadElement";
|
|
93
|
+
export type { SliderElementProps } from "./elements/SliderElement";
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Type tag for a ComposableScreen variable. Drives expression-mode coercion
|
|
97
|
+
* in `setVariable` action evaluation (int/float math vs string concat).
|
|
98
|
+
*/
|
|
99
|
+
export type ComposableVariableKind = "int" | "float" | "string";
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* A variable entry stored in the ComposableScreen variables map.
|
|
103
|
+
* `value` is the canonical value (always a string), `label` is an optional
|
|
104
|
+
* display label, `kind` optionally tags the underlying type.
|
|
105
|
+
*/
|
|
106
|
+
export type ComposableVariableEntry = {
|
|
107
|
+
value: string;
|
|
108
|
+
label?: string;
|
|
109
|
+
kind?: ComposableVariableKind;
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
// UIElement union — must live here (not in elements/) to avoid circular deps
|
|
113
|
+
// because the Stack variant's children: UIElement[] references itself.
|
|
114
|
+
export type UIElement =
|
|
115
|
+
| {
|
|
116
|
+
id: string;
|
|
117
|
+
name?: string;
|
|
118
|
+
renderWhen?: LeafCondition | ConditionGroup;
|
|
119
|
+
type: "YStack" | "XStack";
|
|
120
|
+
props: StackElementProps;
|
|
121
|
+
children: UIElement[];
|
|
122
|
+
}
|
|
123
|
+
| {
|
|
124
|
+
id: string;
|
|
125
|
+
name?: string;
|
|
126
|
+
renderWhen?: LeafCondition | ConditionGroup;
|
|
127
|
+
type: "Text";
|
|
128
|
+
props: TextElementProps;
|
|
129
|
+
}
|
|
130
|
+
| {
|
|
131
|
+
id: string;
|
|
132
|
+
name?: string;
|
|
133
|
+
renderWhen?: LeafCondition | ConditionGroup;
|
|
134
|
+
type: "RichText";
|
|
135
|
+
props: RichTextElementProps;
|
|
136
|
+
children: Array<Extract<UIElement, { type: "Text" }>>;
|
|
137
|
+
}
|
|
138
|
+
| {
|
|
139
|
+
id: string;
|
|
140
|
+
name?: string;
|
|
141
|
+
renderWhen?: LeafCondition | ConditionGroup;
|
|
142
|
+
type: "Image";
|
|
143
|
+
props: ImageElementProps;
|
|
144
|
+
}
|
|
145
|
+
| {
|
|
146
|
+
id: string;
|
|
147
|
+
name?: string;
|
|
148
|
+
renderWhen?: LeafCondition | ConditionGroup;
|
|
149
|
+
type: "ProgressiveBlurImage";
|
|
150
|
+
props: ProgressiveBlurImageElementProps;
|
|
151
|
+
}
|
|
152
|
+
| {
|
|
153
|
+
id: string;
|
|
154
|
+
name?: string;
|
|
155
|
+
renderWhen?: LeafCondition | ConditionGroup;
|
|
156
|
+
type: "Lottie";
|
|
157
|
+
props: LottieElementProps;
|
|
158
|
+
}
|
|
159
|
+
| {
|
|
160
|
+
id: string;
|
|
161
|
+
name?: string;
|
|
162
|
+
renderWhen?: LeafCondition | ConditionGroup;
|
|
163
|
+
type: "Rive";
|
|
164
|
+
props: RiveElementProps;
|
|
165
|
+
}
|
|
166
|
+
| {
|
|
167
|
+
id: string;
|
|
168
|
+
name?: string;
|
|
169
|
+
renderWhen?: LeafCondition | ConditionGroup;
|
|
170
|
+
type: "Icon";
|
|
171
|
+
props: IconElementProps;
|
|
172
|
+
}
|
|
173
|
+
| {
|
|
174
|
+
id: string;
|
|
175
|
+
name?: string;
|
|
176
|
+
renderWhen?: LeafCondition | ConditionGroup;
|
|
177
|
+
type: "Video";
|
|
178
|
+
props: VideoElementProps;
|
|
179
|
+
}
|
|
180
|
+
| {
|
|
181
|
+
id: string;
|
|
182
|
+
name?: string;
|
|
183
|
+
renderWhen?: LeafCondition | ConditionGroup;
|
|
184
|
+
type: "Input";
|
|
185
|
+
props: InputElementProps;
|
|
186
|
+
}
|
|
187
|
+
| {
|
|
188
|
+
id: string;
|
|
189
|
+
name?: string;
|
|
190
|
+
renderWhen?: LeafCondition | ConditionGroup;
|
|
191
|
+
type: "Button";
|
|
192
|
+
props: ButtonElementProps;
|
|
193
|
+
}
|
|
194
|
+
| {
|
|
195
|
+
id: string;
|
|
196
|
+
name?: string;
|
|
197
|
+
renderWhen?: LeafCondition | ConditionGroup;
|
|
198
|
+
type: "RadioGroup";
|
|
199
|
+
props: RadioGroupElementProps;
|
|
200
|
+
}
|
|
201
|
+
| {
|
|
202
|
+
id: string;
|
|
203
|
+
name?: string;
|
|
204
|
+
renderWhen?: LeafCondition | ConditionGroup;
|
|
205
|
+
type: "CheckboxGroup";
|
|
206
|
+
props: CheckboxGroupElementProps;
|
|
207
|
+
}
|
|
208
|
+
| {
|
|
209
|
+
id: string;
|
|
210
|
+
name?: string;
|
|
211
|
+
renderWhen?: LeafCondition | ConditionGroup;
|
|
212
|
+
type: "DatePicker";
|
|
213
|
+
props: DatePickerElementProps;
|
|
214
|
+
}
|
|
215
|
+
| {
|
|
216
|
+
id: string;
|
|
217
|
+
name?: string;
|
|
218
|
+
renderWhen?: LeafCondition | ConditionGroup;
|
|
219
|
+
type: "WheelPicker";
|
|
220
|
+
props: WheelPickerElementProps;
|
|
221
|
+
}
|
|
222
|
+
| {
|
|
223
|
+
id: string;
|
|
224
|
+
name?: string;
|
|
225
|
+
renderWhen?: LeafCondition | ConditionGroup;
|
|
226
|
+
type: "Carousel";
|
|
227
|
+
props: CarouselElementProps;
|
|
228
|
+
children: UIElement[];
|
|
229
|
+
}
|
|
230
|
+
| {
|
|
231
|
+
id: string;
|
|
232
|
+
name?: string;
|
|
233
|
+
renderWhen?: LeafCondition | ConditionGroup;
|
|
234
|
+
type: "ZStack";
|
|
235
|
+
props: ZStackElementProps;
|
|
236
|
+
children: UIElement[];
|
|
237
|
+
}
|
|
238
|
+
| {
|
|
239
|
+
id: string;
|
|
240
|
+
name?: string;
|
|
241
|
+
renderWhen?: LeafCondition | ConditionGroup;
|
|
242
|
+
type: "SafeAreaView";
|
|
243
|
+
props: SafeAreaViewElementProps;
|
|
244
|
+
children: UIElement[];
|
|
245
|
+
}
|
|
246
|
+
| {
|
|
247
|
+
id: string;
|
|
248
|
+
name?: string;
|
|
249
|
+
renderWhen?: LeafCondition | ConditionGroup;
|
|
250
|
+
type: "ScrollView";
|
|
251
|
+
props: ScrollViewElementProps;
|
|
252
|
+
children: UIElement[];
|
|
253
|
+
}
|
|
254
|
+
| {
|
|
255
|
+
id: string;
|
|
256
|
+
name?: string;
|
|
257
|
+
renderWhen?: LeafCondition | ConditionGroup;
|
|
258
|
+
type: "KeyboardAvoidingView";
|
|
259
|
+
props: KeyboardAvoidingViewElementProps;
|
|
260
|
+
children: UIElement[];
|
|
261
|
+
}
|
|
262
|
+
| {
|
|
263
|
+
id: string;
|
|
264
|
+
name?: string;
|
|
265
|
+
renderWhen?: LeafCondition | ConditionGroup;
|
|
266
|
+
type: "ProgressIndicator";
|
|
267
|
+
props: ProgressIndicatorElementProps;
|
|
268
|
+
}
|
|
269
|
+
| {
|
|
270
|
+
id: string;
|
|
271
|
+
name?: string;
|
|
272
|
+
renderWhen?: LeafCondition | ConditionGroup;
|
|
273
|
+
type: "AnimatedText";
|
|
274
|
+
props: AnimatedTextElementProps;
|
|
275
|
+
}
|
|
276
|
+
| {
|
|
277
|
+
id: string;
|
|
278
|
+
name?: string;
|
|
279
|
+
renderWhen?: LeafCondition | ConditionGroup;
|
|
280
|
+
type: "TypewriterText";
|
|
281
|
+
props: TypewriterTextElementProps;
|
|
282
|
+
}
|
|
283
|
+
| {
|
|
284
|
+
id: string;
|
|
285
|
+
name?: string;
|
|
286
|
+
renderWhen?: LeafCondition | ConditionGroup;
|
|
287
|
+
type: "DrawingPad";
|
|
288
|
+
props: DrawingPadElementProps;
|
|
289
|
+
}
|
|
290
|
+
| {
|
|
291
|
+
id: string;
|
|
292
|
+
name?: string;
|
|
293
|
+
renderWhen?: LeafCondition | ConditionGroup;
|
|
294
|
+
type: "Slider";
|
|
295
|
+
props: SliderElementProps;
|
|
296
|
+
};
|
|
297
|
+
|
|
298
|
+
// The `Text` variant, extracted so `RichText` can restrict its children to
|
|
299
|
+
// Text-only (children: z.array(TextUIElementSchema)) while the union references
|
|
300
|
+
// the same object.
|
|
301
|
+
const TextUIElementSchema = z.object({
|
|
302
|
+
id: z.string(),
|
|
303
|
+
name: z.string().optional(),
|
|
304
|
+
renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
|
|
305
|
+
type: z.literal("Text"),
|
|
306
|
+
props: TextElementPropsSchema,
|
|
307
|
+
});
|
|
308
|
+
|
|
309
|
+
export const UIElementSchema: z.ZodType<UIElement> = z.lazy(() =>
|
|
310
|
+
z.union([
|
|
311
|
+
z.object({
|
|
312
|
+
id: z.string(),
|
|
313
|
+
name: z.string().optional(),
|
|
314
|
+
renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
|
|
315
|
+
type: z.union([z.literal("YStack"), z.literal("XStack")]),
|
|
316
|
+
props: StackElementPropsSchema,
|
|
317
|
+
children: z.array(UIElementSchema),
|
|
318
|
+
}),
|
|
319
|
+
TextUIElementSchema,
|
|
320
|
+
z.object({
|
|
321
|
+
id: z.string(),
|
|
322
|
+
name: z.string().optional(),
|
|
323
|
+
renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
|
|
324
|
+
type: z.literal("RichText"),
|
|
325
|
+
props: RichTextElementPropsSchema,
|
|
326
|
+
children: z.array(TextUIElementSchema),
|
|
327
|
+
}),
|
|
328
|
+
z.object({
|
|
329
|
+
id: z.string(),
|
|
330
|
+
name: z.string().optional(),
|
|
331
|
+
renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
|
|
332
|
+
type: z.literal("Image"),
|
|
333
|
+
props: ImageElementPropsSchema,
|
|
334
|
+
}),
|
|
335
|
+
z.object({
|
|
336
|
+
id: z.string(),
|
|
337
|
+
name: z.string().optional(),
|
|
338
|
+
renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
|
|
339
|
+
type: z.literal("ProgressiveBlurImage"),
|
|
340
|
+
props: ProgressiveBlurImageElementPropsSchema,
|
|
341
|
+
}),
|
|
342
|
+
z.object({
|
|
343
|
+
id: z.string(),
|
|
344
|
+
name: z.string().optional(),
|
|
345
|
+
renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
|
|
346
|
+
type: z.literal("Lottie"),
|
|
347
|
+
props: LottieElementPropsSchema,
|
|
348
|
+
}),
|
|
349
|
+
z.object({
|
|
350
|
+
id: z.string(),
|
|
351
|
+
name: z.string().optional(),
|
|
352
|
+
renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
|
|
353
|
+
type: z.literal("Rive"),
|
|
354
|
+
props: RiveElementPropsSchema,
|
|
355
|
+
}),
|
|
356
|
+
z.object({
|
|
357
|
+
id: z.string(),
|
|
358
|
+
name: z.string().optional(),
|
|
359
|
+
renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
|
|
360
|
+
type: z.literal("Icon"),
|
|
361
|
+
props: IconElementPropsSchema,
|
|
362
|
+
}),
|
|
363
|
+
z.object({
|
|
364
|
+
id: z.string(),
|
|
365
|
+
name: z.string().optional(),
|
|
366
|
+
renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
|
|
367
|
+
type: z.literal("Video"),
|
|
368
|
+
props: VideoElementPropsSchema,
|
|
369
|
+
}),
|
|
370
|
+
z.object({
|
|
371
|
+
id: z.string(),
|
|
372
|
+
name: z.string().optional(),
|
|
373
|
+
renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
|
|
374
|
+
type: z.literal("Input"),
|
|
375
|
+
props: InputElementPropsSchema,
|
|
376
|
+
}),
|
|
377
|
+
z.object({
|
|
378
|
+
id: z.string(),
|
|
379
|
+
name: z.string().optional(),
|
|
380
|
+
renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
|
|
381
|
+
type: z.literal("Button"),
|
|
382
|
+
props: ButtonElementPropsSchema,
|
|
383
|
+
}),
|
|
384
|
+
z.object({
|
|
385
|
+
id: z.string(),
|
|
386
|
+
name: z.string().optional(),
|
|
387
|
+
renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
|
|
388
|
+
type: z.literal("RadioGroup"),
|
|
389
|
+
props: RadioGroupElementPropsSchema,
|
|
390
|
+
}),
|
|
391
|
+
z.object({
|
|
392
|
+
id: z.string(),
|
|
393
|
+
name: z.string().optional(),
|
|
394
|
+
renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
|
|
395
|
+
type: z.literal("CheckboxGroup"),
|
|
396
|
+
props: CheckboxGroupElementPropsSchema,
|
|
397
|
+
}),
|
|
398
|
+
z.object({
|
|
399
|
+
id: z.string(),
|
|
400
|
+
name: z.string().optional(),
|
|
401
|
+
renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
|
|
402
|
+
type: z.literal("DatePicker"),
|
|
403
|
+
props: DatePickerElementPropsSchema,
|
|
404
|
+
}),
|
|
405
|
+
z.object({
|
|
406
|
+
id: z.string(),
|
|
407
|
+
name: z.string().optional(),
|
|
408
|
+
renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
|
|
409
|
+
type: z.literal("WheelPicker"),
|
|
410
|
+
props: WheelPickerElementPropsSchema,
|
|
411
|
+
}),
|
|
412
|
+
z.object({
|
|
413
|
+
id: z.string(),
|
|
414
|
+
name: z.string().optional(),
|
|
415
|
+
renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
|
|
416
|
+
type: z.literal("Carousel"),
|
|
417
|
+
props: CarouselElementPropsSchema,
|
|
418
|
+
children: z.array(UIElementSchema),
|
|
419
|
+
}),
|
|
420
|
+
z.object({
|
|
421
|
+
id: z.string(),
|
|
422
|
+
name: z.string().optional(),
|
|
423
|
+
renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
|
|
424
|
+
type: z.literal("ZStack"),
|
|
425
|
+
props: ZStackElementPropsSchema,
|
|
426
|
+
children: z.array(UIElementSchema),
|
|
427
|
+
}),
|
|
428
|
+
z.object({
|
|
429
|
+
id: z.string(),
|
|
430
|
+
name: z.string().optional(),
|
|
431
|
+
renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
|
|
432
|
+
type: z.literal("SafeAreaView"),
|
|
433
|
+
props: SafeAreaViewElementPropsSchema,
|
|
434
|
+
children: z.array(UIElementSchema),
|
|
435
|
+
}),
|
|
436
|
+
z.object({
|
|
437
|
+
id: z.string(),
|
|
438
|
+
name: z.string().optional(),
|
|
439
|
+
renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
|
|
440
|
+
type: z.literal("ScrollView"),
|
|
441
|
+
props: ScrollViewElementPropsSchema,
|
|
442
|
+
children: z.array(UIElementSchema),
|
|
443
|
+
}),
|
|
444
|
+
z.object({
|
|
445
|
+
id: z.string(),
|
|
446
|
+
name: z.string().optional(),
|
|
447
|
+
renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
|
|
448
|
+
type: z.literal("KeyboardAvoidingView"),
|
|
449
|
+
props: KeyboardAvoidingViewElementPropsSchema,
|
|
450
|
+
children: z.array(UIElementSchema),
|
|
451
|
+
}),
|
|
452
|
+
z.object({
|
|
453
|
+
id: z.string(),
|
|
454
|
+
name: z.string().optional(),
|
|
455
|
+
renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
|
|
456
|
+
type: z.literal("ProgressIndicator"),
|
|
457
|
+
props: ProgressIndicatorElementPropsSchema,
|
|
458
|
+
}),
|
|
459
|
+
z.object({
|
|
460
|
+
id: z.string(),
|
|
461
|
+
name: z.string().optional(),
|
|
462
|
+
renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
|
|
463
|
+
type: z.literal("AnimatedText"),
|
|
464
|
+
props: AnimatedTextElementPropsSchema,
|
|
465
|
+
}),
|
|
466
|
+
z.object({
|
|
467
|
+
id: z.string(),
|
|
468
|
+
name: z.string().optional(),
|
|
469
|
+
renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
|
|
470
|
+
type: z.literal("TypewriterText"),
|
|
471
|
+
props: TypewriterTextElementPropsSchema,
|
|
472
|
+
}),
|
|
473
|
+
z.object({
|
|
474
|
+
id: z.string(),
|
|
475
|
+
name: z.string().optional(),
|
|
476
|
+
renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
|
|
477
|
+
type: z.literal("DrawingPad"),
|
|
478
|
+
props: DrawingPadElementPropsSchema,
|
|
479
|
+
}),
|
|
480
|
+
z.object({
|
|
481
|
+
id: z.string(),
|
|
482
|
+
name: z.string().optional(),
|
|
483
|
+
renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
|
|
484
|
+
type: z.literal("Slider"),
|
|
485
|
+
props: SliderElementPropsSchema,
|
|
486
|
+
}),
|
|
487
|
+
])
|
|
488
|
+
);
|
|
489
|
+
|
|
490
|
+
// Walk a UIElement tree; flag any KeyboardAvoidingView descendant of another KeyboardAvoidingView.
|
|
491
|
+
// RN behavior is undefined when a KAV nests another; KAV adjusts the layout of the host view, and
|
|
492
|
+
// stacking adjusters produces drift and clip artifacts on iOS + double height insets on Android.
|
|
493
|
+
const collectNestedKeyboardAvoidingViews = (
|
|
494
|
+
nodes: UIElement[],
|
|
495
|
+
insideKav: boolean,
|
|
496
|
+
out: string[]
|
|
497
|
+
): void => {
|
|
498
|
+
for (const node of nodes) {
|
|
499
|
+
if (node.type === "KeyboardAvoidingView") {
|
|
500
|
+
if (insideKav) out.push(node.id);
|
|
501
|
+
collectNestedKeyboardAvoidingViews(node.children, true, out);
|
|
502
|
+
continue;
|
|
503
|
+
}
|
|
504
|
+
if (
|
|
505
|
+
node.type === "YStack" ||
|
|
506
|
+
node.type === "XStack" ||
|
|
507
|
+
node.type === "ZStack" ||
|
|
508
|
+
node.type === "SafeAreaView" ||
|
|
509
|
+
node.type === "ScrollView" ||
|
|
510
|
+
node.type === "Carousel"
|
|
511
|
+
) {
|
|
512
|
+
collectNestedKeyboardAvoidingViews(node.children, insideKav, out);
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
};
|
|
516
|
+
|
|
517
|
+
/**
|
|
518
|
+
* The elements array of any composable screen — an onboarding step payload, a
|
|
519
|
+
* paywall, or anything else built on this engine. Carries the nested-
|
|
520
|
+
* KeyboardAvoidingView refinement that used to live on the step payload schema,
|
|
521
|
+
* because the constraint is a property of the element tree, not of steps.
|
|
522
|
+
*/
|
|
523
|
+
export const ScreenElementsSchema = z
|
|
524
|
+
.array(UIElementSchema)
|
|
525
|
+
.superRefine((elements, ctx) => {
|
|
526
|
+
const offenders: string[] = [];
|
|
527
|
+
collectNestedKeyboardAvoidingViews(elements, false, offenders);
|
|
528
|
+
for (const id of offenders) {
|
|
529
|
+
ctx.addIssue({
|
|
530
|
+
code: z.ZodIssueCode.custom,
|
|
531
|
+
path: [],
|
|
532
|
+
message: `KeyboardAvoidingView (id="${id}") cannot be nested inside another KeyboardAvoidingView.`,
|
|
533
|
+
});
|
|
534
|
+
}
|
|
535
|
+
});
|