@remotion/studio 4.0.424 → 4.0.426
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/api/create-composition.d.ts +1 -2
- package/dist/api/helpers/calc-new-props.d.ts +1 -2
- package/dist/components/AssetSelector.js +1 -1
- package/dist/components/AssetSelectorItem.d.ts +1 -0
- package/dist/components/AssetSelectorItem.js +9 -8
- package/dist/components/InitialCompositionLoader.js +13 -1
- package/dist/components/NewComposition/CodemodFooter.d.ts +1 -0
- package/dist/components/NewComposition/CodemodFooter.js +3 -1
- package/dist/components/NewComposition/DeleteComposition.js +1 -1
- package/dist/components/NewComposition/DuplicateComposition.js +5 -1
- package/dist/components/NewComposition/RenameComposition.js +1 -1
- package/dist/components/RenderModal/DataEditor.d.ts +2 -1
- package/dist/components/RenderModal/DataEditor.js +6 -6
- package/dist/components/RenderModal/RenderModalJSONPropsEditor.d.ts +2 -2
- package/dist/components/RenderModal/RenderModalJSONPropsEditor.js +3 -2
- package/dist/components/RenderModal/SchemaEditor/SchemaEditor.d.ts +3 -3
- package/dist/components/RenderModal/SchemaEditor/SchemaEditor.js +4 -5
- package/dist/components/RenderModal/SchemaEditor/SchemaErrorMessages.d.ts +3 -3
- package/dist/components/RenderModal/SchemaEditor/SchemaErrorMessages.js +1 -0
- package/dist/components/RenderModal/SchemaEditor/SchemaSeparationLine.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/SchemaSeparationLine.js +4 -3
- package/dist/components/RenderModal/SchemaEditor/ZodArrayEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodArrayEditor.js +3 -6
- package/dist/components/RenderModal/SchemaEditor/ZodArrayItemEditor.d.ts +2 -1
- package/dist/components/RenderModal/SchemaEditor/ZodArrayItemEditor.js +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodBooleanEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodColorEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodDateEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodDefaultEditor.d.ts +3 -3
- package/dist/components/RenderModal/SchemaEditor/ZodDefaultEditor.js +2 -1
- package/dist/components/RenderModal/SchemaEditor/ZodDiscriminatedUnionEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodDiscriminatedUnionEditor.js +18 -18
- package/dist/components/RenderModal/SchemaEditor/ZodEffectEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodEffectEditor.js +6 -10
- package/dist/components/RenderModal/SchemaEditor/ZodEnumEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodEnumEditor.js +4 -12
- package/dist/components/RenderModal/SchemaEditor/ZodErrorMessages.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodErrorMessages.js +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodFieldValidation.js +4 -3
- package/dist/components/RenderModal/SchemaEditor/ZodMatrixEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodMatrixEditor.js +3 -2
- package/dist/components/RenderModal/SchemaEditor/ZodNullableEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodNullableEditor.js +2 -1
- package/dist/components/RenderModal/SchemaEditor/ZodNumberEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodNumberEditor.js +49 -21
- package/dist/components/RenderModal/SchemaEditor/ZodObjectEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodObjectEditor.js +4 -9
- package/dist/components/RenderModal/SchemaEditor/ZodOptionalEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodOptionalEditor.js +2 -1
- package/dist/components/RenderModal/SchemaEditor/ZodOrNullishEditor.d.ts +3 -3
- package/dist/components/RenderModal/SchemaEditor/ZodStaticFileEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodStaticFileEditor.js +0 -10
- package/dist/components/RenderModal/SchemaEditor/ZodStringEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodSwitch.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodSwitch.js +38 -33
- package/dist/components/RenderModal/SchemaEditor/ZodTextareaEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodTupleEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodTupleEditor.js +3 -6
- package/dist/components/RenderModal/SchemaEditor/ZodTupleItemEditor.d.ts +2 -1
- package/dist/components/RenderModal/SchemaEditor/ZodTupleItemEditor.js +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodUnionEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodUnionEditor.js +11 -15
- package/dist/components/RenderModal/SchemaEditor/create-zod-values.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/create-zod-values.js +108 -110
- package/dist/components/RenderModal/SchemaEditor/extract-enum-json-paths.d.ts +3 -3
- package/dist/components/RenderModal/SchemaEditor/extract-enum-json-paths.js +72 -87
- package/dist/components/RenderModal/SchemaEditor/local-state.d.ts +3 -3
- package/dist/components/RenderModal/SchemaEditor/local-state.js +5 -4
- package/dist/components/RenderModal/SchemaEditor/zod-schema-type.d.ts +176 -0
- package/dist/components/RenderModal/SchemaEditor/zod-schema-type.js +330 -0
- package/dist/components/Tabs/index.js +2 -0
- package/dist/components/Tabs/vertical.js +2 -0
- package/dist/components/TimeValue.js +0 -2
- package/dist/components/Timeline/TimelineDragHandler.js +6 -0
- package/dist/components/get-zod-if-possible.d.ts +3 -0
- package/dist/components/get-zod-if-possible.js +23 -2
- package/dist/esm/{chunk-3g77e2p9.js → chunk-kde77jse.js} +589 -373
- package/dist/esm/index.mjs +170 -81
- package/dist/esm/internals.mjs +589 -373
- package/dist/esm/previewEntry.mjs +598 -375
- package/dist/esm/renderEntry.mjs +1 -1
- package/dist/helpers/inject-css.js +2 -1
- package/dist/index.d.ts +2 -2
- package/dist/previewEntry.d.ts +5 -0
- package/dist/previewEntry.js +11 -2
- package/dist/visual-controls/VisualControls.d.ts +4 -4
- package/dist/visual-controls/VisualControls.js +1 -1
- package/package.json +11 -11
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Normalizes zod schema type detection across v3 and v4.
|
|
4
|
+
*
|
|
5
|
+
* v3 schemas have `_def.typeName` (e.g. "ZodString")
|
|
6
|
+
* v4 schemas have `_def.type` (e.g. "string") and `_zod` property
|
|
7
|
+
*
|
|
8
|
+
* This module provides a unified type name using v4-style lowercase strings,
|
|
9
|
+
* and accessor helpers that abstract v3/v4 `_def` property differences.
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.getBrandedInner = exports.getPipelineInput = exports.getPipelineOutput = exports.getRecordKeyType = exports.getRecordValueType = exports.getTupleItems = exports.getIntersectionSchemas = exports.getDiscriminatedOption = exports.getDiscriminatedOptionKeys = exports.getDiscriminator = exports.getDefaultValue = exports.getUnionOptions = exports.getFirstEnumValue = exports.getEnumValues = exports.getLiteralValue = exports.getEffectsInner = exports.getInnerType = exports.getArrayElement = exports.getObjectShape = exports.getZodSchemaDescription = exports.getZodSchemaType = exports.isZodV3Schema = exports.getZodDef = exports.zodSafeParse = void 0;
|
|
13
|
+
/**
|
|
14
|
+
* Call safeParse on any Zod schema (v3 or v4).
|
|
15
|
+
* All Zod schemas have safeParse at runtime, but some v4 internal types
|
|
16
|
+
* (like $ZodObject) don't declare it in their type definition.
|
|
17
|
+
*/
|
|
18
|
+
const zodSafeParse = (schema, data) => {
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
20
|
+
return schema.safeParse(data);
|
|
21
|
+
};
|
|
22
|
+
exports.zodSafeParse = zodSafeParse;
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
24
|
+
const getZodDef = (schema) => {
|
|
25
|
+
if (schema._def)
|
|
26
|
+
return schema._def;
|
|
27
|
+
if (schema._zod)
|
|
28
|
+
return schema._zod.def;
|
|
29
|
+
throw new Error('Invalid zod schema: missing _def and _zod');
|
|
30
|
+
};
|
|
31
|
+
exports.getZodDef = getZodDef;
|
|
32
|
+
const v3TypeNameMap = {
|
|
33
|
+
ZodString: 'string',
|
|
34
|
+
ZodNumber: 'number',
|
|
35
|
+
ZodBoolean: 'boolean',
|
|
36
|
+
ZodObject: 'object',
|
|
37
|
+
ZodArray: 'array',
|
|
38
|
+
ZodEnum: 'enum',
|
|
39
|
+
ZodUnion: 'union',
|
|
40
|
+
ZodDiscriminatedUnion: 'discriminatedUnion',
|
|
41
|
+
ZodOptional: 'optional',
|
|
42
|
+
ZodNullable: 'nullable',
|
|
43
|
+
ZodDefault: 'default',
|
|
44
|
+
ZodTuple: 'tuple',
|
|
45
|
+
ZodDate: 'date',
|
|
46
|
+
ZodAny: 'any',
|
|
47
|
+
ZodUnknown: 'unknown',
|
|
48
|
+
ZodBigInt: 'bigint',
|
|
49
|
+
ZodNull: 'null',
|
|
50
|
+
ZodUndefined: 'undefined',
|
|
51
|
+
ZodEffects: 'effects',
|
|
52
|
+
ZodLiteral: 'literal',
|
|
53
|
+
ZodRecord: 'record',
|
|
54
|
+
ZodNever: 'never',
|
|
55
|
+
ZodVoid: 'void',
|
|
56
|
+
ZodNaN: 'nan',
|
|
57
|
+
ZodSymbol: 'symbol',
|
|
58
|
+
ZodIntersection: 'intersection',
|
|
59
|
+
ZodMap: 'map',
|
|
60
|
+
ZodSet: 'set',
|
|
61
|
+
ZodLazy: 'lazy',
|
|
62
|
+
ZodFunction: 'function',
|
|
63
|
+
ZodNativeEnum: 'nativeEnum',
|
|
64
|
+
ZodCatch: 'catch',
|
|
65
|
+
ZodPromise: 'promise',
|
|
66
|
+
ZodBranded: 'branded',
|
|
67
|
+
ZodPipeline: 'pipeline',
|
|
68
|
+
};
|
|
69
|
+
const isZodV3Schema = (schema) => {
|
|
70
|
+
const def = (0, exports.getZodDef)(schema);
|
|
71
|
+
return 'typeName' in def;
|
|
72
|
+
};
|
|
73
|
+
exports.isZodV3Schema = isZodV3Schema;
|
|
74
|
+
/**
|
|
75
|
+
* Get the normalized type name for a zod schema (v3 or v4).
|
|
76
|
+
*
|
|
77
|
+
* In v4, discriminatedUnion is a union with a `discriminator` property on `_def`.
|
|
78
|
+
* This function returns 'discriminatedUnion' for that case.
|
|
79
|
+
*/
|
|
80
|
+
const getZodSchemaType = (schema) => {
|
|
81
|
+
var _a;
|
|
82
|
+
const def = (0, exports.getZodDef)(schema);
|
|
83
|
+
if ('typeName' in def) {
|
|
84
|
+
const { typeName } = def;
|
|
85
|
+
return (_a = v3TypeNameMap[typeName]) !== null && _a !== void 0 ? _a : typeName;
|
|
86
|
+
}
|
|
87
|
+
// v4 schema: def.type is a string like "string", "number", etc.
|
|
88
|
+
const { type } = def;
|
|
89
|
+
// In v4, discriminatedUnion has def.type === "union" with def.discriminator
|
|
90
|
+
if (type === 'union' && def.discriminator !== undefined) {
|
|
91
|
+
return 'discriminatedUnion';
|
|
92
|
+
}
|
|
93
|
+
return type;
|
|
94
|
+
};
|
|
95
|
+
exports.getZodSchemaType = getZodSchemaType;
|
|
96
|
+
/**
|
|
97
|
+
* Get the description of a schema, handling v3 vs v4 differences.
|
|
98
|
+
*
|
|
99
|
+
* v3: _def.description
|
|
100
|
+
* v4: schema.description
|
|
101
|
+
*/
|
|
102
|
+
const getZodSchemaDescription = (schema) => {
|
|
103
|
+
if ((0, exports.isZodV3Schema)(schema)) {
|
|
104
|
+
return (0, exports.getZodDef)(schema).description;
|
|
105
|
+
}
|
|
106
|
+
return schema.description;
|
|
107
|
+
};
|
|
108
|
+
exports.getZodSchemaDescription = getZodSchemaDescription;
|
|
109
|
+
/**
|
|
110
|
+
* Get the shape of an object schema.
|
|
111
|
+
* v3: _def.shape() (function)
|
|
112
|
+
* v4: _def.shape (plain object)
|
|
113
|
+
*/
|
|
114
|
+
const getObjectShape = (schema) => {
|
|
115
|
+
const { shape } = (0, exports.getZodDef)(schema);
|
|
116
|
+
return typeof shape === 'function' ? shape() : shape;
|
|
117
|
+
};
|
|
118
|
+
exports.getObjectShape = getObjectShape;
|
|
119
|
+
/**
|
|
120
|
+
* Get the element schema of an array.
|
|
121
|
+
* v3: _def.type
|
|
122
|
+
* v4: _def.element
|
|
123
|
+
*/
|
|
124
|
+
const getArrayElement = (schema) => {
|
|
125
|
+
const def = (0, exports.getZodDef)(schema);
|
|
126
|
+
return (0, exports.isZodV3Schema)(schema) ? def.type : def.element;
|
|
127
|
+
};
|
|
128
|
+
exports.getArrayElement = getArrayElement;
|
|
129
|
+
/**
|
|
130
|
+
* Get the inner type for wrappers like optional, nullable, default, catch.
|
|
131
|
+
* Both v3 and v4 use _def.innerType.
|
|
132
|
+
*/
|
|
133
|
+
const getInnerType = (schema) => {
|
|
134
|
+
return (0, exports.getZodDef)(schema).innerType;
|
|
135
|
+
};
|
|
136
|
+
exports.getInnerType = getInnerType;
|
|
137
|
+
/**
|
|
138
|
+
* Get the inner schema for effects (v3 only - v4 doesn't wrap).
|
|
139
|
+
* v3: _def.schema
|
|
140
|
+
*/
|
|
141
|
+
const getEffectsInner = (schema) => {
|
|
142
|
+
return (0, exports.getZodDef)(schema).schema;
|
|
143
|
+
};
|
|
144
|
+
exports.getEffectsInner = getEffectsInner;
|
|
145
|
+
/**
|
|
146
|
+
* Get the literal value.
|
|
147
|
+
* v3: _def.value (single value)
|
|
148
|
+
* v4: _def.values (array of values) - take the first
|
|
149
|
+
*/
|
|
150
|
+
const getLiteralValue = (schema) => {
|
|
151
|
+
var _a;
|
|
152
|
+
const def = (0, exports.getZodDef)(schema);
|
|
153
|
+
if ((0, exports.isZodV3Schema)(schema)) {
|
|
154
|
+
return def.value;
|
|
155
|
+
}
|
|
156
|
+
return (_a = def.values) === null || _a === void 0 ? void 0 : _a[0];
|
|
157
|
+
};
|
|
158
|
+
exports.getLiteralValue = getLiteralValue;
|
|
159
|
+
/**
|
|
160
|
+
* Get enum values as an array of strings.
|
|
161
|
+
* v3: _def.values (string[])
|
|
162
|
+
* v4: _def.entries (Record<string,string>) - convert to values array
|
|
163
|
+
*/
|
|
164
|
+
const getEnumValues = (schema) => {
|
|
165
|
+
const def = (0, exports.getZodDef)(schema);
|
|
166
|
+
if ((0, exports.isZodV3Schema)(schema)) {
|
|
167
|
+
return def.values;
|
|
168
|
+
}
|
|
169
|
+
const { entries } = def;
|
|
170
|
+
return Object.values(entries);
|
|
171
|
+
};
|
|
172
|
+
exports.getEnumValues = getEnumValues;
|
|
173
|
+
/**
|
|
174
|
+
* Get the first valid value from an enum schema.
|
|
175
|
+
* Handles both regular enums and nativeEnums.
|
|
176
|
+
*
|
|
177
|
+
* In v4, nativeEnums are represented as regular enums with bidirectional
|
|
178
|
+
* entries (e.g. { Apple: 0, "0": "Apple" }). This function filters out
|
|
179
|
+
* the reverse mappings to return actual enum values.
|
|
180
|
+
*/
|
|
181
|
+
const getFirstEnumValue = (schema) => {
|
|
182
|
+
const def = (0, exports.getZodDef)(schema);
|
|
183
|
+
if ((0, exports.isZodV3Schema)(schema)) {
|
|
184
|
+
if (def.typeName === 'ZodNativeEnum') {
|
|
185
|
+
const vals = Object.values(def.values);
|
|
186
|
+
return vals[0];
|
|
187
|
+
}
|
|
188
|
+
return def.values[0];
|
|
189
|
+
}
|
|
190
|
+
const { entries } = def;
|
|
191
|
+
const pairs = Object.entries(entries);
|
|
192
|
+
// Check for native enum with bidirectional mapping
|
|
193
|
+
const hasReverseMapping = pairs.some(([key, value]) => key !== String(value));
|
|
194
|
+
if (hasReverseMapping) {
|
|
195
|
+
// For numeric native enums, filter out the numeric-key reverse mappings
|
|
196
|
+
const forwardPairs = pairs.filter(([key]) => Number.isNaN(Number(key)));
|
|
197
|
+
if (forwardPairs.length > 0) {
|
|
198
|
+
return forwardPairs[0][1];
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
return Object.values(entries)[0];
|
|
202
|
+
};
|
|
203
|
+
exports.getFirstEnumValue = getFirstEnumValue;
|
|
204
|
+
/**
|
|
205
|
+
* Get the union/discriminatedUnion options array.
|
|
206
|
+
* Both v3 and v4 use _def.options.
|
|
207
|
+
*/
|
|
208
|
+
const getUnionOptions = (schema) => {
|
|
209
|
+
return (0, exports.getZodDef)(schema).options;
|
|
210
|
+
};
|
|
211
|
+
exports.getUnionOptions = getUnionOptions;
|
|
212
|
+
/**
|
|
213
|
+
* Get the default value from a ZodDefault.
|
|
214
|
+
* v3: _def.defaultValue() (function)
|
|
215
|
+
* v4: _def.defaultValue (plain value)
|
|
216
|
+
*/
|
|
217
|
+
const getDefaultValue = (schema) => {
|
|
218
|
+
const dv = (0, exports.getZodDef)(schema).defaultValue;
|
|
219
|
+
return typeof dv === 'function' ? dv() : dv;
|
|
220
|
+
};
|
|
221
|
+
exports.getDefaultValue = getDefaultValue;
|
|
222
|
+
/**
|
|
223
|
+
* Get the discriminator key from a discriminated union.
|
|
224
|
+
* v3: _def.discriminator
|
|
225
|
+
* v4: _def.discriminator
|
|
226
|
+
*/
|
|
227
|
+
const getDiscriminator = (schema) => {
|
|
228
|
+
return (0, exports.getZodDef)(schema).discriminator;
|
|
229
|
+
};
|
|
230
|
+
exports.getDiscriminator = getDiscriminator;
|
|
231
|
+
/**
|
|
232
|
+
* Get all discriminator option keys from a discriminated union.
|
|
233
|
+
* v3: [..._def.optionsMap.keys()]
|
|
234
|
+
* v4: iterate options and extract literal values from discriminator field
|
|
235
|
+
*/
|
|
236
|
+
const getDiscriminatedOptionKeys = (schema) => {
|
|
237
|
+
const def = (0, exports.getZodDef)(schema);
|
|
238
|
+
const discriminator = (0, exports.getDiscriminator)(schema);
|
|
239
|
+
// v3 has optionsMap
|
|
240
|
+
if ((0, exports.isZodV3Schema)(schema) && def.optionsMap) {
|
|
241
|
+
return [...def.optionsMap.keys()];
|
|
242
|
+
}
|
|
243
|
+
// v4: iterate options
|
|
244
|
+
const options = (0, exports.getUnionOptions)(schema);
|
|
245
|
+
return options.map((option) => {
|
|
246
|
+
const shape = (0, exports.getObjectShape)(option);
|
|
247
|
+
const discriminatorSchema = shape[discriminator];
|
|
248
|
+
return (0, exports.getLiteralValue)(discriminatorSchema);
|
|
249
|
+
});
|
|
250
|
+
};
|
|
251
|
+
exports.getDiscriminatedOptionKeys = getDiscriminatedOptionKeys;
|
|
252
|
+
/**
|
|
253
|
+
* Get the option schema matching a discriminator value.
|
|
254
|
+
* v3: _def.optionsMap.get(value)
|
|
255
|
+
* v4: find matching option by inspecting literal values
|
|
256
|
+
*/
|
|
257
|
+
const getDiscriminatedOption = (schema, discriminatorValue) => {
|
|
258
|
+
const def = (0, exports.getZodDef)(schema);
|
|
259
|
+
const discriminator = (0, exports.getDiscriminator)(schema);
|
|
260
|
+
// v3 has optionsMap
|
|
261
|
+
if ((0, exports.isZodV3Schema)(schema) && def.optionsMap) {
|
|
262
|
+
return def.optionsMap.get(discriminatorValue);
|
|
263
|
+
}
|
|
264
|
+
// v4: iterate options
|
|
265
|
+
const options = (0, exports.getUnionOptions)(schema);
|
|
266
|
+
return options.find((option) => {
|
|
267
|
+
const shape = (0, exports.getObjectShape)(option);
|
|
268
|
+
const discriminatorSchema = shape[discriminator];
|
|
269
|
+
return (0, exports.getLiteralValue)(discriminatorSchema) === discriminatorValue;
|
|
270
|
+
});
|
|
271
|
+
};
|
|
272
|
+
exports.getDiscriminatedOption = getDiscriminatedOption;
|
|
273
|
+
/**
|
|
274
|
+
* Get the left and right schemas from an intersection.
|
|
275
|
+
* Both v3 and v4 use _def.left and _def.right.
|
|
276
|
+
*/
|
|
277
|
+
const getIntersectionSchemas = (schema) => {
|
|
278
|
+
const def = (0, exports.getZodDef)(schema);
|
|
279
|
+
return { left: def.left, right: def.right };
|
|
280
|
+
};
|
|
281
|
+
exports.getIntersectionSchemas = getIntersectionSchemas;
|
|
282
|
+
/**
|
|
283
|
+
* Get the items array from a tuple schema.
|
|
284
|
+
* Both v3 and v4 use _def.items.
|
|
285
|
+
*/
|
|
286
|
+
const getTupleItems = (schema) => {
|
|
287
|
+
return (0, exports.getZodDef)(schema).items;
|
|
288
|
+
};
|
|
289
|
+
exports.getTupleItems = getTupleItems;
|
|
290
|
+
/**
|
|
291
|
+
* Get the value type schema from a record.
|
|
292
|
+
* Both v3 and v4 use _def.valueType.
|
|
293
|
+
*/
|
|
294
|
+
const getRecordValueType = (schema) => {
|
|
295
|
+
return (0, exports.getZodDef)(schema).valueType;
|
|
296
|
+
};
|
|
297
|
+
exports.getRecordValueType = getRecordValueType;
|
|
298
|
+
/**
|
|
299
|
+
* Get the key type schema from a record.
|
|
300
|
+
* Both v3 and v4 use _def.keyType.
|
|
301
|
+
*/
|
|
302
|
+
const getRecordKeyType = (schema) => {
|
|
303
|
+
return (0, exports.getZodDef)(schema).keyType;
|
|
304
|
+
};
|
|
305
|
+
exports.getRecordKeyType = getRecordKeyType;
|
|
306
|
+
/**
|
|
307
|
+
* Get the output schema from a pipeline/pipe.
|
|
308
|
+
* Both v3 and v4 use _def.out.
|
|
309
|
+
*/
|
|
310
|
+
const getPipelineOutput = (schema) => {
|
|
311
|
+
return (0, exports.getZodDef)(schema).out;
|
|
312
|
+
};
|
|
313
|
+
exports.getPipelineOutput = getPipelineOutput;
|
|
314
|
+
/**
|
|
315
|
+
* Get the input schema from a pipeline/pipe.
|
|
316
|
+
* Both v3 and v4 use _def.in.
|
|
317
|
+
*/
|
|
318
|
+
const getPipelineInput = (schema) => {
|
|
319
|
+
return (0, exports.getZodDef)(schema).in;
|
|
320
|
+
};
|
|
321
|
+
exports.getPipelineInput = getPipelineInput;
|
|
322
|
+
/**
|
|
323
|
+
* Get the inner schema from a branded type.
|
|
324
|
+
* v3: _def.type
|
|
325
|
+
* v4: branded is the schema itself (branding is type-level only)
|
|
326
|
+
*/
|
|
327
|
+
const getBrandedInner = (schema) => {
|
|
328
|
+
return (0, exports.isZodV3Schema)(schema) ? (0, exports.getZodDef)(schema).type : schema;
|
|
329
|
+
};
|
|
330
|
+
exports.getBrandedInner = getBrandedInner;
|
|
@@ -31,6 +31,8 @@ const selectorButton = {
|
|
|
31
31
|
color: 'inherit',
|
|
32
32
|
alignItems: 'center',
|
|
33
33
|
cursor: 'default',
|
|
34
|
+
userSelect: 'none',
|
|
35
|
+
WebkitUserSelect: 'none',
|
|
34
36
|
};
|
|
35
37
|
const Tab = ({ children, onClick, style, selected }) => {
|
|
36
38
|
const [hovered, setHovered] = (0, react_1.useState)(false);
|
|
@@ -15,6 +15,8 @@ const selectorButton = {
|
|
|
15
15
|
fontSize: 14,
|
|
16
16
|
color: 'inherit',
|
|
17
17
|
alignItems: 'center',
|
|
18
|
+
userSelect: 'none',
|
|
19
|
+
WebkitUserSelect: 'none',
|
|
18
20
|
};
|
|
19
21
|
const VerticalTab = ({ children, onClick, style, selected }) => {
|
|
20
22
|
const [hovered, setHovered] = (0, react_1.useState)(false);
|
|
@@ -107,6 +107,8 @@ const Inner = () => {
|
|
|
107
107
|
if (!videoConfig) {
|
|
108
108
|
return;
|
|
109
109
|
}
|
|
110
|
+
document.body.style.userSelect = 'none';
|
|
111
|
+
document.body.style.webkitUserSelect = 'none';
|
|
110
112
|
if (e.target === TimelineInOutPointerHandle_1.inPointerHandle.current) {
|
|
111
113
|
if (inFrame === null) {
|
|
112
114
|
throw new Error('expected outframe');
|
|
@@ -280,6 +282,8 @@ const Inner = () => {
|
|
|
280
282
|
}, [get, inFrame, inOutDragging, outFrame, videoConfig, width]);
|
|
281
283
|
const onPointerUpScrubbing = (0, react_1.useCallback)((e) => {
|
|
282
284
|
stopInterval();
|
|
285
|
+
document.body.style.userSelect = '';
|
|
286
|
+
document.body.style.webkitUserSelect = '';
|
|
283
287
|
if (!videoConfig) {
|
|
284
288
|
return;
|
|
285
289
|
}
|
|
@@ -305,6 +309,8 @@ const Inner = () => {
|
|
|
305
309
|
}
|
|
306
310
|
}, [dragging, left, play, videoConfig, setFrame, width]);
|
|
307
311
|
const onPointerUpInOut = (0, react_1.useCallback)((e) => {
|
|
312
|
+
document.body.style.userSelect = '';
|
|
313
|
+
document.body.style.webkitUserSelect = '';
|
|
308
314
|
if (!videoConfig) {
|
|
309
315
|
return;
|
|
310
316
|
}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export type ZodType = Awaited<typeof import('zod')>['z'];
|
|
3
|
+
export type ZodV3Type = Awaited<typeof import('zod/v3')>;
|
|
3
4
|
export type ZodTypesType = Awaited<typeof import('@remotion/zod-types')>;
|
|
4
5
|
export declare function getZodIfPossible(): Promise<ZodType | null>;
|
|
6
|
+
export declare const getZodV3IfPossible: () => Promise<typeof import("zod/v3") | null>;
|
|
5
7
|
export declare const getZTypesIfPossible: () => Promise<typeof import("@remotion/zod-types") | null>;
|
|
6
8
|
export declare function useZodIfPossible(): ZodType | null;
|
|
9
|
+
export declare const useZodV3IfPossible: () => typeof import("zod/v3") | null;
|
|
7
10
|
export declare const useZodTypesIfPossible: () => typeof import("@remotion/zod-types") | null;
|
|
8
11
|
export declare const ZodProvider: React.FC<{
|
|
9
12
|
readonly children: React.ReactNode;
|
|
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.ZodProvider = exports.useZodTypesIfPossible = exports.getZTypesIfPossible = void 0;
|
|
36
|
+
exports.ZodProvider = exports.useZodTypesIfPossible = exports.useZodV3IfPossible = exports.getZTypesIfPossible = exports.getZodV3IfPossible = void 0;
|
|
37
37
|
exports.getZodIfPossible = getZodIfPossible;
|
|
38
38
|
exports.useZodIfPossible = useZodIfPossible;
|
|
39
39
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
@@ -47,6 +47,16 @@ async function getZodIfPossible() {
|
|
|
47
47
|
return null;
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
+
const getZodV3IfPossible = async () => {
|
|
51
|
+
try {
|
|
52
|
+
const mod = await Promise.resolve().then(() => __importStar(require('zod/v3')));
|
|
53
|
+
return mod;
|
|
54
|
+
}
|
|
55
|
+
catch (_a) {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
exports.getZodV3IfPossible = getZodV3IfPossible;
|
|
50
60
|
const getZTypesIfPossible = async () => {
|
|
51
61
|
try {
|
|
52
62
|
const mod = await Promise.resolve().then(() => __importStar(require('@remotion/zod-types')));
|
|
@@ -62,6 +72,12 @@ function useZodIfPossible() {
|
|
|
62
72
|
const context = (0, react_1.useContext)(ZodContext);
|
|
63
73
|
return (_a = context === null || context === void 0 ? void 0 : context.zod) !== null && _a !== void 0 ? _a : null;
|
|
64
74
|
}
|
|
75
|
+
const useZodV3IfPossible = () => {
|
|
76
|
+
var _a;
|
|
77
|
+
const context = (0, react_1.useContext)(ZodContext);
|
|
78
|
+
return (_a = context === null || context === void 0 ? void 0 : context.zodV3) !== null && _a !== void 0 ? _a : null;
|
|
79
|
+
};
|
|
80
|
+
exports.useZodV3IfPossible = useZodV3IfPossible;
|
|
65
81
|
const useZodTypesIfPossible = () => {
|
|
66
82
|
var _a;
|
|
67
83
|
const context = (0, react_1.useContext)(ZodContext);
|
|
@@ -71,19 +87,24 @@ exports.useZodTypesIfPossible = useZodTypesIfPossible;
|
|
|
71
87
|
const ZodContext = (0, react_1.createContext)(null);
|
|
72
88
|
const ZodProvider = ({ children }) => {
|
|
73
89
|
const [zod, setZod] = (0, react_1.useState)(null);
|
|
90
|
+
const [zodV3, setZodV3] = (0, react_1.useState)(null);
|
|
74
91
|
const [zodTypes, setZodTypes] = (0, react_1.useState)(null);
|
|
75
92
|
(0, react_1.useEffect)(() => {
|
|
76
93
|
getZodIfPossible().then((z) => setZod(z));
|
|
77
94
|
}, []);
|
|
95
|
+
(0, react_1.useEffect)(() => {
|
|
96
|
+
(0, exports.getZodV3IfPossible)().then((z) => setZodV3(z));
|
|
97
|
+
}, []);
|
|
78
98
|
(0, react_1.useEffect)(() => {
|
|
79
99
|
(0, exports.getZTypesIfPossible)().then((z) => setZodTypes(z));
|
|
80
100
|
}, []);
|
|
81
101
|
const contextValue = (0, react_1.useMemo)(() => {
|
|
82
102
|
return {
|
|
83
103
|
zod,
|
|
104
|
+
zodV3,
|
|
84
105
|
zodTypes,
|
|
85
106
|
};
|
|
86
|
-
}, [zod, zodTypes]);
|
|
107
|
+
}, [zod, zodV3, zodTypes]);
|
|
87
108
|
return (jsx_runtime_1.jsx(ZodContext.Provider, { value: contextValue, children: children }));
|
|
88
109
|
};
|
|
89
110
|
exports.ZodProvider = ZodProvider;
|