@getrheo/contracts 1.0.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/animations.d.ts +226 -0
- package/dist/animations.js +1160 -0
- package/dist/animations.js.map +1 -0
- package/dist/appIntegrations.d.ts +175 -0
- package/dist/appIntegrations.js +60 -0
- package/dist/appIntegrations.js.map +1 -0
- package/dist/billingPeriod.d.ts +26 -0
- package/dist/billingPeriod.js +39 -0
- package/dist/billingPeriod.js.map +1 -0
- package/dist/canvasEditorGates.d.ts +81 -0
- package/dist/canvasEditorGates.js +1460 -0
- package/dist/canvasEditorGates.js.map +1 -0
- package/dist/constants/index.d.ts +30 -0
- package/dist/constants/index.js +67 -0
- package/dist/constants/index.js.map +1 -0
- package/dist/dashboard.d.ts +181856 -0
- package/dist/dashboard.js +3348 -0
- package/dist/dashboard.js.map +1 -0
- package/dist/decisions.d.ts +575 -0
- package/dist/decisions.js +1209 -0
- package/dist/decisions.js.map +1 -0
- package/dist/events.d.ts +231 -0
- package/dist/events.js +63 -0
- package/dist/events.js.map +1 -0
- package/dist/experiments-DN8pQa_D.d.ts +530 -0
- package/dist/externalSurfaceIntegrations.d.ts +20 -0
- package/dist/externalSurfaceIntegrations.js +49 -0
- package/dist/externalSurfaceIntegrations.js.map +1 -0
- package/dist/externalSurfaces.d.ts +177 -0
- package/dist/externalSurfaces.js +1190 -0
- package/dist/externalSurfaces.js.map +1 -0
- package/dist/fields.d.ts +8 -0
- package/dist/fields.js +15 -0
- package/dist/fields.js.map +1 -0
- package/dist/flowManifestSchema-CtqygXCK.d.ts +50857 -0
- package/dist/flowTemplateComments.d.ts +23 -0
- package/dist/flowTemplateComments.js +14 -0
- package/dist/flowTemplateComments.js.map +1 -0
- package/dist/flowTemplates.d.ts +22 -0
- package/dist/flowTemplates.js +73 -0
- package/dist/flowTemplates.js.map +1 -0
- package/dist/identity.d.ts +35 -0
- package/dist/identity.js +18 -0
- package/dist/identity.js.map +1 -0
- package/dist/imageContentType.d.ts +11 -0
- package/dist/imageContentType.js +54 -0
- package/dist/imageContentType.js.map +1 -0
- package/dist/index.d.ts +224 -0
- package/dist/index.js +4557 -0
- package/dist/index.js.map +1 -0
- package/dist/layerUnion-BzXoAJLY.d.ts +34 -0
- package/dist/layers.d.ts +89844 -0
- package/dist/layers.js +1507 -0
- package/dist/layers.js.map +1 -0
- package/dist/layout-D0LpaKG-.d.ts +12896 -0
- package/dist/localized.d.ts +17 -0
- package/dist/localized.js +18 -0
- package/dist/localized.js.map +1 -0
- package/dist/manifest.d.ts +22192 -0
- package/dist/manifest.js +2163 -0
- package/dist/manifest.js.map +1 -0
- package/dist/media.d.ts +53 -0
- package/dist/media.js +55 -0
- package/dist/media.js.map +1 -0
- package/dist/planEntitlements.d.ts +65 -0
- package/dist/planEntitlements.js +117 -0
- package/dist/planEntitlements.js.map +1 -0
- package/dist/publish-exports.json +102 -0
- package/dist/screens.d.ts +33586 -0
- package/dist/screens.js +1439 -0
- package/dist/screens.js.map +1 -0
- package/dist/sdk.d.ts +145942 -0
- package/dist/sdk.js +3424 -0
- package/dist/sdk.js.map +1 -0
- package/dist/sdkAttributes.d.ts +11 -0
- package/dist/sdkAttributes.js +17 -0
- package/dist/sdkAttributes.js.map +1 -0
- package/dist/workspaceCapabilities.d.ts +15 -0
- package/dist/workspaceCapabilities.js +116 -0
- package/dist/workspaceCapabilities.js.map +1 -0
- package/package.json +162 -0
package/dist/screens.js
ADDED
|
@@ -0,0 +1,1439 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
// src/screens.ts
|
|
4
|
+
|
|
5
|
+
// src/layers/layerSchemaRef.ts
|
|
6
|
+
var layerSchemaStore = {};
|
|
7
|
+
var LocaleCode = z.string().regex(/^[a-z]{2}(-[A-Z]{2})?$/, 'locale must be like "en" or "en-US"');
|
|
8
|
+
var LocalizedTextSchema = z.object({
|
|
9
|
+
default: z.string().min(1, "default copy is required"),
|
|
10
|
+
translations: z.record(LocaleCode, z.string()).optional()
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
// src/hyperlinkHref.ts
|
|
14
|
+
var parseHyperlinkHref = (raw) => {
|
|
15
|
+
const t = raw.trim();
|
|
16
|
+
if (!t) return { ok: false };
|
|
17
|
+
let u;
|
|
18
|
+
try {
|
|
19
|
+
u = new URL(t);
|
|
20
|
+
} catch {
|
|
21
|
+
return { ok: false };
|
|
22
|
+
}
|
|
23
|
+
const scheme = u.protocol.replace(/:$/, "").toLowerCase();
|
|
24
|
+
if (scheme === "https") {
|
|
25
|
+
if (!u.hostname) return { ok: false };
|
|
26
|
+
return { ok: true, scheme: "https", host: u.hostname };
|
|
27
|
+
}
|
|
28
|
+
if (scheme === "mailto") {
|
|
29
|
+
return { ok: true, scheme: "mailto" };
|
|
30
|
+
}
|
|
31
|
+
return { ok: false };
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
// src/constants/index.ts
|
|
35
|
+
var FIELD_CLASSIFICATIONS = ["safe", "sensitive"];
|
|
36
|
+
var MEDIA_TYPES = ["image", "font", "lottie", "video"];
|
|
37
|
+
|
|
38
|
+
// src/media.ts
|
|
39
|
+
var MediaTypeSchema = z.enum(MEDIA_TYPES);
|
|
40
|
+
var MediaReferenceSchema = z.object({
|
|
41
|
+
mediaAssetId: z.string().uuid()
|
|
42
|
+
});
|
|
43
|
+
z.object({
|
|
44
|
+
id: z.string().uuid(),
|
|
45
|
+
orgId: z.string().uuid(),
|
|
46
|
+
type: MediaTypeSchema,
|
|
47
|
+
url: z.string().url(),
|
|
48
|
+
name: z.string().nullable().optional(),
|
|
49
|
+
contentType: z.string(),
|
|
50
|
+
sizeBytes: z.number().int().nonnegative(),
|
|
51
|
+
archivedAt: z.string().datetime().nullable().optional(),
|
|
52
|
+
createdAt: z.string().datetime()
|
|
53
|
+
});
|
|
54
|
+
var LayerIdSchema = z.string().min(1).max(64).regex(/^lyr_[a-z0-9_]+$/i, "layer id must look like lyr_<id>");
|
|
55
|
+
var ScreenIdSchema = z.string().min(1).max(64).regex(/^scr_[a-z0-9_]+$/i, "screen id must look like scr_<id>");
|
|
56
|
+
var RESTING_MOTION_PRESETS = ["translate", "bounce", "scale", "pulse", "rotate"];
|
|
57
|
+
var RestingMotionPresetSchema = z.enum(RESTING_MOTION_PRESETS);
|
|
58
|
+
var RESTING_MOTION_SCALE_DIRECTIONS = ["up", "down"];
|
|
59
|
+
var RestingMotionScaleDirectionSchema = z.enum(RESTING_MOTION_SCALE_DIRECTIONS);
|
|
60
|
+
var RESTING_MOTION_ROTATE_DIRECTIONS = ["clockwise", "counterclockwise"];
|
|
61
|
+
var RestingMotionRotateDirectionSchema = z.enum(RESTING_MOTION_ROTATE_DIRECTIONS);
|
|
62
|
+
var RestingMotionSchema = z.object({
|
|
63
|
+
preset: RestingMotionPresetSchema,
|
|
64
|
+
/**
|
|
65
|
+
* Timeline segment length (ms): motion is active from start until
|
|
66
|
+
* start + durationMs. When {@link loop} is true, the preset pattern repeats
|
|
67
|
+
* every {@link cycleDurationMs} (or preset default) within this window.
|
|
68
|
+
*/
|
|
69
|
+
durationMs: z.number().int().min(200).max(2e4).optional(),
|
|
70
|
+
/** When true, repeat the motion pattern within the timeline segment; default is one shot. */
|
|
71
|
+
loop: z.boolean().optional(),
|
|
72
|
+
/**
|
|
73
|
+
* Duration (ms) of one full pattern cycle when looping. Defaults per {@link RESTING_MOTION_DEFAULT_DURATION_MS}.
|
|
74
|
+
*/
|
|
75
|
+
cycleDurationMs: z.number().int().min(200).max(2e4).optional(),
|
|
76
|
+
intensity: z.number().min(0).max(2).optional(),
|
|
77
|
+
/** Bounce preset only: vertical lift in px. When omitted, uses `14 * intensity` (default intensity 1 → 14). */
|
|
78
|
+
bounceAmplitudePx: z.number().min(1).max(80).optional(),
|
|
79
|
+
/** Scale preset: grow (+) or shrink (−) toward a peak, then return to 100%. */
|
|
80
|
+
scaleDirection: RestingMotionScaleDirectionSchema.optional(),
|
|
81
|
+
/**
|
|
82
|
+
* Scale preset: when true (default), each cycle goes rest → peak scale → rest.
|
|
83
|
+
* When false, ramps rest → peak and holds; with loop, the next cycle restarts from rest.
|
|
84
|
+
*/
|
|
85
|
+
scaleSpringBack: z.boolean().optional(),
|
|
86
|
+
/**
|
|
87
|
+
* Scale preset: magnitude in % — growth above 100% (up to +400% = 5× at peak) or shrink toward
|
|
88
|
+
* 100%− (up to 90% so peak can be 10% size). See authoring caps in the layer editor.
|
|
89
|
+
*/
|
|
90
|
+
scalePercent: z.number().min(0).max(400).optional(),
|
|
91
|
+
/**
|
|
92
|
+
* Scale preset: ms for one full out-and-back (rest → peak → rest). Timeline bar still sets
|
|
93
|
+
* {@link durationMs} (when the layer may animate); this controls how fast each cycle runs.
|
|
94
|
+
*/
|
|
95
|
+
scalePatternDurationMs: z.number().int().min(200).max(2e4).optional(),
|
|
96
|
+
/** @deprecated Use {@link scalePercent} + {@link scaleDirection}. Kept for legacy manifests. */
|
|
97
|
+
scaleUpPercent: z.number().min(0).max(400).optional(),
|
|
98
|
+
/** @deprecated Use {@link scalePercent} + {@link scaleDirection}. Kept for legacy manifests. */
|
|
99
|
+
scaleDownPercent: z.number().min(0).max(90).optional(),
|
|
100
|
+
/**
|
|
101
|
+
* @deprecated Legacy vertical-only float (px). Prefer {@link translatePeakXPercent} / {@link translatePeakYPercent}.
|
|
102
|
+
*/
|
|
103
|
+
translateRangePx: z.number().min(0).max(40).optional(),
|
|
104
|
+
/** @deprecated Legacy peak offsets in px. Prefer {@link translatePeakXPercent} / {@link translatePeakYPercent}. */
|
|
105
|
+
translatePeakXPx: z.number().min(-200).max(200).optional(),
|
|
106
|
+
/** @deprecated Legacy peak offsets in px. Prefer {@link translatePeakXPercent} / {@link translatePeakYPercent}. */
|
|
107
|
+
translatePeakYPx: z.number().min(-200).max(200).optional(),
|
|
108
|
+
/** Translate preset: peak X offset as % of the layer box (−200–200). Scaled by intensity. */
|
|
109
|
+
translatePeakXPercent: z.number().min(-200).max(200).optional(),
|
|
110
|
+
/** Translate preset: peak Y offset as % of the layer box (−200–200). Scaled by intensity. */
|
|
111
|
+
translatePeakYPercent: z.number().min(-200).max(200).optional(),
|
|
112
|
+
/**
|
|
113
|
+
* Translate preset: when true (default), each cycle goes rest → peak offset → rest. When false, ramp to
|
|
114
|
+
* peak and hold; with loop, the next cycle restarts from the origin.
|
|
115
|
+
*/
|
|
116
|
+
translateSpringBack: z.boolean().optional(),
|
|
117
|
+
/** Rotate preset: target rotation in degrees (0–360), scaled by intensity. */
|
|
118
|
+
rotateMaxDeg: z.number().min(0).max(360).optional(),
|
|
119
|
+
/** Rotate preset: spin direction; omitted or `clockwise` → positive angles (default). */
|
|
120
|
+
rotateDirection: RestingMotionRotateDirectionSchema.optional(),
|
|
121
|
+
/**
|
|
122
|
+
* Rotate preset: when true (default), each cycle oscillates 0° → peak → 0°.
|
|
123
|
+
* When false, each cycle ramps 0° → peak and holds; with loop, the next cycle snaps to 0° and ramps again.
|
|
124
|
+
*/
|
|
125
|
+
rotateSpringBack: z.boolean().optional(),
|
|
126
|
+
/** Pulse preset: minimum opacity at the dip (0–1). Omitted → `1 - 0.38 * intensity`. */
|
|
127
|
+
pulseMinOpacity: z.number().min(0).max(1).optional(),
|
|
128
|
+
/** Ms after the last mount/stagger clip ends before motion applies (authoring + scrub). */
|
|
129
|
+
delayMsAfterMountEnd: z.number().int().min(0).max(6e4).optional(),
|
|
130
|
+
/**
|
|
131
|
+
* Absolute start time (ms from screen mount). When set, overrides
|
|
132
|
+
* {@link delayMsAfterMountEnd} + mount-clip end so motion can sit between
|
|
133
|
+
* clips (e.g. after first entry, before exit) when multiple mounts exist.
|
|
134
|
+
*/
|
|
135
|
+
timelineStartMs: z.number().int().min(0).max(36e5).optional()
|
|
136
|
+
}).strict();
|
|
137
|
+
var RestingMotionEntrySchema = RestingMotionSchema.extend({
|
|
138
|
+
id: z.string().min(1)
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
// src/layers/base.ts
|
|
142
|
+
var baseLayerShape = {
|
|
143
|
+
id: LayerIdSchema,
|
|
144
|
+
name: z.string().max(80).optional(),
|
|
145
|
+
restingMotion: RestingMotionSchema.optional(),
|
|
146
|
+
restingMotions: z.array(RestingMotionEntrySchema).optional()
|
|
147
|
+
};
|
|
148
|
+
var ThemedColorModesSchema = z.object({
|
|
149
|
+
light: z.string().min(1).optional(),
|
|
150
|
+
dark: z.string().min(1).optional()
|
|
151
|
+
}).strict().refine((o) => o.light !== void 0 || o.dark !== void 0, {
|
|
152
|
+
message: "at least one of light or dark is required"
|
|
153
|
+
});
|
|
154
|
+
var ThemedColorSchema = z.union([z.string().min(1), ThemedColorModesSchema]);
|
|
155
|
+
var WIDTH_PRESETS = ["auto", "full", "1/2", "1/3", "2/3", "1/4", "3/4"];
|
|
156
|
+
var WidthValueSchema = z.union([z.enum(WIDTH_PRESETS), z.number().int().min(0).max(2e3)]);
|
|
157
|
+
var HEIGHT_PRESETS = ["auto", "full", "fill"];
|
|
158
|
+
var CommonLayoutHeightSchema = z.union([
|
|
159
|
+
z.enum(HEIGHT_PRESETS),
|
|
160
|
+
z.number().int().min(0).max(2e3)
|
|
161
|
+
]);
|
|
162
|
+
|
|
163
|
+
// src/layers/styleCommon.ts
|
|
164
|
+
var NonNegativePxSchema = z.number().int().min(0);
|
|
165
|
+
var PaddingSchema = z.object({
|
|
166
|
+
t: NonNegativePxSchema.optional(),
|
|
167
|
+
r: NonNegativePxSchema.optional(),
|
|
168
|
+
b: NonNegativePxSchema.optional(),
|
|
169
|
+
l: NonNegativePxSchema.optional()
|
|
170
|
+
}).partial();
|
|
171
|
+
var BorderSchema = z.object({
|
|
172
|
+
width: z.number().int().min(0).max(20).optional(),
|
|
173
|
+
color: ThemedColorSchema.optional()
|
|
174
|
+
}).partial();
|
|
175
|
+
var DropShadowSchema = z.object({
|
|
176
|
+
offsetX: z.number().int().min(-100).max(100).optional(),
|
|
177
|
+
offsetY: z.number().int().min(-100).max(100).optional(),
|
|
178
|
+
blur: z.number().int().min(0).max(100).optional(),
|
|
179
|
+
spread: z.number().int().min(-50).max(50).optional(),
|
|
180
|
+
color: ThemedColorSchema.optional(),
|
|
181
|
+
opacity: z.number().min(0).max(1).optional()
|
|
182
|
+
}).partial();
|
|
183
|
+
var CommonStyleSchema = z.object({
|
|
184
|
+
padding: PaddingSchema.optional(),
|
|
185
|
+
margin: PaddingSchema.optional(),
|
|
186
|
+
radius: z.number().int().min(0).max(96).optional(),
|
|
187
|
+
background: ThemedColorSchema.optional(),
|
|
188
|
+
border: BorderSchema.optional(),
|
|
189
|
+
shadow: DropShadowSchema.optional(),
|
|
190
|
+
opacity: z.number().min(0).max(1).optional(),
|
|
191
|
+
width: WidthValueSchema.optional(),
|
|
192
|
+
/** Omit for normal flow; `'absolute'` removes the layer from flex flow (non-root only). */
|
|
193
|
+
position: z.literal("absolute").optional(),
|
|
194
|
+
/** Pixel insets when `position === 'absolute'` (same shape as padding). */
|
|
195
|
+
inset: PaddingSchema.optional(),
|
|
196
|
+
zIndex: z.number().int().min(-999).max(999).optional(),
|
|
197
|
+
/** Static rotation in degrees (CSS `rotate`); not timeline animation. */
|
|
198
|
+
rotate: z.number().min(-360).max(360).optional(),
|
|
199
|
+
/** Cross-axis size: `auto` (hug), `full`/`fill` (parent height), or fixed px. No fractions. */
|
|
200
|
+
height: CommonLayoutHeightSchema.optional(),
|
|
201
|
+
/** Stroke thickness in px for layers that render a stroke primitive (e.g. loader ring). */
|
|
202
|
+
strokeWidth: z.number().int().min(0).max(64).optional()
|
|
203
|
+
}).partial();
|
|
204
|
+
var TextStyleSchema = CommonStyleSchema.extend({
|
|
205
|
+
/**
|
|
206
|
+
* Logical font family: manifest `theme.fontFamily` when omitted, {@link TEXT_FONT_FAMILY_SYSTEM_UI}
|
|
207
|
+
* for the platform stack, or a custom name (matches `Branding.fontFamilies[].name` for uploaded fonts).
|
|
208
|
+
*/
|
|
209
|
+
fontFamily: z.string().min(1).max(128).optional(),
|
|
210
|
+
fontSize: z.number().int().min(8).max(96).optional(),
|
|
211
|
+
fontWeight: z.number().int().min(100).max(900).optional(),
|
|
212
|
+
color: ThemedColorSchema.optional(),
|
|
213
|
+
align: z.enum(["left", "center", "right"]).optional(),
|
|
214
|
+
lineHeight: z.number().min(0.8).max(3).optional(),
|
|
215
|
+
/** Multiplier (0–1) applied to the resolved background color alpha only; text stays fully opaque unless `opacity` is set. */
|
|
216
|
+
backgroundOpacity: z.number().min(0).max(1).optional()
|
|
217
|
+
});
|
|
218
|
+
var ImageStyleSchema = CommonStyleSchema.extend({
|
|
219
|
+
fit: z.enum(["cover", "contain", "fill"]).optional(),
|
|
220
|
+
aspectRatio: z.number().positive().max(10).optional()
|
|
221
|
+
});
|
|
222
|
+
var IconStyleSchema = CommonStyleSchema.extend({
|
|
223
|
+
color: ThemedColorSchema.optional()
|
|
224
|
+
});
|
|
225
|
+
var ICON_FAMILIES = ["ionicons"];
|
|
226
|
+
var ButtonStyleSchema = CommonStyleSchema.extend({
|
|
227
|
+
fontSize: z.number().int().min(8).max(96).optional(),
|
|
228
|
+
fontWeight: z.number().int().min(100).max(900).optional(),
|
|
229
|
+
color: ThemedColorSchema.optional(),
|
|
230
|
+
align: z.enum(["left", "center", "right"]).optional()
|
|
231
|
+
});
|
|
232
|
+
var BUTTON_LAYER_VARIANTS = ["primary", "secondary", "ghost", "destructive"];
|
|
233
|
+
var ButtonLayerVariantSchema = z.enum(BUTTON_LAYER_VARIANTS);
|
|
234
|
+
var CommonStyleBreakpointsSchema = z.object({
|
|
235
|
+
sm: CommonStyleSchema.partial().optional(),
|
|
236
|
+
md: CommonStyleSchema.partial().optional(),
|
|
237
|
+
lg: CommonStyleSchema.partial().optional(),
|
|
238
|
+
xl: CommonStyleSchema.partial().optional(),
|
|
239
|
+
"2xl": CommonStyleSchema.partial().optional()
|
|
240
|
+
}).partial().optional();
|
|
241
|
+
var TextStyleBreakpointsSchema = z.object({
|
|
242
|
+
sm: TextStyleSchema.partial().optional(),
|
|
243
|
+
md: TextStyleSchema.partial().optional(),
|
|
244
|
+
lg: TextStyleSchema.partial().optional(),
|
|
245
|
+
xl: TextStyleSchema.partial().optional(),
|
|
246
|
+
"2xl": TextStyleSchema.partial().optional()
|
|
247
|
+
}).partial().optional();
|
|
248
|
+
var ImageStyleBreakpointsSchema = z.object({
|
|
249
|
+
sm: ImageStyleSchema.partial().optional(),
|
|
250
|
+
md: ImageStyleSchema.partial().optional(),
|
|
251
|
+
lg: ImageStyleSchema.partial().optional(),
|
|
252
|
+
xl: ImageStyleSchema.partial().optional(),
|
|
253
|
+
"2xl": ImageStyleSchema.partial().optional()
|
|
254
|
+
}).partial().optional();
|
|
255
|
+
var IconStyleBreakpointsSchema = z.object({
|
|
256
|
+
sm: IconStyleSchema.partial().optional(),
|
|
257
|
+
md: IconStyleSchema.partial().optional(),
|
|
258
|
+
lg: IconStyleSchema.partial().optional(),
|
|
259
|
+
xl: IconStyleSchema.partial().optional(),
|
|
260
|
+
"2xl": IconStyleSchema.partial().optional()
|
|
261
|
+
}).partial().optional();
|
|
262
|
+
var ButtonStyleBreakpointsSchema = z.object({
|
|
263
|
+
sm: ButtonStyleSchema.partial().optional(),
|
|
264
|
+
md: ButtonStyleSchema.partial().optional(),
|
|
265
|
+
lg: ButtonStyleSchema.partial().optional(),
|
|
266
|
+
xl: ButtonStyleSchema.partial().optional(),
|
|
267
|
+
"2xl": ButtonStyleSchema.partial().optional()
|
|
268
|
+
}).partial().optional();
|
|
269
|
+
var StackLayoutBreakpointPatchSchema = z.object({
|
|
270
|
+
gap: NonNegativePxSchema.optional(),
|
|
271
|
+
direction: z.enum(["vertical", "horizontal"]).optional()
|
|
272
|
+
}).partial();
|
|
273
|
+
var StackLayoutBreakpointsSchema = z.object({
|
|
274
|
+
sm: StackLayoutBreakpointPatchSchema.optional(),
|
|
275
|
+
md: StackLayoutBreakpointPatchSchema.optional(),
|
|
276
|
+
lg: StackLayoutBreakpointPatchSchema.optional(),
|
|
277
|
+
xl: StackLayoutBreakpointPatchSchema.optional(),
|
|
278
|
+
"2xl": StackLayoutBreakpointPatchSchema.optional()
|
|
279
|
+
}).partial().optional();
|
|
280
|
+
var ButtonLayoutBreakpointPatchSchema = z.object({
|
|
281
|
+
gap: NonNegativePxSchema.optional(),
|
|
282
|
+
direction: z.enum(["vertical", "horizontal"]).optional()
|
|
283
|
+
}).partial();
|
|
284
|
+
var ButtonLayoutBreakpointsSchema = z.object({
|
|
285
|
+
sm: ButtonLayoutBreakpointPatchSchema.optional(),
|
|
286
|
+
md: ButtonLayoutBreakpointPatchSchema.optional(),
|
|
287
|
+
lg: ButtonLayoutBreakpointPatchSchema.optional(),
|
|
288
|
+
xl: ButtonLayoutBreakpointPatchSchema.optional(),
|
|
289
|
+
"2xl": ButtonLayoutBreakpointPatchSchema.optional()
|
|
290
|
+
}).partial().optional();
|
|
291
|
+
var OS_PERMISSION_KEYS = [
|
|
292
|
+
"notifications",
|
|
293
|
+
"camera",
|
|
294
|
+
"microphone",
|
|
295
|
+
"photo_library",
|
|
296
|
+
"contacts",
|
|
297
|
+
"calendar",
|
|
298
|
+
"reminders",
|
|
299
|
+
"location_when_in_use",
|
|
300
|
+
"location_always",
|
|
301
|
+
"motion",
|
|
302
|
+
"bluetooth",
|
|
303
|
+
"app_tracking_transparency",
|
|
304
|
+
"speech_recognition",
|
|
305
|
+
"face_id",
|
|
306
|
+
"health_kit",
|
|
307
|
+
"media_library",
|
|
308
|
+
"local_network",
|
|
309
|
+
"nearby_interactions",
|
|
310
|
+
"nfc",
|
|
311
|
+
"full_screen_intent_android",
|
|
312
|
+
"sms_android",
|
|
313
|
+
"phone_android"
|
|
314
|
+
];
|
|
315
|
+
var OsPermissionKeySchema = z.enum(OS_PERMISSION_KEYS);
|
|
316
|
+
var PERMISSION_CAPTURE_FIELD_KEY_PREFIX = "permission:";
|
|
317
|
+
var permissionCaptureFieldKey = (key) => `${PERMISSION_CAPTURE_FIELD_KEY_PREFIX}${key}`;
|
|
318
|
+
var PERMISSION_OUTCOME_VALUES = ["granted", "denied", "blocked"];
|
|
319
|
+
z.enum(PERMISSION_OUTCOME_VALUES);
|
|
320
|
+
var OS_PERMISSION_OUTCOME_CONTINUE = "continue";
|
|
321
|
+
var OS_PERMISSION_OUTCOME_END = "end";
|
|
322
|
+
var OsPermissionOutcomeBranchTargetSchema = z.union([
|
|
323
|
+
ScreenIdSchema,
|
|
324
|
+
z.literal(OS_PERMISSION_OUTCOME_CONTINUE),
|
|
325
|
+
z.literal(OS_PERMISSION_OUTCOME_END)
|
|
326
|
+
]);
|
|
327
|
+
var OsPermissionOutcomesSchema = z.object({
|
|
328
|
+
granted: OsPermissionOutcomeBranchTargetSchema,
|
|
329
|
+
denied: OsPermissionOutcomeBranchTargetSchema,
|
|
330
|
+
blocked: OsPermissionOutcomeBranchTargetSchema
|
|
331
|
+
}).strict();
|
|
332
|
+
var APP_REVIEW_CAPTURE_FIELD_KEY_PREFIX = "app_review:";
|
|
333
|
+
var appReviewCaptureFieldKey = (layerId) => `${APP_REVIEW_CAPTURE_FIELD_KEY_PREFIX}${layerId}`;
|
|
334
|
+
var APP_REVIEW_OUTCOMES = ["not_shown", "dismissed"];
|
|
335
|
+
z.enum(APP_REVIEW_OUTCOMES);
|
|
336
|
+
var ButtonActionSchema = z.discriminatedUnion("kind", [
|
|
337
|
+
z.object({ kind: z.literal("none") }),
|
|
338
|
+
z.object({ kind: z.literal("continue") }),
|
|
339
|
+
z.object({ kind: z.literal("skip") }),
|
|
340
|
+
z.object({ kind: z.literal("end_flow") }),
|
|
341
|
+
z.object({
|
|
342
|
+
kind: z.literal("go_back_one_screen"),
|
|
343
|
+
fallbackScreenId: ScreenIdSchema.optional()
|
|
344
|
+
}),
|
|
345
|
+
z.object({ kind: z.literal("go_to_step"), screenId: ScreenIdSchema }),
|
|
346
|
+
z.object({
|
|
347
|
+
kind: z.literal("request_os_permission"),
|
|
348
|
+
permissionKey: OsPermissionKeySchema,
|
|
349
|
+
outcomes: OsPermissionOutcomesSchema
|
|
350
|
+
}),
|
|
351
|
+
z.object({
|
|
352
|
+
kind: z.literal("play_media"),
|
|
353
|
+
targetLayerIds: z.array(z.string().min(1)).min(1)
|
|
354
|
+
}),
|
|
355
|
+
z.object({ kind: z.literal("request_app_review") })
|
|
356
|
+
]);
|
|
357
|
+
var TEXT_INPUT_TYPES = ["plain", "email", "phone", "url", "multiline"];
|
|
358
|
+
var TextInputTypeSchema = z.enum(TEXT_INPUT_TYPES);
|
|
359
|
+
var COUNTER_DISPLAY_KINDS = ["number", "time"];
|
|
360
|
+
var COUNTER_TIME_FORMATS = ["mm_ss", "hh_mm_ss", "dd_hh_mm_ss"];
|
|
361
|
+
var CheckboxGlyphStyleSchema = z.object({
|
|
362
|
+
/** Square edge length in px. */
|
|
363
|
+
size: z.number().int().min(8).max(128).optional(),
|
|
364
|
+
radius: z.number().int().min(0).max(96).optional(),
|
|
365
|
+
background: ThemedColorSchema.optional(),
|
|
366
|
+
border: BorderSchema.optional(),
|
|
367
|
+
shadow: DropShadowSchema.optional(),
|
|
368
|
+
opacity: z.number().min(0).max(1).optional(),
|
|
369
|
+
/** Fill color for the check mark when checked. */
|
|
370
|
+
checkColor: ThemedColorSchema.optional()
|
|
371
|
+
}).partial();
|
|
372
|
+
var OAUTH_LOGIN_PRESETS = ["github", "google", "apple"];
|
|
373
|
+
var OAuthPresetButtonChromeSchema = CommonStyleSchema.pick({
|
|
374
|
+
width: true,
|
|
375
|
+
padding: true,
|
|
376
|
+
margin: true,
|
|
377
|
+
radius: true
|
|
378
|
+
}).partial();
|
|
379
|
+
var OAuthPresetButtonChromeBreakpointsSchema = z.object({
|
|
380
|
+
sm: OAuthPresetButtonChromeSchema.partial().optional(),
|
|
381
|
+
md: OAuthPresetButtonChromeSchema.partial().optional(),
|
|
382
|
+
lg: OAuthPresetButtonChromeSchema.partial().optional(),
|
|
383
|
+
xl: OAuthPresetButtonChromeSchema.partial().optional(),
|
|
384
|
+
"2xl": OAuthPresetButtonChromeSchema.partial().optional()
|
|
385
|
+
}).partial().optional();
|
|
386
|
+
var EMAIL_PASSWORD_AUTH_MODES = ["sign_in", "sign_up"];
|
|
387
|
+
var EMAIL_PASSWORD_SLOTS = ["email", "password", "confirm"];
|
|
388
|
+
|
|
389
|
+
// src/layers/kinds/chrome.ts
|
|
390
|
+
var lazyLayer = () => layerSchemaStore.schema;
|
|
391
|
+
var ButtonLayerSchema = z.object({
|
|
392
|
+
...baseLayerShape,
|
|
393
|
+
kind: z.literal("button"),
|
|
394
|
+
children: z.lazy(() => z.array(lazyLayer())),
|
|
395
|
+
action: ButtonActionSchema,
|
|
396
|
+
variant: ButtonLayerVariantSchema,
|
|
397
|
+
direction: z.enum(["vertical", "horizontal"]).optional(),
|
|
398
|
+
gap: z.number().int().min(0).optional(),
|
|
399
|
+
align: z.enum(["start", "center", "end", "stretch"]).optional(),
|
|
400
|
+
distribution: z.enum(["start", "center", "end", "between", "around"]).optional(),
|
|
401
|
+
style: ButtonStyleSchema.optional(),
|
|
402
|
+
styleBreakpoints: ButtonStyleBreakpointsSchema,
|
|
403
|
+
buttonLayoutBreakpoints: ButtonLayoutBreakpointsSchema
|
|
404
|
+
});
|
|
405
|
+
var BackButtonLayerSchema = z.object({
|
|
406
|
+
...baseLayerShape,
|
|
407
|
+
kind: z.literal("back_button"),
|
|
408
|
+
children: z.lazy(() => z.array(lazyLayer())),
|
|
409
|
+
variant: ButtonLayerVariantSchema,
|
|
410
|
+
direction: z.enum(["vertical", "horizontal"]).optional(),
|
|
411
|
+
gap: z.number().int().min(0).optional(),
|
|
412
|
+
align: z.enum(["start", "center", "end", "stretch"]).optional(),
|
|
413
|
+
distribution: z.enum(["start", "center", "end", "between", "around"]).optional(),
|
|
414
|
+
style: ButtonStyleSchema.optional(),
|
|
415
|
+
styleBreakpoints: ButtonStyleBreakpointsSchema,
|
|
416
|
+
buttonLayoutBreakpoints: ButtonLayoutBreakpointsSchema,
|
|
417
|
+
fallbackScreenId: ScreenIdSchema.optional()
|
|
418
|
+
});
|
|
419
|
+
var ProgressLayerSchema = z.object({
|
|
420
|
+
...baseLayerShape,
|
|
421
|
+
kind: z.literal("progress"),
|
|
422
|
+
trackColor: ThemedColorSchema.optional(),
|
|
423
|
+
fillColor: ThemedColorSchema.optional(),
|
|
424
|
+
style: CommonStyleSchema.optional()
|
|
425
|
+
});
|
|
426
|
+
var LoaderOnCompleteSchema = z.discriminatedUnion("mode", [
|
|
427
|
+
z.object({ mode: z.literal("none") }),
|
|
428
|
+
z.object({ mode: z.literal("next") }),
|
|
429
|
+
z.object({ mode: z.literal("screen"), screenId: ScreenIdSchema })
|
|
430
|
+
]);
|
|
431
|
+
var LoaderLayerSchema = z.object({
|
|
432
|
+
...baseLayerShape,
|
|
433
|
+
kind: z.literal("loader"),
|
|
434
|
+
variant: z.enum(["linear", "circular"]).optional(),
|
|
435
|
+
targetPercent: z.number().int().min(0).max(100).optional(),
|
|
436
|
+
fillDelayMs: z.number().int().min(0).max(1e4).optional(),
|
|
437
|
+
durationMs: z.number().int().min(0).max(36e5).optional(),
|
|
438
|
+
onComplete: LoaderOnCompleteSchema.optional(),
|
|
439
|
+
trackColor: ThemedColorSchema.optional(),
|
|
440
|
+
trackOpacity: z.number().min(0).max(1).optional(),
|
|
441
|
+
fillColor: ThemedColorSchema.optional(),
|
|
442
|
+
/** Horizontal alignment of the bar or ring within the layer box (default start). */
|
|
443
|
+
align: z.enum(["start", "center", "end"]).optional(),
|
|
444
|
+
style: CommonStyleSchema.optional()
|
|
445
|
+
}).superRefine((data, ctx) => {
|
|
446
|
+
if (data.variant !== "circular") return;
|
|
447
|
+
const w = data.style?.width;
|
|
448
|
+
const h = data.style?.height;
|
|
449
|
+
if (typeof w === "number" && typeof h === "number" && w !== h) {
|
|
450
|
+
ctx.addIssue({
|
|
451
|
+
code: z.ZodIssueCode.custom,
|
|
452
|
+
message: "circular loader requires style.width === style.height",
|
|
453
|
+
path: ["style", "height"]
|
|
454
|
+
});
|
|
455
|
+
}
|
|
456
|
+
});
|
|
457
|
+
var CounterLayerSchema = z.object({
|
|
458
|
+
...baseLayerShape,
|
|
459
|
+
kind: z.literal("counter"),
|
|
460
|
+
startValue: z.number().finite(),
|
|
461
|
+
endValue: z.number().finite(),
|
|
462
|
+
durationMs: z.number().int().min(0).max(36e5).optional(),
|
|
463
|
+
delayMs: z.number().int().min(0).max(36e5).optional(),
|
|
464
|
+
decimalPlaces: z.number().int().min(0).max(10).optional(),
|
|
465
|
+
displayKind: z.enum(COUNTER_DISPLAY_KINDS).optional(),
|
|
466
|
+
timeFormat: z.enum(COUNTER_TIME_FORMATS).optional(),
|
|
467
|
+
style: TextStyleSchema.optional(),
|
|
468
|
+
styleBreakpoints: TextStyleBreakpointsSchema
|
|
469
|
+
});
|
|
470
|
+
var CheckboxLayerSchema = z.object({
|
|
471
|
+
...baseLayerShape,
|
|
472
|
+
kind: z.literal("checkbox"),
|
|
473
|
+
fieldKey: z.string().min(1),
|
|
474
|
+
blocking: z.boolean().optional(),
|
|
475
|
+
uncheckedStyle: CheckboxGlyphStyleSchema.optional(),
|
|
476
|
+
checkedStyle: CheckboxGlyphStyleSchema.optional(),
|
|
477
|
+
style: CommonStyleSchema.optional(),
|
|
478
|
+
styleBreakpoints: CommonStyleBreakpointsSchema
|
|
479
|
+
});
|
|
480
|
+
|
|
481
|
+
// src/layers/kinds/layout.ts
|
|
482
|
+
var lazyLayer2 = () => layerSchemaStore.schema;
|
|
483
|
+
var StackLayerSchema = z.object({
|
|
484
|
+
...baseLayerShape,
|
|
485
|
+
kind: z.literal("stack"),
|
|
486
|
+
style: CommonStyleSchema.optional(),
|
|
487
|
+
styleBreakpoints: CommonStyleBreakpointsSchema,
|
|
488
|
+
stackLayoutBreakpoints: StackLayoutBreakpointsSchema,
|
|
489
|
+
selectedStyle: CommonStyleSchema.optional(),
|
|
490
|
+
direction: z.enum(["vertical", "horizontal"]),
|
|
491
|
+
gap: z.number().int().min(0).optional(),
|
|
492
|
+
align: z.enum(["start", "center", "end", "stretch"]).optional(),
|
|
493
|
+
justify: z.enum(["start", "center", "end"]).optional(),
|
|
494
|
+
distribution: z.enum(["start", "center", "end", "between", "around"]).optional(),
|
|
495
|
+
wrap: z.boolean().optional(),
|
|
496
|
+
children: z.lazy(() => z.array(lazyLayer2()))
|
|
497
|
+
});
|
|
498
|
+
var TextLayerSchema = z.object({
|
|
499
|
+
...baseLayerShape,
|
|
500
|
+
kind: z.literal("text"),
|
|
501
|
+
text: LocalizedTextSchema,
|
|
502
|
+
style: TextStyleSchema.optional(),
|
|
503
|
+
styleBreakpoints: TextStyleBreakpointsSchema
|
|
504
|
+
});
|
|
505
|
+
var migrateLegacyHyperlinkForParse = (raw) => {
|
|
506
|
+
if (!raw || typeof raw !== "object") return raw;
|
|
507
|
+
const o = raw;
|
|
508
|
+
if (o.kind !== "hyperlink") return raw;
|
|
509
|
+
const existing = o.children;
|
|
510
|
+
if (Array.isArray(existing) && existing.length > 0) return raw;
|
|
511
|
+
const idSrc = typeof o.id === "string" ? o.id.replace(/[^a-zA-Z0-9_]/g, "_") : "lyr_hyperlink";
|
|
512
|
+
const textChildId = `${idSrc}_lnktxt`.slice(0, 64);
|
|
513
|
+
const children = [
|
|
514
|
+
{
|
|
515
|
+
id: textChildId,
|
|
516
|
+
kind: "text",
|
|
517
|
+
text: o.text ?? { default: "Link" },
|
|
518
|
+
...typeof o.style === "object" && o.style !== null ? { style: o.style } : {},
|
|
519
|
+
...typeof o.styleBreakpoints === "object" && o.styleBreakpoints !== null ? { styleBreakpoints: o.styleBreakpoints } : {}
|
|
520
|
+
}
|
|
521
|
+
];
|
|
522
|
+
const next = {
|
|
523
|
+
...o,
|
|
524
|
+
children
|
|
525
|
+
};
|
|
526
|
+
delete next.text;
|
|
527
|
+
delete next.style;
|
|
528
|
+
delete next.styleBreakpoints;
|
|
529
|
+
return next;
|
|
530
|
+
};
|
|
531
|
+
var HyperlinkLayerSchemaInner = z.object({
|
|
532
|
+
...baseLayerShape,
|
|
533
|
+
kind: z.literal("hyperlink"),
|
|
534
|
+
href: z.string().min(1).max(2048),
|
|
535
|
+
children: z.lazy(() => z.array(lazyLayer2()).min(1)),
|
|
536
|
+
direction: z.enum(["vertical", "horizontal"]).optional(),
|
|
537
|
+
gap: z.number().int().min(0).optional(),
|
|
538
|
+
align: z.enum(["start", "center", "end", "stretch"]).optional(),
|
|
539
|
+
distribution: z.enum(["start", "center", "end", "between", "around"]).optional(),
|
|
540
|
+
wrap: z.boolean().optional(),
|
|
541
|
+
style: CommonStyleSchema.optional(),
|
|
542
|
+
styleBreakpoints: CommonStyleBreakpointsSchema
|
|
543
|
+
}).superRefine((data, ctx) => {
|
|
544
|
+
const p = parseHyperlinkHref(data.href.trim());
|
|
545
|
+
if (!p.ok) {
|
|
546
|
+
ctx.addIssue({
|
|
547
|
+
code: z.ZodIssueCode.custom,
|
|
548
|
+
message: "hyperlink href must be a valid https: or mailto: URL",
|
|
549
|
+
path: ["href"]
|
|
550
|
+
});
|
|
551
|
+
}
|
|
552
|
+
});
|
|
553
|
+
var HyperlinkLayerSchema = z.preprocess(
|
|
554
|
+
migrateLegacyHyperlinkForParse,
|
|
555
|
+
HyperlinkLayerSchemaInner
|
|
556
|
+
);
|
|
557
|
+
var ImageLayerSchema = z.object({
|
|
558
|
+
...baseLayerShape,
|
|
559
|
+
kind: z.literal("image"),
|
|
560
|
+
media: MediaReferenceSchema.optional(),
|
|
561
|
+
alt: z.string().max(280).optional(),
|
|
562
|
+
style: ImageStyleSchema.optional(),
|
|
563
|
+
styleBreakpoints: ImageStyleBreakpointsSchema
|
|
564
|
+
});
|
|
565
|
+
var LottieLayerSchema = z.object({
|
|
566
|
+
...baseLayerShape,
|
|
567
|
+
kind: z.literal("lottie"),
|
|
568
|
+
media: MediaReferenceSchema.optional(),
|
|
569
|
+
loop: z.boolean().optional(),
|
|
570
|
+
autoPlay: z.boolean().optional(),
|
|
571
|
+
triggerLayerId: z.string().min(1).optional(),
|
|
572
|
+
onComplete: LoaderOnCompleteSchema.optional(),
|
|
573
|
+
style: ImageStyleSchema.optional(),
|
|
574
|
+
styleBreakpoints: ImageStyleBreakpointsSchema
|
|
575
|
+
});
|
|
576
|
+
var VideoLayerSchema = z.object({
|
|
577
|
+
...baseLayerShape,
|
|
578
|
+
kind: z.literal("video"),
|
|
579
|
+
media: MediaReferenceSchema.optional(),
|
|
580
|
+
loop: z.boolean().optional(),
|
|
581
|
+
autoPlay: z.boolean().optional(),
|
|
582
|
+
triggerLayerId: z.string().min(1).optional(),
|
|
583
|
+
onComplete: LoaderOnCompleteSchema.optional(),
|
|
584
|
+
audioEnabled: z.boolean().optional(),
|
|
585
|
+
style: ImageStyleSchema.optional(),
|
|
586
|
+
styleBreakpoints: ImageStyleBreakpointsSchema
|
|
587
|
+
});
|
|
588
|
+
var IconLayerSchema = z.object({
|
|
589
|
+
...baseLayerShape,
|
|
590
|
+
kind: z.literal("icon"),
|
|
591
|
+
family: z.enum(ICON_FAMILIES),
|
|
592
|
+
iconName: z.string().min(1).max(128),
|
|
593
|
+
style: IconStyleSchema.optional(),
|
|
594
|
+
styleBreakpoints: IconStyleBreakpointsSchema
|
|
595
|
+
});
|
|
596
|
+
var lazyLayer3 = () => layerSchemaStore.schema;
|
|
597
|
+
var OAuthProviderPresetLayerSchema = z.object({
|
|
598
|
+
...baseLayerShape,
|
|
599
|
+
kind: z.literal("oauth_provider"),
|
|
600
|
+
variant: z.literal("preset"),
|
|
601
|
+
provider: z.enum(OAUTH_LOGIN_PRESETS),
|
|
602
|
+
label: LocalizedTextSchema.optional(),
|
|
603
|
+
style: OAuthPresetButtonChromeSchema.optional(),
|
|
604
|
+
styleBreakpoints: OAuthPresetButtonChromeBreakpointsSchema.optional()
|
|
605
|
+
});
|
|
606
|
+
var migrateOAuthProviderCustomIncoming = (raw) => {
|
|
607
|
+
if (!raw || typeof raw !== "object") return raw;
|
|
608
|
+
const o = raw;
|
|
609
|
+
if (o.kind !== "oauth_provider" || o.variant !== "custom") return raw;
|
|
610
|
+
const ch = o.children;
|
|
611
|
+
if (Array.isArray(ch) && ch.length > 0) {
|
|
612
|
+
const next2 = { ...o };
|
|
613
|
+
if (next2.buttonVariant === void 0) next2.buttonVariant = "secondary";
|
|
614
|
+
return next2;
|
|
615
|
+
}
|
|
616
|
+
const pid = typeof o.id === "string" ? o.id : "lyr_oauth_custom";
|
|
617
|
+
const slug = pid.replace(/[^a-z0-9_]/gi, "_").slice(0, 40) || "oauth";
|
|
618
|
+
const label = o.label ?? { default: "Custom" };
|
|
619
|
+
let family = o.family ?? "ionicons";
|
|
620
|
+
let iconName = o.iconName ?? "shield-outline";
|
|
621
|
+
if (family === "sf_symbol") {
|
|
622
|
+
family = "ionicons";
|
|
623
|
+
iconName = "star-outline";
|
|
624
|
+
}
|
|
625
|
+
const cid = slug;
|
|
626
|
+
const iconId = `lyr_${cid}_ico`.slice(0, 64);
|
|
627
|
+
const textId = `lyr_${cid}_txt`.slice(0, 64);
|
|
628
|
+
const next = { ...o };
|
|
629
|
+
delete next.label;
|
|
630
|
+
delete next.family;
|
|
631
|
+
delete next.iconName;
|
|
632
|
+
return {
|
|
633
|
+
...next,
|
|
634
|
+
buttonVariant: o.buttonVariant ?? "secondary",
|
|
635
|
+
children: [
|
|
636
|
+
{ id: iconId, kind: "icon", family, iconName },
|
|
637
|
+
{ id: textId, kind: "text", text: label }
|
|
638
|
+
]
|
|
639
|
+
};
|
|
640
|
+
};
|
|
641
|
+
var OAuthProviderCustomLayerSchemaValidated = z.object({
|
|
642
|
+
...baseLayerShape,
|
|
643
|
+
kind: z.literal("oauth_provider"),
|
|
644
|
+
variant: z.literal("custom"),
|
|
645
|
+
rowId: z.string().uuid(),
|
|
646
|
+
buttonVariant: ButtonLayerVariantSchema,
|
|
647
|
+
direction: z.enum(["vertical", "horizontal"]).optional(),
|
|
648
|
+
gap: z.number().int().min(0).optional(),
|
|
649
|
+
align: z.enum(["start", "center", "end", "stretch"]).optional(),
|
|
650
|
+
distribution: z.enum(["start", "center", "end", "between", "around"]).optional(),
|
|
651
|
+
children: z.lazy(() => z.array(lazyLayer3()).min(1)),
|
|
652
|
+
style: ButtonStyleSchema.optional(),
|
|
653
|
+
styleBreakpoints: ButtonStyleBreakpointsSchema,
|
|
654
|
+
buttonLayoutBreakpoints: ButtonLayoutBreakpointsSchema
|
|
655
|
+
});
|
|
656
|
+
var OAuthProviderCustomLayerSchema = z.preprocess(
|
|
657
|
+
migrateOAuthProviderCustomIncoming,
|
|
658
|
+
OAuthProviderCustomLayerSchemaValidated
|
|
659
|
+
);
|
|
660
|
+
var OAuthProviderLayerSchema = z.union([
|
|
661
|
+
OAuthProviderPresetLayerSchema,
|
|
662
|
+
OAuthProviderCustomLayerSchema
|
|
663
|
+
]);
|
|
664
|
+
var OAuthLoginPresetProviderSchema = z.object({
|
|
665
|
+
type: z.literal("preset"),
|
|
666
|
+
provider: z.enum(OAUTH_LOGIN_PRESETS)
|
|
667
|
+
});
|
|
668
|
+
var OAuthLoginCustomProviderSchema = z.object({
|
|
669
|
+
type: z.literal("custom"),
|
|
670
|
+
rowId: z.string().uuid(),
|
|
671
|
+
label: LocalizedTextSchema,
|
|
672
|
+
family: z.enum(ICON_FAMILIES),
|
|
673
|
+
iconName: z.string().min(1).max(128)
|
|
674
|
+
});
|
|
675
|
+
var OAuthLoginProviderSchema = z.discriminatedUnion("type", [
|
|
676
|
+
OAuthLoginPresetProviderSchema,
|
|
677
|
+
OAuthLoginCustomProviderSchema
|
|
678
|
+
]);
|
|
679
|
+
var oauthLoginChildrenUniquePresets = (children, ctx) => {
|
|
680
|
+
const seen = /* @__PURE__ */ new Set();
|
|
681
|
+
for (let i = 0; i < children.length; i++) {
|
|
682
|
+
const c = children[i];
|
|
683
|
+
if (!c || c.kind !== "oauth_provider" || c.variant !== "preset") continue;
|
|
684
|
+
const preset = c.provider;
|
|
685
|
+
if (seen.has(preset)) {
|
|
686
|
+
ctx.addIssue({
|
|
687
|
+
code: z.ZodIssueCode.custom,
|
|
688
|
+
message: `duplicate OAuth preset "${preset}"`,
|
|
689
|
+
path: ["children", i, "provider"]
|
|
690
|
+
});
|
|
691
|
+
return;
|
|
692
|
+
}
|
|
693
|
+
seen.add(preset);
|
|
694
|
+
}
|
|
695
|
+
};
|
|
696
|
+
var migrateOAuthLoginIncoming = (raw) => {
|
|
697
|
+
if (!raw || typeof raw !== "object") return raw;
|
|
698
|
+
const o = raw;
|
|
699
|
+
if (o.kind !== "oauth_login") return raw;
|
|
700
|
+
if (Array.isArray(o.children) && o.children.length > 0) return raw;
|
|
701
|
+
const provs = o.providers;
|
|
702
|
+
if (!Array.isArray(provs) || provs.length === 0) return raw;
|
|
703
|
+
const pid = typeof o.id === "string" ? o.id : "lyr_oauth_legacy";
|
|
704
|
+
const slug = pid.replace(/^lyr_/i, "").replace(/[^a-z0-9_]/gi, "_").replace(/^_+/, "").slice(0, 48) || "oauth";
|
|
705
|
+
const children = provs.map((p, idx) => {
|
|
706
|
+
const prov = p ?? {};
|
|
707
|
+
const cid = `lyr_${slug}_opr_${idx}`.slice(0, 64);
|
|
708
|
+
if (prov.type === "preset") {
|
|
709
|
+
return {
|
|
710
|
+
id: cid,
|
|
711
|
+
kind: "oauth_provider",
|
|
712
|
+
variant: "preset",
|
|
713
|
+
provider: prov.provider
|
|
714
|
+
};
|
|
715
|
+
}
|
|
716
|
+
return {
|
|
717
|
+
id: cid,
|
|
718
|
+
kind: "oauth_provider",
|
|
719
|
+
variant: "custom",
|
|
720
|
+
rowId: String(prov.rowId),
|
|
721
|
+
buttonVariant: "secondary",
|
|
722
|
+
children: [
|
|
723
|
+
{
|
|
724
|
+
id: `${cid}_ico`.slice(0, 64),
|
|
725
|
+
kind: "icon",
|
|
726
|
+
family: prov.family ?? "ionicons",
|
|
727
|
+
iconName: String(prov.iconName ?? "shield")
|
|
728
|
+
},
|
|
729
|
+
{
|
|
730
|
+
id: `${cid}_txt`.slice(0, 64),
|
|
731
|
+
kind: "text",
|
|
732
|
+
text: prov.label ?? { default: "Custom" }
|
|
733
|
+
}
|
|
734
|
+
]
|
|
735
|
+
};
|
|
736
|
+
});
|
|
737
|
+
const { providers: _omit, ...rest } = o;
|
|
738
|
+
return { ...rest, children };
|
|
739
|
+
};
|
|
740
|
+
var OAuthLoginLayerSchemaValidated = z.object({
|
|
741
|
+
...baseLayerShape,
|
|
742
|
+
kind: z.literal("oauth_login"),
|
|
743
|
+
children: z.lazy(
|
|
744
|
+
() => z.array(OAuthProviderLayerSchema).min(1).superRefine(oauthLoginChildrenUniquePresets)
|
|
745
|
+
),
|
|
746
|
+
gap: z.number().int().min(0).optional(),
|
|
747
|
+
align: z.enum(["start", "center", "end", "stretch"]).optional(),
|
|
748
|
+
style: CommonStyleSchema.optional(),
|
|
749
|
+
styleBreakpoints: CommonStyleBreakpointsSchema
|
|
750
|
+
});
|
|
751
|
+
var OAuthLoginLayerSchema = z.preprocess(
|
|
752
|
+
migrateOAuthLoginIncoming,
|
|
753
|
+
OAuthLoginLayerSchemaValidated
|
|
754
|
+
);
|
|
755
|
+
z.array(OAuthLoginProviderSchema).min(1).superRefine((providers, ctx) => {
|
|
756
|
+
const seen = /* @__PURE__ */ new Set();
|
|
757
|
+
for (let i = 0; i < providers.length; i++) {
|
|
758
|
+
const p = providers[i];
|
|
759
|
+
if (!p || p.type !== "preset") continue;
|
|
760
|
+
const preset = p.provider;
|
|
761
|
+
if (seen.has(preset)) {
|
|
762
|
+
ctx.addIssue({
|
|
763
|
+
code: z.ZodIssueCode.custom,
|
|
764
|
+
message: `duplicate OAuth preset "${preset}"`,
|
|
765
|
+
path: [i, "provider"]
|
|
766
|
+
});
|
|
767
|
+
return;
|
|
768
|
+
}
|
|
769
|
+
seen.add(preset);
|
|
770
|
+
}
|
|
771
|
+
});
|
|
772
|
+
var FIELD_KEY_RE = /^[a-z][a-z0-9_]*$/;
|
|
773
|
+
var FieldKeySchema = z.string().min(1).max(64).regex(FIELD_KEY_RE, "field key must be snake_case");
|
|
774
|
+
var FieldClassificationSchema = z.enum(FIELD_CLASSIFICATIONS);
|
|
775
|
+
|
|
776
|
+
// src/layers/kinds/auth/emailPasswordAuth.ts
|
|
777
|
+
var lazyLayer4 = () => layerSchemaStore.schema;
|
|
778
|
+
var EmailPasswordAuthModeSchema = z.enum(EMAIL_PASSWORD_AUTH_MODES);
|
|
779
|
+
var migrateEmailPasswordAuthIncoming = (raw) => {
|
|
780
|
+
if (!raw || typeof raw !== "object") return raw;
|
|
781
|
+
const o = raw;
|
|
782
|
+
if (o.kind !== "email_password_auth") return raw;
|
|
783
|
+
if (Array.isArray(o.children) && o.children.length > 0) return raw;
|
|
784
|
+
const idBase = typeof o.id === "string" ? o.id : "lyr_email_password_auth";
|
|
785
|
+
const slugRaw = idBase.replace(/^lyr_/i, "").replace(/[^a-z0-9_]/gi, "_");
|
|
786
|
+
const slug = slugRaw.length > 0 ? slugRaw.slice(0, 40) : "ep_auth";
|
|
787
|
+
const mode = o.mode === "sign_up" ? "sign_up" : "sign_in";
|
|
788
|
+
const pickLt = (v, fallback) => v && typeof v === "object" && v !== null && "default" in v ? v : { default: fallback };
|
|
789
|
+
const mkField = (suf, slot, labelSource, fallbackPlaceholder) => ({
|
|
790
|
+
id: `lyr_${slug}_fld_${suf}`.slice(0, 64),
|
|
791
|
+
kind: "email_password_field",
|
|
792
|
+
slot,
|
|
793
|
+
...labelSource ? { placeholder: pickLt(labelSource, fallbackPlaceholder) } : { placeholder: { default: fallbackPlaceholder } },
|
|
794
|
+
children: []
|
|
795
|
+
});
|
|
796
|
+
const children = [];
|
|
797
|
+
children.push(mkField("email", "email", o.emailLabel, "Email"));
|
|
798
|
+
children.push(mkField("pw", "password", o.passwordLabel, "Password"));
|
|
799
|
+
if (mode === "sign_up") {
|
|
800
|
+
children.push(mkField("cf", "confirm", o.confirmPasswordLabel, "Confirm password"));
|
|
801
|
+
}
|
|
802
|
+
const submitLbl = o.submitLabel ?? { default: mode === "sign_in" ? "Sign in" : "Create account" };
|
|
803
|
+
children.push({
|
|
804
|
+
id: `lyr_${slug}_submit`.slice(0, 64),
|
|
805
|
+
kind: "email_password_submit",
|
|
806
|
+
buttonVariant: "primary",
|
|
807
|
+
direction: "horizontal",
|
|
808
|
+
align: "center",
|
|
809
|
+
distribution: "center",
|
|
810
|
+
gap: 8,
|
|
811
|
+
children: [
|
|
812
|
+
{
|
|
813
|
+
id: `lyr_${slug}_submit_txt`.slice(0, 64),
|
|
814
|
+
kind: "text",
|
|
815
|
+
text: submitLbl
|
|
816
|
+
}
|
|
817
|
+
]
|
|
818
|
+
});
|
|
819
|
+
const {
|
|
820
|
+
emailLabel: _e,
|
|
821
|
+
passwordLabel: _p,
|
|
822
|
+
confirmPasswordLabel: _c,
|
|
823
|
+
submitLabel: _s,
|
|
824
|
+
...rest
|
|
825
|
+
} = o;
|
|
826
|
+
return { ...rest, mode, children };
|
|
827
|
+
};
|
|
828
|
+
var refineEmailPasswordAuthChildren = (data, ctx) => {
|
|
829
|
+
const fields = data.children.filter((c) => c.kind === "email_password_field");
|
|
830
|
+
const submits = data.children.filter((c) => c.kind === "email_password_submit");
|
|
831
|
+
const slotSeen = /* @__PURE__ */ new Set();
|
|
832
|
+
for (const f of fields) {
|
|
833
|
+
if (slotSeen.has(f.slot)) {
|
|
834
|
+
ctx.addIssue({
|
|
835
|
+
code: z.ZodIssueCode.custom,
|
|
836
|
+
message: `duplicate email_password_field slot "${f.slot}"`,
|
|
837
|
+
path: ["children"]
|
|
838
|
+
});
|
|
839
|
+
}
|
|
840
|
+
slotSeen.add(f.slot);
|
|
841
|
+
}
|
|
842
|
+
const slotHas = new Set(fields.map((f) => f.slot));
|
|
843
|
+
const requiredSlots = data.mode === "sign_up" ? ["email", "password", "confirm"] : ["email", "password"];
|
|
844
|
+
for (const s of requiredSlots) {
|
|
845
|
+
if (!slotHas.has(s)) {
|
|
846
|
+
ctx.addIssue({
|
|
847
|
+
code: z.ZodIssueCode.custom,
|
|
848
|
+
message: data.mode === "sign_up" ? `sign_up requires an email_password_field with slot "${s}"` : `sign_in requires an email_password_field with slot "${s}"`,
|
|
849
|
+
path: ["children"]
|
|
850
|
+
});
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
if (data.mode === "sign_in" && slotHas.has("confirm")) {
|
|
854
|
+
ctx.addIssue({
|
|
855
|
+
code: z.ZodIssueCode.custom,
|
|
856
|
+
message: 'sign_in must not include email_password_field with slot "confirm"',
|
|
857
|
+
path: ["children"]
|
|
858
|
+
});
|
|
859
|
+
}
|
|
860
|
+
if (submits.length !== 1) {
|
|
861
|
+
ctx.addIssue({
|
|
862
|
+
code: z.ZodIssueCode.custom,
|
|
863
|
+
message: `email_password_auth must have exactly one email_password_submit (found ${submits.length})`,
|
|
864
|
+
path: ["children"]
|
|
865
|
+
});
|
|
866
|
+
}
|
|
867
|
+
};
|
|
868
|
+
var EmailPasswordFieldLayerSchema = z.object({
|
|
869
|
+
...baseLayerShape,
|
|
870
|
+
kind: z.literal("email_password_field"),
|
|
871
|
+
slot: z.enum(EMAIL_PASSWORD_SLOTS),
|
|
872
|
+
placeholder: LocalizedTextSchema.optional(),
|
|
873
|
+
children: z.lazy(() => z.array(lazyLayer4())).optional(),
|
|
874
|
+
style: CommonStyleSchema.optional(),
|
|
875
|
+
styleBreakpoints: CommonStyleBreakpointsSchema
|
|
876
|
+
});
|
|
877
|
+
var EmailPasswordSubmitLayerSchema = z.object({
|
|
878
|
+
...baseLayerShape,
|
|
879
|
+
kind: z.literal("email_password_submit"),
|
|
880
|
+
buttonVariant: ButtonLayerVariantSchema,
|
|
881
|
+
direction: z.enum(["vertical", "horizontal"]).optional(),
|
|
882
|
+
gap: z.number().int().min(0).optional(),
|
|
883
|
+
align: z.enum(["start", "center", "end", "stretch"]).optional(),
|
|
884
|
+
distribution: z.enum(["start", "center", "end", "between", "around"]).optional(),
|
|
885
|
+
children: z.lazy(() => z.array(lazyLayer4()).min(1)),
|
|
886
|
+
style: ButtonStyleSchema.optional(),
|
|
887
|
+
styleBreakpoints: ButtonStyleBreakpointsSchema,
|
|
888
|
+
buttonLayoutBreakpoints: ButtonLayoutBreakpointsSchema
|
|
889
|
+
});
|
|
890
|
+
var EmailPasswordAuthLayerSchemaValidated = z.object({
|
|
891
|
+
...baseLayerShape,
|
|
892
|
+
kind: z.literal("email_password_auth"),
|
|
893
|
+
mode: EmailPasswordAuthModeSchema,
|
|
894
|
+
fieldKey: FieldKeySchema,
|
|
895
|
+
minPasswordLength: z.number().int().min(4).max(128).optional(),
|
|
896
|
+
children: z.lazy(
|
|
897
|
+
() => z.array(z.union([EmailPasswordFieldLayerSchema, EmailPasswordSubmitLayerSchema])).min(1)
|
|
898
|
+
),
|
|
899
|
+
gap: z.number().int().min(0).optional(),
|
|
900
|
+
align: z.enum(["start", "center", "end", "stretch"]).optional(),
|
|
901
|
+
style: CommonStyleSchema.optional(),
|
|
902
|
+
styleBreakpoints: CommonStyleBreakpointsSchema
|
|
903
|
+
}).superRefine(refineEmailPasswordAuthChildren);
|
|
904
|
+
var EmailPasswordAuthLayerSchema = z.preprocess(
|
|
905
|
+
migrateEmailPasswordAuthIncoming,
|
|
906
|
+
EmailPasswordAuthLayerSchemaValidated
|
|
907
|
+
);
|
|
908
|
+
var ChoiceOptionBindingSchema = z.object({
|
|
909
|
+
optionId: z.string().min(1).max(64),
|
|
910
|
+
rootLayerId: LayerIdSchema
|
|
911
|
+
});
|
|
912
|
+
var BranchConditionSchema = z.object({
|
|
913
|
+
choiceId: z.string().min(1),
|
|
914
|
+
goTo: ScreenIdSchema
|
|
915
|
+
});
|
|
916
|
+
var ChoiceBranchingSchema = z.object({
|
|
917
|
+
enabled: z.boolean(),
|
|
918
|
+
conditions: z.array(BranchConditionSchema)
|
|
919
|
+
});
|
|
920
|
+
|
|
921
|
+
// src/layers/kinds/input.ts
|
|
922
|
+
var lazyLayer5 = () => layerSchemaStore.schema;
|
|
923
|
+
var SingleChoiceLayerSchema = z.object({
|
|
924
|
+
...baseLayerShape,
|
|
925
|
+
kind: z.literal("single_choice"),
|
|
926
|
+
fieldKey: FieldKeySchema,
|
|
927
|
+
children: z.lazy(
|
|
928
|
+
() => z.array(StackLayerSchema).min(2)
|
|
929
|
+
),
|
|
930
|
+
optionBindings: z.array(ChoiceOptionBindingSchema).min(2),
|
|
931
|
+
branching: ChoiceBranchingSchema,
|
|
932
|
+
direction: z.enum(["vertical", "horizontal", "grid"]).optional(),
|
|
933
|
+
gap: z.number().int().min(0).optional(),
|
|
934
|
+
columns: z.number().int().min(1).max(12).optional(),
|
|
935
|
+
style: CommonStyleSchema.optional(),
|
|
936
|
+
styleBreakpoints: CommonStyleBreakpointsSchema
|
|
937
|
+
});
|
|
938
|
+
var MultipleChoiceLayerSchema = z.object({
|
|
939
|
+
...baseLayerShape,
|
|
940
|
+
kind: z.literal("multiple_choice"),
|
|
941
|
+
fieldKey: FieldKeySchema,
|
|
942
|
+
children: z.lazy(
|
|
943
|
+
() => z.array(StackLayerSchema).min(2)
|
|
944
|
+
),
|
|
945
|
+
optionBindings: z.array(ChoiceOptionBindingSchema).min(2),
|
|
946
|
+
minSelections: z.number().int().nonnegative().optional(),
|
|
947
|
+
maxSelections: z.number().int().positive().optional(),
|
|
948
|
+
branching: ChoiceBranchingSchema,
|
|
949
|
+
direction: z.enum(["vertical", "horizontal", "grid"]).optional(),
|
|
950
|
+
gap: z.number().int().min(0).optional(),
|
|
951
|
+
columns: z.number().int().min(1).max(12).optional(),
|
|
952
|
+
style: CommonStyleSchema.optional(),
|
|
953
|
+
styleBreakpoints: CommonStyleBreakpointsSchema
|
|
954
|
+
});
|
|
955
|
+
var TextInputLayerSchema = z.object({
|
|
956
|
+
...baseLayerShape,
|
|
957
|
+
kind: z.literal("text_input"),
|
|
958
|
+
fieldKey: FieldKeySchema,
|
|
959
|
+
placeholder: LocalizedTextSchema.optional(),
|
|
960
|
+
inputType: TextInputTypeSchema.optional(),
|
|
961
|
+
required: z.boolean().optional(),
|
|
962
|
+
minLength: z.number().int().min(0).max(2e3).optional(),
|
|
963
|
+
maxLength: z.number().int().positive().max(2e3).optional(),
|
|
964
|
+
classification: FieldClassificationSchema,
|
|
965
|
+
children: z.lazy(() => z.array(lazyLayer5())).optional(),
|
|
966
|
+
style: CommonStyleSchema.optional()
|
|
967
|
+
});
|
|
968
|
+
var ScaleInputLabelStyleSchema = z.object({
|
|
969
|
+
fontFamily: z.string().min(1).max(128).optional(),
|
|
970
|
+
fontSize: z.number().int().min(8).max(96).optional(),
|
|
971
|
+
fontWeight: z.number().int().min(100).max(900).optional(),
|
|
972
|
+
color: ThemedColorSchema.optional(),
|
|
973
|
+
align: z.enum(["left", "center", "right"]).optional(),
|
|
974
|
+
lineHeight: z.number().min(0.8).max(3).optional(),
|
|
975
|
+
opacity: z.number().min(0).max(1).optional()
|
|
976
|
+
}).partial();
|
|
977
|
+
var ScaleInputLayerSchema = z.object({
|
|
978
|
+
...baseLayerShape,
|
|
979
|
+
kind: z.literal("scale_input"),
|
|
980
|
+
fieldKey: FieldKeySchema,
|
|
981
|
+
min: z.number(),
|
|
982
|
+
max: z.number(),
|
|
983
|
+
step: z.number().positive().optional(),
|
|
984
|
+
defaultValue: z.number().optional(),
|
|
985
|
+
minLabel: LocalizedTextSchema.optional(),
|
|
986
|
+
maxLabel: LocalizedTextSchema.optional(),
|
|
987
|
+
labelStyle: ScaleInputLabelStyleSchema.optional(),
|
|
988
|
+
valueStyle: ScaleInputLabelStyleSchema.optional(),
|
|
989
|
+
showLabels: z.boolean().optional(),
|
|
990
|
+
showValue: z.boolean().optional(),
|
|
991
|
+
trackHeight: z.number().int().min(2).max(32).optional(),
|
|
992
|
+
trackColor: ThemedColorSchema.optional(),
|
|
993
|
+
fillColor: ThemedColorSchema.optional(),
|
|
994
|
+
thumbSize: z.number().int().min(8).max(48).optional(),
|
|
995
|
+
thumbColor: ThemedColorSchema.optional(),
|
|
996
|
+
children: z.lazy(() => z.array(lazyLayer5())).optional(),
|
|
997
|
+
style: CommonStyleSchema.optional()
|
|
998
|
+
});
|
|
999
|
+
var CarouselIndicatorsStyleSchema = z.object({
|
|
1000
|
+
width: z.number().int().min(1).max(64).optional(),
|
|
1001
|
+
height: z.number().int().min(1).max(64).optional(),
|
|
1002
|
+
defaultColor: ThemedColorSchema.optional(),
|
|
1003
|
+
defaultOpacity: z.number().min(0).max(1).optional(),
|
|
1004
|
+
activeColor: ThemedColorSchema.optional(),
|
|
1005
|
+
activeOpacity: z.number().min(0).max(1).optional(),
|
|
1006
|
+
activeWidth: z.number().int().min(1).max(64).optional(),
|
|
1007
|
+
activeHeight: z.number().int().min(1).max(64).optional(),
|
|
1008
|
+
border: BorderSchema.optional(),
|
|
1009
|
+
activeBorder: BorderSchema.optional()
|
|
1010
|
+
}).partial();
|
|
1011
|
+
var CarouselPageControlSchema = z.object({
|
|
1012
|
+
position: z.enum(["top", "bottom"]),
|
|
1013
|
+
spacing: z.number().int().min(0).optional(),
|
|
1014
|
+
padding: PaddingSchema.optional(),
|
|
1015
|
+
margin: PaddingSchema.optional(),
|
|
1016
|
+
indicators: CarouselIndicatorsStyleSchema.optional(),
|
|
1017
|
+
border: BorderSchema.optional(),
|
|
1018
|
+
shadow: DropShadowSchema.optional()
|
|
1019
|
+
});
|
|
1020
|
+
var CarouselLayerSchema = z.object({
|
|
1021
|
+
...baseLayerShape,
|
|
1022
|
+
kind: z.literal("carousel"),
|
|
1023
|
+
slides: z.lazy(() => z.array(StackLayerSchema).min(1)),
|
|
1024
|
+
pageAlignment: z.enum(["top", "center", "bottom"]).optional(),
|
|
1025
|
+
pageSpacing: z.number().int().min(0).optional(),
|
|
1026
|
+
pagePeek: z.number().int().min(0).max(400).optional(),
|
|
1027
|
+
openOn: z.number().int().min(0).optional(),
|
|
1028
|
+
loop: z.boolean().optional(),
|
|
1029
|
+
autoAdvance: z.boolean().optional(),
|
|
1030
|
+
autoAdvanceMs: z.number().int().min(500).max(6e4).optional(),
|
|
1031
|
+
pageControl: CarouselPageControlSchema.optional(),
|
|
1032
|
+
style: CommonStyleSchema.optional(),
|
|
1033
|
+
styleBreakpoints: CommonStyleBreakpointsSchema
|
|
1034
|
+
});
|
|
1035
|
+
|
|
1036
|
+
// src/layers/initLayerSchema.ts
|
|
1037
|
+
layerSchemaStore.schema = z.lazy(
|
|
1038
|
+
() => z.union([
|
|
1039
|
+
StackLayerSchema,
|
|
1040
|
+
TextLayerSchema,
|
|
1041
|
+
HyperlinkLayerSchema,
|
|
1042
|
+
ImageLayerSchema,
|
|
1043
|
+
LottieLayerSchema,
|
|
1044
|
+
VideoLayerSchema,
|
|
1045
|
+
IconLayerSchema,
|
|
1046
|
+
ButtonLayerSchema,
|
|
1047
|
+
BackButtonLayerSchema,
|
|
1048
|
+
ProgressLayerSchema,
|
|
1049
|
+
LoaderLayerSchema,
|
|
1050
|
+
CounterLayerSchema,
|
|
1051
|
+
CheckboxLayerSchema,
|
|
1052
|
+
SingleChoiceLayerSchema,
|
|
1053
|
+
MultipleChoiceLayerSchema,
|
|
1054
|
+
TextInputLayerSchema,
|
|
1055
|
+
ScaleInputLayerSchema,
|
|
1056
|
+
OAuthLoginLayerSchema,
|
|
1057
|
+
OAuthProviderPresetLayerSchema,
|
|
1058
|
+
OAuthProviderCustomLayerSchema,
|
|
1059
|
+
EmailPasswordAuthLayerSchema,
|
|
1060
|
+
EmailPasswordFieldLayerSchema,
|
|
1061
|
+
EmailPasswordSubmitLayerSchema,
|
|
1062
|
+
CarouselLayerSchema
|
|
1063
|
+
])
|
|
1064
|
+
);
|
|
1065
|
+
|
|
1066
|
+
// src/layers/layerUnion.ts
|
|
1067
|
+
var isInputLayer = (l) => l.kind === "single_choice" || l.kind === "multiple_choice" || l.kind === "text_input" || l.kind === "scale_input";
|
|
1068
|
+
var SCREEN_BACKGROUND_PLAYBACK_PREFIX = "__screen_bg__:";
|
|
1069
|
+
var screenBackgroundPlaybackId = (screenId) => `${SCREEN_BACKGROUND_PLAYBACK_PREFIX}${screenId}`;
|
|
1070
|
+
var isScreenBackgroundPlaybackId = (id) => id.startsWith(SCREEN_BACKGROUND_PLAYBACK_PREFIX);
|
|
1071
|
+
var ScreenBackgroundFitSchema = z.enum(["cover", "contain", "fill"]);
|
|
1072
|
+
var ScreenBackgroundScrimSchema = z.object({
|
|
1073
|
+
color: ThemedColorSchema.optional(),
|
|
1074
|
+
opacity: z.number().min(0).max(1).optional()
|
|
1075
|
+
}).partial();
|
|
1076
|
+
var screenBackgroundMediaShape = {
|
|
1077
|
+
media: MediaReferenceSchema.optional(),
|
|
1078
|
+
fit: ScreenBackgroundFitSchema.optional(),
|
|
1079
|
+
opacity: z.number().min(0).max(1).optional(),
|
|
1080
|
+
scrim: ScreenBackgroundScrimSchema.optional()
|
|
1081
|
+
};
|
|
1082
|
+
var ScreenBackgroundColorFillSchema = z.object({
|
|
1083
|
+
kind: z.literal("color"),
|
|
1084
|
+
color: ThemedColorSchema.optional(),
|
|
1085
|
+
opacity: z.number().min(0).max(1).optional()
|
|
1086
|
+
});
|
|
1087
|
+
var ScreenBackgroundImageFillSchema = z.object({
|
|
1088
|
+
kind: z.literal("image"),
|
|
1089
|
+
...screenBackgroundMediaShape
|
|
1090
|
+
});
|
|
1091
|
+
var ScreenBackgroundVideoFillSchema = z.object({
|
|
1092
|
+
kind: z.literal("video"),
|
|
1093
|
+
...screenBackgroundMediaShape,
|
|
1094
|
+
loop: z.boolean().optional(),
|
|
1095
|
+
autoPlay: z.boolean().optional(),
|
|
1096
|
+
triggerLayerId: z.string().min(1).optional(),
|
|
1097
|
+
onComplete: LoaderOnCompleteSchema.optional(),
|
|
1098
|
+
audioEnabled: z.boolean().optional()
|
|
1099
|
+
});
|
|
1100
|
+
var ScreenBackgroundFillSchema = z.discriminatedUnion("kind", [
|
|
1101
|
+
ScreenBackgroundColorFillSchema,
|
|
1102
|
+
ScreenBackgroundImageFillSchema,
|
|
1103
|
+
ScreenBackgroundVideoFillSchema
|
|
1104
|
+
]);
|
|
1105
|
+
var ScreenBackgroundFillPatchSchema = z.object({
|
|
1106
|
+
color: ThemedColorSchema.optional(),
|
|
1107
|
+
fit: ScreenBackgroundFitSchema.optional(),
|
|
1108
|
+
opacity: z.number().min(0).max(1).optional(),
|
|
1109
|
+
scrim: ScreenBackgroundScrimSchema.optional(),
|
|
1110
|
+
loop: z.boolean().optional(),
|
|
1111
|
+
autoPlay: z.boolean().optional(),
|
|
1112
|
+
triggerLayerId: z.string().min(1).optional(),
|
|
1113
|
+
onComplete: LoaderOnCompleteSchema.optional(),
|
|
1114
|
+
audioEnabled: z.boolean().optional()
|
|
1115
|
+
}).partial();
|
|
1116
|
+
var defaultScreenBackgroundColorFill = () => ({
|
|
1117
|
+
kind: "color"
|
|
1118
|
+
});
|
|
1119
|
+
var defaultScreenBackgroundImageFill = (mediaAssetId) => ({
|
|
1120
|
+
kind: "image",
|
|
1121
|
+
media: { mediaAssetId },
|
|
1122
|
+
fit: "cover"
|
|
1123
|
+
});
|
|
1124
|
+
var defaultScreenBackgroundVideoFill = (mediaAssetId) => ({
|
|
1125
|
+
kind: "video",
|
|
1126
|
+
media: { mediaAssetId },
|
|
1127
|
+
fit: "cover",
|
|
1128
|
+
loop: true,
|
|
1129
|
+
autoPlay: true,
|
|
1130
|
+
audioEnabled: false
|
|
1131
|
+
});
|
|
1132
|
+
var ScreenContainerBreakpointPatchSchema = z.object({
|
|
1133
|
+
padding: PaddingSchema.optional(),
|
|
1134
|
+
margin: PaddingSchema.optional(),
|
|
1135
|
+
insetSafeArea: z.boolean().optional(),
|
|
1136
|
+
backgroundFillPatch: ScreenBackgroundFillPatchSchema.optional()
|
|
1137
|
+
}).partial();
|
|
1138
|
+
var ScreenContainerStyleBreakpointsSchema = z.object({
|
|
1139
|
+
sm: ScreenContainerBreakpointPatchSchema.optional(),
|
|
1140
|
+
md: ScreenContainerBreakpointPatchSchema.optional(),
|
|
1141
|
+
lg: ScreenContainerBreakpointPatchSchema.optional(),
|
|
1142
|
+
xl: ScreenContainerBreakpointPatchSchema.optional(),
|
|
1143
|
+
"2xl": ScreenContainerBreakpointPatchSchema.optional()
|
|
1144
|
+
}).partial().optional();
|
|
1145
|
+
var DecisionNodeIdSchema = z.string().min(1).max(64).regex(/^dec_[a-z0-9_]+$/i, "decision node id must look like dec_<id>");
|
|
1146
|
+
var ExternalSurfaceJumpIdSchema = z.string().min(1).max(64).regex(/^surf_[a-z0-9_]+$/i, "external surface node id must look like surf_<id>");
|
|
1147
|
+
var EXTERNAL_SURFACE_NO_NEXT = "__onb_surface_no_next__";
|
|
1148
|
+
var ExternalSurfaceTerminalTargetSchema = z.literal(EXTERNAL_SURFACE_NO_NEXT);
|
|
1149
|
+
var FlowJumpTargetSchema = ScreenIdSchema.or(DecisionNodeIdSchema).or(ExternalSurfaceJumpIdSchema).or(ExternalSurfaceTerminalTargetSchema).nullable();
|
|
1150
|
+
var DecisionBuiltinNameSchema = z.enum(["locale", "platform"]);
|
|
1151
|
+
var DecisionVariableRefSchema = z.discriminatedUnion("kind", [
|
|
1152
|
+
z.object({ kind: z.literal("builtin"), name: DecisionBuiltinNameSchema }),
|
|
1153
|
+
z.object({ kind: z.literal("sdk"), key: z.string().min(1).max(128) }),
|
|
1154
|
+
z.object({ kind: z.literal("field"), fieldKey: z.string().min(1).max(128) })
|
|
1155
|
+
]);
|
|
1156
|
+
var DecisionStringPredicateSchema = z.discriminatedUnion("op", [
|
|
1157
|
+
z.object({ op: z.literal("eq"), value: z.string() }),
|
|
1158
|
+
z.object({ op: z.literal("neq"), value: z.string() }),
|
|
1159
|
+
z.object({ op: z.literal("contains"), value: z.string() })
|
|
1160
|
+
]);
|
|
1161
|
+
var DecisionNumberPredicateSchema = z.discriminatedUnion("op", [
|
|
1162
|
+
z.object({ op: z.literal("eq"), value: z.number() }),
|
|
1163
|
+
z.object({ op: z.literal("neq"), value: z.number() }),
|
|
1164
|
+
z.object({ op: z.literal("lt"), value: z.number() }),
|
|
1165
|
+
z.object({ op: z.literal("lte"), value: z.number() }),
|
|
1166
|
+
z.object({ op: z.literal("gt"), value: z.number() }),
|
|
1167
|
+
z.object({ op: z.literal("gte"), value: z.number() })
|
|
1168
|
+
]);
|
|
1169
|
+
var DecisionChoicePredicateSchema = z.discriminatedUnion("op", [
|
|
1170
|
+
z.object({ op: z.literal("eq"), optionId: z.string().min(1) }),
|
|
1171
|
+
z.object({ op: z.literal("one_of"), optionIds: z.array(z.string().min(1)).min(1) })
|
|
1172
|
+
]);
|
|
1173
|
+
var DecisionMultiPredicateSchema = z.discriminatedUnion("op", [
|
|
1174
|
+
z.object({
|
|
1175
|
+
op: z.literal("intersects"),
|
|
1176
|
+
optionIds: z.array(z.string().min(1)).min(1)
|
|
1177
|
+
}),
|
|
1178
|
+
z.object({
|
|
1179
|
+
op: z.literal("contains_all"),
|
|
1180
|
+
optionIds: z.array(z.string().min(1)).min(1)
|
|
1181
|
+
}),
|
|
1182
|
+
z.object({
|
|
1183
|
+
op: z.literal("subset_of"),
|
|
1184
|
+
optionIds: z.array(z.string().min(1)).min(1)
|
|
1185
|
+
})
|
|
1186
|
+
]);
|
|
1187
|
+
var DecisionBooleanPredicateSchema = z.discriminatedUnion("op", [
|
|
1188
|
+
z.object({ op: z.literal("eq"), value: z.boolean() }),
|
|
1189
|
+
z.object({ op: z.literal("neq"), value: z.boolean() })
|
|
1190
|
+
]);
|
|
1191
|
+
var DecisionPredicatePayloadSchema = z.discriminatedUnion("type", [
|
|
1192
|
+
z.object({ type: z.literal("string"), pred: DecisionStringPredicateSchema }),
|
|
1193
|
+
z.object({ type: z.literal("number"), pred: DecisionNumberPredicateSchema }),
|
|
1194
|
+
z.object({ type: z.literal("boolean"), pred: DecisionBooleanPredicateSchema }),
|
|
1195
|
+
z.object({ type: z.literal("choice"), pred: DecisionChoicePredicateSchema }),
|
|
1196
|
+
z.object({ type: z.literal("multi"), pred: DecisionMultiPredicateSchema })
|
|
1197
|
+
]);
|
|
1198
|
+
var DecisionExprSchema = z.lazy(
|
|
1199
|
+
() => z.discriminatedUnion("kind", [
|
|
1200
|
+
z.object({ kind: z.literal("empty") }),
|
|
1201
|
+
z.object({
|
|
1202
|
+
kind: z.literal("group"),
|
|
1203
|
+
op: z.enum(["and", "or"]),
|
|
1204
|
+
children: z.array(DecisionExprSchema).min(1)
|
|
1205
|
+
}),
|
|
1206
|
+
z.object({
|
|
1207
|
+
kind: z.literal("predicate"),
|
|
1208
|
+
variable: DecisionVariableRefSchema,
|
|
1209
|
+
predicate: DecisionPredicatePayloadSchema
|
|
1210
|
+
})
|
|
1211
|
+
])
|
|
1212
|
+
);
|
|
1213
|
+
var DecisionCaseSchema = z.object({
|
|
1214
|
+
id: z.string().min(1).max(80),
|
|
1215
|
+
/** Display label in the editor (e.g. “Engaged users”). */
|
|
1216
|
+
name: z.string().min(1).max(80).optional(),
|
|
1217
|
+
expression: DecisionExprSchema,
|
|
1218
|
+
next: FlowJumpTargetSchema
|
|
1219
|
+
});
|
|
1220
|
+
z.object({
|
|
1221
|
+
id: DecisionNodeIdSchema,
|
|
1222
|
+
name: z.string().min(1).max(80).optional(),
|
|
1223
|
+
cases: z.array(DecisionCaseSchema).min(1).max(16),
|
|
1224
|
+
elseNext: FlowJumpTargetSchema
|
|
1225
|
+
});
|
|
1226
|
+
var ANIMATABLE_PROPERTIES = [
|
|
1227
|
+
"opacity",
|
|
1228
|
+
"translateX",
|
|
1229
|
+
"translateY",
|
|
1230
|
+
"scale"
|
|
1231
|
+
];
|
|
1232
|
+
var AnimatablePropertySchema = z.enum(ANIMATABLE_PROPERTIES);
|
|
1233
|
+
var EASING_TOKENS = [
|
|
1234
|
+
"linear",
|
|
1235
|
+
"ease-in",
|
|
1236
|
+
"ease-out",
|
|
1237
|
+
"ease-in-out",
|
|
1238
|
+
"standard",
|
|
1239
|
+
"emphasized"
|
|
1240
|
+
];
|
|
1241
|
+
var EasingTokenSchema = z.enum(EASING_TOKENS);
|
|
1242
|
+
var KeyframeSchema = z.object({
|
|
1243
|
+
t: z.number().min(0).max(1),
|
|
1244
|
+
value: z.number(),
|
|
1245
|
+
/** Easing applied from this keyframe to the next; defaults to linear. */
|
|
1246
|
+
easing: EasingTokenSchema.optional()
|
|
1247
|
+
}).strict();
|
|
1248
|
+
var KeyframeTrackSchema = z.object({
|
|
1249
|
+
property: AnimatablePropertySchema,
|
|
1250
|
+
keyframes: z.array(KeyframeSchema).min(2)
|
|
1251
|
+
}).strict().superRefine((track, ctx) => {
|
|
1252
|
+
let last = -Infinity;
|
|
1253
|
+
for (const k of track.keyframes) {
|
|
1254
|
+
if (k.t < last) {
|
|
1255
|
+
ctx.addIssue({
|
|
1256
|
+
code: z.ZodIssueCode.custom,
|
|
1257
|
+
message: `keyframe times must be monotonically non-decreasing on track "${track.property}"`
|
|
1258
|
+
});
|
|
1259
|
+
return;
|
|
1260
|
+
}
|
|
1261
|
+
last = k.t;
|
|
1262
|
+
}
|
|
1263
|
+
if (track.keyframes[0].t !== 0) {
|
|
1264
|
+
ctx.addIssue({
|
|
1265
|
+
code: z.ZodIssueCode.custom,
|
|
1266
|
+
message: `track "${track.property}" first keyframe must start at t=0`
|
|
1267
|
+
});
|
|
1268
|
+
}
|
|
1269
|
+
if (track.keyframes[track.keyframes.length - 1].t !== 1) {
|
|
1270
|
+
ctx.addIssue({
|
|
1271
|
+
code: z.ZodIssueCode.custom,
|
|
1272
|
+
message: `track "${track.property}" last keyframe must end at t=1`
|
|
1273
|
+
});
|
|
1274
|
+
}
|
|
1275
|
+
});
|
|
1276
|
+
var ANIMATION_TRIGGERS = ["mount", "stagger", "unmount"];
|
|
1277
|
+
var AnimationTriggerSchema = z.enum(ANIMATION_TRIGGERS);
|
|
1278
|
+
var AnimationClipSchema = z.object({
|
|
1279
|
+
id: z.string().min(1).max(64),
|
|
1280
|
+
targetLayerId: LayerIdSchema,
|
|
1281
|
+
trigger: AnimationTriggerSchema,
|
|
1282
|
+
/** Position in the screen's stagger order. Required when trigger is `stagger`. */
|
|
1283
|
+
staggerIndex: z.number().int().min(0).max(64).optional(),
|
|
1284
|
+
/** Total clip duration in milliseconds (renderer scales 0..1 keyframes by this). */
|
|
1285
|
+
durationMs: z.number().int().min(0).max(36e5),
|
|
1286
|
+
/** Pre-roll delay before the clip begins, in ms. Stagger adds on top of this. */
|
|
1287
|
+
delayMs: z.number().int().min(0).max(36e5).optional(),
|
|
1288
|
+
tracks: z.array(KeyframeTrackSchema).min(1)
|
|
1289
|
+
}).strict().superRefine((clip, ctx) => {
|
|
1290
|
+
if (clip.trigger === "unmount" && clip.staggerIndex !== void 0) {
|
|
1291
|
+
ctx.addIssue({
|
|
1292
|
+
code: z.ZodIssueCode.custom,
|
|
1293
|
+
message: `clip "${clip.id}" with trigger "unmount" must not set staggerIndex`,
|
|
1294
|
+
path: ["staggerIndex"]
|
|
1295
|
+
});
|
|
1296
|
+
}
|
|
1297
|
+
if (clip.trigger === "stagger" && clip.staggerIndex === void 0) {
|
|
1298
|
+
ctx.addIssue({
|
|
1299
|
+
code: z.ZodIssueCode.custom,
|
|
1300
|
+
message: `clip "${clip.id}" with trigger "stagger" must define staggerIndex`,
|
|
1301
|
+
path: ["staggerIndex"]
|
|
1302
|
+
});
|
|
1303
|
+
}
|
|
1304
|
+
const seenProps = /* @__PURE__ */ new Set();
|
|
1305
|
+
for (const track of clip.tracks) {
|
|
1306
|
+
if (seenProps.has(track.property)) {
|
|
1307
|
+
ctx.addIssue({
|
|
1308
|
+
code: z.ZodIssueCode.custom,
|
|
1309
|
+
message: `clip "${clip.id}" has duplicate track for property "${track.property}"`
|
|
1310
|
+
});
|
|
1311
|
+
}
|
|
1312
|
+
seenProps.add(track.property);
|
|
1313
|
+
}
|
|
1314
|
+
});
|
|
1315
|
+
var ScreenStaggerSchema = z.object({
|
|
1316
|
+
/** Per-index delay multiplier in ms. */
|
|
1317
|
+
stepMs: z.number().int().min(0).max(2e3)
|
|
1318
|
+
}).strict();
|
|
1319
|
+
|
|
1320
|
+
// src/screens.ts
|
|
1321
|
+
var ScreenNextSchema = z.object({
|
|
1322
|
+
default: FlowJumpTargetSchema
|
|
1323
|
+
});
|
|
1324
|
+
var ScreenRegionsSchema = z.object({
|
|
1325
|
+
header: StackLayerSchema.optional(),
|
|
1326
|
+
body: StackLayerSchema,
|
|
1327
|
+
footer: StackLayerSchema.optional()
|
|
1328
|
+
});
|
|
1329
|
+
var ScreenContainerStyleSchema = z.object({
|
|
1330
|
+
padding: PaddingSchema.optional(),
|
|
1331
|
+
margin: PaddingSchema.optional(),
|
|
1332
|
+
/** When true, runtimes add device safe-area insets to shell padding (in addition to manual padding). */
|
|
1333
|
+
insetSafeArea: z.boolean().optional(),
|
|
1334
|
+
backgroundFill: ScreenBackgroundFillSchema.optional()
|
|
1335
|
+
}).partial();
|
|
1336
|
+
var ScreenSchema = z.object({
|
|
1337
|
+
id: ScreenIdSchema,
|
|
1338
|
+
name: z.string().min(1).max(80),
|
|
1339
|
+
regions: ScreenRegionsSchema,
|
|
1340
|
+
next: ScreenNextSchema,
|
|
1341
|
+
/** Ordered animation clips bound to layers on this screen. */
|
|
1342
|
+
animations: z.array(AnimationClipSchema).optional(),
|
|
1343
|
+
/** Defaults for clips with `trigger: stagger`. */
|
|
1344
|
+
stagger: ScreenStaggerSchema.optional(),
|
|
1345
|
+
/** Chrome on the outer screen container (wraps all regions). */
|
|
1346
|
+
containerStyle: ScreenContainerStyleSchema.optional(),
|
|
1347
|
+
containerStyleBreakpoints: ScreenContainerStyleBreakpointsSchema
|
|
1348
|
+
});
|
|
1349
|
+
var walkScreenLayersWithLayoutContext = (screen, fn) => {
|
|
1350
|
+
const visit = (l, ctx) => {
|
|
1351
|
+
fn(l, ctx);
|
|
1352
|
+
const childCtx = (opts = {}) => ({
|
|
1353
|
+
region: ctx.region,
|
|
1354
|
+
isRegionRoot: false,
|
|
1355
|
+
insideChoiceOption: opts.insideChoiceOption ?? ctx.insideChoiceOption,
|
|
1356
|
+
parentKind: l.kind
|
|
1357
|
+
});
|
|
1358
|
+
if (l.kind === "stack") {
|
|
1359
|
+
for (const c of l.children) visit(c, childCtx());
|
|
1360
|
+
} else if (l.kind === "carousel") {
|
|
1361
|
+
for (const s of l.slides) visit(s, childCtx());
|
|
1362
|
+
} else if (l.kind === "button" || l.kind === "back_button") {
|
|
1363
|
+
for (const c of l.children) visit(c, childCtx());
|
|
1364
|
+
} else if (l.kind === "hyperlink") {
|
|
1365
|
+
for (const c of l.children) visit(c, childCtx());
|
|
1366
|
+
} else if (l.kind === "single_choice" || l.kind === "multiple_choice") {
|
|
1367
|
+
for (const c of l.children) {
|
|
1368
|
+
visit(c, childCtx({ insideChoiceOption: true }));
|
|
1369
|
+
}
|
|
1370
|
+
} else if (l.kind === "text_input" || l.kind === "scale_input") {
|
|
1371
|
+
for (const c of l.children ?? []) visit(c, childCtx());
|
|
1372
|
+
} else if (l.kind === "oauth_login") {
|
|
1373
|
+
for (const c of l.children) visit(c, childCtx());
|
|
1374
|
+
} else if (l.kind === "oauth_provider" && l.variant === "custom") {
|
|
1375
|
+
for (const c of l.children) visit(c, childCtx());
|
|
1376
|
+
} else if (l.kind === "email_password_auth") {
|
|
1377
|
+
for (const c of l.children) visit(c, childCtx());
|
|
1378
|
+
} else if (l.kind === "email_password_field") {
|
|
1379
|
+
for (const c of l.children ?? []) visit(c, childCtx());
|
|
1380
|
+
} else if (l.kind === "email_password_submit") {
|
|
1381
|
+
for (const c of l.children) visit(c, childCtx());
|
|
1382
|
+
}
|
|
1383
|
+
};
|
|
1384
|
+
const regionCtx = (region) => ({
|
|
1385
|
+
region,
|
|
1386
|
+
isRegionRoot: true,
|
|
1387
|
+
insideChoiceOption: false,
|
|
1388
|
+
parentKind: null
|
|
1389
|
+
});
|
|
1390
|
+
if (screen.regions.header) visit(screen.regions.header, regionCtx("header"));
|
|
1391
|
+
visit(screen.regions.body, regionCtx("body"));
|
|
1392
|
+
if (screen.regions.footer) visit(screen.regions.footer, regionCtx("footer"));
|
|
1393
|
+
};
|
|
1394
|
+
var walkScreenLayers = (screen, fn) => {
|
|
1395
|
+
const visit = (l) => {
|
|
1396
|
+
fn(l);
|
|
1397
|
+
if (l.kind === "stack") l.children.forEach(visit);
|
|
1398
|
+
else if (l.kind === "carousel") l.slides.forEach(visit);
|
|
1399
|
+
else if (l.kind === "button") l.children.forEach(visit);
|
|
1400
|
+
else if (l.kind === "back_button") l.children.forEach(visit);
|
|
1401
|
+
else if (l.kind === "hyperlink") l.children.forEach(visit);
|
|
1402
|
+
else if (l.kind === "single_choice" || l.kind === "multiple_choice") {
|
|
1403
|
+
l.children.forEach(visit);
|
|
1404
|
+
} else if (l.kind === "text_input" || l.kind === "scale_input") {
|
|
1405
|
+
l.children?.forEach(visit);
|
|
1406
|
+
} else if (l.kind === "oauth_login") {
|
|
1407
|
+
l.children.forEach(visit);
|
|
1408
|
+
} else if (l.kind === "oauth_provider" && l.variant === "custom") {
|
|
1409
|
+
l.children.forEach(visit);
|
|
1410
|
+
} else if (l.kind === "email_password_auth") {
|
|
1411
|
+
l.children.forEach(visit);
|
|
1412
|
+
} else if (l.kind === "email_password_field") {
|
|
1413
|
+
l.children?.forEach(visit);
|
|
1414
|
+
} else if (l.kind === "email_password_submit") {
|
|
1415
|
+
l.children.forEach(visit);
|
|
1416
|
+
}
|
|
1417
|
+
};
|
|
1418
|
+
if (screen.regions.header) visit(screen.regions.header);
|
|
1419
|
+
visit(screen.regions.body);
|
|
1420
|
+
if (screen.regions.footer) visit(screen.regions.footer);
|
|
1421
|
+
};
|
|
1422
|
+
var collectAnswerCaptureFieldKeysFromScreen = (screen) => {
|
|
1423
|
+
const keys = [];
|
|
1424
|
+
walkScreenLayers(screen, (l) => {
|
|
1425
|
+
if (isInputLayer(l)) keys.push(l.fieldKey);
|
|
1426
|
+
if (l.kind === "checkbox") keys.push(l.fieldKey);
|
|
1427
|
+
if (l.kind === "button" && l.action.kind === "request_os_permission") {
|
|
1428
|
+
keys.push(permissionCaptureFieldKey(l.action.permissionKey));
|
|
1429
|
+
}
|
|
1430
|
+
if (l.kind === "button" && l.action.kind === "request_app_review") {
|
|
1431
|
+
keys.push(appReviewCaptureFieldKey(l.id));
|
|
1432
|
+
}
|
|
1433
|
+
});
|
|
1434
|
+
return keys;
|
|
1435
|
+
};
|
|
1436
|
+
|
|
1437
|
+
export { SCREEN_BACKGROUND_PLAYBACK_PREFIX, ScreenBackgroundColorFillSchema, ScreenBackgroundFillPatchSchema, ScreenBackgroundFillSchema, ScreenBackgroundFitSchema, ScreenBackgroundImageFillSchema, ScreenBackgroundScrimSchema, ScreenBackgroundVideoFillSchema, ScreenContainerStyleBreakpointsSchema, ScreenContainerStyleSchema, ScreenNextSchema, ScreenRegionsSchema, ScreenSchema, collectAnswerCaptureFieldKeysFromScreen, defaultScreenBackgroundColorFill, defaultScreenBackgroundImageFill, defaultScreenBackgroundVideoFill, isScreenBackgroundPlaybackId, screenBackgroundPlaybackId, walkScreenLayers, walkScreenLayersWithLayoutContext };
|
|
1438
|
+
//# sourceMappingURL=screens.js.map
|
|
1439
|
+
//# sourceMappingURL=screens.js.map
|