@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
package/dist/esm/internals.mjs
CHANGED
|
@@ -3712,7 +3712,8 @@ var AssetFolderItem = ({
|
|
|
3712
3712
|
parentFolder,
|
|
3713
3713
|
toggleFolder,
|
|
3714
3714
|
dropLocation,
|
|
3715
|
-
setDropLocation
|
|
3715
|
+
setDropLocation,
|
|
3716
|
+
readOnlyStudio
|
|
3716
3717
|
}) => {
|
|
3717
3718
|
const [hovered, setHovered] = useState15(false);
|
|
3718
3719
|
const openFolderTimerRef = useRef12(null);
|
|
@@ -3795,7 +3796,8 @@ var AssetFolderItem = ({
|
|
|
3795
3796
|
tabIndex,
|
|
3796
3797
|
toggleFolder,
|
|
3797
3798
|
dropLocation,
|
|
3798
|
-
setDropLocation
|
|
3799
|
+
setDropLocation,
|
|
3800
|
+
readOnlyStudio
|
|
3799
3801
|
}, item.name) : null
|
|
3800
3802
|
]
|
|
3801
3803
|
});
|
|
@@ -3808,7 +3810,8 @@ var AssetFolderTree = ({
|
|
|
3808
3810
|
toggleFolder,
|
|
3809
3811
|
tabIndex,
|
|
3810
3812
|
dropLocation,
|
|
3811
|
-
setDropLocation
|
|
3813
|
+
setDropLocation,
|
|
3814
|
+
readOnlyStudio
|
|
3812
3815
|
}) => {
|
|
3813
3816
|
const combinedParents = useMemo23(() => {
|
|
3814
3817
|
return [parentFolder, name].filter(NoReactInternals3.truthy).join("/");
|
|
@@ -3823,7 +3826,8 @@ var AssetFolderTree = ({
|
|
|
3823
3826
|
parentFolder: combinedParents,
|
|
3824
3827
|
toggleFolder,
|
|
3825
3828
|
dropLocation,
|
|
3826
|
-
setDropLocation
|
|
3829
|
+
setDropLocation,
|
|
3830
|
+
readOnlyStudio
|
|
3827
3831
|
}, folder.name);
|
|
3828
3832
|
}),
|
|
3829
3833
|
item.files.map((file) => {
|
|
@@ -3831,13 +3835,14 @@ var AssetFolderTree = ({
|
|
|
3831
3835
|
item: file,
|
|
3832
3836
|
tabIndex,
|
|
3833
3837
|
level,
|
|
3834
|
-
parentFolder: combinedParents
|
|
3838
|
+
parentFolder: combinedParents,
|
|
3839
|
+
readOnlyStudio
|
|
3835
3840
|
}, file.src);
|
|
3836
3841
|
})
|
|
3837
3842
|
]
|
|
3838
3843
|
});
|
|
3839
3844
|
};
|
|
3840
|
-
var AssetSelectorItem = ({ item, tabIndex, level, parentFolder }) => {
|
|
3845
|
+
var AssetSelectorItem = ({ item, tabIndex, level, parentFolder, readOnlyStudio }) => {
|
|
3841
3846
|
const isMobileLayout = useMobileLayout();
|
|
3842
3847
|
const [hovered, setHovered] = useState15(false);
|
|
3843
3848
|
const { setSidebarCollapsedState } = useContext10(SidebarContext);
|
|
@@ -3944,13 +3949,17 @@ var AssetSelectorItem = ({ item, tabIndex, level, parentFolder }) => {
|
|
|
3944
3949
|
renderAction: renderCopyAction,
|
|
3945
3950
|
onClick: copyToClipboard
|
|
3946
3951
|
}),
|
|
3947
|
-
/* @__PURE__ */
|
|
3948
|
-
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
3952
|
+
readOnlyStudio ? null : /* @__PURE__ */ jsxs9(Fragment5, {
|
|
3953
|
+
children: [
|
|
3954
|
+
/* @__PURE__ */ jsx35(Spacing, {
|
|
3955
|
+
x: 0.5
|
|
3956
|
+
}),
|
|
3957
|
+
/* @__PURE__ */ jsx35(InlineAction, {
|
|
3958
|
+
title: "Open in Explorer",
|
|
3959
|
+
renderAction: renderFileExplorerAction,
|
|
3960
|
+
onClick: revealInExplorer
|
|
3961
|
+
})
|
|
3962
|
+
]
|
|
3954
3963
|
})
|
|
3955
3964
|
]
|
|
3956
3965
|
}) : null
|
|
@@ -4305,7 +4314,8 @@ var AssetSelector = ({ readOnlyStudio }) => {
|
|
|
4305
4314
|
tabIndex,
|
|
4306
4315
|
toggleFolder,
|
|
4307
4316
|
dropLocation,
|
|
4308
|
-
setDropLocation
|
|
4317
|
+
setDropLocation,
|
|
4318
|
+
readOnlyStudio
|
|
4309
4319
|
})
|
|
4310
4320
|
})
|
|
4311
4321
|
]
|
|
@@ -4426,7 +4436,9 @@ var selectorButton = {
|
|
|
4426
4436
|
fontSize: 14,
|
|
4427
4437
|
color: "inherit",
|
|
4428
4438
|
alignItems: "center",
|
|
4429
|
-
cursor: "default"
|
|
4439
|
+
cursor: "default",
|
|
4440
|
+
userSelect: "none",
|
|
4441
|
+
WebkitUserSelect: "none"
|
|
4430
4442
|
};
|
|
4431
4443
|
var Tab = ({ children, onClick, style, selected }) => {
|
|
4432
4444
|
const [hovered, setHovered] = useState20(false);
|
|
@@ -4596,10 +4608,16 @@ var InitialCompositionLoader = () => {
|
|
|
4596
4608
|
const selectAsset = useSelectAsset();
|
|
4597
4609
|
const staticFiles = useStaticFiles();
|
|
4598
4610
|
useEffect15(() => {
|
|
4611
|
+
const canvasContentFromUrl = deriveCanvasContentFromUrl();
|
|
4599
4612
|
if (canvasContent) {
|
|
4613
|
+
if (canvasContentFromUrl && canvasContentFromUrl.type === "composition" && canvasContent.type === "composition" && canvasContentFromUrl.compositionId !== canvasContent.compositionId) {
|
|
4614
|
+
const exists = compositions.find((c) => c.id === canvasContentFromUrl.compositionId);
|
|
4615
|
+
if (exists) {
|
|
4616
|
+
selectComposition(exists, false);
|
|
4617
|
+
}
|
|
4618
|
+
}
|
|
4600
4619
|
return;
|
|
4601
4620
|
}
|
|
4602
|
-
const canvasContentFromUrl = deriveCanvasContentFromUrl();
|
|
4603
4621
|
if (canvasContentFromUrl && canvasContentFromUrl.type === "composition") {
|
|
4604
4622
|
const exists = compositions.find((c) => c.id === canvasContentFromUrl.compositionId);
|
|
4605
4623
|
if (exists) {
|
|
@@ -10858,6 +10876,14 @@ async function getZodIfPossible() {
|
|
|
10858
10876
|
return null;
|
|
10859
10877
|
}
|
|
10860
10878
|
}
|
|
10879
|
+
var getZodV3IfPossible = async () => {
|
|
10880
|
+
try {
|
|
10881
|
+
const mod = await import("zod/v3");
|
|
10882
|
+
return mod;
|
|
10883
|
+
} catch {
|
|
10884
|
+
return null;
|
|
10885
|
+
}
|
|
10886
|
+
};
|
|
10861
10887
|
var getZTypesIfPossible = async () => {
|
|
10862
10888
|
try {
|
|
10863
10889
|
const mod = await import("@remotion/zod-types");
|
|
@@ -10877,19 +10903,24 @@ var useZodTypesIfPossible = () => {
|
|
|
10877
10903
|
var ZodContext = createContext16(null);
|
|
10878
10904
|
var ZodProvider = ({ children }) => {
|
|
10879
10905
|
const [zod, setZod] = useState39(null);
|
|
10906
|
+
const [zodV3, setZodV3] = useState39(null);
|
|
10880
10907
|
const [zodTypes, setZodTypes] = useState39(null);
|
|
10881
10908
|
useEffect39(() => {
|
|
10882
10909
|
getZodIfPossible().then((z) => setZod(z));
|
|
10883
10910
|
}, []);
|
|
10911
|
+
useEffect39(() => {
|
|
10912
|
+
getZodV3IfPossible().then((z) => setZodV3(z));
|
|
10913
|
+
}, []);
|
|
10884
10914
|
useEffect39(() => {
|
|
10885
10915
|
getZTypesIfPossible().then((z) => setZodTypes(z));
|
|
10886
10916
|
}, []);
|
|
10887
10917
|
const contextValue = useMemo53(() => {
|
|
10888
10918
|
return {
|
|
10889
10919
|
zod,
|
|
10920
|
+
zodV3,
|
|
10890
10921
|
zodTypes
|
|
10891
10922
|
};
|
|
10892
|
-
}, [zod, zodTypes]);
|
|
10923
|
+
}, [zod, zodV3, zodTypes]);
|
|
10893
10924
|
return /* @__PURE__ */ jsx95(ZodContext.Provider, {
|
|
10894
10925
|
value: contextValue,
|
|
10895
10926
|
children
|
|
@@ -11031,6 +11062,184 @@ import { Internals as Internals30 } from "remotion";
|
|
|
11031
11062
|
// src/api/save-default-props.ts
|
|
11032
11063
|
import { getRemotionEnvironment as getRemotionEnvironment4 } from "remotion";
|
|
11033
11064
|
|
|
11065
|
+
// src/components/RenderModal/SchemaEditor/zod-schema-type.ts
|
|
11066
|
+
var zodSafeParse = (schema, data) => {
|
|
11067
|
+
return schema.safeParse(data);
|
|
11068
|
+
};
|
|
11069
|
+
var getZodDef = (schema) => {
|
|
11070
|
+
if (schema._def)
|
|
11071
|
+
return schema._def;
|
|
11072
|
+
if (schema._zod)
|
|
11073
|
+
return schema._zod.def;
|
|
11074
|
+
throw new Error("Invalid zod schema: missing _def and _zod");
|
|
11075
|
+
};
|
|
11076
|
+
var v3TypeNameMap = {
|
|
11077
|
+
ZodString: "string",
|
|
11078
|
+
ZodNumber: "number",
|
|
11079
|
+
ZodBoolean: "boolean",
|
|
11080
|
+
ZodObject: "object",
|
|
11081
|
+
ZodArray: "array",
|
|
11082
|
+
ZodEnum: "enum",
|
|
11083
|
+
ZodUnion: "union",
|
|
11084
|
+
ZodDiscriminatedUnion: "discriminatedUnion",
|
|
11085
|
+
ZodOptional: "optional",
|
|
11086
|
+
ZodNullable: "nullable",
|
|
11087
|
+
ZodDefault: "default",
|
|
11088
|
+
ZodTuple: "tuple",
|
|
11089
|
+
ZodDate: "date",
|
|
11090
|
+
ZodAny: "any",
|
|
11091
|
+
ZodUnknown: "unknown",
|
|
11092
|
+
ZodBigInt: "bigint",
|
|
11093
|
+
ZodNull: "null",
|
|
11094
|
+
ZodUndefined: "undefined",
|
|
11095
|
+
ZodEffects: "effects",
|
|
11096
|
+
ZodLiteral: "literal",
|
|
11097
|
+
ZodRecord: "record",
|
|
11098
|
+
ZodNever: "never",
|
|
11099
|
+
ZodVoid: "void",
|
|
11100
|
+
ZodNaN: "nan",
|
|
11101
|
+
ZodSymbol: "symbol",
|
|
11102
|
+
ZodIntersection: "intersection",
|
|
11103
|
+
ZodMap: "map",
|
|
11104
|
+
ZodSet: "set",
|
|
11105
|
+
ZodLazy: "lazy",
|
|
11106
|
+
ZodFunction: "function",
|
|
11107
|
+
ZodNativeEnum: "nativeEnum",
|
|
11108
|
+
ZodCatch: "catch",
|
|
11109
|
+
ZodPromise: "promise",
|
|
11110
|
+
ZodBranded: "branded",
|
|
11111
|
+
ZodPipeline: "pipeline"
|
|
11112
|
+
};
|
|
11113
|
+
var isZodV3Schema = (schema) => {
|
|
11114
|
+
const def = getZodDef(schema);
|
|
11115
|
+
return "typeName" in def;
|
|
11116
|
+
};
|
|
11117
|
+
var getZodSchemaType = (schema) => {
|
|
11118
|
+
const def = getZodDef(schema);
|
|
11119
|
+
if ("typeName" in def) {
|
|
11120
|
+
const { typeName } = def;
|
|
11121
|
+
return v3TypeNameMap[typeName] ?? typeName;
|
|
11122
|
+
}
|
|
11123
|
+
const { type } = def;
|
|
11124
|
+
if (type === "union" && def.discriminator !== undefined) {
|
|
11125
|
+
return "discriminatedUnion";
|
|
11126
|
+
}
|
|
11127
|
+
return type;
|
|
11128
|
+
};
|
|
11129
|
+
var getZodSchemaDescription = (schema) => {
|
|
11130
|
+
if (isZodV3Schema(schema)) {
|
|
11131
|
+
return getZodDef(schema).description;
|
|
11132
|
+
}
|
|
11133
|
+
return schema.description;
|
|
11134
|
+
};
|
|
11135
|
+
var getObjectShape = (schema) => {
|
|
11136
|
+
const { shape } = getZodDef(schema);
|
|
11137
|
+
return typeof shape === "function" ? shape() : shape;
|
|
11138
|
+
};
|
|
11139
|
+
var getArrayElement = (schema) => {
|
|
11140
|
+
const def = getZodDef(schema);
|
|
11141
|
+
return isZodV3Schema(schema) ? def.type : def.element;
|
|
11142
|
+
};
|
|
11143
|
+
var getInnerType = (schema) => {
|
|
11144
|
+
return getZodDef(schema).innerType;
|
|
11145
|
+
};
|
|
11146
|
+
var getEffectsInner = (schema) => {
|
|
11147
|
+
return getZodDef(schema).schema;
|
|
11148
|
+
};
|
|
11149
|
+
var getLiteralValue = (schema) => {
|
|
11150
|
+
const def = getZodDef(schema);
|
|
11151
|
+
if (isZodV3Schema(schema)) {
|
|
11152
|
+
return def.value;
|
|
11153
|
+
}
|
|
11154
|
+
return def.values?.[0];
|
|
11155
|
+
};
|
|
11156
|
+
var getEnumValues = (schema) => {
|
|
11157
|
+
const def = getZodDef(schema);
|
|
11158
|
+
if (isZodV3Schema(schema)) {
|
|
11159
|
+
return def.values;
|
|
11160
|
+
}
|
|
11161
|
+
const { entries } = def;
|
|
11162
|
+
return Object.values(entries);
|
|
11163
|
+
};
|
|
11164
|
+
var getFirstEnumValue = (schema) => {
|
|
11165
|
+
const def = getZodDef(schema);
|
|
11166
|
+
if (isZodV3Schema(schema)) {
|
|
11167
|
+
if (def.typeName === "ZodNativeEnum") {
|
|
11168
|
+
const vals = Object.values(def.values);
|
|
11169
|
+
return vals[0];
|
|
11170
|
+
}
|
|
11171
|
+
return def.values[0];
|
|
11172
|
+
}
|
|
11173
|
+
const { entries } = def;
|
|
11174
|
+
const pairs = Object.entries(entries);
|
|
11175
|
+
const hasReverseMapping = pairs.some(([key, value]) => key !== String(value));
|
|
11176
|
+
if (hasReverseMapping) {
|
|
11177
|
+
const forwardPairs = pairs.filter(([key]) => Number.isNaN(Number(key)));
|
|
11178
|
+
if (forwardPairs.length > 0) {
|
|
11179
|
+
return forwardPairs[0][1];
|
|
11180
|
+
}
|
|
11181
|
+
}
|
|
11182
|
+
return Object.values(entries)[0];
|
|
11183
|
+
};
|
|
11184
|
+
var getUnionOptions = (schema) => {
|
|
11185
|
+
return getZodDef(schema).options;
|
|
11186
|
+
};
|
|
11187
|
+
var getDefaultValue = (schema) => {
|
|
11188
|
+
const dv = getZodDef(schema).defaultValue;
|
|
11189
|
+
return typeof dv === "function" ? dv() : dv;
|
|
11190
|
+
};
|
|
11191
|
+
var getDiscriminator = (schema) => {
|
|
11192
|
+
return getZodDef(schema).discriminator;
|
|
11193
|
+
};
|
|
11194
|
+
var getDiscriminatedOptionKeys = (schema) => {
|
|
11195
|
+
const def = getZodDef(schema);
|
|
11196
|
+
const discriminator = getDiscriminator(schema);
|
|
11197
|
+
if (isZodV3Schema(schema) && def.optionsMap) {
|
|
11198
|
+
return [...def.optionsMap.keys()];
|
|
11199
|
+
}
|
|
11200
|
+
const options = getUnionOptions(schema);
|
|
11201
|
+
return options.map((option) => {
|
|
11202
|
+
const shape = getObjectShape(option);
|
|
11203
|
+
const discriminatorSchema = shape[discriminator];
|
|
11204
|
+
return getLiteralValue(discriminatorSchema);
|
|
11205
|
+
});
|
|
11206
|
+
};
|
|
11207
|
+
var getDiscriminatedOption = (schema, discriminatorValue) => {
|
|
11208
|
+
const def = getZodDef(schema);
|
|
11209
|
+
const discriminator = getDiscriminator(schema);
|
|
11210
|
+
if (isZodV3Schema(schema) && def.optionsMap) {
|
|
11211
|
+
return def.optionsMap.get(discriminatorValue);
|
|
11212
|
+
}
|
|
11213
|
+
const options = getUnionOptions(schema);
|
|
11214
|
+
return options.find((option) => {
|
|
11215
|
+
const shape = getObjectShape(option);
|
|
11216
|
+
const discriminatorSchema = shape[discriminator];
|
|
11217
|
+
return getLiteralValue(discriminatorSchema) === discriminatorValue;
|
|
11218
|
+
});
|
|
11219
|
+
};
|
|
11220
|
+
var getIntersectionSchemas = (schema) => {
|
|
11221
|
+
const def = getZodDef(schema);
|
|
11222
|
+
return { left: def.left, right: def.right };
|
|
11223
|
+
};
|
|
11224
|
+
var getTupleItems = (schema) => {
|
|
11225
|
+
return getZodDef(schema).items;
|
|
11226
|
+
};
|
|
11227
|
+
var getRecordValueType = (schema) => {
|
|
11228
|
+
return getZodDef(schema).valueType;
|
|
11229
|
+
};
|
|
11230
|
+
var getRecordKeyType = (schema) => {
|
|
11231
|
+
return getZodDef(schema).keyType;
|
|
11232
|
+
};
|
|
11233
|
+
var getPipelineOutput = (schema) => {
|
|
11234
|
+
return getZodDef(schema).out;
|
|
11235
|
+
};
|
|
11236
|
+
var getPipelineInput = (schema) => {
|
|
11237
|
+
return getZodDef(schema).in;
|
|
11238
|
+
};
|
|
11239
|
+
var getBrandedInner = (schema) => {
|
|
11240
|
+
return isZodV3Schema(schema) ? getZodDef(schema).type : schema;
|
|
11241
|
+
};
|
|
11242
|
+
|
|
11034
11243
|
// src/components/RenderModal/SchemaEditor/extract-enum-json-paths.ts
|
|
11035
11244
|
var extractEnumJsonPaths = ({
|
|
11036
11245
|
schema,
|
|
@@ -11038,11 +11247,14 @@ var extractEnumJsonPaths = ({
|
|
|
11038
11247
|
currentPath,
|
|
11039
11248
|
zodTypes
|
|
11040
11249
|
}) => {
|
|
11041
|
-
const
|
|
11042
|
-
|
|
11250
|
+
const description = getZodSchemaDescription(schema);
|
|
11251
|
+
if (zodTypes && description === zodTypes.ZodZypesInternals.REMOTION_MATRIX_BRAND) {
|
|
11252
|
+
return [currentPath];
|
|
11253
|
+
}
|
|
11254
|
+
const typeName = getZodSchemaType(schema);
|
|
11043
11255
|
switch (typeName) {
|
|
11044
|
-
case
|
|
11045
|
-
const shape =
|
|
11256
|
+
case "object": {
|
|
11257
|
+
const shape = getObjectShape(schema);
|
|
11046
11258
|
const keys = Object.keys(shape);
|
|
11047
11259
|
return keys.map((key) => {
|
|
11048
11260
|
return extractEnumJsonPaths({
|
|
@@ -11053,16 +11265,16 @@ var extractEnumJsonPaths = ({
|
|
|
11053
11265
|
});
|
|
11054
11266
|
}).flat(1);
|
|
11055
11267
|
}
|
|
11056
|
-
case
|
|
11268
|
+
case "array": {
|
|
11057
11269
|
return extractEnumJsonPaths({
|
|
11058
|
-
schema:
|
|
11270
|
+
schema: getArrayElement(schema),
|
|
11059
11271
|
zodRuntime,
|
|
11060
11272
|
currentPath: [...currentPath, "[]"],
|
|
11061
11273
|
zodTypes
|
|
11062
11274
|
});
|
|
11063
11275
|
}
|
|
11064
|
-
case
|
|
11065
|
-
return
|
|
11276
|
+
case "union": {
|
|
11277
|
+
return getUnionOptions(schema).map((option) => {
|
|
11066
11278
|
return extractEnumJsonPaths({
|
|
11067
11279
|
schema: option,
|
|
11068
11280
|
zodRuntime,
|
|
@@ -11071,8 +11283,8 @@ var extractEnumJsonPaths = ({
|
|
|
11071
11283
|
});
|
|
11072
11284
|
}).flat(1);
|
|
11073
11285
|
}
|
|
11074
|
-
case
|
|
11075
|
-
return
|
|
11286
|
+
case "discriminatedUnion": {
|
|
11287
|
+
return getUnionOptions(schema).map((op) => {
|
|
11076
11288
|
return extractEnumJsonPaths({
|
|
11077
11289
|
schema: op,
|
|
11078
11290
|
zodRuntime,
|
|
@@ -11081,22 +11293,19 @@ var extractEnumJsonPaths = ({
|
|
|
11081
11293
|
});
|
|
11082
11294
|
}).flat(1);
|
|
11083
11295
|
}
|
|
11084
|
-
case
|
|
11296
|
+
case "literal": {
|
|
11085
11297
|
return [currentPath];
|
|
11086
11298
|
}
|
|
11087
|
-
case
|
|
11088
|
-
if (zodTypes && schema._def.description === zodTypes.ZodZypesInternals.REMOTION_MATRIX_BRAND) {
|
|
11089
|
-
return [currentPath];
|
|
11090
|
-
}
|
|
11299
|
+
case "effects": {
|
|
11091
11300
|
return extractEnumJsonPaths({
|
|
11092
|
-
schema:
|
|
11301
|
+
schema: getEffectsInner(schema),
|
|
11093
11302
|
zodRuntime,
|
|
11094
11303
|
currentPath,
|
|
11095
11304
|
zodTypes
|
|
11096
11305
|
});
|
|
11097
11306
|
}
|
|
11098
|
-
case
|
|
11099
|
-
const { left: left3, right } =
|
|
11307
|
+
case "intersection": {
|
|
11308
|
+
const { left: left3, right } = getIntersectionSchemas(schema);
|
|
11100
11309
|
const leftValue = extractEnumJsonPaths({
|
|
11101
11310
|
schema: left3,
|
|
11102
11311
|
zodRuntime,
|
|
@@ -11111,109 +11320,94 @@ var extractEnumJsonPaths = ({
|
|
|
11111
11320
|
});
|
|
11112
11321
|
return [...leftValue, ...rightValue];
|
|
11113
11322
|
}
|
|
11114
|
-
case
|
|
11115
|
-
return
|
|
11323
|
+
case "tuple": {
|
|
11324
|
+
return getTupleItems(schema).map((item, i) => extractEnumJsonPaths({
|
|
11116
11325
|
schema: item,
|
|
11117
11326
|
zodRuntime,
|
|
11118
11327
|
currentPath: [...currentPath, i],
|
|
11119
11328
|
zodTypes
|
|
11120
11329
|
})).flat(1);
|
|
11121
11330
|
}
|
|
11122
|
-
case
|
|
11123
|
-
const
|
|
11124
|
-
|
|
11331
|
+
case "record": {
|
|
11332
|
+
const recordPath = [...currentPath, "{}"];
|
|
11333
|
+
const keyResults = extractEnumJsonPaths({
|
|
11334
|
+
schema: getRecordKeyType(schema),
|
|
11335
|
+
zodRuntime,
|
|
11336
|
+
currentPath: recordPath,
|
|
11337
|
+
zodTypes
|
|
11338
|
+
});
|
|
11339
|
+
const valueResults = extractEnumJsonPaths({
|
|
11340
|
+
schema: getRecordValueType(schema),
|
|
11125
11341
|
zodRuntime,
|
|
11126
|
-
currentPath:
|
|
11342
|
+
currentPath: recordPath,
|
|
11127
11343
|
zodTypes
|
|
11128
11344
|
});
|
|
11129
|
-
return
|
|
11345
|
+
return [...keyResults, ...valueResults];
|
|
11130
11346
|
}
|
|
11131
|
-
case
|
|
11347
|
+
case "function": {
|
|
11132
11348
|
throw new Error("Cannot create a value for type function");
|
|
11133
11349
|
}
|
|
11134
|
-
case
|
|
11350
|
+
case "enum": {
|
|
11135
11351
|
return [currentPath];
|
|
11136
11352
|
}
|
|
11137
|
-
case
|
|
11353
|
+
case "nativeEnum": {
|
|
11138
11354
|
return [];
|
|
11139
11355
|
}
|
|
11140
|
-
case
|
|
11141
|
-
|
|
11142
|
-
|
|
11143
|
-
schema: defType.innerType,
|
|
11144
|
-
zodRuntime,
|
|
11145
|
-
currentPath,
|
|
11146
|
-
zodTypes
|
|
11147
|
-
});
|
|
11148
|
-
return value;
|
|
11149
|
-
}
|
|
11150
|
-
case zodRuntime.ZodFirstPartyTypeKind.ZodNullable: {
|
|
11151
|
-
const defType = def;
|
|
11152
|
-
const value = extractEnumJsonPaths({
|
|
11153
|
-
schema: defType.innerType,
|
|
11154
|
-
zodRuntime,
|
|
11155
|
-
currentPath,
|
|
11156
|
-
zodTypes
|
|
11157
|
-
});
|
|
11158
|
-
return value;
|
|
11159
|
-
}
|
|
11160
|
-
case zodRuntime.ZodFirstPartyTypeKind.ZodDefault: {
|
|
11161
|
-
const defType = def;
|
|
11356
|
+
case "optional":
|
|
11357
|
+
case "nullable":
|
|
11358
|
+
case "catch": {
|
|
11162
11359
|
return extractEnumJsonPaths({
|
|
11163
|
-
schema:
|
|
11360
|
+
schema: getInnerType(schema),
|
|
11164
11361
|
zodRuntime,
|
|
11165
11362
|
currentPath,
|
|
11166
11363
|
zodTypes
|
|
11167
11364
|
});
|
|
11168
11365
|
}
|
|
11169
|
-
case
|
|
11170
|
-
const defType = def;
|
|
11366
|
+
case "default": {
|
|
11171
11367
|
return extractEnumJsonPaths({
|
|
11172
|
-
schema:
|
|
11368
|
+
schema: getInnerType(schema),
|
|
11173
11369
|
zodRuntime,
|
|
11174
11370
|
currentPath,
|
|
11175
11371
|
zodTypes
|
|
11176
11372
|
});
|
|
11177
11373
|
}
|
|
11178
|
-
case
|
|
11374
|
+
case "promise": {
|
|
11179
11375
|
return [];
|
|
11180
11376
|
}
|
|
11181
|
-
case
|
|
11182
|
-
|
|
11183
|
-
|
|
11184
|
-
schema: defType.type,
|
|
11377
|
+
case "branded": {
|
|
11378
|
+
return extractEnumJsonPaths({
|
|
11379
|
+
schema: getBrandedInner(schema),
|
|
11185
11380
|
zodRuntime,
|
|
11186
11381
|
currentPath,
|
|
11187
11382
|
zodTypes
|
|
11188
11383
|
});
|
|
11189
|
-
return value;
|
|
11190
11384
|
}
|
|
11191
|
-
case
|
|
11192
|
-
|
|
11193
|
-
|
|
11194
|
-
schema:
|
|
11385
|
+
case "pipeline":
|
|
11386
|
+
case "pipe": {
|
|
11387
|
+
return extractEnumJsonPaths({
|
|
11388
|
+
schema: getPipelineOutput(schema),
|
|
11195
11389
|
zodRuntime,
|
|
11196
11390
|
currentPath,
|
|
11197
11391
|
zodTypes
|
|
11198
11392
|
});
|
|
11199
|
-
return value;
|
|
11200
11393
|
}
|
|
11201
|
-
case
|
|
11202
|
-
case
|
|
11203
|
-
case
|
|
11204
|
-
case
|
|
11205
|
-
case
|
|
11206
|
-
case
|
|
11207
|
-
case
|
|
11208
|
-
case
|
|
11209
|
-
case
|
|
11210
|
-
case
|
|
11211
|
-
case
|
|
11212
|
-
case
|
|
11213
|
-
case
|
|
11214
|
-
case
|
|
11215
|
-
case
|
|
11216
|
-
case
|
|
11394
|
+
case "string":
|
|
11395
|
+
case "number":
|
|
11396
|
+
case "bigint":
|
|
11397
|
+
case "boolean":
|
|
11398
|
+
case "nan":
|
|
11399
|
+
case "date":
|
|
11400
|
+
case "symbol":
|
|
11401
|
+
case "undefined":
|
|
11402
|
+
case "null":
|
|
11403
|
+
case "any":
|
|
11404
|
+
case "unknown":
|
|
11405
|
+
case "never":
|
|
11406
|
+
case "void":
|
|
11407
|
+
case "map":
|
|
11408
|
+
case "lazy":
|
|
11409
|
+
case "set":
|
|
11410
|
+
case "custom": {
|
|
11217
11411
|
return [];
|
|
11218
11412
|
}
|
|
11219
11413
|
default:
|
|
@@ -11569,7 +11763,7 @@ var ZodErrorMessages = ({ zodValidationResult, viewTab }) => {
|
|
|
11569
11763
|
}, []);
|
|
11570
11764
|
if (viewTab === "json") {
|
|
11571
11765
|
return /* @__PURE__ */ jsx102("div", {
|
|
11572
|
-
children: zodValidationResult.error.
|
|
11766
|
+
children: zodValidationResult.error.issues.map((error) => {
|
|
11573
11767
|
return /* @__PURE__ */ jsxs46("div", {
|
|
11574
11768
|
style: style7,
|
|
11575
11769
|
children: [
|
|
@@ -11589,7 +11783,7 @@ var ZodErrorMessages = ({ zodValidationResult, viewTab }) => {
|
|
|
11589
11783
|
});
|
|
11590
11784
|
}
|
|
11591
11785
|
return /* @__PURE__ */ jsx102("div", {
|
|
11592
|
-
children: zodValidationResult.error.
|
|
11786
|
+
children: zodValidationResult.error.issues.map((error) => {
|
|
11593
11787
|
return /* @__PURE__ */ jsxs46("div", {
|
|
11594
11788
|
style: style7,
|
|
11595
11789
|
children: [
|
|
@@ -11646,7 +11840,7 @@ var scrollable = {
|
|
|
11646
11840
|
var parseJSON = (str, schema) => {
|
|
11647
11841
|
try {
|
|
11648
11842
|
const value = NoReactInternals8.deserializeJSONWithSpecialTypes(str);
|
|
11649
|
-
const zodValidation = schema
|
|
11843
|
+
const zodValidation = zodSafeParse(schema, value);
|
|
11650
11844
|
return { str, value, validJSON: true, zodValidation };
|
|
11651
11845
|
} catch (e) {
|
|
11652
11846
|
return { str, validJSON: false, error: e.message };
|
|
@@ -11678,7 +11872,7 @@ var RenderModalJSONPropsEditor = ({
|
|
|
11678
11872
|
const onChange = useCallback47((e) => {
|
|
11679
11873
|
const parsed = parseJSON(e.target.value, schema);
|
|
11680
11874
|
if (parsed.validJSON) {
|
|
11681
|
-
const validationResult = schema
|
|
11875
|
+
const validationResult = zodSafeParse(schema, parsed.value);
|
|
11682
11876
|
setLocalValue({
|
|
11683
11877
|
str: e.target.value,
|
|
11684
11878
|
value: parsed.value,
|
|
@@ -12290,46 +12484,72 @@ var createZodValues = (schema, zodRuntime, zodTypes) => {
|
|
|
12290
12484
|
if (!schema) {
|
|
12291
12485
|
throw new Error("Invalid zod schema");
|
|
12292
12486
|
}
|
|
12293
|
-
const
|
|
12294
|
-
|
|
12487
|
+
const description = getZodSchemaDescription(schema);
|
|
12488
|
+
if (zodTypes) {
|
|
12489
|
+
if (description === zodTypes.ZodZypesInternals.REMOTION_COLOR_BRAND) {
|
|
12490
|
+
return "#ffffff";
|
|
12491
|
+
}
|
|
12492
|
+
if (description === zodTypes.ZodZypesInternals.REMOTION_TEXTAREA_BRAND) {
|
|
12493
|
+
return "";
|
|
12494
|
+
}
|
|
12495
|
+
if (description === zodTypes.ZodZypesInternals.REMOTION_MATRIX_BRAND) {
|
|
12496
|
+
return [
|
|
12497
|
+
[1, 0, 0],
|
|
12498
|
+
[0, 1, 0],
|
|
12499
|
+
[0, 0, 1]
|
|
12500
|
+
];
|
|
12501
|
+
}
|
|
12502
|
+
}
|
|
12503
|
+
const typeName = getZodSchemaType(schema);
|
|
12295
12504
|
switch (typeName) {
|
|
12296
|
-
case
|
|
12505
|
+
case "string":
|
|
12297
12506
|
return "";
|
|
12298
|
-
case
|
|
12299
|
-
|
|
12300
|
-
|
|
12301
|
-
|
|
12302
|
-
|
|
12303
|
-
|
|
12304
|
-
|
|
12507
|
+
case "number": {
|
|
12508
|
+
const { checks } = getZodDef(schema);
|
|
12509
|
+
if (checks) {
|
|
12510
|
+
if (isZodV3Schema(schema)) {
|
|
12511
|
+
for (const check of checks) {
|
|
12512
|
+
if (check.kind === "min")
|
|
12513
|
+
return check.value;
|
|
12514
|
+
if (check.kind === "max" && check.value < 0)
|
|
12515
|
+
return check.value;
|
|
12516
|
+
}
|
|
12517
|
+
} else {
|
|
12518
|
+
for (const check of checks) {
|
|
12519
|
+
const cd = check._zod?.def;
|
|
12520
|
+
if (cd?.check === "greater_than")
|
|
12521
|
+
return cd.value;
|
|
12522
|
+
if (cd?.check === "less_than" && cd.value < 0)
|
|
12523
|
+
return cd.value;
|
|
12524
|
+
}
|
|
12305
12525
|
}
|
|
12306
12526
|
}
|
|
12307
12527
|
return 0;
|
|
12308
12528
|
}
|
|
12309
|
-
case
|
|
12529
|
+
case "bigint":
|
|
12310
12530
|
return BigInt(0);
|
|
12311
|
-
case
|
|
12531
|
+
case "boolean":
|
|
12312
12532
|
return false;
|
|
12313
|
-
case
|
|
12533
|
+
case "nan":
|
|
12314
12534
|
return NaN;
|
|
12315
|
-
case
|
|
12535
|
+
case "date":
|
|
12316
12536
|
return new Date;
|
|
12317
|
-
case
|
|
12537
|
+
case "symbol":
|
|
12318
12538
|
return Symbol("remotion");
|
|
12319
|
-
case
|
|
12539
|
+
case "undefined":
|
|
12540
|
+
case "void":
|
|
12320
12541
|
return;
|
|
12321
|
-
case
|
|
12542
|
+
case "null":
|
|
12322
12543
|
return null;
|
|
12323
|
-
case
|
|
12544
|
+
case "any":
|
|
12545
|
+
case "custom":
|
|
12324
12546
|
throw new Error("Cannot create a value for type z.any()");
|
|
12325
|
-
case
|
|
12547
|
+
case "unknown":
|
|
12326
12548
|
throw new Error("Cannot create a value for type z.unknown()");
|
|
12327
|
-
case
|
|
12549
|
+
case "never":
|
|
12328
12550
|
throw new Error("Cannot create a value for type z.never()");
|
|
12329
|
-
case
|
|
12330
|
-
|
|
12331
|
-
case zodRuntime.ZodFirstPartyTypeKind.ZodObject: {
|
|
12332
|
-
const shape = def.shape();
|
|
12551
|
+
case "object": {
|
|
12552
|
+
const shape = getObjectShape(schema);
|
|
12333
12553
|
const keys = Object.keys(shape);
|
|
12334
12554
|
const returnValue = keys.reduce((existing, key) => {
|
|
12335
12555
|
existing[key] = createZodValues(shape[key], zodRuntime, zodTypes);
|
|
@@ -12337,40 +12557,25 @@ var createZodValues = (schema, zodRuntime, zodTypes) => {
|
|
|
12337
12557
|
}, {});
|
|
12338
12558
|
return returnValue;
|
|
12339
12559
|
}
|
|
12340
|
-
case
|
|
12341
|
-
return [
|
|
12342
|
-
createZodValues(def.type, zodRuntime, zodTypes)
|
|
12343
|
-
];
|
|
12560
|
+
case "array": {
|
|
12561
|
+
return [createZodValues(getArrayElement(schema), zodRuntime, zodTypes)];
|
|
12344
12562
|
}
|
|
12345
|
-
case
|
|
12346
|
-
const
|
|
12347
|
-
return
|
|
12563
|
+
case "union": {
|
|
12564
|
+
const firstOption = getUnionOptions(schema)[0];
|
|
12565
|
+
return firstOption ? createZodValues(firstOption, zodRuntime, zodTypes) : undefined;
|
|
12348
12566
|
}
|
|
12349
|
-
case
|
|
12350
|
-
const
|
|
12351
|
-
return createZodValues(
|
|
12567
|
+
case "discriminatedUnion": {
|
|
12568
|
+
const firstOption = getUnionOptions(schema)[0];
|
|
12569
|
+
return createZodValues(firstOption, zodRuntime, zodTypes);
|
|
12352
12570
|
}
|
|
12353
|
-
case
|
|
12354
|
-
return
|
|
12571
|
+
case "literal": {
|
|
12572
|
+
return getLiteralValue(schema);
|
|
12355
12573
|
}
|
|
12356
|
-
case
|
|
12357
|
-
|
|
12358
|
-
return "#ffffff";
|
|
12359
|
-
}
|
|
12360
|
-
if (zodTypes && schema._def.description === zodTypes.ZodZypesInternals.REMOTION_TEXTAREA_BRAND) {
|
|
12361
|
-
return "";
|
|
12362
|
-
}
|
|
12363
|
-
if (zodTypes && schema._def.description === zodTypes.ZodZypesInternals.REMOTION_MATRIX_BRAND) {
|
|
12364
|
-
return [
|
|
12365
|
-
[1, 0, 0],
|
|
12366
|
-
[0, 1, 0],
|
|
12367
|
-
[0, 0, 1]
|
|
12368
|
-
];
|
|
12369
|
-
}
|
|
12370
|
-
return createZodValues(def.schema, zodRuntime, zodTypes);
|
|
12574
|
+
case "effects": {
|
|
12575
|
+
return createZodValues(getEffectsInner(schema), zodRuntime, zodTypes);
|
|
12371
12576
|
}
|
|
12372
|
-
case
|
|
12373
|
-
const { left: left3, right } =
|
|
12577
|
+
case "intersection": {
|
|
12578
|
+
const { left: left3, right } = getIntersectionSchemas(schema);
|
|
12374
12579
|
const leftValue = createZodValues(left3, zodRuntime, zodTypes);
|
|
12375
12580
|
if (typeof leftValue !== "object") {
|
|
12376
12581
|
throw new Error("Cannot create value for type z.intersection: Left side is not an object");
|
|
@@ -12381,73 +12586,59 @@ var createZodValues = (schema, zodRuntime, zodTypes) => {
|
|
|
12381
12586
|
}
|
|
12382
12587
|
return { ...leftValue, ...rightValue };
|
|
12383
12588
|
}
|
|
12384
|
-
case
|
|
12385
|
-
|
|
12386
|
-
return items;
|
|
12589
|
+
case "tuple": {
|
|
12590
|
+
return getTupleItems(schema).map((item2) => createZodValues(item2, zodRuntime, zodTypes));
|
|
12387
12591
|
}
|
|
12388
|
-
case
|
|
12389
|
-
const values = createZodValues(
|
|
12592
|
+
case "record": {
|
|
12593
|
+
const values = createZodValues(getRecordValueType(schema), zodRuntime, zodTypes);
|
|
12390
12594
|
return { key: values };
|
|
12391
12595
|
}
|
|
12392
|
-
case
|
|
12393
|
-
const
|
|
12394
|
-
const
|
|
12395
|
-
const key = createZodValues(defType.keyType, zodRuntime, zodTypes);
|
|
12596
|
+
case "map": {
|
|
12597
|
+
const values = createZodValues(getRecordValueType(schema), zodRuntime, zodTypes);
|
|
12598
|
+
const key = createZodValues(getRecordKeyType(schema), zodRuntime, zodTypes);
|
|
12396
12599
|
return new Map([[key, values]]);
|
|
12397
12600
|
}
|
|
12398
|
-
case
|
|
12399
|
-
const
|
|
12400
|
-
const type = defType.getter();
|
|
12601
|
+
case "lazy": {
|
|
12602
|
+
const type = getZodDef(schema).getter();
|
|
12401
12603
|
return createZodValues(type, zodRuntime, zodTypes);
|
|
12402
12604
|
}
|
|
12403
|
-
case
|
|
12404
|
-
const
|
|
12405
|
-
const values = createZodValues(defType.valueType, zodRuntime, zodTypes);
|
|
12605
|
+
case "set": {
|
|
12606
|
+
const values = createZodValues(getZodDef(schema).valueType, zodRuntime, zodTypes);
|
|
12406
12607
|
return new Set([values]);
|
|
12407
12608
|
}
|
|
12408
|
-
case
|
|
12609
|
+
case "function": {
|
|
12409
12610
|
throw new Error("Cannot create a value for type function");
|
|
12410
12611
|
}
|
|
12411
|
-
case
|
|
12412
|
-
|
|
12413
|
-
return values[0];
|
|
12612
|
+
case "enum": {
|
|
12613
|
+
return getFirstEnumValue(schema);
|
|
12414
12614
|
}
|
|
12415
|
-
case
|
|
12615
|
+
case "nativeEnum": {
|
|
12416
12616
|
return 0;
|
|
12417
12617
|
}
|
|
12418
|
-
case
|
|
12419
|
-
|
|
12420
|
-
|
|
12421
|
-
return
|
|
12618
|
+
case "optional":
|
|
12619
|
+
case "nullable":
|
|
12620
|
+
case "catch": {
|
|
12621
|
+
return createZodValues(getInnerType(schema), zodRuntime, zodTypes);
|
|
12422
12622
|
}
|
|
12423
|
-
case
|
|
12424
|
-
|
|
12425
|
-
const value = createZodValues(defType.innerType, zodRuntime, zodTypes);
|
|
12426
|
-
return value;
|
|
12427
|
-
}
|
|
12428
|
-
case zodRuntime.ZodFirstPartyTypeKind.ZodDefault: {
|
|
12429
|
-
const defType = def;
|
|
12430
|
-
return defType.defaultValue();
|
|
12623
|
+
case "default": {
|
|
12624
|
+
return getDefaultValue(schema);
|
|
12431
12625
|
}
|
|
12432
|
-
case
|
|
12433
|
-
const
|
|
12434
|
-
const
|
|
12435
|
-
|
|
12436
|
-
}
|
|
12437
|
-
case zodRuntime.ZodFirstPartyTypeKind.ZodPromise: {
|
|
12438
|
-
const defType = def;
|
|
12439
|
-
const value = createZodValues(defType.type, zodRuntime, zodTypes);
|
|
12626
|
+
case "promise": {
|
|
12627
|
+
const def = getZodDef(schema);
|
|
12628
|
+
const inner = isZodV3Schema(schema) ? def.type : def.innerType;
|
|
12629
|
+
const value = createZodValues(inner, zodRuntime, zodTypes);
|
|
12440
12630
|
return Promise.resolve(value);
|
|
12441
12631
|
}
|
|
12442
|
-
case
|
|
12443
|
-
|
|
12444
|
-
const value = createZodValues(defType.type, zodRuntime, zodTypes);
|
|
12445
|
-
return value;
|
|
12632
|
+
case "branded": {
|
|
12633
|
+
return createZodValues(getBrandedInner(schema), zodRuntime, zodTypes);
|
|
12446
12634
|
}
|
|
12447
|
-
case
|
|
12448
|
-
|
|
12449
|
-
const
|
|
12450
|
-
|
|
12635
|
+
case "pipeline":
|
|
12636
|
+
case "pipe": {
|
|
12637
|
+
const out = getPipelineOutput(schema);
|
|
12638
|
+
if (getZodSchemaType(out) === "transform") {
|
|
12639
|
+
return createZodValues(getPipelineInput(schema), zodRuntime, zodTypes);
|
|
12640
|
+
}
|
|
12641
|
+
return createZodValues(out, zodRuntime, zodTypes);
|
|
12451
12642
|
}
|
|
12452
12643
|
default:
|
|
12453
12644
|
throw new Error("Not implemented: " + typeName);
|
|
@@ -12480,16 +12671,16 @@ var SchemaArrayItemSeparationLine = ({ onChange, index, schema, isLast, showAddB
|
|
|
12480
12671
|
if (!z) {
|
|
12481
12672
|
throw new Error("expected zod");
|
|
12482
12673
|
}
|
|
12483
|
-
const
|
|
12674
|
+
const arrayElement = getArrayElement(schema);
|
|
12484
12675
|
const onAdd = useCallback50(() => {
|
|
12485
12676
|
onChange((oldV) => {
|
|
12486
12677
|
return [
|
|
12487
12678
|
...oldV.slice(0, index + 1),
|
|
12488
|
-
createZodValues(
|
|
12679
|
+
createZodValues(arrayElement, z, zodTypes),
|
|
12489
12680
|
...oldV.slice(index + 1)
|
|
12490
12681
|
];
|
|
12491
12682
|
}, false, true);
|
|
12492
|
-
}, [
|
|
12683
|
+
}, [arrayElement, index, onChange, z, zodTypes]);
|
|
12493
12684
|
const dynamicAddButtonStyle = useMemo61(() => {
|
|
12494
12685
|
return {
|
|
12495
12686
|
display: "flex",
|
|
@@ -12620,7 +12811,7 @@ import React78, { useMemo as useMemo67, useState as useState46 } from "react";
|
|
|
12620
12811
|
import { useCallback as useCallback51, useMemo as useMemo63 } from "react";
|
|
12621
12812
|
import { jsx as jsx111 } from "react/jsx-runtime";
|
|
12622
12813
|
var ZodArrayItemEditor = ({
|
|
12623
|
-
|
|
12814
|
+
elementSchema,
|
|
12624
12815
|
onChange,
|
|
12625
12816
|
jsonPath,
|
|
12626
12817
|
index,
|
|
@@ -12658,7 +12849,7 @@ var ZodArrayItemEditor = ({
|
|
|
12658
12849
|
return /* @__PURE__ */ jsx111("div", {
|
|
12659
12850
|
children: /* @__PURE__ */ jsx111(ZodSwitch, {
|
|
12660
12851
|
jsonPath: newJsonPath,
|
|
12661
|
-
schema:
|
|
12852
|
+
schema: elementSchema,
|
|
12662
12853
|
value,
|
|
12663
12854
|
setValue,
|
|
12664
12855
|
defaultValue,
|
|
@@ -12892,7 +13083,8 @@ var stackTraceLabel = {
|
|
|
12892
13083
|
fontSize: 14
|
|
12893
13084
|
};
|
|
12894
13085
|
var ZodFieldValidation = ({ localValue, path }) => {
|
|
12895
|
-
|
|
13086
|
+
const { zodValidation } = localValue;
|
|
13087
|
+
if (zodValidation.success) {
|
|
12896
13088
|
return null;
|
|
12897
13089
|
}
|
|
12898
13090
|
return /* @__PURE__ */ jsxs54("div", {
|
|
@@ -12900,7 +13092,7 @@ var ZodFieldValidation = ({ localValue, path }) => {
|
|
|
12900
13092
|
children: [
|
|
12901
13093
|
/* @__PURE__ */ jsx114(ValidationMessage, {
|
|
12902
13094
|
align: "flex-start",
|
|
12903
|
-
message:
|
|
13095
|
+
message: zodValidation.error.format()._errors[0],
|
|
12904
13096
|
type: "error"
|
|
12905
13097
|
}),
|
|
12906
13098
|
/* @__PURE__ */ jsx114(Spacing, {
|
|
@@ -12915,7 +13107,7 @@ var ZodFieldValidation = ({ localValue, path }) => {
|
|
|
12915
13107
|
style: stackTraceLabel,
|
|
12916
13108
|
children: "Zod Validation has failed:"
|
|
12917
13109
|
}),
|
|
12918
|
-
|
|
13110
|
+
zodValidation.error.issues.map((error, index) => /* @__PURE__ */ jsxs54("div", {
|
|
12919
13111
|
style: stackTraceLabel,
|
|
12920
13112
|
children: [
|
|
12921
13113
|
"Type: ",
|
|
@@ -12967,7 +13159,7 @@ var useLocalState = ({
|
|
|
12967
13159
|
[parentRevision]: {
|
|
12968
13160
|
value: unsavedValue,
|
|
12969
13161
|
keyStabilityRevision: 0,
|
|
12970
|
-
zodValidation: schema
|
|
13162
|
+
zodValidation: zodSafeParse(schema, unsavedValue)
|
|
12971
13163
|
}
|
|
12972
13164
|
};
|
|
12973
13165
|
});
|
|
@@ -12976,7 +13168,7 @@ var useLocalState = ({
|
|
|
12976
13168
|
return {
|
|
12977
13169
|
value: unsavedValue,
|
|
12978
13170
|
keyStabilityRevision: 0,
|
|
12979
|
-
zodValidation: schema
|
|
13171
|
+
zodValidation: zodSafeParse(schema, unsavedValue)
|
|
12980
13172
|
};
|
|
12981
13173
|
}
|
|
12982
13174
|
return localValueOrNull[parentRevision];
|
|
@@ -12995,7 +13187,7 @@ var useLocalState = ({
|
|
|
12995
13187
|
return localUnsavedValue ?? {
|
|
12996
13188
|
value: savedValue,
|
|
12997
13189
|
keyStabilityRevision: 0,
|
|
12998
|
-
zodValidation: schema
|
|
13190
|
+
zodValidation: zodSafeParse(schema, savedValue)
|
|
12999
13191
|
};
|
|
13000
13192
|
}, [localUnsavedValue, savedValue, schema]);
|
|
13001
13193
|
const stateRef = useRef26(currentLocalValue);
|
|
@@ -13006,7 +13198,7 @@ var useLocalState = ({
|
|
|
13006
13198
|
if (isSame) {
|
|
13007
13199
|
return;
|
|
13008
13200
|
}
|
|
13009
|
-
const safeParse = schema
|
|
13201
|
+
const safeParse = zodSafeParse(schema, newValue);
|
|
13010
13202
|
if (safeParse.success || forceApply) {
|
|
13011
13203
|
setValue(updater, forceApply, increment);
|
|
13012
13204
|
}
|
|
@@ -13074,7 +13266,7 @@ var ZodArrayEditor = ({
|
|
|
13074
13266
|
savedValue: defaultValue
|
|
13075
13267
|
});
|
|
13076
13268
|
const [expanded, setExpanded] = useState46(true);
|
|
13077
|
-
const
|
|
13269
|
+
const arrayElement = getArrayElement(schema);
|
|
13078
13270
|
const suffix2 = useMemo67(() => {
|
|
13079
13271
|
return expanded ? " [" : " [...] ";
|
|
13080
13272
|
}, [expanded]);
|
|
@@ -13083,10 +13275,6 @@ var ZodArrayEditor = ({
|
|
|
13083
13275
|
throw new Error("expected zod");
|
|
13084
13276
|
}
|
|
13085
13277
|
const zodTypes = useZodTypesIfPossible();
|
|
13086
|
-
const typeName = def.typeName;
|
|
13087
|
-
if (typeName !== z.ZodFirstPartyTypeKind.ZodArray) {
|
|
13088
|
-
throw new Error("expected object");
|
|
13089
|
-
}
|
|
13090
13278
|
const isDefaultValue = useMemo67(() => {
|
|
13091
13279
|
return deepEqual(localValue.value, defaultValue);
|
|
13092
13280
|
}, [defaultValue, localValue]);
|
|
@@ -13125,10 +13313,10 @@ var ZodArrayEditor = ({
|
|
|
13125
13313
|
/* @__PURE__ */ jsx116(ZodArrayItemEditor, {
|
|
13126
13314
|
onChange,
|
|
13127
13315
|
value: child,
|
|
13128
|
-
|
|
13316
|
+
elementSchema: arrayElement,
|
|
13129
13317
|
index: i,
|
|
13130
13318
|
jsonPath,
|
|
13131
|
-
defaultValue: defaultValue?.[i] ?? createZodValues(
|
|
13319
|
+
defaultValue: defaultValue?.[i] ?? createZodValues(arrayElement, z, zodTypes),
|
|
13132
13320
|
onSave,
|
|
13133
13321
|
showSaveButton,
|
|
13134
13322
|
saving,
|
|
@@ -13777,7 +13965,7 @@ var ZodDefaultEditor = ({
|
|
|
13777
13965
|
saveDisabledByParent,
|
|
13778
13966
|
mayPad
|
|
13779
13967
|
}) => {
|
|
13780
|
-
const
|
|
13968
|
+
const innerType = getInnerType(schema);
|
|
13781
13969
|
return /* @__PURE__ */ jsx123(ZodSwitch, {
|
|
13782
13970
|
defaultValue,
|
|
13783
13971
|
jsonPath,
|
|
@@ -13814,8 +14002,8 @@ var ZodDiscriminatedUnionEditor = ({
|
|
|
13814
14002
|
throw new Error("expected zod");
|
|
13815
14003
|
}
|
|
13816
14004
|
const zodTypes = useZodTypesIfPossible();
|
|
13817
|
-
const
|
|
13818
|
-
const options = useMemo72(() =>
|
|
14005
|
+
const discriminator = getDiscriminator(schema);
|
|
14006
|
+
const options = useMemo72(() => getDiscriminatedOptionKeys(schema), [schema]);
|
|
13819
14007
|
const {
|
|
13820
14008
|
localValue,
|
|
13821
14009
|
onChange: setLocalValue,
|
|
@@ -13833,9 +14021,13 @@ var ZodDiscriminatedUnionEditor = ({
|
|
|
13833
14021
|
label: option,
|
|
13834
14022
|
id: option,
|
|
13835
14023
|
keyHint: null,
|
|
13836
|
-
leftItem: option === value[
|
|
14024
|
+
leftItem: option === value[discriminator] ? /* @__PURE__ */ jsx124(Checkmark, {}) : null,
|
|
13837
14025
|
onClick: () => {
|
|
13838
|
-
const
|
|
14026
|
+
const optionSchema = getDiscriminatedOption(schema, option);
|
|
14027
|
+
if (!optionSchema) {
|
|
14028
|
+
throw new Error(`No schema found for discriminator value: ${option}`);
|
|
14029
|
+
}
|
|
14030
|
+
const val = createZodValues(optionSchema, z, zodTypes);
|
|
13839
14031
|
setLocalValue(() => val, false, false);
|
|
13840
14032
|
},
|
|
13841
14033
|
quickSwitcherLabel: null,
|
|
@@ -13843,29 +14035,21 @@ var ZodDiscriminatedUnionEditor = ({
|
|
|
13843
14035
|
type: "item"
|
|
13844
14036
|
};
|
|
13845
14037
|
});
|
|
13846
|
-
}, [
|
|
13847
|
-
options,
|
|
13848
|
-
setLocalValue,
|
|
13849
|
-
typedSchema.discriminator,
|
|
13850
|
-
typedSchema.optionsMap,
|
|
13851
|
-
value,
|
|
13852
|
-
z,
|
|
13853
|
-
zodTypes
|
|
13854
|
-
]);
|
|
14038
|
+
}, [options, setLocalValue, discriminator, schema, value, z, zodTypes]);
|
|
13855
14039
|
const save = useCallback58(() => {
|
|
13856
14040
|
onSave(() => value, false, false);
|
|
13857
14041
|
}, [onSave, value]);
|
|
13858
14042
|
const discriminatedUnionReplacement = useMemo72(() => {
|
|
13859
14043
|
return {
|
|
13860
|
-
discriminator
|
|
14044
|
+
discriminator,
|
|
13861
14045
|
markup: /* @__PURE__ */ jsxs60(Fieldset, {
|
|
13862
14046
|
shouldPad: mayPad,
|
|
13863
14047
|
success: true,
|
|
13864
14048
|
children: [
|
|
13865
14049
|
/* @__PURE__ */ jsx124(SchemaLabel, {
|
|
13866
14050
|
handleClick: null,
|
|
13867
|
-
isDefaultValue: localValue.value[
|
|
13868
|
-
jsonPath: [...jsonPath,
|
|
14051
|
+
isDefaultValue: localValue.value[discriminator] === defaultValue[discriminator],
|
|
14052
|
+
jsonPath: [...jsonPath, discriminator],
|
|
13869
14053
|
onRemove,
|
|
13870
14054
|
onReset: reset,
|
|
13871
14055
|
onSave: save,
|
|
@@ -13878,7 +14062,7 @@ var ZodDiscriminatedUnionEditor = ({
|
|
|
13878
14062
|
/* @__PURE__ */ jsx124(Combobox, {
|
|
13879
14063
|
title: "Select type",
|
|
13880
14064
|
values: comboBoxValues,
|
|
13881
|
-
selectedId: value[
|
|
14065
|
+
selectedId: value[discriminator]
|
|
13882
14066
|
})
|
|
13883
14067
|
]
|
|
13884
14068
|
}, "replacement")
|
|
@@ -13896,9 +14080,13 @@ var ZodDiscriminatedUnionEditor = ({
|
|
|
13896
14080
|
saveDisabledByParent,
|
|
13897
14081
|
saving,
|
|
13898
14082
|
showSaveButton,
|
|
13899
|
-
|
|
14083
|
+
discriminator,
|
|
13900
14084
|
value
|
|
13901
14085
|
]);
|
|
14086
|
+
const currentOptionSchema = getDiscriminatedOption(schema, value[discriminator]);
|
|
14087
|
+
if (!currentOptionSchema) {
|
|
14088
|
+
throw new Error("No matching option found for discriminated union");
|
|
14089
|
+
}
|
|
13902
14090
|
return /* @__PURE__ */ jsx124(ZodObjectEditor, {
|
|
13903
14091
|
jsonPath,
|
|
13904
14092
|
mayPad,
|
|
@@ -13907,12 +14095,12 @@ var ZodDiscriminatedUnionEditor = ({
|
|
|
13907
14095
|
onSave,
|
|
13908
14096
|
saveDisabledByParent,
|
|
13909
14097
|
saving,
|
|
13910
|
-
schema:
|
|
14098
|
+
schema: currentOptionSchema,
|
|
13911
14099
|
setValue: setLocalValue,
|
|
13912
14100
|
showSaveButton,
|
|
13913
14101
|
unsavedValue: value,
|
|
13914
14102
|
discriminatedUnionReplacement
|
|
13915
|
-
}, value[
|
|
14103
|
+
}, value[discriminator]);
|
|
13916
14104
|
};
|
|
13917
14105
|
|
|
13918
14106
|
// src/components/RenderModal/SchemaEditor/ZodEffectEditor.tsx
|
|
@@ -13932,9 +14120,9 @@ var ZodEffectEditor = ({
|
|
|
13932
14120
|
saving,
|
|
13933
14121
|
mayPad
|
|
13934
14122
|
}) => {
|
|
13935
|
-
const
|
|
13936
|
-
if (
|
|
13937
|
-
throw new Error("expected
|
|
14123
|
+
const typeName = getZodSchemaType(schema);
|
|
14124
|
+
if (typeName !== "effects") {
|
|
14125
|
+
throw new Error("expected effect");
|
|
13938
14126
|
}
|
|
13939
14127
|
const { localValue, onChange } = useLocalState({
|
|
13940
14128
|
unsavedValue: value,
|
|
@@ -13942,11 +14130,7 @@ var ZodEffectEditor = ({
|
|
|
13942
14130
|
setValue: updateValue,
|
|
13943
14131
|
savedValue: defaultValue
|
|
13944
14132
|
});
|
|
13945
|
-
const
|
|
13946
|
-
const typeName = def.typeName;
|
|
13947
|
-
if (typeName !== z.ZodFirstPartyTypeKind.ZodEffects) {
|
|
13948
|
-
throw new Error("expected effect");
|
|
13949
|
-
}
|
|
14133
|
+
const innerSchema = getEffectsInner(schema);
|
|
13950
14134
|
return /* @__PURE__ */ jsxs61(Fieldset, {
|
|
13951
14135
|
shouldPad: mayPad,
|
|
13952
14136
|
success: localValue.zodValidation.success,
|
|
@@ -13957,7 +14141,7 @@ var ZodEffectEditor = ({
|
|
|
13957
14141
|
value,
|
|
13958
14142
|
setValue: onChange,
|
|
13959
14143
|
jsonPath,
|
|
13960
|
-
schema:
|
|
14144
|
+
schema: innerSchema,
|
|
13961
14145
|
defaultValue,
|
|
13962
14146
|
onSave,
|
|
13963
14147
|
showSaveButton,
|
|
@@ -13992,10 +14176,6 @@ var ZodEnumEditor = ({
|
|
|
13992
14176
|
onRemove,
|
|
13993
14177
|
saving
|
|
13994
14178
|
}) => {
|
|
13995
|
-
const z = useZodIfPossible();
|
|
13996
|
-
if (!z) {
|
|
13997
|
-
throw new Error("expected zod");
|
|
13998
|
-
}
|
|
13999
14179
|
const {
|
|
14000
14180
|
localValue,
|
|
14001
14181
|
onChange: setLocalValue,
|
|
@@ -14006,14 +14186,10 @@ var ZodEnumEditor = ({
|
|
|
14006
14186
|
unsavedValue: value,
|
|
14007
14187
|
savedValue: defaultValue
|
|
14008
14188
|
});
|
|
14009
|
-
const
|
|
14010
|
-
const typeName = def.typeName;
|
|
14011
|
-
if (typeName !== z.ZodFirstPartyTypeKind.ZodEnum) {
|
|
14012
|
-
throw new Error("expected enum");
|
|
14013
|
-
}
|
|
14189
|
+
const enumValues = getEnumValues(schema);
|
|
14014
14190
|
const isRoot = jsonPath.length === 0;
|
|
14015
14191
|
const comboBoxValues = useMemo73(() => {
|
|
14016
|
-
return
|
|
14192
|
+
return enumValues.map((option) => {
|
|
14017
14193
|
return {
|
|
14018
14194
|
value: option,
|
|
14019
14195
|
label: option,
|
|
@@ -14028,7 +14204,7 @@ var ZodEnumEditor = ({
|
|
|
14028
14204
|
type: "item"
|
|
14029
14205
|
};
|
|
14030
14206
|
});
|
|
14031
|
-
}, [
|
|
14207
|
+
}, [enumValues, setLocalValue, value]);
|
|
14032
14208
|
const save = useCallback59(() => {
|
|
14033
14209
|
onSave(() => value, false, false);
|
|
14034
14210
|
}, [onSave, value]);
|
|
@@ -14093,7 +14269,7 @@ var ZodMatrixEditor = ({
|
|
|
14093
14269
|
savedValue: defaultValue
|
|
14094
14270
|
});
|
|
14095
14271
|
const [expanded, setExpanded] = useState49(true);
|
|
14096
|
-
const
|
|
14272
|
+
const arrayElement = getArrayElement(schema);
|
|
14097
14273
|
const suffix2 = useMemo74(() => {
|
|
14098
14274
|
return expanded ? " [" : " [...] ";
|
|
14099
14275
|
}, [expanded]);
|
|
@@ -14151,10 +14327,10 @@ var ZodMatrixEditor = ({
|
|
|
14151
14327
|
children: /* @__PURE__ */ jsx127(ZodArrayItemEditor, {
|
|
14152
14328
|
onChange,
|
|
14153
14329
|
value: item2,
|
|
14154
|
-
|
|
14330
|
+
elementSchema: arrayElement,
|
|
14155
14331
|
index: actualIndex,
|
|
14156
14332
|
jsonPath,
|
|
14157
|
-
defaultValue: defaultValue?.[actualIndex] ?? createZodValues(
|
|
14333
|
+
defaultValue: defaultValue?.[actualIndex] ?? createZodValues(arrayElement, z, zodTypes),
|
|
14158
14334
|
onSave,
|
|
14159
14335
|
showSaveButton,
|
|
14160
14336
|
saving,
|
|
@@ -14354,7 +14530,7 @@ var ZodNullableEditor = ({
|
|
|
14354
14530
|
saveDisabledByParent,
|
|
14355
14531
|
mayPad
|
|
14356
14532
|
}) => {
|
|
14357
|
-
const
|
|
14533
|
+
const innerType = getInnerType(schema);
|
|
14358
14534
|
return /* @__PURE__ */ jsx130(ZodOrNullishEditor, {
|
|
14359
14535
|
defaultValue,
|
|
14360
14536
|
jsonPath,
|
|
@@ -14379,40 +14555,58 @@ var fullWidth6 = {
|
|
|
14379
14555
|
width: "100%"
|
|
14380
14556
|
};
|
|
14381
14557
|
var getMinValue = (schema) => {
|
|
14382
|
-
const
|
|
14383
|
-
if (!
|
|
14384
|
-
return -Infinity;
|
|
14385
|
-
}
|
|
14386
|
-
if (minCheck.kind !== "min") {
|
|
14387
|
-
throw new Error("Expected min check");
|
|
14388
|
-
}
|
|
14389
|
-
if (!minCheck.inclusive) {
|
|
14558
|
+
const { checks } = getZodDef(schema);
|
|
14559
|
+
if (!checks)
|
|
14390
14560
|
return -Infinity;
|
|
14561
|
+
if (isZodV3Schema(schema)) {
|
|
14562
|
+
const minCheck = checks.find((c) => c.kind === "min");
|
|
14563
|
+
if (!minCheck || !minCheck.inclusive)
|
|
14564
|
+
return -Infinity;
|
|
14565
|
+
return minCheck.value;
|
|
14566
|
+
}
|
|
14567
|
+
for (const c of checks) {
|
|
14568
|
+
const def = c._zod?.def;
|
|
14569
|
+
if (def?.check === "greater_than" && def.inclusive) {
|
|
14570
|
+
return def.value;
|
|
14571
|
+
}
|
|
14391
14572
|
}
|
|
14392
|
-
return
|
|
14573
|
+
return -Infinity;
|
|
14393
14574
|
};
|
|
14394
14575
|
var getMaxValue = (schema) => {
|
|
14395
|
-
const
|
|
14396
|
-
if (!
|
|
14397
|
-
return Infinity;
|
|
14398
|
-
}
|
|
14399
|
-
if (maxCheck.kind !== "max") {
|
|
14400
|
-
throw new Error("Expected max check");
|
|
14401
|
-
}
|
|
14402
|
-
if (!maxCheck.inclusive) {
|
|
14576
|
+
const { checks } = getZodDef(schema);
|
|
14577
|
+
if (!checks)
|
|
14403
14578
|
return Infinity;
|
|
14579
|
+
if (isZodV3Schema(schema)) {
|
|
14580
|
+
const maxCheck = checks.find((c) => c.kind === "max");
|
|
14581
|
+
if (!maxCheck || !maxCheck.inclusive)
|
|
14582
|
+
return Infinity;
|
|
14583
|
+
return maxCheck.value;
|
|
14584
|
+
}
|
|
14585
|
+
for (const c of checks) {
|
|
14586
|
+
const def = c._zod?.def;
|
|
14587
|
+
if (def?.check === "less_than" && def.inclusive) {
|
|
14588
|
+
return def.value;
|
|
14589
|
+
}
|
|
14404
14590
|
}
|
|
14405
|
-
return
|
|
14591
|
+
return Infinity;
|
|
14406
14592
|
};
|
|
14407
14593
|
var getStep = (schema) => {
|
|
14408
|
-
const
|
|
14409
|
-
if (!
|
|
14594
|
+
const { checks } = getZodDef(schema);
|
|
14595
|
+
if (!checks)
|
|
14410
14596
|
return;
|
|
14597
|
+
if (isZodV3Schema(schema)) {
|
|
14598
|
+
const multipleStep = checks.find((c) => c.kind === "multipleOf");
|
|
14599
|
+
if (!multipleStep)
|
|
14600
|
+
return;
|
|
14601
|
+
return multipleStep.value;
|
|
14411
14602
|
}
|
|
14412
|
-
|
|
14413
|
-
|
|
14603
|
+
for (const c of checks) {
|
|
14604
|
+
const def = c._zod?.def;
|
|
14605
|
+
if (def?.check === "multiple_of") {
|
|
14606
|
+
return def.value;
|
|
14607
|
+
}
|
|
14414
14608
|
}
|
|
14415
|
-
return
|
|
14609
|
+
return;
|
|
14416
14610
|
};
|
|
14417
14611
|
var ZodNumberEditor = ({
|
|
14418
14612
|
jsonPath,
|
|
@@ -14505,7 +14699,7 @@ var ZodOptionalEditor = ({
|
|
|
14505
14699
|
saveDisabledByParent,
|
|
14506
14700
|
mayPad
|
|
14507
14701
|
}) => {
|
|
14508
|
-
const
|
|
14702
|
+
const innerType = getInnerType(schema);
|
|
14509
14703
|
return /* @__PURE__ */ jsx132(ZodOrNullishEditor, {
|
|
14510
14704
|
defaultValue,
|
|
14511
14705
|
jsonPath,
|
|
@@ -14542,10 +14736,6 @@ var ZodStaticFileEditor = ({
|
|
|
14542
14736
|
saveDisabledByParent,
|
|
14543
14737
|
mayPad
|
|
14544
14738
|
}) => {
|
|
14545
|
-
const z = useZodIfPossible();
|
|
14546
|
-
if (!z) {
|
|
14547
|
-
throw new Error("expected zod");
|
|
14548
|
-
}
|
|
14549
14739
|
const {
|
|
14550
14740
|
localValue,
|
|
14551
14741
|
onChange: setLocalValue,
|
|
@@ -14556,11 +14746,6 @@ var ZodStaticFileEditor = ({
|
|
|
14556
14746
|
unsavedValue: value,
|
|
14557
14747
|
savedValue: defaultValue
|
|
14558
14748
|
});
|
|
14559
|
-
const def = schema._def;
|
|
14560
|
-
const typeName = def.typeName;
|
|
14561
|
-
if (typeName !== z.ZodFirstPartyTypeKind.ZodString) {
|
|
14562
|
-
throw new Error("expected enum");
|
|
14563
|
-
}
|
|
14564
14749
|
const isRoot = jsonPath.length === 0;
|
|
14565
14750
|
const staticFiles = useStaticFiles();
|
|
14566
14751
|
const comboBoxValues = useMemo75(() => {
|
|
@@ -14785,7 +14970,7 @@ import React92, { useMemo as useMemo77, useState as useState50 } from "react";
|
|
|
14785
14970
|
import { useCallback as useCallback66, useMemo as useMemo76 } from "react";
|
|
14786
14971
|
import { jsx as jsx136 } from "react/jsx-runtime";
|
|
14787
14972
|
var ZodTupleItemEditor = ({
|
|
14788
|
-
|
|
14973
|
+
tupleItems,
|
|
14789
14974
|
onChange,
|
|
14790
14975
|
jsonPath,
|
|
14791
14976
|
index,
|
|
@@ -14819,7 +15004,7 @@ var ZodTupleItemEditor = ({
|
|
|
14819
15004
|
return /* @__PURE__ */ jsx136("div", {
|
|
14820
15005
|
children: /* @__PURE__ */ jsx136(ZodSwitch, {
|
|
14821
15006
|
jsonPath: newJsonPath,
|
|
14822
|
-
schema:
|
|
15007
|
+
schema: tupleItems[index],
|
|
14823
15008
|
value,
|
|
14824
15009
|
setValue,
|
|
14825
15010
|
defaultValue,
|
|
@@ -14855,7 +15040,7 @@ var ZodTupleEditor = ({
|
|
|
14855
15040
|
savedValue: defaultValue
|
|
14856
15041
|
});
|
|
14857
15042
|
const [expanded, setExpanded] = useState50(true);
|
|
14858
|
-
const
|
|
15043
|
+
const tupleItems = getTupleItems(schema);
|
|
14859
15044
|
const suffix2 = useMemo77(() => {
|
|
14860
15045
|
return expanded ? " [" : " [...] ";
|
|
14861
15046
|
}, [expanded]);
|
|
@@ -14864,10 +15049,6 @@ var ZodTupleEditor = ({
|
|
|
14864
15049
|
throw new Error("expected zod");
|
|
14865
15050
|
}
|
|
14866
15051
|
const zodTypes = useZodTypesIfPossible();
|
|
14867
|
-
const typeName = def.typeName;
|
|
14868
|
-
if (typeName !== z.ZodFirstPartyTypeKind.ZodTuple) {
|
|
14869
|
-
throw new Error("expected object");
|
|
14870
|
-
}
|
|
14871
15052
|
const isDefaultValue = useMemo77(() => {
|
|
14872
15053
|
return deepEqual(localValue.value, defaultValue);
|
|
14873
15054
|
}, [defaultValue, localValue]);
|
|
@@ -14906,10 +15087,10 @@ var ZodTupleEditor = ({
|
|
|
14906
15087
|
/* @__PURE__ */ jsx137(ZodTupleItemEditor, {
|
|
14907
15088
|
onChange,
|
|
14908
15089
|
value: child,
|
|
14909
|
-
|
|
15090
|
+
tupleItems,
|
|
14910
15091
|
index: i,
|
|
14911
15092
|
jsonPath,
|
|
14912
|
-
defaultValue: defaultValue?.[i] ?? createZodValues(
|
|
15093
|
+
defaultValue: defaultValue?.[i] ?? createZodValues(tupleItems[i], z, zodTypes),
|
|
14913
15094
|
onSave,
|
|
14914
15095
|
showSaveButton,
|
|
14915
15096
|
saving,
|
|
@@ -14946,14 +15127,18 @@ var ZodTupleEditor = ({
|
|
|
14946
15127
|
|
|
14947
15128
|
// src/components/RenderModal/SchemaEditor/ZodUnionEditor.tsx
|
|
14948
15129
|
import { jsx as jsx138 } from "react/jsx-runtime";
|
|
14949
|
-
var findNull = (value
|
|
14950
|
-
const nullIndex = value.findIndex((v) =>
|
|
15130
|
+
var findNull = (value) => {
|
|
15131
|
+
const nullIndex = value.findIndex((v) => {
|
|
15132
|
+
const type = getZodSchemaType(v);
|
|
15133
|
+
return type === "null" || type === "undefined";
|
|
15134
|
+
});
|
|
14951
15135
|
if (nullIndex === -1) {
|
|
14952
15136
|
return null;
|
|
14953
15137
|
}
|
|
14954
|
-
const nullishValue = value[nullIndex]
|
|
15138
|
+
const nullishValue = getZodSchemaType(value[nullIndex]) === "null" ? null : undefined;
|
|
14955
15139
|
const otherSchema = value[nullIndex === 0 ? 1 : 0];
|
|
14956
|
-
const
|
|
15140
|
+
const otherType = getZodSchemaType(otherSchema);
|
|
15141
|
+
const otherSchemaIsAlsoNullish = otherType === "null" || otherType === "undefined";
|
|
14957
15142
|
return {
|
|
14958
15143
|
nullIndex,
|
|
14959
15144
|
nullishValue,
|
|
@@ -14974,11 +15159,7 @@ var ZodUnionEditor = ({
|
|
|
14974
15159
|
saveDisabledByParent,
|
|
14975
15160
|
mayPad
|
|
14976
15161
|
}) => {
|
|
14977
|
-
const
|
|
14978
|
-
const z = useZodIfPossible();
|
|
14979
|
-
if (!z) {
|
|
14980
|
-
throw new Error("expected zod");
|
|
14981
|
-
}
|
|
15162
|
+
const options = getUnionOptions(schema);
|
|
14982
15163
|
if (options.length > 2) {
|
|
14983
15164
|
return /* @__PURE__ */ jsx138(ZonNonEditableValue, {
|
|
14984
15165
|
jsonPath,
|
|
@@ -14997,7 +15178,7 @@ var ZodUnionEditor = ({
|
|
|
14997
15178
|
mayPad
|
|
14998
15179
|
});
|
|
14999
15180
|
}
|
|
15000
|
-
const nullResult = findNull(options
|
|
15181
|
+
const nullResult = findNull(options);
|
|
15001
15182
|
if (!nullResult) {
|
|
15002
15183
|
return /* @__PURE__ */ jsx138(ZonNonEditableValue, {
|
|
15003
15184
|
jsonPath,
|
|
@@ -15049,14 +15230,10 @@ var ZodSwitch = ({
|
|
|
15049
15230
|
saveDisabledByParent,
|
|
15050
15231
|
mayPad
|
|
15051
15232
|
}) => {
|
|
15052
|
-
const
|
|
15053
|
-
const
|
|
15054
|
-
const z = useZodIfPossible();
|
|
15055
|
-
if (!z) {
|
|
15056
|
-
throw new Error("expected zod");
|
|
15057
|
-
}
|
|
15233
|
+
const typeName = getZodSchemaType(schema);
|
|
15234
|
+
const description = getZodSchemaDescription(schema);
|
|
15058
15235
|
const zodTypes = useZodTypesIfPossible();
|
|
15059
|
-
if (typeName ===
|
|
15236
|
+
if (typeName === "object") {
|
|
15060
15237
|
return /* @__PURE__ */ jsx139(ZodObjectEditor, {
|
|
15061
15238
|
setValue,
|
|
15062
15239
|
unsavedValue: value,
|
|
@@ -15072,7 +15249,22 @@ var ZodSwitch = ({
|
|
|
15072
15249
|
discriminatedUnionReplacement: null
|
|
15073
15250
|
});
|
|
15074
15251
|
}
|
|
15075
|
-
if (typeName ===
|
|
15252
|
+
if (typeName === "string") {
|
|
15253
|
+
if (zodTypes && description === zodTypes.ZodZypesInternals.REMOTION_COLOR_BRAND) {
|
|
15254
|
+
return /* @__PURE__ */ jsx139(ZodColorEditor, {
|
|
15255
|
+
value,
|
|
15256
|
+
setValue,
|
|
15257
|
+
jsonPath,
|
|
15258
|
+
schema,
|
|
15259
|
+
onSave,
|
|
15260
|
+
defaultValue,
|
|
15261
|
+
showSaveButton,
|
|
15262
|
+
onRemove,
|
|
15263
|
+
saving,
|
|
15264
|
+
saveDisabledByParent,
|
|
15265
|
+
mayPad
|
|
15266
|
+
});
|
|
15267
|
+
}
|
|
15076
15268
|
if (value.startsWith(window.remotion_staticBase)) {
|
|
15077
15269
|
return /* @__PURE__ */ jsx139(ZodStaticFileEditor, {
|
|
15078
15270
|
setValue,
|
|
@@ -15088,7 +15280,7 @@ var ZodSwitch = ({
|
|
|
15088
15280
|
mayPad
|
|
15089
15281
|
});
|
|
15090
15282
|
}
|
|
15091
|
-
if (zodTypes &&
|
|
15283
|
+
if (zodTypes && description === zodTypes.ZodZypesInternals.REMOTION_TEXTAREA_BRAND) {
|
|
15092
15284
|
return /* @__PURE__ */ jsx139(ZodTextareaEditor, {
|
|
15093
15285
|
value,
|
|
15094
15286
|
setValue,
|
|
@@ -15117,7 +15309,7 @@ var ZodSwitch = ({
|
|
|
15117
15309
|
mayPad
|
|
15118
15310
|
});
|
|
15119
15311
|
}
|
|
15120
|
-
if (typeName ===
|
|
15312
|
+
if (typeName === "date") {
|
|
15121
15313
|
return /* @__PURE__ */ jsx139(ZodDateEditor, {
|
|
15122
15314
|
value,
|
|
15123
15315
|
setValue,
|
|
@@ -15132,7 +15324,7 @@ var ZodSwitch = ({
|
|
|
15132
15324
|
mayPad
|
|
15133
15325
|
});
|
|
15134
15326
|
}
|
|
15135
|
-
if (typeName ===
|
|
15327
|
+
if (typeName === "number") {
|
|
15136
15328
|
return /* @__PURE__ */ jsx139(ZodNumberEditor, {
|
|
15137
15329
|
value,
|
|
15138
15330
|
setValue,
|
|
@@ -15147,7 +15339,7 @@ var ZodSwitch = ({
|
|
|
15147
15339
|
mayPad
|
|
15148
15340
|
});
|
|
15149
15341
|
}
|
|
15150
|
-
if (typeName ===
|
|
15342
|
+
if (typeName === "boolean") {
|
|
15151
15343
|
return /* @__PURE__ */ jsx139(ZodBooleanEditor, {
|
|
15152
15344
|
value,
|
|
15153
15345
|
setValue,
|
|
@@ -15162,7 +15354,7 @@ var ZodSwitch = ({
|
|
|
15162
15354
|
schema
|
|
15163
15355
|
});
|
|
15164
15356
|
}
|
|
15165
|
-
if (typeName ===
|
|
15357
|
+
if (typeName === "undefined") {
|
|
15166
15358
|
return /* @__PURE__ */ jsx139(ZonNonEditableValue, {
|
|
15167
15359
|
jsonPath,
|
|
15168
15360
|
showSaveButton,
|
|
@@ -15171,7 +15363,7 @@ var ZodSwitch = ({
|
|
|
15171
15363
|
mayPad
|
|
15172
15364
|
});
|
|
15173
15365
|
}
|
|
15174
|
-
if (typeName ===
|
|
15366
|
+
if (typeName === "null") {
|
|
15175
15367
|
return /* @__PURE__ */ jsx139(ZonNonEditableValue, {
|
|
15176
15368
|
jsonPath,
|
|
15177
15369
|
showSaveButton,
|
|
@@ -15180,7 +15372,7 @@ var ZodSwitch = ({
|
|
|
15180
15372
|
mayPad
|
|
15181
15373
|
});
|
|
15182
15374
|
}
|
|
15183
|
-
if (typeName ===
|
|
15375
|
+
if (typeName === "any") {
|
|
15184
15376
|
return /* @__PURE__ */ jsx139(ZonNonEditableValue, {
|
|
15185
15377
|
jsonPath,
|
|
15186
15378
|
showSaveButton,
|
|
@@ -15189,7 +15381,7 @@ var ZodSwitch = ({
|
|
|
15189
15381
|
mayPad
|
|
15190
15382
|
});
|
|
15191
15383
|
}
|
|
15192
|
-
if (typeName ===
|
|
15384
|
+
if (typeName === "bigint") {
|
|
15193
15385
|
return /* @__PURE__ */ jsx139(ZonNonEditableValue, {
|
|
15194
15386
|
jsonPath,
|
|
15195
15387
|
showSaveButton,
|
|
@@ -15198,7 +15390,7 @@ var ZodSwitch = ({
|
|
|
15198
15390
|
mayPad
|
|
15199
15391
|
});
|
|
15200
15392
|
}
|
|
15201
|
-
if (typeName ===
|
|
15393
|
+
if (typeName === "unknown") {
|
|
15202
15394
|
return /* @__PURE__ */ jsx139(ZonNonEditableValue, {
|
|
15203
15395
|
jsonPath,
|
|
15204
15396
|
showSaveButton,
|
|
@@ -15207,7 +15399,22 @@ var ZodSwitch = ({
|
|
|
15207
15399
|
mayPad
|
|
15208
15400
|
});
|
|
15209
15401
|
}
|
|
15210
|
-
if (typeName ===
|
|
15402
|
+
if (typeName === "array") {
|
|
15403
|
+
if (zodTypes && description === zodTypes.ZodZypesInternals.REMOTION_MATRIX_BRAND) {
|
|
15404
|
+
return /* @__PURE__ */ jsx139(ZodMatrixEditor, {
|
|
15405
|
+
setValue,
|
|
15406
|
+
value,
|
|
15407
|
+
jsonPath,
|
|
15408
|
+
schema,
|
|
15409
|
+
defaultValue,
|
|
15410
|
+
onSave,
|
|
15411
|
+
showSaveButton,
|
|
15412
|
+
onRemove,
|
|
15413
|
+
saving,
|
|
15414
|
+
saveDisabledByParent,
|
|
15415
|
+
mayPad
|
|
15416
|
+
});
|
|
15417
|
+
}
|
|
15211
15418
|
return /* @__PURE__ */ jsx139(ZodArrayEditor, {
|
|
15212
15419
|
setValue,
|
|
15213
15420
|
value,
|
|
@@ -15222,7 +15429,7 @@ var ZodSwitch = ({
|
|
|
15222
15429
|
mayPad
|
|
15223
15430
|
});
|
|
15224
15431
|
}
|
|
15225
|
-
if (typeName ===
|
|
15432
|
+
if (typeName === "enum") {
|
|
15226
15433
|
return /* @__PURE__ */ jsx139(ZodEnumEditor, {
|
|
15227
15434
|
setValue,
|
|
15228
15435
|
value,
|
|
@@ -15235,8 +15442,8 @@ var ZodSwitch = ({
|
|
|
15235
15442
|
saving
|
|
15236
15443
|
});
|
|
15237
15444
|
}
|
|
15238
|
-
if (typeName ===
|
|
15239
|
-
if (zodTypes &&
|
|
15445
|
+
if (typeName === "effects") {
|
|
15446
|
+
if (zodTypes && description === zodTypes.ZodZypesInternals.REMOTION_COLOR_BRAND) {
|
|
15240
15447
|
return /* @__PURE__ */ jsx139(ZodColorEditor, {
|
|
15241
15448
|
value,
|
|
15242
15449
|
setValue,
|
|
@@ -15251,12 +15458,12 @@ var ZodSwitch = ({
|
|
|
15251
15458
|
mayPad
|
|
15252
15459
|
});
|
|
15253
15460
|
}
|
|
15254
|
-
if (zodTypes &&
|
|
15461
|
+
if (zodTypes && description === zodTypes.ZodZypesInternals.REMOTION_MATRIX_BRAND) {
|
|
15255
15462
|
return /* @__PURE__ */ jsx139(ZodMatrixEditor, {
|
|
15256
15463
|
setValue,
|
|
15257
15464
|
value,
|
|
15258
15465
|
jsonPath,
|
|
15259
|
-
schema: schema
|
|
15466
|
+
schema: getEffectsInner(schema),
|
|
15260
15467
|
defaultValue,
|
|
15261
15468
|
onSave,
|
|
15262
15469
|
showSaveButton,
|
|
@@ -15279,7 +15486,7 @@ var ZodSwitch = ({
|
|
|
15279
15486
|
mayPad
|
|
15280
15487
|
});
|
|
15281
15488
|
}
|
|
15282
|
-
if (typeName ===
|
|
15489
|
+
if (typeName === "union") {
|
|
15283
15490
|
return /* @__PURE__ */ jsx139(ZodUnionEditor, {
|
|
15284
15491
|
schema,
|
|
15285
15492
|
showSaveButton,
|
|
@@ -15294,7 +15501,7 @@ var ZodSwitch = ({
|
|
|
15294
15501
|
mayPad
|
|
15295
15502
|
});
|
|
15296
15503
|
}
|
|
15297
|
-
if (typeName ===
|
|
15504
|
+
if (typeName === "optional") {
|
|
15298
15505
|
return /* @__PURE__ */ jsx139(ZodOptionalEditor, {
|
|
15299
15506
|
jsonPath,
|
|
15300
15507
|
showSaveButton,
|
|
@@ -15309,7 +15516,7 @@ var ZodSwitch = ({
|
|
|
15309
15516
|
mayPad
|
|
15310
15517
|
});
|
|
15311
15518
|
}
|
|
15312
|
-
if (typeName ===
|
|
15519
|
+
if (typeName === "nullable") {
|
|
15313
15520
|
return /* @__PURE__ */ jsx139(ZodNullableEditor, {
|
|
15314
15521
|
jsonPath,
|
|
15315
15522
|
showSaveButton,
|
|
@@ -15324,7 +15531,7 @@ var ZodSwitch = ({
|
|
|
15324
15531
|
mayPad
|
|
15325
15532
|
});
|
|
15326
15533
|
}
|
|
15327
|
-
if (typeName ===
|
|
15534
|
+
if (typeName === "default") {
|
|
15328
15535
|
return /* @__PURE__ */ jsx139(ZodDefaultEditor, {
|
|
15329
15536
|
jsonPath,
|
|
15330
15537
|
showSaveButton,
|
|
@@ -15339,7 +15546,7 @@ var ZodSwitch = ({
|
|
|
15339
15546
|
mayPad
|
|
15340
15547
|
});
|
|
15341
15548
|
}
|
|
15342
|
-
if (typeName ===
|
|
15549
|
+
if (typeName === "discriminatedUnion") {
|
|
15343
15550
|
return /* @__PURE__ */ jsx139(ZodDiscriminatedUnionEditor, {
|
|
15344
15551
|
defaultValue,
|
|
15345
15552
|
mayPad,
|
|
@@ -15354,7 +15561,7 @@ var ZodSwitch = ({
|
|
|
15354
15561
|
showSaveButton
|
|
15355
15562
|
});
|
|
15356
15563
|
}
|
|
15357
|
-
if (typeName ===
|
|
15564
|
+
if (typeName === "tuple") {
|
|
15358
15565
|
return /* @__PURE__ */ jsx139(ZodTupleEditor, {
|
|
15359
15566
|
setValue,
|
|
15360
15567
|
value,
|
|
@@ -15394,10 +15601,6 @@ var ZodObjectEditor = ({
|
|
|
15394
15601
|
mayPad,
|
|
15395
15602
|
discriminatedUnionReplacement
|
|
15396
15603
|
}) => {
|
|
15397
|
-
const z = useZodIfPossible();
|
|
15398
|
-
if (!z) {
|
|
15399
|
-
throw new Error("expected zod");
|
|
15400
|
-
}
|
|
15401
15604
|
const [expanded, setExpanded] = useState51(true);
|
|
15402
15605
|
const { localValue, onChange, RevisionContextProvider, reset } = useLocalState({
|
|
15403
15606
|
schema,
|
|
@@ -15405,12 +15608,11 @@ var ZodObjectEditor = ({
|
|
|
15405
15608
|
unsavedValue,
|
|
15406
15609
|
savedValue
|
|
15407
15610
|
});
|
|
15408
|
-
const
|
|
15409
|
-
|
|
15410
|
-
if (typeName !== z.ZodFirstPartyTypeKind.ZodObject) {
|
|
15611
|
+
const typeName = getZodSchemaType(schema);
|
|
15612
|
+
if (typeName !== "object") {
|
|
15411
15613
|
throw new Error("expected object");
|
|
15412
15614
|
}
|
|
15413
|
-
const shape =
|
|
15615
|
+
const shape = getObjectShape(schema);
|
|
15414
15616
|
const keys = Object.keys(shape);
|
|
15415
15617
|
const isRoot = jsonPath.length === 0;
|
|
15416
15618
|
const isDefaultValue = useMemo78(() => {
|
|
@@ -15555,13 +15757,12 @@ var SchemaEditor = ({
|
|
|
15555
15757
|
save.unregister();
|
|
15556
15758
|
};
|
|
15557
15759
|
}, [keybindings, onQuickSave, onSave]);
|
|
15558
|
-
const
|
|
15559
|
-
const typeName = def.typeName;
|
|
15760
|
+
const typeName = getZodSchemaType(schema);
|
|
15560
15761
|
const reset = useCallback67(() => {
|
|
15561
15762
|
setValue(savedDefaultProps);
|
|
15562
15763
|
}, [savedDefaultProps, setValue]);
|
|
15563
15764
|
if (!zodValidationResult.success) {
|
|
15564
|
-
const defaultPropsValid = schema
|
|
15765
|
+
const defaultPropsValid = zodSafeParse(schema, savedDefaultProps);
|
|
15565
15766
|
if (!defaultPropsValid.success) {
|
|
15566
15767
|
return /* @__PURE__ */ jsx141(InvalidDefaultProps, {
|
|
15567
15768
|
zodValidationResult
|
|
@@ -15572,7 +15773,7 @@ var SchemaEditor = ({
|
|
|
15572
15773
|
zodValidationResult
|
|
15573
15774
|
});
|
|
15574
15775
|
}
|
|
15575
|
-
if (typeName !==
|
|
15776
|
+
if (typeName !== "object") {
|
|
15576
15777
|
return /* @__PURE__ */ jsx141(TopLevelZodValue, {
|
|
15577
15778
|
typeReceived: typeName
|
|
15578
15779
|
});
|
|
@@ -15834,7 +16035,7 @@ var DataEditor = ({
|
|
|
15834
16035
|
if (schema === "no-schema") {
|
|
15835
16036
|
return "no-schema";
|
|
15836
16037
|
}
|
|
15837
|
-
return schema
|
|
16038
|
+
return zodSafeParse(schema, defaultProps);
|
|
15838
16039
|
}, [defaultProps, schema]);
|
|
15839
16040
|
const setShowWarning = useCallback69((val) => {
|
|
15840
16041
|
setShowWarningWithoutPersistance((prevVal) => {
|
|
@@ -16009,9 +16210,8 @@ var DataEditor = ({
|
|
|
16009
16210
|
if (zodValidationResult === "no-schema") {
|
|
16010
16211
|
throw new Error("expected schema");
|
|
16011
16212
|
}
|
|
16012
|
-
const
|
|
16013
|
-
|
|
16014
|
-
if (typeName === z.ZodFirstPartyTypeKind.ZodAny) {
|
|
16213
|
+
const typeName = getZodSchemaType(schema);
|
|
16214
|
+
if (typeName === "any") {
|
|
16015
16215
|
return /* @__PURE__ */ jsx143(NoSchemaDefined, {});
|
|
16016
16216
|
}
|
|
16017
16217
|
if (!unresolvedComposition.defaultProps) {
|
|
@@ -20562,6 +20762,8 @@ var Inner2 = () => {
|
|
|
20562
20762
|
if (!videoConfig) {
|
|
20563
20763
|
return;
|
|
20564
20764
|
}
|
|
20765
|
+
document.body.style.userSelect = "none";
|
|
20766
|
+
document.body.style.webkitUserSelect = "none";
|
|
20565
20767
|
if (e.target === inPointerHandle.current) {
|
|
20566
20768
|
if (inFrame === null) {
|
|
20567
20769
|
throw new Error("expected outframe");
|
|
@@ -20723,6 +20925,8 @@ var Inner2 = () => {
|
|
|
20723
20925
|
}, [get, inFrame, inOutDragging, outFrame, videoConfig, width]);
|
|
20724
20926
|
const onPointerUpScrubbing = useCallback96((e) => {
|
|
20725
20927
|
stopInterval();
|
|
20928
|
+
document.body.style.userSelect = "";
|
|
20929
|
+
document.body.style.webkitUserSelect = "";
|
|
20726
20930
|
if (!videoConfig) {
|
|
20727
20931
|
return;
|
|
20728
20932
|
}
|
|
@@ -20748,6 +20952,8 @@ var Inner2 = () => {
|
|
|
20748
20952
|
}
|
|
20749
20953
|
}, [dragging, left3, play, videoConfig, setFrame, width]);
|
|
20750
20954
|
const onPointerUpInOut = useCallback96((e) => {
|
|
20955
|
+
document.body.style.userSelect = "";
|
|
20956
|
+
document.body.style.webkitUserSelect = "";
|
|
20751
20957
|
if (!videoConfig) {
|
|
20752
20958
|
return;
|
|
20753
20959
|
}
|
|
@@ -21253,9 +21459,7 @@ var text = {
|
|
|
21253
21459
|
alignItems: "center",
|
|
21254
21460
|
fontVariantNumeric: "tabular-nums",
|
|
21255
21461
|
lineHeight: 1,
|
|
21256
|
-
width: "100%"
|
|
21257
|
-
userSelect: "none",
|
|
21258
|
-
WebkitUserSelect: "none"
|
|
21462
|
+
width: "100%"
|
|
21259
21463
|
};
|
|
21260
21464
|
var time = {
|
|
21261
21465
|
display: "inline-block",
|
|
@@ -23359,7 +23563,8 @@ var CodemodFooter = ({
|
|
|
23359
23563
|
successNotification,
|
|
23360
23564
|
errorNotification,
|
|
23361
23565
|
genericSubmitLabel,
|
|
23362
|
-
submitLabel
|
|
23566
|
+
submitLabel,
|
|
23567
|
+
onSuccess
|
|
23363
23568
|
}) => {
|
|
23364
23569
|
const [submitting, setSubmitting] = useState72(false);
|
|
23365
23570
|
const { setSelectedModal } = useContext78(ModalsContext);
|
|
@@ -23388,6 +23593,7 @@ var CodemodFooter = ({
|
|
|
23388
23593
|
signal: new AbortController().signal
|
|
23389
23594
|
}).then(() => {
|
|
23390
23595
|
notification2.replaceContent(successNotification, 2000);
|
|
23596
|
+
onSuccess?.();
|
|
23391
23597
|
}).catch((err) => {
|
|
23392
23598
|
notification2.replaceContent(`${errorNotification}: ${err.message}`, 2000);
|
|
23393
23599
|
});
|
|
@@ -23395,6 +23601,7 @@ var CodemodFooter = ({
|
|
|
23395
23601
|
codemod,
|
|
23396
23602
|
errorNotification,
|
|
23397
23603
|
loadingNotification,
|
|
23604
|
+
onSuccess,
|
|
23398
23605
|
setSelectedModal,
|
|
23399
23606
|
successNotification
|
|
23400
23607
|
]);
|
|
@@ -23539,7 +23746,8 @@ var DeleteCompositionLoaded = ({ compositionId }) => {
|
|
|
23539
23746
|
genericSubmitLabel: `Delete`,
|
|
23540
23747
|
submitLabel: ({ relativeRootPath }) => `Delete from ${relativeRootPath}`,
|
|
23541
23748
|
codemod,
|
|
23542
|
-
valid: true
|
|
23749
|
+
valid: true,
|
|
23750
|
+
onSuccess: null
|
|
23543
23751
|
})
|
|
23544
23752
|
})
|
|
23545
23753
|
]
|
|
@@ -23800,6 +24008,9 @@ var DuplicateCompositionLoaded = ({ initialType }) => {
|
|
|
23800
24008
|
size4.width,
|
|
23801
24009
|
type
|
|
23802
24010
|
]);
|
|
24011
|
+
const onDuplicateSuccess = useCallback106(() => {
|
|
24012
|
+
pushUrl(`/${newId}`);
|
|
24013
|
+
}, [newId]);
|
|
23803
24014
|
const onSubmit = useCallback106((e) => {
|
|
23804
24015
|
e.preventDefault();
|
|
23805
24016
|
}, []);
|
|
@@ -23998,7 +24209,8 @@ var DuplicateCompositionLoaded = ({ initialType }) => {
|
|
|
23998
24209
|
genericSubmitLabel: "Duplicate",
|
|
23999
24210
|
submitLabel: ({ relativeRootPath }) => `Add to ${relativeRootPath}`,
|
|
24000
24211
|
codemod,
|
|
24001
|
-
valid
|
|
24212
|
+
valid,
|
|
24213
|
+
onSuccess: onDuplicateSuccess
|
|
24002
24214
|
})
|
|
24003
24215
|
})
|
|
24004
24216
|
]
|
|
@@ -24110,7 +24322,8 @@ var RenameCompositionLoaded = () => {
|
|
|
24110
24322
|
genericSubmitLabel: "Rename",
|
|
24111
24323
|
submitLabel: ({ relativeRootPath }) => `Modify ${relativeRootPath}`,
|
|
24112
24324
|
codemod,
|
|
24113
|
-
valid
|
|
24325
|
+
valid,
|
|
24326
|
+
onSuccess: null
|
|
24114
24327
|
})
|
|
24115
24328
|
})
|
|
24116
24329
|
]
|
|
@@ -26221,7 +26434,9 @@ var selectorButton2 = {
|
|
|
26221
26434
|
flexDirection: "row",
|
|
26222
26435
|
fontSize: 14,
|
|
26223
26436
|
color: "inherit",
|
|
26224
|
-
alignItems: "center"
|
|
26437
|
+
alignItems: "center",
|
|
26438
|
+
userSelect: "none",
|
|
26439
|
+
WebkitUserSelect: "none"
|
|
26225
26440
|
};
|
|
26226
26441
|
var VerticalTab = ({ children, onClick, style: style12, selected }) => {
|
|
26227
26442
|
const [hovered, setHovered] = useState79(false);
|
|
@@ -32864,9 +33079,10 @@ var makeDefaultGlobalCSS = () => {
|
|
|
32864
33079
|
/* Override Chakra UI position: relative on body */
|
|
32865
33080
|
position: static !important;
|
|
32866
33081
|
}
|
|
32867
|
-
|
|
33082
|
+
|
|
32868
33083
|
.remotion-splitter {
|
|
32869
33084
|
user-select: none;
|
|
33085
|
+
-webkit-user-select: none;
|
|
32870
33086
|
}
|
|
32871
33087
|
|
|
32872
33088
|
.remotion-splitter-horizontal {
|