@valbuild/shared 0.108.0 → 0.109.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -999,16 +999,25 @@ var SourcePath = zod.z.string().transform(function (path) {
|
|
|
999
999
|
return path;
|
|
1000
1000
|
});
|
|
1001
1001
|
|
|
1002
|
+
// A render is static config, so unlike a `preview` it travels WHOLE — this
|
|
1003
|
+
// is the field the editor reads the layout from. See `core/src/render.ts`.
|
|
1004
|
+
// Every field can carry `{ as: "inline" }`; strings have layouts of their own
|
|
1005
|
+
// on top. NB: these z.objects STRIP unknown keys, so a render variant that is
|
|
1006
|
+
// not declared here is silently dropped in transit — add it here when it is
|
|
1007
|
+
// added to `render.ts`.
|
|
1008
|
+
var InlineRender = zod.z.object({
|
|
1009
|
+
as: zod.z.literal("inline")
|
|
1010
|
+
});
|
|
1011
|
+
var FieldRender = InlineRender.optional();
|
|
1002
1012
|
var SerializedStringSchema = zod.z.object({
|
|
1003
1013
|
type: zod.z.literal("string"),
|
|
1004
|
-
// A render is static config, so unlike a `preview` it travels WHOLE — this
|
|
1005
|
-
// is the field the editor reads the layout from. See `core/src/render.ts`.
|
|
1006
1014
|
render: zod.z.union([zod.z.object({
|
|
1007
1015
|
as: zod.z.literal("textarea")
|
|
1008
1016
|
}), zod.z.object({
|
|
1009
1017
|
as: zod.z.literal("code"),
|
|
1010
1018
|
language: zod.z["enum"](core.CODE_LANGUAGES)
|
|
1011
|
-
})]).optional(),
|
|
1019
|
+
}), InlineRender]).optional(),
|
|
1020
|
+
preview: zod.z.literal(true).optional(),
|
|
1012
1021
|
options: zod.z.object({
|
|
1013
1022
|
maxLength: zod.z.number().optional(),
|
|
1014
1023
|
minLength: zod.z.number().optional(),
|
|
@@ -1024,6 +1033,8 @@ var SerializedStringSchema = zod.z.object({
|
|
|
1024
1033
|
});
|
|
1025
1034
|
var SerializedLiteralSchema = zod.z.object({
|
|
1026
1035
|
type: zod.z.literal("literal"),
|
|
1036
|
+
render: FieldRender,
|
|
1037
|
+
preview: zod.z.literal(true).optional(),
|
|
1027
1038
|
value: zod.z.string(),
|
|
1028
1039
|
opt: zod.z["boolean"](),
|
|
1029
1040
|
readonly: zod.z["boolean"]().optional(),
|
|
@@ -1031,12 +1042,16 @@ var SerializedLiteralSchema = zod.z.object({
|
|
|
1031
1042
|
});
|
|
1032
1043
|
var SerializedBooleanSchema = zod.z.object({
|
|
1033
1044
|
type: zod.z.literal("boolean"),
|
|
1045
|
+
render: FieldRender,
|
|
1046
|
+
preview: zod.z.literal(true).optional(),
|
|
1034
1047
|
opt: zod.z["boolean"](),
|
|
1035
1048
|
readonly: zod.z["boolean"]().optional(),
|
|
1036
1049
|
hidden: zod.z["boolean"]().optional()
|
|
1037
1050
|
});
|
|
1038
1051
|
var SerializedNumberSchema = zod.z.object({
|
|
1039
1052
|
type: zod.z.literal("number"),
|
|
1053
|
+
render: FieldRender,
|
|
1054
|
+
preview: zod.z.literal(true).optional(),
|
|
1040
1055
|
options: zod.z.object({
|
|
1041
1056
|
max: zod.z.number().optional(),
|
|
1042
1057
|
min: zod.z.number().optional()
|
|
@@ -1048,6 +1063,8 @@ var SerializedNumberSchema = zod.z.object({
|
|
|
1048
1063
|
var SerializedObjectSchema = zod.z.lazy(function () {
|
|
1049
1064
|
return zod.z.object({
|
|
1050
1065
|
type: zod.z.literal("object"),
|
|
1066
|
+
render: FieldRender,
|
|
1067
|
+
preview: zod.z.literal(true).optional(),
|
|
1051
1068
|
items: zod.z.record(zod.z.string(), SerializedSchema),
|
|
1052
1069
|
opt: zod.z["boolean"](),
|
|
1053
1070
|
readonly: zod.z["boolean"]().optional(),
|
|
@@ -1057,10 +1074,10 @@ var SerializedObjectSchema = zod.z.lazy(function () {
|
|
|
1057
1074
|
var SerializedArraySchema = zod.z.lazy(function () {
|
|
1058
1075
|
return zod.z.object({
|
|
1059
1076
|
type: zod.z.literal("array"),
|
|
1077
|
+
render: FieldRender,
|
|
1078
|
+
preview: zod.z.literal(true).optional(),
|
|
1060
1079
|
item: SerializedSchema,
|
|
1061
1080
|
opt: zod.z["boolean"](),
|
|
1062
|
-
// Only whether a preview EXISTS: the closure itself cannot be serialized.
|
|
1063
|
-
preview: zod.z.literal(true).optional(),
|
|
1064
1081
|
readonly: zod.z["boolean"]().optional(),
|
|
1065
1082
|
hidden: zod.z["boolean"]().optional()
|
|
1066
1083
|
});
|
|
@@ -1068,6 +1085,8 @@ var SerializedArraySchema = zod.z.lazy(function () {
|
|
|
1068
1085
|
var SerializedUnionSchema = zod.z.lazy(function () {
|
|
1069
1086
|
return zod.z.union([zod.z.object({
|
|
1070
1087
|
type: zod.z.literal("union"),
|
|
1088
|
+
render: FieldRender,
|
|
1089
|
+
preview: zod.z.literal(true).optional(),
|
|
1071
1090
|
key: SerializedLiteralSchema,
|
|
1072
1091
|
items: zod.z.array(SerializedLiteralSchema),
|
|
1073
1092
|
opt: zod.z["boolean"](),
|
|
@@ -1075,6 +1094,8 @@ var SerializedUnionSchema = zod.z.lazy(function () {
|
|
|
1075
1094
|
hidden: zod.z["boolean"]().optional()
|
|
1076
1095
|
}), zod.z.object({
|
|
1077
1096
|
type: zod.z.literal("union"),
|
|
1097
|
+
render: FieldRender,
|
|
1098
|
+
preview: zod.z.literal(true).optional(),
|
|
1078
1099
|
key: zod.z.string(),
|
|
1079
1100
|
items: zod.z.array(SerializedObjectSchema),
|
|
1080
1101
|
opt: zod.z["boolean"](),
|
|
@@ -1090,6 +1111,8 @@ var ImageOptions = zod.z.object({
|
|
|
1090
1111
|
});
|
|
1091
1112
|
var SerializedImageSchema = zod.z.object({
|
|
1092
1113
|
type: zod.z.literal("image"),
|
|
1114
|
+
render: FieldRender,
|
|
1115
|
+
preview: zod.z.literal(true).optional(),
|
|
1093
1116
|
options: ImageOptions.optional(),
|
|
1094
1117
|
opt: zod.z["boolean"](),
|
|
1095
1118
|
readonly: zod.z["boolean"]().optional(),
|
|
@@ -1120,6 +1143,8 @@ var RichTextOptions = zod.z.lazy(function () {
|
|
|
1120
1143
|
});
|
|
1121
1144
|
var SerializedRichTextSchema = zod.z.object({
|
|
1122
1145
|
type: zod.z.literal("richtext"),
|
|
1146
|
+
render: FieldRender,
|
|
1147
|
+
preview: zod.z.literal(true).optional(),
|
|
1123
1148
|
options: RichTextOptions.optional(),
|
|
1124
1149
|
opt: zod.z["boolean"](),
|
|
1125
1150
|
readonly: zod.z["boolean"]().optional(),
|
|
@@ -1128,10 +1153,10 @@ var SerializedRichTextSchema = zod.z.object({
|
|
|
1128
1153
|
var SerializedRecordSchema = zod.z.lazy(function () {
|
|
1129
1154
|
return zod.z.object({
|
|
1130
1155
|
type: zod.z.literal("record"),
|
|
1156
|
+
render: FieldRender,
|
|
1157
|
+
preview: zod.z.literal(true).optional(),
|
|
1131
1158
|
item: SerializedSchema,
|
|
1132
1159
|
opt: zod.z["boolean"](),
|
|
1133
|
-
// Only whether a preview EXISTS: the closure itself cannot be serialized.
|
|
1134
|
-
preview: zod.z.literal(true).optional(),
|
|
1135
1160
|
// Optional gallery marker for files/images
|
|
1136
1161
|
mediaType: zod.z.union([zod.z.literal("files"), zod.z.literal("images")]).optional(),
|
|
1137
1162
|
// Optional legacy gallery metadata
|
|
@@ -1147,6 +1172,8 @@ var SerializedRecordSchema = zod.z.lazy(function () {
|
|
|
1147
1172
|
var SerializedKeyOfSchema = zod.z.lazy(function () {
|
|
1148
1173
|
return zod.z.object({
|
|
1149
1174
|
type: zod.z.literal("keyOf"),
|
|
1175
|
+
render: FieldRender,
|
|
1176
|
+
preview: zod.z.literal(true).optional(),
|
|
1150
1177
|
path: SourcePath,
|
|
1151
1178
|
schema: zod.z.union([zod.z.object({
|
|
1152
1179
|
type: zod.z.literal("object"),
|
|
@@ -1167,6 +1194,8 @@ var FileOptions = zod.z.object({
|
|
|
1167
1194
|
});
|
|
1168
1195
|
var SerializedFileSchema = zod.z.object({
|
|
1169
1196
|
type: zod.z.literal("file"),
|
|
1197
|
+
render: FieldRender,
|
|
1198
|
+
preview: zod.z.literal(true).optional(),
|
|
1170
1199
|
options: FileOptions.optional(),
|
|
1171
1200
|
opt: zod.z["boolean"](),
|
|
1172
1201
|
readonly: zod.z["boolean"]().optional(),
|
|
@@ -1178,6 +1207,8 @@ var DateOptions = zod.z.object({
|
|
|
1178
1207
|
});
|
|
1179
1208
|
var SerializedDateSchema = zod.z.object({
|
|
1180
1209
|
type: zod.z.literal("date"),
|
|
1210
|
+
render: FieldRender,
|
|
1211
|
+
preview: zod.z.literal(true).optional(),
|
|
1181
1212
|
options: DateOptions.optional(),
|
|
1182
1213
|
opt: zod.z["boolean"](),
|
|
1183
1214
|
customValidate: zod.z["boolean"]().optional(),
|
|
@@ -1187,6 +1218,8 @@ var SerializedDateSchema = zod.z.object({
|
|
|
1187
1218
|
});
|
|
1188
1219
|
var SerializedDateTimeSchema = zod.z.object({
|
|
1189
1220
|
type: zod.z.literal("dateTime"),
|
|
1221
|
+
render: FieldRender,
|
|
1222
|
+
preview: zod.z.literal(true).optional(),
|
|
1190
1223
|
options: DateOptions.optional(),
|
|
1191
1224
|
opt: zod.z["boolean"](),
|
|
1192
1225
|
customValidate: zod.z["boolean"]().optional(),
|
|
@@ -1200,6 +1233,8 @@ var ColorOptions = zod.z.object({
|
|
|
1200
1233
|
});
|
|
1201
1234
|
var SerializedColorSchema = zod.z.object({
|
|
1202
1235
|
type: zod.z.literal("color"),
|
|
1236
|
+
render: FieldRender,
|
|
1237
|
+
preview: zod.z.literal(true).optional(),
|
|
1203
1238
|
options: ColorOptions.optional(),
|
|
1204
1239
|
opt: zod.z["boolean"](),
|
|
1205
1240
|
customValidate: zod.z["boolean"]().optional(),
|
|
@@ -1209,6 +1244,8 @@ var SerializedColorSchema = zod.z.object({
|
|
|
1209
1244
|
});
|
|
1210
1245
|
var SerializedRouteSchema = zod.z.object({
|
|
1211
1246
|
type: zod.z.literal("route"),
|
|
1247
|
+
render: FieldRender,
|
|
1248
|
+
preview: zod.z.literal(true).optional(),
|
|
1212
1249
|
options: zod.z.object({
|
|
1213
1250
|
include: zod.z.object({
|
|
1214
1251
|
source: zod.z.string(),
|
|
@@ -999,16 +999,25 @@ var SourcePath = zod.z.string().transform(function (path) {
|
|
|
999
999
|
return path;
|
|
1000
1000
|
});
|
|
1001
1001
|
|
|
1002
|
+
// A render is static config, so unlike a `preview` it travels WHOLE — this
|
|
1003
|
+
// is the field the editor reads the layout from. See `core/src/render.ts`.
|
|
1004
|
+
// Every field can carry `{ as: "inline" }`; strings have layouts of their own
|
|
1005
|
+
// on top. NB: these z.objects STRIP unknown keys, so a render variant that is
|
|
1006
|
+
// not declared here is silently dropped in transit — add it here when it is
|
|
1007
|
+
// added to `render.ts`.
|
|
1008
|
+
var InlineRender = zod.z.object({
|
|
1009
|
+
as: zod.z.literal("inline")
|
|
1010
|
+
});
|
|
1011
|
+
var FieldRender = InlineRender.optional();
|
|
1002
1012
|
var SerializedStringSchema = zod.z.object({
|
|
1003
1013
|
type: zod.z.literal("string"),
|
|
1004
|
-
// A render is static config, so unlike a `preview` it travels WHOLE — this
|
|
1005
|
-
// is the field the editor reads the layout from. See `core/src/render.ts`.
|
|
1006
1014
|
render: zod.z.union([zod.z.object({
|
|
1007
1015
|
as: zod.z.literal("textarea")
|
|
1008
1016
|
}), zod.z.object({
|
|
1009
1017
|
as: zod.z.literal("code"),
|
|
1010
1018
|
language: zod.z["enum"](core.CODE_LANGUAGES)
|
|
1011
|
-
})]).optional(),
|
|
1019
|
+
}), InlineRender]).optional(),
|
|
1020
|
+
preview: zod.z.literal(true).optional(),
|
|
1012
1021
|
options: zod.z.object({
|
|
1013
1022
|
maxLength: zod.z.number().optional(),
|
|
1014
1023
|
minLength: zod.z.number().optional(),
|
|
@@ -1024,6 +1033,8 @@ var SerializedStringSchema = zod.z.object({
|
|
|
1024
1033
|
});
|
|
1025
1034
|
var SerializedLiteralSchema = zod.z.object({
|
|
1026
1035
|
type: zod.z.literal("literal"),
|
|
1036
|
+
render: FieldRender,
|
|
1037
|
+
preview: zod.z.literal(true).optional(),
|
|
1027
1038
|
value: zod.z.string(),
|
|
1028
1039
|
opt: zod.z["boolean"](),
|
|
1029
1040
|
readonly: zod.z["boolean"]().optional(),
|
|
@@ -1031,12 +1042,16 @@ var SerializedLiteralSchema = zod.z.object({
|
|
|
1031
1042
|
});
|
|
1032
1043
|
var SerializedBooleanSchema = zod.z.object({
|
|
1033
1044
|
type: zod.z.literal("boolean"),
|
|
1045
|
+
render: FieldRender,
|
|
1046
|
+
preview: zod.z.literal(true).optional(),
|
|
1034
1047
|
opt: zod.z["boolean"](),
|
|
1035
1048
|
readonly: zod.z["boolean"]().optional(),
|
|
1036
1049
|
hidden: zod.z["boolean"]().optional()
|
|
1037
1050
|
});
|
|
1038
1051
|
var SerializedNumberSchema = zod.z.object({
|
|
1039
1052
|
type: zod.z.literal("number"),
|
|
1053
|
+
render: FieldRender,
|
|
1054
|
+
preview: zod.z.literal(true).optional(),
|
|
1040
1055
|
options: zod.z.object({
|
|
1041
1056
|
max: zod.z.number().optional(),
|
|
1042
1057
|
min: zod.z.number().optional()
|
|
@@ -1048,6 +1063,8 @@ var SerializedNumberSchema = zod.z.object({
|
|
|
1048
1063
|
var SerializedObjectSchema = zod.z.lazy(function () {
|
|
1049
1064
|
return zod.z.object({
|
|
1050
1065
|
type: zod.z.literal("object"),
|
|
1066
|
+
render: FieldRender,
|
|
1067
|
+
preview: zod.z.literal(true).optional(),
|
|
1051
1068
|
items: zod.z.record(zod.z.string(), SerializedSchema),
|
|
1052
1069
|
opt: zod.z["boolean"](),
|
|
1053
1070
|
readonly: zod.z["boolean"]().optional(),
|
|
@@ -1057,10 +1074,10 @@ var SerializedObjectSchema = zod.z.lazy(function () {
|
|
|
1057
1074
|
var SerializedArraySchema = zod.z.lazy(function () {
|
|
1058
1075
|
return zod.z.object({
|
|
1059
1076
|
type: zod.z.literal("array"),
|
|
1077
|
+
render: FieldRender,
|
|
1078
|
+
preview: zod.z.literal(true).optional(),
|
|
1060
1079
|
item: SerializedSchema,
|
|
1061
1080
|
opt: zod.z["boolean"](),
|
|
1062
|
-
// Only whether a preview EXISTS: the closure itself cannot be serialized.
|
|
1063
|
-
preview: zod.z.literal(true).optional(),
|
|
1064
1081
|
readonly: zod.z["boolean"]().optional(),
|
|
1065
1082
|
hidden: zod.z["boolean"]().optional()
|
|
1066
1083
|
});
|
|
@@ -1068,6 +1085,8 @@ var SerializedArraySchema = zod.z.lazy(function () {
|
|
|
1068
1085
|
var SerializedUnionSchema = zod.z.lazy(function () {
|
|
1069
1086
|
return zod.z.union([zod.z.object({
|
|
1070
1087
|
type: zod.z.literal("union"),
|
|
1088
|
+
render: FieldRender,
|
|
1089
|
+
preview: zod.z.literal(true).optional(),
|
|
1071
1090
|
key: SerializedLiteralSchema,
|
|
1072
1091
|
items: zod.z.array(SerializedLiteralSchema),
|
|
1073
1092
|
opt: zod.z["boolean"](),
|
|
@@ -1075,6 +1094,8 @@ var SerializedUnionSchema = zod.z.lazy(function () {
|
|
|
1075
1094
|
hidden: zod.z["boolean"]().optional()
|
|
1076
1095
|
}), zod.z.object({
|
|
1077
1096
|
type: zod.z.literal("union"),
|
|
1097
|
+
render: FieldRender,
|
|
1098
|
+
preview: zod.z.literal(true).optional(),
|
|
1078
1099
|
key: zod.z.string(),
|
|
1079
1100
|
items: zod.z.array(SerializedObjectSchema),
|
|
1080
1101
|
opt: zod.z["boolean"](),
|
|
@@ -1090,6 +1111,8 @@ var ImageOptions = zod.z.object({
|
|
|
1090
1111
|
});
|
|
1091
1112
|
var SerializedImageSchema = zod.z.object({
|
|
1092
1113
|
type: zod.z.literal("image"),
|
|
1114
|
+
render: FieldRender,
|
|
1115
|
+
preview: zod.z.literal(true).optional(),
|
|
1093
1116
|
options: ImageOptions.optional(),
|
|
1094
1117
|
opt: zod.z["boolean"](),
|
|
1095
1118
|
readonly: zod.z["boolean"]().optional(),
|
|
@@ -1120,6 +1143,8 @@ var RichTextOptions = zod.z.lazy(function () {
|
|
|
1120
1143
|
});
|
|
1121
1144
|
var SerializedRichTextSchema = zod.z.object({
|
|
1122
1145
|
type: zod.z.literal("richtext"),
|
|
1146
|
+
render: FieldRender,
|
|
1147
|
+
preview: zod.z.literal(true).optional(),
|
|
1123
1148
|
options: RichTextOptions.optional(),
|
|
1124
1149
|
opt: zod.z["boolean"](),
|
|
1125
1150
|
readonly: zod.z["boolean"]().optional(),
|
|
@@ -1128,10 +1153,10 @@ var SerializedRichTextSchema = zod.z.object({
|
|
|
1128
1153
|
var SerializedRecordSchema = zod.z.lazy(function () {
|
|
1129
1154
|
return zod.z.object({
|
|
1130
1155
|
type: zod.z.literal("record"),
|
|
1156
|
+
render: FieldRender,
|
|
1157
|
+
preview: zod.z.literal(true).optional(),
|
|
1131
1158
|
item: SerializedSchema,
|
|
1132
1159
|
opt: zod.z["boolean"](),
|
|
1133
|
-
// Only whether a preview EXISTS: the closure itself cannot be serialized.
|
|
1134
|
-
preview: zod.z.literal(true).optional(),
|
|
1135
1160
|
// Optional gallery marker for files/images
|
|
1136
1161
|
mediaType: zod.z.union([zod.z.literal("files"), zod.z.literal("images")]).optional(),
|
|
1137
1162
|
// Optional legacy gallery metadata
|
|
@@ -1147,6 +1172,8 @@ var SerializedRecordSchema = zod.z.lazy(function () {
|
|
|
1147
1172
|
var SerializedKeyOfSchema = zod.z.lazy(function () {
|
|
1148
1173
|
return zod.z.object({
|
|
1149
1174
|
type: zod.z.literal("keyOf"),
|
|
1175
|
+
render: FieldRender,
|
|
1176
|
+
preview: zod.z.literal(true).optional(),
|
|
1150
1177
|
path: SourcePath,
|
|
1151
1178
|
schema: zod.z.union([zod.z.object({
|
|
1152
1179
|
type: zod.z.literal("object"),
|
|
@@ -1167,6 +1194,8 @@ var FileOptions = zod.z.object({
|
|
|
1167
1194
|
});
|
|
1168
1195
|
var SerializedFileSchema = zod.z.object({
|
|
1169
1196
|
type: zod.z.literal("file"),
|
|
1197
|
+
render: FieldRender,
|
|
1198
|
+
preview: zod.z.literal(true).optional(),
|
|
1170
1199
|
options: FileOptions.optional(),
|
|
1171
1200
|
opt: zod.z["boolean"](),
|
|
1172
1201
|
readonly: zod.z["boolean"]().optional(),
|
|
@@ -1178,6 +1207,8 @@ var DateOptions = zod.z.object({
|
|
|
1178
1207
|
});
|
|
1179
1208
|
var SerializedDateSchema = zod.z.object({
|
|
1180
1209
|
type: zod.z.literal("date"),
|
|
1210
|
+
render: FieldRender,
|
|
1211
|
+
preview: zod.z.literal(true).optional(),
|
|
1181
1212
|
options: DateOptions.optional(),
|
|
1182
1213
|
opt: zod.z["boolean"](),
|
|
1183
1214
|
customValidate: zod.z["boolean"]().optional(),
|
|
@@ -1187,6 +1218,8 @@ var SerializedDateSchema = zod.z.object({
|
|
|
1187
1218
|
});
|
|
1188
1219
|
var SerializedDateTimeSchema = zod.z.object({
|
|
1189
1220
|
type: zod.z.literal("dateTime"),
|
|
1221
|
+
render: FieldRender,
|
|
1222
|
+
preview: zod.z.literal(true).optional(),
|
|
1190
1223
|
options: DateOptions.optional(),
|
|
1191
1224
|
opt: zod.z["boolean"](),
|
|
1192
1225
|
customValidate: zod.z["boolean"]().optional(),
|
|
@@ -1200,6 +1233,8 @@ var ColorOptions = zod.z.object({
|
|
|
1200
1233
|
});
|
|
1201
1234
|
var SerializedColorSchema = zod.z.object({
|
|
1202
1235
|
type: zod.z.literal("color"),
|
|
1236
|
+
render: FieldRender,
|
|
1237
|
+
preview: zod.z.literal(true).optional(),
|
|
1203
1238
|
options: ColorOptions.optional(),
|
|
1204
1239
|
opt: zod.z["boolean"](),
|
|
1205
1240
|
customValidate: zod.z["boolean"]().optional(),
|
|
@@ -1209,6 +1244,8 @@ var SerializedColorSchema = zod.z.object({
|
|
|
1209
1244
|
});
|
|
1210
1245
|
var SerializedRouteSchema = zod.z.object({
|
|
1211
1246
|
type: zod.z.literal("route"),
|
|
1247
|
+
render: FieldRender,
|
|
1248
|
+
preview: zod.z.literal(true).optional(),
|
|
1212
1249
|
options: zod.z.object({
|
|
1213
1250
|
include: zod.z.object({
|
|
1214
1251
|
source: zod.z.string(),
|
|
@@ -995,16 +995,25 @@ var SourcePath = z.string().transform(function (path) {
|
|
|
995
995
|
return path;
|
|
996
996
|
});
|
|
997
997
|
|
|
998
|
+
// A render is static config, so unlike a `preview` it travels WHOLE — this
|
|
999
|
+
// is the field the editor reads the layout from. See `core/src/render.ts`.
|
|
1000
|
+
// Every field can carry `{ as: "inline" }`; strings have layouts of their own
|
|
1001
|
+
// on top. NB: these z.objects STRIP unknown keys, so a render variant that is
|
|
1002
|
+
// not declared here is silently dropped in transit — add it here when it is
|
|
1003
|
+
// added to `render.ts`.
|
|
1004
|
+
var InlineRender = z.object({
|
|
1005
|
+
as: z.literal("inline")
|
|
1006
|
+
});
|
|
1007
|
+
var FieldRender = InlineRender.optional();
|
|
998
1008
|
var SerializedStringSchema = z.object({
|
|
999
1009
|
type: z.literal("string"),
|
|
1000
|
-
// A render is static config, so unlike a `preview` it travels WHOLE — this
|
|
1001
|
-
// is the field the editor reads the layout from. See `core/src/render.ts`.
|
|
1002
1010
|
render: z.union([z.object({
|
|
1003
1011
|
as: z.literal("textarea")
|
|
1004
1012
|
}), z.object({
|
|
1005
1013
|
as: z.literal("code"),
|
|
1006
1014
|
language: z["enum"](CODE_LANGUAGES)
|
|
1007
|
-
})]).optional(),
|
|
1015
|
+
}), InlineRender]).optional(),
|
|
1016
|
+
preview: z.literal(true).optional(),
|
|
1008
1017
|
options: z.object({
|
|
1009
1018
|
maxLength: z.number().optional(),
|
|
1010
1019
|
minLength: z.number().optional(),
|
|
@@ -1020,6 +1029,8 @@ var SerializedStringSchema = z.object({
|
|
|
1020
1029
|
});
|
|
1021
1030
|
var SerializedLiteralSchema = z.object({
|
|
1022
1031
|
type: z.literal("literal"),
|
|
1032
|
+
render: FieldRender,
|
|
1033
|
+
preview: z.literal(true).optional(),
|
|
1023
1034
|
value: z.string(),
|
|
1024
1035
|
opt: z["boolean"](),
|
|
1025
1036
|
readonly: z["boolean"]().optional(),
|
|
@@ -1027,12 +1038,16 @@ var SerializedLiteralSchema = z.object({
|
|
|
1027
1038
|
});
|
|
1028
1039
|
var SerializedBooleanSchema = z.object({
|
|
1029
1040
|
type: z.literal("boolean"),
|
|
1041
|
+
render: FieldRender,
|
|
1042
|
+
preview: z.literal(true).optional(),
|
|
1030
1043
|
opt: z["boolean"](),
|
|
1031
1044
|
readonly: z["boolean"]().optional(),
|
|
1032
1045
|
hidden: z["boolean"]().optional()
|
|
1033
1046
|
});
|
|
1034
1047
|
var SerializedNumberSchema = z.object({
|
|
1035
1048
|
type: z.literal("number"),
|
|
1049
|
+
render: FieldRender,
|
|
1050
|
+
preview: z.literal(true).optional(),
|
|
1036
1051
|
options: z.object({
|
|
1037
1052
|
max: z.number().optional(),
|
|
1038
1053
|
min: z.number().optional()
|
|
@@ -1044,6 +1059,8 @@ var SerializedNumberSchema = z.object({
|
|
|
1044
1059
|
var SerializedObjectSchema = z.lazy(function () {
|
|
1045
1060
|
return z.object({
|
|
1046
1061
|
type: z.literal("object"),
|
|
1062
|
+
render: FieldRender,
|
|
1063
|
+
preview: z.literal(true).optional(),
|
|
1047
1064
|
items: z.record(z.string(), SerializedSchema),
|
|
1048
1065
|
opt: z["boolean"](),
|
|
1049
1066
|
readonly: z["boolean"]().optional(),
|
|
@@ -1053,10 +1070,10 @@ var SerializedObjectSchema = z.lazy(function () {
|
|
|
1053
1070
|
var SerializedArraySchema = z.lazy(function () {
|
|
1054
1071
|
return z.object({
|
|
1055
1072
|
type: z.literal("array"),
|
|
1073
|
+
render: FieldRender,
|
|
1074
|
+
preview: z.literal(true).optional(),
|
|
1056
1075
|
item: SerializedSchema,
|
|
1057
1076
|
opt: z["boolean"](),
|
|
1058
|
-
// Only whether a preview EXISTS: the closure itself cannot be serialized.
|
|
1059
|
-
preview: z.literal(true).optional(),
|
|
1060
1077
|
readonly: z["boolean"]().optional(),
|
|
1061
1078
|
hidden: z["boolean"]().optional()
|
|
1062
1079
|
});
|
|
@@ -1064,6 +1081,8 @@ var SerializedArraySchema = z.lazy(function () {
|
|
|
1064
1081
|
var SerializedUnionSchema = z.lazy(function () {
|
|
1065
1082
|
return z.union([z.object({
|
|
1066
1083
|
type: z.literal("union"),
|
|
1084
|
+
render: FieldRender,
|
|
1085
|
+
preview: z.literal(true).optional(),
|
|
1067
1086
|
key: SerializedLiteralSchema,
|
|
1068
1087
|
items: z.array(SerializedLiteralSchema),
|
|
1069
1088
|
opt: z["boolean"](),
|
|
@@ -1071,6 +1090,8 @@ var SerializedUnionSchema = z.lazy(function () {
|
|
|
1071
1090
|
hidden: z["boolean"]().optional()
|
|
1072
1091
|
}), z.object({
|
|
1073
1092
|
type: z.literal("union"),
|
|
1093
|
+
render: FieldRender,
|
|
1094
|
+
preview: z.literal(true).optional(),
|
|
1074
1095
|
key: z.string(),
|
|
1075
1096
|
items: z.array(SerializedObjectSchema),
|
|
1076
1097
|
opt: z["boolean"](),
|
|
@@ -1086,6 +1107,8 @@ var ImageOptions = z.object({
|
|
|
1086
1107
|
});
|
|
1087
1108
|
var SerializedImageSchema = z.object({
|
|
1088
1109
|
type: z.literal("image"),
|
|
1110
|
+
render: FieldRender,
|
|
1111
|
+
preview: z.literal(true).optional(),
|
|
1089
1112
|
options: ImageOptions.optional(),
|
|
1090
1113
|
opt: z["boolean"](),
|
|
1091
1114
|
readonly: z["boolean"]().optional(),
|
|
@@ -1116,6 +1139,8 @@ var RichTextOptions = z.lazy(function () {
|
|
|
1116
1139
|
});
|
|
1117
1140
|
var SerializedRichTextSchema = z.object({
|
|
1118
1141
|
type: z.literal("richtext"),
|
|
1142
|
+
render: FieldRender,
|
|
1143
|
+
preview: z.literal(true).optional(),
|
|
1119
1144
|
options: RichTextOptions.optional(),
|
|
1120
1145
|
opt: z["boolean"](),
|
|
1121
1146
|
readonly: z["boolean"]().optional(),
|
|
@@ -1124,10 +1149,10 @@ var SerializedRichTextSchema = z.object({
|
|
|
1124
1149
|
var SerializedRecordSchema = z.lazy(function () {
|
|
1125
1150
|
return z.object({
|
|
1126
1151
|
type: z.literal("record"),
|
|
1152
|
+
render: FieldRender,
|
|
1153
|
+
preview: z.literal(true).optional(),
|
|
1127
1154
|
item: SerializedSchema,
|
|
1128
1155
|
opt: z["boolean"](),
|
|
1129
|
-
// Only whether a preview EXISTS: the closure itself cannot be serialized.
|
|
1130
|
-
preview: z.literal(true).optional(),
|
|
1131
1156
|
// Optional gallery marker for files/images
|
|
1132
1157
|
mediaType: z.union([z.literal("files"), z.literal("images")]).optional(),
|
|
1133
1158
|
// Optional legacy gallery metadata
|
|
@@ -1143,6 +1168,8 @@ var SerializedRecordSchema = z.lazy(function () {
|
|
|
1143
1168
|
var SerializedKeyOfSchema = z.lazy(function () {
|
|
1144
1169
|
return z.object({
|
|
1145
1170
|
type: z.literal("keyOf"),
|
|
1171
|
+
render: FieldRender,
|
|
1172
|
+
preview: z.literal(true).optional(),
|
|
1146
1173
|
path: SourcePath,
|
|
1147
1174
|
schema: z.union([z.object({
|
|
1148
1175
|
type: z.literal("object"),
|
|
@@ -1163,6 +1190,8 @@ var FileOptions = z.object({
|
|
|
1163
1190
|
});
|
|
1164
1191
|
var SerializedFileSchema = z.object({
|
|
1165
1192
|
type: z.literal("file"),
|
|
1193
|
+
render: FieldRender,
|
|
1194
|
+
preview: z.literal(true).optional(),
|
|
1166
1195
|
options: FileOptions.optional(),
|
|
1167
1196
|
opt: z["boolean"](),
|
|
1168
1197
|
readonly: z["boolean"]().optional(),
|
|
@@ -1174,6 +1203,8 @@ var DateOptions = z.object({
|
|
|
1174
1203
|
});
|
|
1175
1204
|
var SerializedDateSchema = z.object({
|
|
1176
1205
|
type: z.literal("date"),
|
|
1206
|
+
render: FieldRender,
|
|
1207
|
+
preview: z.literal(true).optional(),
|
|
1177
1208
|
options: DateOptions.optional(),
|
|
1178
1209
|
opt: z["boolean"](),
|
|
1179
1210
|
customValidate: z["boolean"]().optional(),
|
|
@@ -1183,6 +1214,8 @@ var SerializedDateSchema = z.object({
|
|
|
1183
1214
|
});
|
|
1184
1215
|
var SerializedDateTimeSchema = z.object({
|
|
1185
1216
|
type: z.literal("dateTime"),
|
|
1217
|
+
render: FieldRender,
|
|
1218
|
+
preview: z.literal(true).optional(),
|
|
1186
1219
|
options: DateOptions.optional(),
|
|
1187
1220
|
opt: z["boolean"](),
|
|
1188
1221
|
customValidate: z["boolean"]().optional(),
|
|
@@ -1196,6 +1229,8 @@ var ColorOptions = z.object({
|
|
|
1196
1229
|
});
|
|
1197
1230
|
var SerializedColorSchema = z.object({
|
|
1198
1231
|
type: z.literal("color"),
|
|
1232
|
+
render: FieldRender,
|
|
1233
|
+
preview: z.literal(true).optional(),
|
|
1199
1234
|
options: ColorOptions.optional(),
|
|
1200
1235
|
opt: z["boolean"](),
|
|
1201
1236
|
customValidate: z["boolean"]().optional(),
|
|
@@ -1205,6 +1240,8 @@ var SerializedColorSchema = z.object({
|
|
|
1205
1240
|
});
|
|
1206
1241
|
var SerializedRouteSchema = z.object({
|
|
1207
1242
|
type: z.literal("route"),
|
|
1243
|
+
render: FieldRender,
|
|
1244
|
+
preview: z.literal(true).optional(),
|
|
1208
1245
|
options: z.object({
|
|
1209
1246
|
include: z.object({
|
|
1210
1247
|
source: z.string(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@valbuild/shared",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.109.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Val shared types and utilities",
|
|
6
6
|
"repository": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"zod": "^4.4.3",
|
|
33
33
|
"zod-validation-error": "^5.0.0",
|
|
34
|
-
"@valbuild/core": "0.
|
|
34
|
+
"@valbuild/core": "0.109.0"
|
|
35
35
|
},
|
|
36
36
|
"files": [
|
|
37
37
|
"dist",
|