@valbuild/shared 0.108.0 → 0.110.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.
@@ -7,11 +7,21 @@ export declare const SerializedNumberSchema: z.ZodType<SerializedNumberSchemaT>;
7
7
  export declare const SerializedObjectSchema: z.ZodType<SerializedObjectSchemaT>;
8
8
  export declare const SerializedArraySchema: z.ZodType<SerializedArraySchemaT>;
9
9
  export declare const SerializedUnionSchema: z.ZodType<SerializedUnionSchemaT>;
10
+ export declare const ImageEncodeOption: z.ZodUnion<readonly [z.ZodLiteral<false>, z.ZodObject<{
11
+ type: z.ZodLiteral<"webp">;
12
+ quality: z.ZodOptional<z.ZodNumber>;
13
+ maxWidth: z.ZodOptional<z.ZodNumber>;
14
+ maxHeight: z.ZodOptional<z.ZodNumber>;
15
+ }, z.core.$strip>]>;
10
16
  export declare const ImageOptions: z.ZodObject<{
11
- ext: z.ZodOptional<z.ZodUnion<readonly [z.ZodTuple<[z.ZodLiteral<"jpg">], null>, z.ZodTuple<[z.ZodLiteral<"webp">], null>]>>;
12
17
  directory: z.ZodOptional<z.ZodString>;
13
- prefix: z.ZodOptional<z.ZodString>;
14
18
  accept: z.ZodOptional<z.ZodString>;
19
+ encode: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<false>, z.ZodObject<{
20
+ type: z.ZodLiteral<"webp">;
21
+ quality: z.ZodOptional<z.ZodNumber>;
22
+ maxWidth: z.ZodOptional<z.ZodNumber>;
23
+ maxHeight: z.ZodOptional<z.ZodNumber>;
24
+ }, z.core.$strip>]>>;
15
25
  }, z.core.$strip>;
16
26
  export declare const SerializedImageSchema: z.ZodType<SerializedImageSchemaT>;
17
27
  export declare const RichTextOptions: z.ZodType<SerializedRichTextOptionsT>;
@@ -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"](),
@@ -1082,14 +1103,21 @@ var SerializedUnionSchema = zod.z.lazy(function () {
1082
1103
  hidden: zod.z["boolean"]().optional()
1083
1104
  })]);
1084
1105
  });
1106
+ var ImageEncodeOption = zod.z.union([zod.z.literal(false), zod.z.object({
1107
+ type: zod.z.literal("webp"),
1108
+ quality: zod.z.number().optional(),
1109
+ maxWidth: zod.z.number().optional(),
1110
+ maxHeight: zod.z.number().optional()
1111
+ })]);
1085
1112
  var ImageOptions = zod.z.object({
1086
- ext: zod.z.union([zod.z.tuple([zod.z.literal("jpg")]), zod.z.tuple([zod.z.literal("webp")])]).optional(),
1087
1113
  directory: zod.z.string().optional(),
1088
- prefix: zod.z.string().optional(),
1089
- accept: zod.z.string().optional()
1114
+ accept: zod.z.string().optional(),
1115
+ encode: ImageEncodeOption.optional()
1090
1116
  });
1091
1117
  var SerializedImageSchema = zod.z.object({
1092
1118
  type: zod.z.literal("image"),
1119
+ render: FieldRender,
1120
+ preview: zod.z.literal(true).optional(),
1093
1121
  options: ImageOptions.optional(),
1094
1122
  opt: zod.z["boolean"](),
1095
1123
  readonly: zod.z["boolean"]().optional(),
@@ -1120,6 +1148,8 @@ var RichTextOptions = zod.z.lazy(function () {
1120
1148
  });
1121
1149
  var SerializedRichTextSchema = zod.z.object({
1122
1150
  type: zod.z.literal("richtext"),
1151
+ render: FieldRender,
1152
+ preview: zod.z.literal(true).optional(),
1123
1153
  options: RichTextOptions.optional(),
1124
1154
  opt: zod.z["boolean"](),
1125
1155
  readonly: zod.z["boolean"]().optional(),
@@ -1128,16 +1158,17 @@ var SerializedRichTextSchema = zod.z.object({
1128
1158
  var SerializedRecordSchema = zod.z.lazy(function () {
1129
1159
  return zod.z.object({
1130
1160
  type: zod.z.literal("record"),
1161
+ render: FieldRender,
1162
+ preview: zod.z.literal(true).optional(),
1131
1163
  item: SerializedSchema,
1132
1164
  opt: zod.z["boolean"](),
1133
- // Only whether a preview EXISTS: the closure itself cannot be serialized.
1134
- preview: zod.z.literal(true).optional(),
1135
1165
  // Optional gallery marker for files/images
1136
1166
  mediaType: zod.z.union([zod.z.literal("files"), zod.z.literal("images")]).optional(),
1137
1167
  // Optional legacy gallery metadata
1138
1168
  accept: zod.z.string().optional(),
1139
1169
  directory: zod.z.string().optional(),
1140
1170
  remote: zod.z["boolean"]().optional(),
1171
+ encode: ImageEncodeOption.optional(),
1141
1172
  alt: SerializedSchema.optional(),
1142
1173
  moduleMetadata: zod.z.record(zod.z.string(), zod.z.record(zod.z.string(), zod.z.any())).optional(),
1143
1174
  readonly: zod.z["boolean"]().optional(),
@@ -1147,6 +1178,8 @@ var SerializedRecordSchema = zod.z.lazy(function () {
1147
1178
  var SerializedKeyOfSchema = zod.z.lazy(function () {
1148
1179
  return zod.z.object({
1149
1180
  type: zod.z.literal("keyOf"),
1181
+ render: FieldRender,
1182
+ preview: zod.z.literal(true).optional(),
1150
1183
  path: SourcePath,
1151
1184
  schema: zod.z.union([zod.z.object({
1152
1185
  type: zod.z.literal("object"),
@@ -1167,6 +1200,8 @@ var FileOptions = zod.z.object({
1167
1200
  });
1168
1201
  var SerializedFileSchema = zod.z.object({
1169
1202
  type: zod.z.literal("file"),
1203
+ render: FieldRender,
1204
+ preview: zod.z.literal(true).optional(),
1170
1205
  options: FileOptions.optional(),
1171
1206
  opt: zod.z["boolean"](),
1172
1207
  readonly: zod.z["boolean"]().optional(),
@@ -1178,6 +1213,8 @@ var DateOptions = zod.z.object({
1178
1213
  });
1179
1214
  var SerializedDateSchema = zod.z.object({
1180
1215
  type: zod.z.literal("date"),
1216
+ render: FieldRender,
1217
+ preview: zod.z.literal(true).optional(),
1181
1218
  options: DateOptions.optional(),
1182
1219
  opt: zod.z["boolean"](),
1183
1220
  customValidate: zod.z["boolean"]().optional(),
@@ -1187,6 +1224,8 @@ var SerializedDateSchema = zod.z.object({
1187
1224
  });
1188
1225
  var SerializedDateTimeSchema = zod.z.object({
1189
1226
  type: zod.z.literal("dateTime"),
1227
+ render: FieldRender,
1228
+ preview: zod.z.literal(true).optional(),
1190
1229
  options: DateOptions.optional(),
1191
1230
  opt: zod.z["boolean"](),
1192
1231
  customValidate: zod.z["boolean"]().optional(),
@@ -1200,6 +1239,8 @@ var ColorOptions = zod.z.object({
1200
1239
  });
1201
1240
  var SerializedColorSchema = zod.z.object({
1202
1241
  type: zod.z.literal("color"),
1242
+ render: FieldRender,
1243
+ preview: zod.z.literal(true).optional(),
1203
1244
  options: ColorOptions.optional(),
1204
1245
  opt: zod.z["boolean"](),
1205
1246
  customValidate: zod.z["boolean"]().optional(),
@@ -1209,6 +1250,8 @@ var SerializedColorSchema = zod.z.object({
1209
1250
  });
1210
1251
  var SerializedRouteSchema = zod.z.object({
1211
1252
  type: zod.z.literal("route"),
1253
+ render: FieldRender,
1254
+ preview: zod.z.literal(true).optional(),
1212
1255
  options: zod.z.object({
1213
1256
  include: zod.z.object({
1214
1257
  source: zod.z.string(),
@@ -3410,6 +3453,7 @@ exports.ColorOptions = ColorOptions;
3410
3453
  exports.DEFAULT_ERROR_MESSAGE = DEFAULT_ERROR_MESSAGE;
3411
3454
  exports.DateOptions = DateOptions;
3412
3455
  exports.FileOptions = FileOptions;
3456
+ exports.ImageEncodeOption = ImageEncodeOption;
3413
3457
  exports.ImageOptions = ImageOptions;
3414
3458
  exports.JSON_ENTRIES_BATCH_MAX = JSON_ENTRIES_BATCH_MAX;
3415
3459
  exports.ParentRef = ParentRef$1;
@@ -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"](),
@@ -1082,14 +1103,21 @@ var SerializedUnionSchema = zod.z.lazy(function () {
1082
1103
  hidden: zod.z["boolean"]().optional()
1083
1104
  })]);
1084
1105
  });
1106
+ var ImageEncodeOption = zod.z.union([zod.z.literal(false), zod.z.object({
1107
+ type: zod.z.literal("webp"),
1108
+ quality: zod.z.number().optional(),
1109
+ maxWidth: zod.z.number().optional(),
1110
+ maxHeight: zod.z.number().optional()
1111
+ })]);
1085
1112
  var ImageOptions = zod.z.object({
1086
- ext: zod.z.union([zod.z.tuple([zod.z.literal("jpg")]), zod.z.tuple([zod.z.literal("webp")])]).optional(),
1087
1113
  directory: zod.z.string().optional(),
1088
- prefix: zod.z.string().optional(),
1089
- accept: zod.z.string().optional()
1114
+ accept: zod.z.string().optional(),
1115
+ encode: ImageEncodeOption.optional()
1090
1116
  });
1091
1117
  var SerializedImageSchema = zod.z.object({
1092
1118
  type: zod.z.literal("image"),
1119
+ render: FieldRender,
1120
+ preview: zod.z.literal(true).optional(),
1093
1121
  options: ImageOptions.optional(),
1094
1122
  opt: zod.z["boolean"](),
1095
1123
  readonly: zod.z["boolean"]().optional(),
@@ -1120,6 +1148,8 @@ var RichTextOptions = zod.z.lazy(function () {
1120
1148
  });
1121
1149
  var SerializedRichTextSchema = zod.z.object({
1122
1150
  type: zod.z.literal("richtext"),
1151
+ render: FieldRender,
1152
+ preview: zod.z.literal(true).optional(),
1123
1153
  options: RichTextOptions.optional(),
1124
1154
  opt: zod.z["boolean"](),
1125
1155
  readonly: zod.z["boolean"]().optional(),
@@ -1128,16 +1158,17 @@ var SerializedRichTextSchema = zod.z.object({
1128
1158
  var SerializedRecordSchema = zod.z.lazy(function () {
1129
1159
  return zod.z.object({
1130
1160
  type: zod.z.literal("record"),
1161
+ render: FieldRender,
1162
+ preview: zod.z.literal(true).optional(),
1131
1163
  item: SerializedSchema,
1132
1164
  opt: zod.z["boolean"](),
1133
- // Only whether a preview EXISTS: the closure itself cannot be serialized.
1134
- preview: zod.z.literal(true).optional(),
1135
1165
  // Optional gallery marker for files/images
1136
1166
  mediaType: zod.z.union([zod.z.literal("files"), zod.z.literal("images")]).optional(),
1137
1167
  // Optional legacy gallery metadata
1138
1168
  accept: zod.z.string().optional(),
1139
1169
  directory: zod.z.string().optional(),
1140
1170
  remote: zod.z["boolean"]().optional(),
1171
+ encode: ImageEncodeOption.optional(),
1141
1172
  alt: SerializedSchema.optional(),
1142
1173
  moduleMetadata: zod.z.record(zod.z.string(), zod.z.record(zod.z.string(), zod.z.any())).optional(),
1143
1174
  readonly: zod.z["boolean"]().optional(),
@@ -1147,6 +1178,8 @@ var SerializedRecordSchema = zod.z.lazy(function () {
1147
1178
  var SerializedKeyOfSchema = zod.z.lazy(function () {
1148
1179
  return zod.z.object({
1149
1180
  type: zod.z.literal("keyOf"),
1181
+ render: FieldRender,
1182
+ preview: zod.z.literal(true).optional(),
1150
1183
  path: SourcePath,
1151
1184
  schema: zod.z.union([zod.z.object({
1152
1185
  type: zod.z.literal("object"),
@@ -1167,6 +1200,8 @@ var FileOptions = zod.z.object({
1167
1200
  });
1168
1201
  var SerializedFileSchema = zod.z.object({
1169
1202
  type: zod.z.literal("file"),
1203
+ render: FieldRender,
1204
+ preview: zod.z.literal(true).optional(),
1170
1205
  options: FileOptions.optional(),
1171
1206
  opt: zod.z["boolean"](),
1172
1207
  readonly: zod.z["boolean"]().optional(),
@@ -1178,6 +1213,8 @@ var DateOptions = zod.z.object({
1178
1213
  });
1179
1214
  var SerializedDateSchema = zod.z.object({
1180
1215
  type: zod.z.literal("date"),
1216
+ render: FieldRender,
1217
+ preview: zod.z.literal(true).optional(),
1181
1218
  options: DateOptions.optional(),
1182
1219
  opt: zod.z["boolean"](),
1183
1220
  customValidate: zod.z["boolean"]().optional(),
@@ -1187,6 +1224,8 @@ var SerializedDateSchema = zod.z.object({
1187
1224
  });
1188
1225
  var SerializedDateTimeSchema = zod.z.object({
1189
1226
  type: zod.z.literal("dateTime"),
1227
+ render: FieldRender,
1228
+ preview: zod.z.literal(true).optional(),
1190
1229
  options: DateOptions.optional(),
1191
1230
  opt: zod.z["boolean"](),
1192
1231
  customValidate: zod.z["boolean"]().optional(),
@@ -1200,6 +1239,8 @@ var ColorOptions = zod.z.object({
1200
1239
  });
1201
1240
  var SerializedColorSchema = zod.z.object({
1202
1241
  type: zod.z.literal("color"),
1242
+ render: FieldRender,
1243
+ preview: zod.z.literal(true).optional(),
1203
1244
  options: ColorOptions.optional(),
1204
1245
  opt: zod.z["boolean"](),
1205
1246
  customValidate: zod.z["boolean"]().optional(),
@@ -1209,6 +1250,8 @@ var SerializedColorSchema = zod.z.object({
1209
1250
  });
1210
1251
  var SerializedRouteSchema = zod.z.object({
1211
1252
  type: zod.z.literal("route"),
1253
+ render: FieldRender,
1254
+ preview: zod.z.literal(true).optional(),
1212
1255
  options: zod.z.object({
1213
1256
  include: zod.z.object({
1214
1257
  source: zod.z.string(),
@@ -3410,6 +3453,7 @@ exports.ColorOptions = ColorOptions;
3410
3453
  exports.DEFAULT_ERROR_MESSAGE = DEFAULT_ERROR_MESSAGE;
3411
3454
  exports.DateOptions = DateOptions;
3412
3455
  exports.FileOptions = FileOptions;
3456
+ exports.ImageEncodeOption = ImageEncodeOption;
3413
3457
  exports.ImageOptions = ImageOptions;
3414
3458
  exports.JSON_ENTRIES_BATCH_MAX = JSON_ENTRIES_BATCH_MAX;
3415
3459
  exports.ParentRef = ParentRef$1;
@@ -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"](),
@@ -1078,14 +1099,21 @@ var SerializedUnionSchema = z.lazy(function () {
1078
1099
  hidden: z["boolean"]().optional()
1079
1100
  })]);
1080
1101
  });
1102
+ var ImageEncodeOption = z.union([z.literal(false), z.object({
1103
+ type: z.literal("webp"),
1104
+ quality: z.number().optional(),
1105
+ maxWidth: z.number().optional(),
1106
+ maxHeight: z.number().optional()
1107
+ })]);
1081
1108
  var ImageOptions = z.object({
1082
- ext: z.union([z.tuple([z.literal("jpg")]), z.tuple([z.literal("webp")])]).optional(),
1083
1109
  directory: z.string().optional(),
1084
- prefix: z.string().optional(),
1085
- accept: z.string().optional()
1110
+ accept: z.string().optional(),
1111
+ encode: ImageEncodeOption.optional()
1086
1112
  });
1087
1113
  var SerializedImageSchema = z.object({
1088
1114
  type: z.literal("image"),
1115
+ render: FieldRender,
1116
+ preview: z.literal(true).optional(),
1089
1117
  options: ImageOptions.optional(),
1090
1118
  opt: z["boolean"](),
1091
1119
  readonly: z["boolean"]().optional(),
@@ -1116,6 +1144,8 @@ var RichTextOptions = z.lazy(function () {
1116
1144
  });
1117
1145
  var SerializedRichTextSchema = z.object({
1118
1146
  type: z.literal("richtext"),
1147
+ render: FieldRender,
1148
+ preview: z.literal(true).optional(),
1119
1149
  options: RichTextOptions.optional(),
1120
1150
  opt: z["boolean"](),
1121
1151
  readonly: z["boolean"]().optional(),
@@ -1124,16 +1154,17 @@ var SerializedRichTextSchema = z.object({
1124
1154
  var SerializedRecordSchema = z.lazy(function () {
1125
1155
  return z.object({
1126
1156
  type: z.literal("record"),
1157
+ render: FieldRender,
1158
+ preview: z.literal(true).optional(),
1127
1159
  item: SerializedSchema,
1128
1160
  opt: z["boolean"](),
1129
- // Only whether a preview EXISTS: the closure itself cannot be serialized.
1130
- preview: z.literal(true).optional(),
1131
1161
  // Optional gallery marker for files/images
1132
1162
  mediaType: z.union([z.literal("files"), z.literal("images")]).optional(),
1133
1163
  // Optional legacy gallery metadata
1134
1164
  accept: z.string().optional(),
1135
1165
  directory: z.string().optional(),
1136
1166
  remote: z["boolean"]().optional(),
1167
+ encode: ImageEncodeOption.optional(),
1137
1168
  alt: SerializedSchema.optional(),
1138
1169
  moduleMetadata: z.record(z.string(), z.record(z.string(), z.any())).optional(),
1139
1170
  readonly: z["boolean"]().optional(),
@@ -1143,6 +1174,8 @@ var SerializedRecordSchema = z.lazy(function () {
1143
1174
  var SerializedKeyOfSchema = z.lazy(function () {
1144
1175
  return z.object({
1145
1176
  type: z.literal("keyOf"),
1177
+ render: FieldRender,
1178
+ preview: z.literal(true).optional(),
1146
1179
  path: SourcePath,
1147
1180
  schema: z.union([z.object({
1148
1181
  type: z.literal("object"),
@@ -1163,6 +1196,8 @@ var FileOptions = z.object({
1163
1196
  });
1164
1197
  var SerializedFileSchema = z.object({
1165
1198
  type: z.literal("file"),
1199
+ render: FieldRender,
1200
+ preview: z.literal(true).optional(),
1166
1201
  options: FileOptions.optional(),
1167
1202
  opt: z["boolean"](),
1168
1203
  readonly: z["boolean"]().optional(),
@@ -1174,6 +1209,8 @@ var DateOptions = z.object({
1174
1209
  });
1175
1210
  var SerializedDateSchema = z.object({
1176
1211
  type: z.literal("date"),
1212
+ render: FieldRender,
1213
+ preview: z.literal(true).optional(),
1177
1214
  options: DateOptions.optional(),
1178
1215
  opt: z["boolean"](),
1179
1216
  customValidate: z["boolean"]().optional(),
@@ -1183,6 +1220,8 @@ var SerializedDateSchema = z.object({
1183
1220
  });
1184
1221
  var SerializedDateTimeSchema = z.object({
1185
1222
  type: z.literal("dateTime"),
1223
+ render: FieldRender,
1224
+ preview: z.literal(true).optional(),
1186
1225
  options: DateOptions.optional(),
1187
1226
  opt: z["boolean"](),
1188
1227
  customValidate: z["boolean"]().optional(),
@@ -1196,6 +1235,8 @@ var ColorOptions = z.object({
1196
1235
  });
1197
1236
  var SerializedColorSchema = z.object({
1198
1237
  type: z.literal("color"),
1238
+ render: FieldRender,
1239
+ preview: z.literal(true).optional(),
1199
1240
  options: ColorOptions.optional(),
1200
1241
  opt: z["boolean"](),
1201
1242
  customValidate: z["boolean"]().optional(),
@@ -1205,6 +1246,8 @@ var SerializedColorSchema = z.object({
1205
1246
  });
1206
1247
  var SerializedRouteSchema = z.object({
1207
1248
  type: z.literal("route"),
1249
+ render: FieldRender,
1250
+ preview: z.literal(true).optional(),
1208
1251
  options: z.object({
1209
1252
  include: z.object({
1210
1253
  source: z.string(),
@@ -3401,4 +3444,4 @@ function withValCanvasParam(url) {
3401
3444
  return "".concat(url).concat(separator).concat(VAL_CANVAS_PARAM, "=1");
3402
3445
  }
3403
3446
 
3404
- export { Api, ColorOptions, DEFAULT_ERROR_MESSAGE, DateOptions, FileOptions, ImageOptions, JSON_ENTRIES_BATCH_MAX, ParentRef$1 as ParentRef, Patch, PatchBlock, PatchId, PatchJSON, RemirrorBr, RemirrorBulletList, RemirrorHeading, RemirrorImage, RemirrorJSON, RemirrorLinkMark, RemirrorListItem, RemirrorOrderedList, RemirrorParagraph, RemirrorText, RemirrorTextMark, RichTextOptions, SerializedArraySchema, SerializedBooleanSchema, SerializedColorSchema, SerializedDateSchema, SerializedDateTimeSchema, SerializedFileSchema, SerializedImageSchema, SerializedKeyOfSchema, SerializedLiteralSchema, SerializedNumberSchema, SerializedObjectSchema, SerializedRecordSchema, SerializedRichTextSchema, SerializedRouteSchema, SerializedSchema, SerializedStringSchema, SerializedUnionSchema, SharedValConfig, VAL_AI_SESSION_STORAGE_KEY, VAL_CANVAS_MESSAGE, VAL_CANVAS_PARAM, VAL_CONFIG_SESSION_STORAGE_KEY, VAL_ENABLE_COOKIE_NAME, VAL_SESSION_COOKIE, VAL_STATE_COOKIE, VAL_THEME_SESSION_STORAGE_KEY, ValCommit, ValDeployment, createRegExpFromPattern, createValClient, filterRoutesByPatterns, findSimilar, getErrorMessageFromUnknownJson, getNextAppRouterSitemapTree, getNextAppRouterSourceFolder, getPatternFromModuleFilePath, getRoutesOf, getRoutesWithModulePaths, isValCanvasFrame, isValCanvasPageMessage, isValCanvasStudioMessage, levenshtein, parseRoutePattern, remirrorToRichTextSource, resolveSchemaSourceFixForError, resolveSchemaSourceFixes, richTextToRemirror, urlOf, validateRoutePatterns, withValCanvasParam };
3447
+ export { Api, ColorOptions, DEFAULT_ERROR_MESSAGE, DateOptions, FileOptions, ImageEncodeOption, ImageOptions, JSON_ENTRIES_BATCH_MAX, ParentRef$1 as ParentRef, Patch, PatchBlock, PatchId, PatchJSON, RemirrorBr, RemirrorBulletList, RemirrorHeading, RemirrorImage, RemirrorJSON, RemirrorLinkMark, RemirrorListItem, RemirrorOrderedList, RemirrorParagraph, RemirrorText, RemirrorTextMark, RichTextOptions, SerializedArraySchema, SerializedBooleanSchema, SerializedColorSchema, SerializedDateSchema, SerializedDateTimeSchema, SerializedFileSchema, SerializedImageSchema, SerializedKeyOfSchema, SerializedLiteralSchema, SerializedNumberSchema, SerializedObjectSchema, SerializedRecordSchema, SerializedRichTextSchema, SerializedRouteSchema, SerializedSchema, SerializedStringSchema, SerializedUnionSchema, SharedValConfig, VAL_AI_SESSION_STORAGE_KEY, VAL_CANVAS_MESSAGE, VAL_CANVAS_PARAM, VAL_CONFIG_SESSION_STORAGE_KEY, VAL_ENABLE_COOKIE_NAME, VAL_SESSION_COOKIE, VAL_STATE_COOKIE, VAL_THEME_SESSION_STORAGE_KEY, ValCommit, ValDeployment, createRegExpFromPattern, createValClient, filterRoutesByPatterns, findSimilar, getErrorMessageFromUnknownJson, getNextAppRouterSitemapTree, getNextAppRouterSourceFolder, getPatternFromModuleFilePath, getRoutesOf, getRoutesWithModulePaths, isValCanvasFrame, isValCanvasPageMessage, isValCanvasStudioMessage, levenshtein, parseRoutePattern, remirrorToRichTextSource, resolveSchemaSourceFixForError, resolveSchemaSourceFixes, richTextToRemirror, urlOf, validateRoutePatterns, withValCanvasParam };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@valbuild/shared",
3
- "version": "0.108.0",
3
+ "version": "0.110.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.106.0"
34
+ "@valbuild/core": "0.110.0"
35
35
  },
36
36
  "files": [
37
37
  "dist",