@sveltia/cms 0.123.0 → 0.124.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -9
- package/dist/sveltia-cms.js +231 -231
- package/dist/sveltia-cms.js.map +1 -1
- package/dist/sveltia-cms.mjs +230 -230
- package/dist/sveltia-cms.mjs.map +1 -1
- package/main.d.ts +15 -14
- package/package.json +1 -1
- package/schema/sveltia-cms.json +1 -1
- package/types/public.d.ts +60 -42
package/types/public.d.ts
CHANGED
|
@@ -118,7 +118,7 @@ export type DefaultMediaLibraryConfig = {
|
|
|
118
118
|
/**
|
|
119
119
|
* Whether to allow multiple file selection in the media library.
|
|
120
120
|
* This option is available for compatibility with the Cloudinary and Uploadcare media libraries,
|
|
121
|
-
* but you can simply use the `multiple` option for the File/Image
|
|
121
|
+
* but you can simply use the `multiple` option for the File/Image field types instead.
|
|
122
122
|
*/
|
|
123
123
|
multiple?: boolean;
|
|
124
124
|
/**
|
|
@@ -258,7 +258,7 @@ export type CommonFieldProps = {
|
|
|
258
258
|
name: string;
|
|
259
259
|
};
|
|
260
260
|
/**
|
|
261
|
-
* Standard field properties for a built-in
|
|
261
|
+
* Standard field properties for a built-in field type.
|
|
262
262
|
*/
|
|
263
263
|
export type StandardFieldProps = {
|
|
264
264
|
/**
|
|
@@ -432,7 +432,7 @@ export type VariableFieldType = {
|
|
|
432
432
|
*/
|
|
433
433
|
label?: string;
|
|
434
434
|
/**
|
|
435
|
-
*
|
|
435
|
+
* Field type. Values other than `object` are ignored.
|
|
436
436
|
*/
|
|
437
437
|
widget?: "object";
|
|
438
438
|
/**
|
|
@@ -494,7 +494,7 @@ export type CharCountProps = {
|
|
|
494
494
|
*/
|
|
495
495
|
export type BooleanFieldProps = {
|
|
496
496
|
/**
|
|
497
|
-
*
|
|
497
|
+
* Field type.
|
|
498
498
|
*/
|
|
499
499
|
widget: "boolean";
|
|
500
500
|
/**
|
|
@@ -511,7 +511,7 @@ export type BooleanField = VisibleFieldProps & BooleanFieldProps & AdjacentLabel
|
|
|
511
511
|
*/
|
|
512
512
|
export type CodeFieldProps = {
|
|
513
513
|
/**
|
|
514
|
-
*
|
|
514
|
+
* Field type.
|
|
515
515
|
*/
|
|
516
516
|
widget: "code";
|
|
517
517
|
/**
|
|
@@ -552,7 +552,7 @@ export type CodeField = VisibleFieldProps & FieldValidationProps & CodeFieldProp
|
|
|
552
552
|
*/
|
|
553
553
|
export type ColorFieldProps = {
|
|
554
554
|
/**
|
|
555
|
-
*
|
|
555
|
+
* Field type.
|
|
556
556
|
*/
|
|
557
557
|
widget: "color";
|
|
558
558
|
/**
|
|
@@ -579,7 +579,7 @@ export type ColorField = VisibleFieldProps & FieldValidationProps & ColorFieldPr
|
|
|
579
579
|
*/
|
|
580
580
|
export type ComputeFieldProps = {
|
|
581
581
|
/**
|
|
582
|
-
*
|
|
582
|
+
* Field type.
|
|
583
583
|
*/
|
|
584
584
|
widget: "compute";
|
|
585
585
|
/**
|
|
@@ -596,7 +596,7 @@ export type ComputeField = VisibleFieldProps & ComputeFieldProps;
|
|
|
596
596
|
*/
|
|
597
597
|
export type DateTimeFieldProps = {
|
|
598
598
|
/**
|
|
599
|
-
*
|
|
599
|
+
* Field type.
|
|
600
600
|
*/
|
|
601
601
|
widget: "datetime";
|
|
602
602
|
/**
|
|
@@ -637,7 +637,7 @@ export type DateTimeField = VisibleFieldProps & FieldValidationProps & DateTimeF
|
|
|
637
637
|
*/
|
|
638
638
|
export type FileFieldProps = {
|
|
639
639
|
/**
|
|
640
|
-
*
|
|
640
|
+
* Field type.
|
|
641
641
|
*/
|
|
642
642
|
widget: "file";
|
|
643
643
|
};
|
|
@@ -650,7 +650,7 @@ export type FileField = VisibleFieldProps & FieldValidationProps & MediaFieldPro
|
|
|
650
650
|
*/
|
|
651
651
|
export type HiddenFieldProps = {
|
|
652
652
|
/**
|
|
653
|
-
*
|
|
653
|
+
* Field type.
|
|
654
654
|
*/
|
|
655
655
|
widget: "hidden";
|
|
656
656
|
/**
|
|
@@ -676,7 +676,7 @@ export type HiddenField = CommonFieldProps & HiddenFieldProps;
|
|
|
676
676
|
*/
|
|
677
677
|
export type ImageFieldProps = {
|
|
678
678
|
/**
|
|
679
|
-
*
|
|
679
|
+
* Field type.
|
|
680
680
|
*/
|
|
681
681
|
widget: "image";
|
|
682
682
|
};
|
|
@@ -689,7 +689,7 @@ export type ImageField = VisibleFieldProps & FieldValidationProps & MediaFieldPr
|
|
|
689
689
|
*/
|
|
690
690
|
export type KeyValueFieldProps = {
|
|
691
691
|
/**
|
|
692
|
-
*
|
|
692
|
+
* Field type.
|
|
693
693
|
*/
|
|
694
694
|
widget: "keyvalue";
|
|
695
695
|
/**
|
|
@@ -714,7 +714,7 @@ export type KeyValueField = VisibleFieldProps & KeyValueFieldProps & MultiValueF
|
|
|
714
714
|
*/
|
|
715
715
|
export type ListFieldProps = {
|
|
716
716
|
/**
|
|
717
|
-
*
|
|
717
|
+
* Field type.
|
|
718
718
|
*/
|
|
719
719
|
widget: "list";
|
|
720
720
|
/**
|
|
@@ -839,7 +839,7 @@ export type ListField = SimpleListField | ListFieldWithSubField | ListFieldWithS
|
|
|
839
839
|
*/
|
|
840
840
|
export type MapFieldProps = {
|
|
841
841
|
/**
|
|
842
|
-
*
|
|
842
|
+
* Field type.
|
|
843
843
|
*/
|
|
844
844
|
widget: "map";
|
|
845
845
|
/**
|
|
@@ -874,13 +874,9 @@ export type RichTextEditorComponentName = "code-block" | "image";
|
|
|
874
874
|
*/
|
|
875
875
|
export type RichTextEditorMode = "rich_text" | "raw";
|
|
876
876
|
/**
|
|
877
|
-
*
|
|
877
|
+
* RichText field base properties.
|
|
878
878
|
*/
|
|
879
|
-
export type
|
|
880
|
-
/**
|
|
881
|
-
* Widget name.
|
|
882
|
-
*/
|
|
883
|
-
widget: "markdown";
|
|
879
|
+
export type RichTextFieldBaseProps = {
|
|
884
880
|
/**
|
|
885
881
|
* Default value.
|
|
886
882
|
*/
|
|
@@ -921,16 +917,38 @@ export type MarkdownFieldProps = {
|
|
|
921
917
|
*/
|
|
922
918
|
linked_images?: boolean;
|
|
923
919
|
};
|
|
920
|
+
/**
|
|
921
|
+
* RichText field properties.
|
|
922
|
+
*/
|
|
923
|
+
export type RichTextFieldProps = {
|
|
924
|
+
/**
|
|
925
|
+
* Field type.
|
|
926
|
+
*/
|
|
927
|
+
widget: "richtext";
|
|
928
|
+
};
|
|
929
|
+
/**
|
|
930
|
+
* RichText field definition.
|
|
931
|
+
*/
|
|
932
|
+
export type RichTextField = VisibleFieldProps & FieldValidationProps & RichTextFieldBaseProps & RichTextFieldProps;
|
|
933
|
+
/**
|
|
934
|
+
* Markdown field properties.
|
|
935
|
+
*/
|
|
936
|
+
export type MarkdownFieldProps = {
|
|
937
|
+
/**
|
|
938
|
+
* Field type.
|
|
939
|
+
*/
|
|
940
|
+
widget: "markdown";
|
|
941
|
+
};
|
|
924
942
|
/**
|
|
925
943
|
* Markdown field definition.
|
|
926
944
|
*/
|
|
927
|
-
export type MarkdownField = VisibleFieldProps & FieldValidationProps & MarkdownFieldProps;
|
|
945
|
+
export type MarkdownField = VisibleFieldProps & FieldValidationProps & RichTextFieldBaseProps & MarkdownFieldProps;
|
|
928
946
|
/**
|
|
929
947
|
* Number field properties.
|
|
930
948
|
*/
|
|
931
949
|
export type NumberFieldProps = {
|
|
932
950
|
/**
|
|
933
|
-
*
|
|
951
|
+
* Field type.
|
|
934
952
|
*/
|
|
935
953
|
widget: "number";
|
|
936
954
|
/**
|
|
@@ -963,7 +981,7 @@ export type NumberField = VisibleFieldProps & FieldValidationProps & NumberField
|
|
|
963
981
|
*/
|
|
964
982
|
export type ObjectFieldProps = {
|
|
965
983
|
/**
|
|
966
|
-
*
|
|
984
|
+
* Field type.
|
|
967
985
|
*/
|
|
968
986
|
widget: "object";
|
|
969
987
|
/**
|
|
@@ -1024,7 +1042,7 @@ export type RelationFieldFilterOptions = {
|
|
|
1024
1042
|
*/
|
|
1025
1043
|
export type RelationFieldProps = {
|
|
1026
1044
|
/**
|
|
1027
|
-
*
|
|
1045
|
+
* Field type.
|
|
1028
1046
|
*/
|
|
1029
1047
|
widget: "relation";
|
|
1030
1048
|
/**
|
|
@@ -1077,7 +1095,7 @@ export type SelectFieldValue = string | number | null;
|
|
|
1077
1095
|
*/
|
|
1078
1096
|
export type SelectFieldProps = {
|
|
1079
1097
|
/**
|
|
1080
|
-
*
|
|
1098
|
+
* Field type.
|
|
1081
1099
|
*/
|
|
1082
1100
|
widget: "select";
|
|
1083
1101
|
/**
|
|
@@ -1102,7 +1120,7 @@ export type SelectField = VisibleFieldProps & FieldValidationProps & SelectField
|
|
|
1102
1120
|
*/
|
|
1103
1121
|
export type StringFieldProps = {
|
|
1104
1122
|
/**
|
|
1105
|
-
*
|
|
1123
|
+
* Field type.
|
|
1106
1124
|
*/
|
|
1107
1125
|
widget?: "string";
|
|
1108
1126
|
/**
|
|
@@ -1132,7 +1150,7 @@ export type StringField = VisibleFieldProps & FieldValidationProps & StringField
|
|
|
1132
1150
|
*/
|
|
1133
1151
|
export type TextFieldProps = {
|
|
1134
1152
|
/**
|
|
1135
|
-
*
|
|
1153
|
+
* Field type.
|
|
1136
1154
|
*/
|
|
1137
1155
|
widget: "text";
|
|
1138
1156
|
/**
|
|
@@ -1149,7 +1167,7 @@ export type TextField = VisibleFieldProps & FieldValidationProps & TextFieldProp
|
|
|
1149
1167
|
*/
|
|
1150
1168
|
export type UuidFieldProps = {
|
|
1151
1169
|
/**
|
|
1152
|
-
*
|
|
1170
|
+
* Field type.
|
|
1153
1171
|
*/
|
|
1154
1172
|
widget: "uuid";
|
|
1155
1173
|
/**
|
|
@@ -1167,7 +1185,7 @@ export type UuidFieldProps = {
|
|
|
1167
1185
|
/**
|
|
1168
1186
|
* Whether to make the field read-only. Default: `true`.
|
|
1169
1187
|
* @deprecated Use the `readonly` common field option instead, which defaults to `true` for the
|
|
1170
|
-
* UUID
|
|
1188
|
+
* UUID field type.
|
|
1171
1189
|
*/
|
|
1172
1190
|
read_only?: boolean;
|
|
1173
1191
|
};
|
|
@@ -1178,9 +1196,9 @@ export type UuidField = VisibleFieldProps & UuidFieldProps;
|
|
|
1178
1196
|
/**
|
|
1179
1197
|
* Visible field types.
|
|
1180
1198
|
*/
|
|
1181
|
-
export type VisibleField = BooleanField | CodeField | ColorField | ComputeField | DateTimeField | FileField | ImageField | KeyValueField | ListField | MapField | MarkdownField | NumberField | ObjectField | RelationField | SelectField | StringField | TextField | UuidField;
|
|
1199
|
+
export type VisibleField = BooleanField | CodeField | ColorField | ComputeField | DateTimeField | FileField | ImageField | KeyValueField | ListField | MapField | MarkdownField | NumberField | ObjectField | RelationField | RichTextField | SelectField | StringField | TextField | UuidField;
|
|
1182
1200
|
/**
|
|
1183
|
-
* Entry field using a built-in
|
|
1201
|
+
* Entry field using a built-in field type.
|
|
1184
1202
|
*/
|
|
1185
1203
|
export type StandardField = VisibleField | HiddenField;
|
|
1186
1204
|
/**
|
|
@@ -1204,21 +1222,21 @@ export type FieldWithSubFields = ListFieldWithSubFields | ObjectFieldWithSubFiel
|
|
|
1204
1222
|
*/
|
|
1205
1223
|
export type FieldWithTypes = ListFieldWithTypes | ObjectFieldWithTypes;
|
|
1206
1224
|
/**
|
|
1207
|
-
*
|
|
1208
|
-
* well as some new
|
|
1225
|
+
* Built-in field type name. Sveltia CMS supports all the built-in field types provided by Decap CMS
|
|
1226
|
+
* as well as some new field types.
|
|
1209
1227
|
*/
|
|
1210
|
-
export type
|
|
1228
|
+
export type BuiltInFieldType = "boolean" | "code" | "color" | "compute" | "datetime" | "file" | "hidden" | "image" | "keyvalue" | "list" | "map" | "markdown" | "number" | "object" | "relation" | "richtext" | "select" | "string" | "text" | "uuid";
|
|
1211
1229
|
/**
|
|
1212
1230
|
* Custom field properties.
|
|
1213
1231
|
*/
|
|
1214
1232
|
export type CustomFieldProps = {
|
|
1215
1233
|
/**
|
|
1216
|
-
*
|
|
1234
|
+
* Field type.
|
|
1217
1235
|
*/
|
|
1218
|
-
widget: Exclude<string,
|
|
1236
|
+
widget: Exclude<string, BuiltInFieldType | "">;
|
|
1219
1237
|
};
|
|
1220
1238
|
/**
|
|
1221
|
-
* Entry field using a custom
|
|
1239
|
+
* Entry field using a custom field type.
|
|
1222
1240
|
*/
|
|
1223
1241
|
export type CustomField = CommonFieldProps & CustomFieldProps & Record<string, any>;
|
|
1224
1242
|
/**
|
|
@@ -1511,7 +1529,7 @@ export type NestedCollectionOptions = {
|
|
|
1511
1529
|
*/
|
|
1512
1530
|
export type CollectionMetaDataPath = {
|
|
1513
1531
|
/**
|
|
1514
|
-
*
|
|
1532
|
+
* Field type for editing the path name.
|
|
1515
1533
|
*/
|
|
1516
1534
|
widget?: "string";
|
|
1517
1535
|
/**
|
|
@@ -2262,7 +2280,7 @@ export type FileParser = (text: string) => any | Promise<any>;
|
|
|
2262
2280
|
*/
|
|
2263
2281
|
export type FileFormatter = (value: any) => string | Promise<string>;
|
|
2264
2282
|
/**
|
|
2265
|
-
* Custom editor component options.
|
|
2283
|
+
* Custom rich text editor component options.
|
|
2266
2284
|
*/
|
|
2267
2285
|
export type EditorComponentDefinition = {
|
|
2268
2286
|
/**
|
|
@@ -2457,14 +2475,14 @@ export type CustomPreviewTemplateProps = {
|
|
|
2457
2475
|
document: Document;
|
|
2458
2476
|
window: Window;
|
|
2459
2477
|
};
|
|
2460
|
-
export type
|
|
2478
|
+
export type CustomFieldControlProps = {
|
|
2461
2479
|
value: any;
|
|
2462
2480
|
field: Record<string, any>;
|
|
2463
2481
|
forID: string;
|
|
2464
2482
|
classNameWrapper: string;
|
|
2465
2483
|
onChange: (value: any) => void;
|
|
2466
2484
|
};
|
|
2467
|
-
export type
|
|
2485
|
+
export type CustomFieldPreviewProps = {
|
|
2468
2486
|
value: any;
|
|
2469
2487
|
field: Record<string, any>;
|
|
2470
2488
|
metadata: Record<string, any>;
|
|
@@ -2472,7 +2490,7 @@ export type CustomWidgetPreviewProps = {
|
|
|
2472
2490
|
getAsset: (name: string) => any;
|
|
2473
2491
|
fieldsMetaData: Record<string, any>;
|
|
2474
2492
|
};
|
|
2475
|
-
export type
|
|
2493
|
+
export type CustomFieldSchema = {
|
|
2476
2494
|
properties: Record<string, any>;
|
|
2477
2495
|
};
|
|
2478
2496
|
import type { JSX } from 'react';
|