@sveltia/cms 0.63.0 → 0.63.1

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.
@@ -0,0 +1,1625 @@
1
+ /**
2
+ * Standard IETF locale tag like `en` or `en-US`.
3
+ */
4
+ export type LocaleCode = string;
5
+ /**
6
+ * An entry field name. It can be written in dot notation like `author.name` if the field is nested
7
+ * with an Object field. For a List subfield, a wildcard can be used like `authors.*.name`. We
8
+ * call this a key path, which is derived from the IndexedDB API terminology, and use it everywhere,
9
+ * as entry data is managed as a flatten object for easier access.
10
+ */
11
+ export type FieldKeyPath = string;
12
+ /**
13
+ * Supported media library name.
14
+ */
15
+ export type MediaLibraryName = "default" | "cloudinary" | "uploadcare";
16
+ /**
17
+ * Configuration for the built-in media library.
18
+ */
19
+ export type DefaultMediaLibraryOptions = {
20
+ /**
21
+ * Maximum file size in bytes that can be accepted for uploading.
22
+ */
23
+ max_file_size?: number;
24
+ };
25
+ /**
26
+ * Options for the built-in media library.
27
+ */
28
+ export type DefaultMediaLibrary = {
29
+ /**
30
+ * Configuration for the built-in media library.
31
+ */
32
+ config?: DefaultMediaLibraryOptions;
33
+ };
34
+ /**
35
+ * Options for the Cloudinary media library.
36
+ */
37
+ export type CloudinaryMediaLibrary = {
38
+ /**
39
+ * Whether to output a file name instead of a full URL.
40
+ * Default: `false`.
41
+ */
42
+ output_filename_only?: boolean;
43
+ /**
44
+ * Whether to include transformation segments in an output
45
+ * URL. Default: `true`.
46
+ */
47
+ use_transformations?: boolean;
48
+ /**
49
+ * Whether to use an HTTP URL. Default: `true`.
50
+ */
51
+ use_secure_url?: boolean;
52
+ /**
53
+ * Options to be passed to Uploadcare, such as `multiple`.
54
+ * The `cloud_name` and `api_key` options are required for the global `media_library` option. See
55
+ * https://cloudinary.com/documentation/media_library_widget#2_set_the_configuration_options for a
56
+ * full list of available options.
57
+ */
58
+ config?: Record<string, any>;
59
+ };
60
+ /**
61
+ * Settings for the Uploadcare media library.
62
+ */
63
+ export type UploadcareMediaLibrarySettings = {
64
+ /**
65
+ * Whether to append a file name to an output URL. Default:
66
+ * `false`.
67
+ */
68
+ autoFilename?: boolean;
69
+ /**
70
+ * Transformation operations to be included in an output URL.
71
+ * Default: empty string.
72
+ */
73
+ defaultOperations?: string;
74
+ };
75
+ /**
76
+ * Options for the Uploadcare media library.
77
+ */
78
+ export type UploadcareMediaLibrary = {
79
+ /**
80
+ * Options to be passed to Uploadcare, such as `multiple`.
81
+ * The `publicKey` option is required for the global `media_library` option. See
82
+ * https://uploadcare.com/docs/uploads/file-uploader-options/ for a full list of available options.
83
+ */
84
+ config?: Record<string, any>;
85
+ /**
86
+ * Integration settings.
87
+ */
88
+ settings?: UploadcareMediaLibrarySettings;
89
+ };
90
+ /**
91
+ * Supported media library.
92
+ */
93
+ export type MediaLibrary = DefaultMediaLibrary | CloudinaryMediaLibrary | UploadcareMediaLibrary;
94
+ /**
95
+ * Common field properties.
96
+ */
97
+ export type CommonFieldProps = {
98
+ /**
99
+ * Unique identifier for the field. It cannot include periods and spaces.
100
+ */
101
+ name: string;
102
+ /**
103
+ * Label of the field to be displayed in the editor UI. Default: `name`
104
+ * field value.
105
+ */
106
+ label?: string;
107
+ /**
108
+ * Short description of the field to be displayed in the editor UI.
109
+ */
110
+ comment?: string;
111
+ /**
112
+ * Name of a widget that defines the input UI and data type. Default:
113
+ * `string`.
114
+ */
115
+ widget?: string;
116
+ /**
117
+ * Whether to make data input on the field required.
118
+ * Default: `true`. This option also affects data output if the `omit_empty_optional_fields` global
119
+ * output option is `true`. If i18n is enabled and the field doesn’t require input in all locales,
120
+ * required locale codes can be passed as an array like `[en, fr]` instead of a boolean.
121
+ */
122
+ required?: boolean | LocaleCode[];
123
+ /**
124
+ * Validation format. The first argument is a regular
125
+ * expression pattern for a valid input value, and the second argument is an error message. This
126
+ * option has no effect on a List or Object field with subfields.
127
+ */
128
+ pattern?: [string, string];
129
+ /**
130
+ * Help message to be displayed below the input UI. Limited Markdown
131
+ * formatting is supported: bold, italic, strikethrough and links.
132
+ */
133
+ hint?: string;
134
+ /**
135
+ * Whether to show the preview of the field. Default: `true`.
136
+ */
137
+ preview?: boolean;
138
+ /**
139
+ * Whether to enable the editor UI
140
+ * in locales other than the default locale. Default: `false`. `duplicate` disables the UI in
141
+ * non-default like `false` but automatically copies the default locale’s value to other locales.
142
+ * `translate` and `none` are aliases of `true` and `false`, respectively. This option only works
143
+ * when i18n is set up with the global and collection-level `i18n` option.
144
+ */
145
+ i18n?: boolean | "duplicate" | "translate" | "none";
146
+ };
147
+ /**
148
+ * Field-level media library options.
149
+ */
150
+ export type FieldMediaLibraryOptions = {
151
+ /**
152
+ * Library name.
153
+ */
154
+ name?: MediaLibraryName;
155
+ };
156
+ /**
157
+ * Media field properties.
158
+ */
159
+ export type MediaFieldProps = {
160
+ /**
161
+ * Default value. A file path or complete URL.
162
+ */
163
+ default?: string;
164
+ /**
165
+ * Whether to show the URL input UI. Default: `true`.
166
+ */
167
+ choose_url?: boolean;
168
+ /**
169
+ * Internal media folder path for the field. Default: global or
170
+ * collection-level `media_folder` value.
171
+ */
172
+ media_folder?: string;
173
+ /**
174
+ * Public media folder path for the field. Default:
175
+ * `media_folder` option value.
176
+ */
177
+ public_folder?: string;
178
+ /**
179
+ * Media library options for the
180
+ * field. Default: global `media_library` value.
181
+ */
182
+ media_library?: MediaLibrary & FieldMediaLibraryOptions;
183
+ /**
184
+ * Whether to enable multiple item selection in an external
185
+ * media library. Default: `true`.
186
+ */
187
+ allow_multiple?: boolean;
188
+ };
189
+ /**
190
+ * Options for a field accepting multiple values.
191
+ */
192
+ export type MultiValueFieldProps = {
193
+ /**
194
+ * Minimum number of items that can be added. Default: 0.
195
+ */
196
+ min?: number;
197
+ /**
198
+ * Maximum number of items that can be added. Default: infinity.
199
+ */
200
+ max?: number;
201
+ };
202
+ /**
203
+ * Options for a field showing multiple options.
204
+ */
205
+ export type MultiOptionFieldProps = {
206
+ /**
207
+ * Whether to accept multiple values. Default: `false`.
208
+ */
209
+ multiple?: boolean;
210
+ /**
211
+ * Minimum number of items that can be selected. Default: 0. Ignored if
212
+ * `multiple` is `false`.
213
+ */
214
+ min?: number;
215
+ /**
216
+ * Maximum number of items that can be selected. Default: infinity. Ignored
217
+ * if `multiple` is `false`.
218
+ */
219
+ max?: number;
220
+ /**
221
+ * Maximum number of options to be displayed as radio
222
+ * buttons (single-select) or checkboxes (multi-select) rather than a dropdown list. Default: 5.
223
+ */
224
+ dropdown_threshold?: number;
225
+ };
226
+ /**
227
+ * Variable type for List/Object fields.
228
+ */
229
+ export type VariableFieldType = {
230
+ /**
231
+ * Unique identifier for the type.
232
+ */
233
+ name: string;
234
+ /**
235
+ * Label of the type to be displayed in the editor UI. Default: `name`
236
+ * field value.
237
+ */
238
+ label?: string;
239
+ /**
240
+ * Widget name. Values other than `object` are ignored.
241
+ */
242
+ widget?: "object";
243
+ /**
244
+ * Template of a label to be displayed on a collapsed object.
245
+ */
246
+ summary?: string;
247
+ /**
248
+ * Set of subfields. This option can be omitted; in that case, only
249
+ * the `type` property will be saved.
250
+ */
251
+ fields?: Field[];
252
+ };
253
+ /**
254
+ * Variable field properties.
255
+ */
256
+ export type VariableFieldProps = {
257
+ /**
258
+ * Set of nested Object widgets to be selected or added.
259
+ */
260
+ types?: VariableFieldType[];
261
+ /**
262
+ * Property name to store the type name in nested objects. Default:
263
+ * `type`.
264
+ */
265
+ typeKey?: string;
266
+ };
267
+ /**
268
+ * Options for a field with a simple input UI that allows for extra labels.
269
+ */
270
+ export type AdjacentLabelProps = {
271
+ /**
272
+ * An extra label to be displayed before the input UI. Markdown is
273
+ * supported. Default: empty string.
274
+ */
275
+ before_input?: string;
276
+ /**
277
+ * An extra label to be displayed after the input UI. Markdown is
278
+ * supported. Default: empty string.
279
+ */
280
+ after_input?: string;
281
+ };
282
+ /**
283
+ * Options for a field with a string-type input UI that counts the number of characters.
284
+ */
285
+ export type CharCountProps = {
286
+ /**
287
+ * Minimum number of characters that can be entered in the input.
288
+ * Default: 0.
289
+ */
290
+ minlength?: number;
291
+ /**
292
+ * Maximum number of characters that can be entered in the input.
293
+ * Default: infinity.
294
+ */
295
+ maxlength?: number;
296
+ };
297
+ /**
298
+ * Boolean field properties.
299
+ */
300
+ export type BooleanFieldProps = {
301
+ /**
302
+ * Widget name.
303
+ */
304
+ widget: "boolean";
305
+ /**
306
+ * Default value.
307
+ */
308
+ default?: boolean;
309
+ };
310
+ /**
311
+ * Boolean field definition.
312
+ */
313
+ export type BooleanField = CommonFieldProps & BooleanFieldProps & AdjacentLabelProps;
314
+ /**
315
+ * Code field properties.
316
+ */
317
+ export type CodeFieldProps = {
318
+ /**
319
+ * Widget name.
320
+ */
321
+ widget: "code";
322
+ /**
323
+ * Default value. It must be a string if
324
+ * `output_code_only` is `false`. Otherwise it must be an object that match the `keys` option.
325
+ */
326
+ default?: string | Record<string, string>;
327
+ /**
328
+ * Default language to be selected, like `js`. See
329
+ * https://prismjs.com/#supported-languages for a list of supported languages.
330
+ */
331
+ default_language?: string;
332
+ /**
333
+ * Whether to show a language switcher so that users
334
+ * can change the language mode. Default: `true` (the Decap CMS document is wrong).
335
+ */
336
+ allow_language_selection?: boolean;
337
+ /**
338
+ * Whether to output code snippet only. Default: `false`.
339
+ */
340
+ output_code_only?: boolean;
341
+ /**
342
+ * Output property names. It has no effect if
343
+ * `output_code_only` is `true`.
344
+ */
345
+ keys?: {
346
+ code: string;
347
+ lang: string;
348
+ };
349
+ };
350
+ /**
351
+ * Code field definition.
352
+ */
353
+ export type CodeField = CommonFieldProps & CodeFieldProps;
354
+ /**
355
+ * Color field properties.
356
+ */
357
+ export type ColorFieldProps = {
358
+ /**
359
+ * Widget name.
360
+ */
361
+ widget: "color";
362
+ /**
363
+ * Default value. Accepts a Hex color code.
364
+ */
365
+ default?: string;
366
+ /**
367
+ * Whether to show a textbox that allows users to manually edit the
368
+ * value. Default: `false`.
369
+ */
370
+ allowInput?: boolean;
371
+ /**
372
+ * Whether to edit/save the alpha channel value.
373
+ */
374
+ enableAlpha?: boolean;
375
+ };
376
+ /**
377
+ * Color field definition.
378
+ */
379
+ export type ColorField = CommonFieldProps & ColorFieldProps;
380
+ /**
381
+ * Compute field properties.
382
+ */
383
+ export type ComputeFieldProps = {
384
+ /**
385
+ * Widget name.
386
+ */
387
+ widget: "compute";
388
+ /**
389
+ * Value template, like `posts-{{fields.slug}}`.
390
+ */
391
+ value: string;
392
+ };
393
+ /**
394
+ * Compute field definition.
395
+ */
396
+ export type ComputeField = CommonFieldProps & ComputeFieldProps;
397
+ /**
398
+ * DateTime field properties.
399
+ */
400
+ export type DateTimeFieldProps = {
401
+ /**
402
+ * Widget name.
403
+ */
404
+ widget: "datetime";
405
+ /**
406
+ * Default value. Accepts a date/time string that matches the `format`,
407
+ * or `{{now}}` to populate the current date/time. Default: empty string.
408
+ */
409
+ default?: string;
410
+ /**
411
+ * Storage format written in Moment.js tokens. See
412
+ * https://momentjs.com/docs/#/displaying/format/ for supported tokens. Default: ISO 8601 format.
413
+ */
414
+ format?: string;
415
+ /**
416
+ * Date storage format written in Moment.js tokens if the
417
+ * value is a string and the `format` option is not defined. If `true`, ISO 8601 format is used
418
+ * unless the `format` option is defined. If `false`, date input/output is disabled.
419
+ */
420
+ date_format?: string | boolean;
421
+ /**
422
+ * Time storage format written in Moment.js tokens if the
423
+ * value is a string and the `format` option is not defined. If `true`, ISO 8601 format is used
424
+ * unless the `format` option is defined. If `false`, time input/output is disabled.
425
+ */
426
+ time_format?: string | boolean;
427
+ /**
428
+ * Whether to make the date input/output UTC. Default: `false`.
429
+ */
430
+ picker_utc?: boolean;
431
+ };
432
+ /**
433
+ * DateTime field definition.
434
+ */
435
+ export type DateTimeField = CommonFieldProps & DateTimeFieldProps;
436
+ /**
437
+ * File field properties.
438
+ */
439
+ export type FileFieldProps = {
440
+ /**
441
+ * Widget name.
442
+ */
443
+ widget: "file";
444
+ };
445
+ /**
446
+ * File field definition.
447
+ */
448
+ export type FileField = CommonFieldProps & MediaFieldProps & FileFieldProps;
449
+ /**
450
+ * Hidden field properties.
451
+ */
452
+ export type HiddenFieldProps = {
453
+ /**
454
+ * Widget name.
455
+ */
456
+ widget: "hidden";
457
+ /**
458
+ * Default value. Accepts any data type that can be stored with the
459
+ * configured file format.
460
+ */
461
+ default?: any;
462
+ };
463
+ /**
464
+ * Hidden field definition.
465
+ */
466
+ export type HiddenField = CommonFieldProps & HiddenFieldProps;
467
+ /**
468
+ * Image field properties.
469
+ */
470
+ export type ImageFieldProps = {
471
+ /**
472
+ * Widget name.
473
+ */
474
+ widget: "image";
475
+ };
476
+ /**
477
+ * Image field definition.
478
+ */
479
+ export type ImageField = CommonFieldProps & MediaFieldProps & ImageFieldProps;
480
+ /**
481
+ * KeyValue field properties.
482
+ */
483
+ export type KeyValueFieldProps = {
484
+ /**
485
+ * Widget name.
486
+ */
487
+ widget: "keyvalue";
488
+ /**
489
+ * Default key-value pairs.
490
+ */
491
+ default?: Record<string, string>;
492
+ /**
493
+ * Label for the key column. Default: Key.
494
+ */
495
+ key_label?: string;
496
+ /**
497
+ * Label for the value column. Default: Value.
498
+ */
499
+ value_label?: string;
500
+ };
501
+ /**
502
+ * KeyValue field definition.
503
+ */
504
+ export type KeyValueField = CommonFieldProps & KeyValueFieldProps & MultiValueFieldProps;
505
+ /**
506
+ * List field properties.
507
+ */
508
+ export type ListFieldProps = {
509
+ /**
510
+ * Widget name.
511
+ */
512
+ widget: "list";
513
+ /**
514
+ * Default value.
515
+ */
516
+ default?: string[] | Record<string, any>[] | Record<string, any>;
517
+ /**
518
+ * Whether to allow users to add new values. Default: `true`.
519
+ */
520
+ allow_add?: boolean;
521
+ /**
522
+ * Whether to add new items to the top of the list instead of the
523
+ * bottom. Default: `false`.
524
+ */
525
+ add_to_top?: boolean;
526
+ /**
527
+ * Label to be displayed on the Add button. Default: `label`
528
+ * field value.
529
+ */
530
+ label_singular?: string;
531
+ /**
532
+ * Template of a label to be displayed on a collapsed list item.
533
+ */
534
+ summary?: string;
535
+ /**
536
+ * Whether to collapse the UI by default. Default: `false`.
537
+ */
538
+ collapsed?: boolean;
539
+ /**
540
+ * Whether to collapse the entire UI. Default: `false`.
541
+ */
542
+ minimize_collapsed?: boolean;
543
+ /**
544
+ * Single field to be included in a list item.
545
+ */
546
+ field?: Field;
547
+ /**
548
+ * Set of fields to be included in a list item.
549
+ */
550
+ fields?: Field[];
551
+ /**
552
+ * Whether to save the field value at the top-level of the data file
553
+ * without the field name. If the `single_file` i18n structure is enabled, the lists will still be
554
+ * saved under locale keys. Default: `false`. See
555
+ * https://github.com/sveltia/sveltia-cms#editing-data-files-with-a-top-level-list for details.
556
+ */
557
+ root?: boolean;
558
+ };
559
+ /**
560
+ * List field definition.
561
+ */
562
+ export type ListField = CommonFieldProps & ListFieldProps & MultiValueFieldProps & VariableFieldProps;
563
+ /**
564
+ * Map field properties.
565
+ */
566
+ export type MapFieldProps = {
567
+ /**
568
+ * Widget name.
569
+ */
570
+ widget: "map";
571
+ /**
572
+ * Default value. Accepts a stringified single GeoJSON geometry object.
573
+ */
574
+ default?: string;
575
+ /**
576
+ * Precision of coordinates to be saved. Default: 7.
577
+ */
578
+ decimals?: number;
579
+ /**
580
+ * Geometry type. Default: Point.
581
+ */
582
+ type?: "Point" | "LineString" | "Polygon";
583
+ };
584
+ /**
585
+ * Map field definition.
586
+ */
587
+ export type MapField = CommonFieldProps & MapFieldProps;
588
+ /**
589
+ * Supported button name for the rich text editor.
590
+ */
591
+ export type RichTextEditorButtonName = "bold" | "italic" | "code" | "link" | "heading-one" | "heading-two" | "heading-three" | "heading-four" | "heading-five" | "heading-six" | "quote" | "bulleted-list" | "numbered-list";
592
+ /**
593
+ * Built-in editor component name for the rich text editor.
594
+ */
595
+ export type RichTextEditorComponentName = "code-block" | "image";
596
+ /**
597
+ * Supported mode name for the rich text editor.
598
+ */
599
+ export type RichTextEditorMode = "rich_text" | "raw";
600
+ /**
601
+ * Markdown field properties.
602
+ */
603
+ export type MarkdownFieldProps = {
604
+ /**
605
+ * Widget name.
606
+ */
607
+ widget: "markdown";
608
+ /**
609
+ * Default value.
610
+ */
611
+ default?: string;
612
+ /**
613
+ * Whether to minimize the toolbar height.
614
+ */
615
+ minimal?: boolean;
616
+ /**
617
+ * Names of formatting buttons and menu items to be
618
+ * enabled in the editor UI. Default: all the supported button names.
619
+ */
620
+ buttons?: RichTextEditorButtonName[];
621
+ /**
622
+ * Names of components to
623
+ * be enabled in the editor UI. This may include custom component names. Default: all the built-in
624
+ * component names.
625
+ */
626
+ editor_components?: (RichTextEditorComponentName | string)[];
627
+ /**
628
+ * Editor modes to be enabled. If it’s `[raw, rich_text]`,
629
+ * rich text mode is disabled by default. Default: `[rich_text, raw]`.
630
+ */
631
+ modes?: RichTextEditorMode[];
632
+ /**
633
+ * Whether to sanitize the preview HTML. Default: `false`.
634
+ */
635
+ sanitize_preview?: boolean;
636
+ };
637
+ /**
638
+ * Markdown field definition.
639
+ */
640
+ export type MarkdownField = CommonFieldProps & MarkdownFieldProps;
641
+ /**
642
+ * Number field properties.
643
+ */
644
+ export type NumberFieldProps = {
645
+ /**
646
+ * Widget name.
647
+ */
648
+ widget: "number";
649
+ /**
650
+ * Default value.
651
+ */
652
+ default?: number | string;
653
+ /**
654
+ * Type of value to be saved. Default: `int`.
655
+ */
656
+ value_type?: "int" | "float" | string;
657
+ /**
658
+ * Minimum value that can be entered in the input. Default: undefined.
659
+ */
660
+ min?: number;
661
+ /**
662
+ * Maximum value that can be entered in the input. Default: undefined.
663
+ */
664
+ max?: number;
665
+ /**
666
+ * Number to increase/decrease with the arrow key/button. Default: 1.
667
+ */
668
+ step?: number;
669
+ };
670
+ /**
671
+ * Number field definition.
672
+ */
673
+ export type NumberField = CommonFieldProps & NumberFieldProps & AdjacentLabelProps;
674
+ /**
675
+ * Object field properties.
676
+ */
677
+ export type ObjectFieldProps = {
678
+ /**
679
+ * Widget name.
680
+ */
681
+ widget: "object";
682
+ /**
683
+ * Default values.
684
+ */
685
+ default?: Record<string, any>;
686
+ /**
687
+ * Whether to collapse the UI by default. Default: `false`.
688
+ */
689
+ collapsed?: boolean;
690
+ /**
691
+ * Template of a label to be displayed on a collapsed object.
692
+ */
693
+ summary?: string;
694
+ /**
695
+ * Set of fields to be included.
696
+ */
697
+ fields: Field[];
698
+ };
699
+ /**
700
+ * Object field definition.
701
+ */
702
+ export type ObjectField = CommonFieldProps & ObjectFieldProps & VariableFieldProps;
703
+ /**
704
+ * Entry filter options for a Relation field.
705
+ */
706
+ export type RelationFieldFilterOptions = {
707
+ /**
708
+ * Field name.
709
+ */
710
+ field: FieldKeyPath;
711
+ /**
712
+ * One or more values to be matched.
713
+ */
714
+ values: any[];
715
+ };
716
+ /**
717
+ * Relation field properties.
718
+ */
719
+ export type RelationFieldProps = {
720
+ /**
721
+ * Widget name.
722
+ */
723
+ widget: "relation";
724
+ /**
725
+ * Default value.
726
+ */
727
+ default?: any;
728
+ /**
729
+ * Referenced collection name.
730
+ */
731
+ collection: string;
732
+ /**
733
+ * Referenced file identifier for a file collection. Required if the
734
+ * `collection` is a file collection.
735
+ */
736
+ file?: string;
737
+ /**
738
+ * Field name to be stored as the value, or
739
+ * `{{slug}}`. It can contain a locale prefix like `{{locale}}/{{slug}}` if i18n is enabled.
740
+ */
741
+ value_field: FieldKeyPath | string;
742
+ /**
743
+ * Name of fields to be displayed. It can
744
+ * contain string templates. Default: `value_field` field value.
745
+ */
746
+ display_fields?: (FieldKeyPath | string)[];
747
+ /**
748
+ * Name of fields to be searched. Default:
749
+ * `display_fields` field value.
750
+ */
751
+ search_fields?: FieldKeyPath[];
752
+ /**
753
+ * Entry filter options.
754
+ */
755
+ filters?: RelationFieldFilterOptions[];
756
+ };
757
+ /**
758
+ * Relation field definition.
759
+ */
760
+ export type RelationField = CommonFieldProps & RelationFieldProps & MultiOptionFieldProps;
761
+ /**
762
+ * Select field properties.
763
+ */
764
+ export type SelectFieldProps = {
765
+ /**
766
+ * Widget name.
767
+ */
768
+ widget: "select";
769
+ /**
770
+ * Default values, which should math the options.
771
+ */
772
+ default?: string[];
773
+ /**
774
+ * Options.
775
+ */
776
+ options: string[] | {
777
+ label: string;
778
+ value: string;
779
+ }[];
780
+ };
781
+ /**
782
+ * Select field definition.
783
+ */
784
+ export type SelectField = CommonFieldProps & SelectFieldProps & MultiOptionFieldProps;
785
+ /**
786
+ * String field properties.
787
+ */
788
+ export type StringFieldProps = {
789
+ /**
790
+ * Widget name.
791
+ */
792
+ widget: "string";
793
+ /**
794
+ * Default value.
795
+ */
796
+ default?: string;
797
+ /**
798
+ * Input type. Default: text.
799
+ */
800
+ type?: "email" | "url" | "text";
801
+ /**
802
+ * A string to be prepended to the value. Default: empty string.
803
+ */
804
+ prefix?: string;
805
+ /**
806
+ * A string to be appended to the value. Default: empty string.
807
+ */
808
+ suffix?: string;
809
+ };
810
+ /**
811
+ * String field definition.
812
+ */
813
+ export type StringField = CommonFieldProps & StringFieldProps & AdjacentLabelProps & CharCountProps;
814
+ /**
815
+ * Text field properties.
816
+ */
817
+ export type TextFieldProps = {
818
+ /**
819
+ * Widget name.
820
+ */
821
+ widget: "text";
822
+ /**
823
+ * Default value.
824
+ */
825
+ default?: string;
826
+ };
827
+ /**
828
+ * Text field definition.
829
+ */
830
+ export type TextField = CommonFieldProps & TextFieldProps & CharCountProps;
831
+ /**
832
+ * UUID field properties.
833
+ */
834
+ export type UuidFieldProps = {
835
+ /**
836
+ * Widget name.
837
+ */
838
+ widget: "uuid";
839
+ /**
840
+ * A string to be prepended to the value. Default: empty string.
841
+ */
842
+ prefix?: string;
843
+ /**
844
+ * Whether to encode the value with Base32. Default: `false`.
845
+ */
846
+ use_b32_encoding?: boolean;
847
+ /**
848
+ * Whether to make the field read-only. Default: `true`.
849
+ */
850
+ read_only?: boolean;
851
+ };
852
+ /**
853
+ * UUID field definition.
854
+ */
855
+ export type UuidField = CommonFieldProps & UuidFieldProps;
856
+ /**
857
+ * Custom field definition. It can contain any properties.
858
+ */
859
+ export type CustomField = CommonFieldProps & Record<string, any>;
860
+ /**
861
+ * Entry field.
862
+ */
863
+ export type Field = BooleanField | CodeField | ColorField | ComputeField | DateTimeField | FileField | HiddenField | ImageField | KeyValueField | ListField | MapField | MarkdownField | NumberField | ObjectField | RelationField | SelectField | StringField | TextField | UuidField | CustomField;
864
+ /**
865
+ * Internationalization (i18n) file structure type.
866
+ */
867
+ export type I18nFileStructure = "single_file" | "multiple_files" | "multiple_folders" | "multiple_folders_i18n_root";
868
+ /**
869
+ * Global, collection-level or collection file-level i18n options.
870
+ */
871
+ export type I18nOptions = {
872
+ /**
873
+ * File structure for entry collections. File collections
874
+ * must define the structure using `{{locale}}` in the `file` option.
875
+ */
876
+ structure: I18nFileStructure;
877
+ /**
878
+ * List of all available locales.
879
+ */
880
+ locales: LocaleCode[];
881
+ /**
882
+ * Default locale. Default: first locale in the `locales`
883
+ * option.
884
+ */
885
+ default_locale?: LocaleCode;
886
+ /**
887
+ * Locales to be enabled when
888
+ * creating a new entry draft. If this option is used, users will be able to disable the output of
889
+ * non-default locales through the UI. See
890
+ * https://github.com/sveltia/sveltia-cms#disabling-non-default-locale-content for details.
891
+ */
892
+ initial_locales?: LocaleCode[] | "all" | "default";
893
+ /**
894
+ * Whether to save collection entries in all the locales. If
895
+ * `false`, users will be able to disable the output of non-default locales through the UI. See
896
+ * https://github.com/sveltia/sveltia-cms#disabling-non-default-locale-content for details.
897
+ */
898
+ save_all_locales?: boolean;
899
+ /**
900
+ * Property name and value template used
901
+ * to add a canonical slug to entry files, which helps Sveltia CMS and some frameworks to link
902
+ * localized files when entry slugs are localized. The default property name is `translationKey`
903
+ * used in Hugo’s multilingual support, and the default value is the default locale’s slug. See
904
+ * https://github.com/sveltia/sveltia-cms#localizing-entry-slugs for details.
905
+ */
906
+ canonical_slug?: {
907
+ key: string;
908
+ value: string;
909
+ };
910
+ };
911
+ /**
912
+ * Single file in a file collection.
913
+ */
914
+ export type CollectionFile = {
915
+ /**
916
+ * Unique identifier for the file.
917
+ */
918
+ name: string;
919
+ /**
920
+ * Label to be displayed in the editor UI. Default: `name` option value.
921
+ */
922
+ label?: string;
923
+ /**
924
+ * File path relative to the project root.
925
+ */
926
+ file: string;
927
+ /**
928
+ * Set of fields to be included in the file.
929
+ */
930
+ fields: Field[];
931
+ /**
932
+ * I18n options. Default: `false`.
933
+ */
934
+ i18n?: I18nOptions | boolean;
935
+ /**
936
+ * Preview URL path template.
937
+ */
938
+ preview_path?: string;
939
+ /**
940
+ * Date field name used for `preview_path`.
941
+ */
942
+ preview_path_date_field?: FieldKeyPath;
943
+ };
944
+ /**
945
+ * Supported file extension.
946
+ */
947
+ export type FileExtension = "yml" | "yaml" | "toml" | "json" | "md" | "markdown" | "html" | string;
948
+ /**
949
+ * Supported Markdown front matter format.
950
+ */
951
+ export type FrontMatterFormat = "yaml-frontmatter" | "toml-frontmatter" | "json-frontmatter";
952
+ /**
953
+ * Supported file format.
954
+ */
955
+ export type FileFormat = "yml" | "yaml" | "toml" | "json" | "frontmatter" | FrontMatterFormat;
956
+ /**
957
+ * Collection filter options.
958
+ */
959
+ export type CollectionFilter = {
960
+ /**
961
+ * Field name.
962
+ */
963
+ field: FieldKeyPath;
964
+ /**
965
+ * Field value. `null` can be used to match an undefined field.
966
+ * Multiple values can be defined with an array. This option or `pattern` is required.
967
+ */
968
+ value?: any | any[];
969
+ /**
970
+ * Regex matching pattern.
971
+ */
972
+ pattern?: string;
973
+ };
974
+ /**
975
+ * The default options for the sortable fields.
976
+ */
977
+ export type SortableFieldsDefaultOptions = {
978
+ /**
979
+ * A field name to be sorted by default.
980
+ */
981
+ field: FieldKeyPath;
982
+ /**
983
+ * Default
984
+ * sort direction. Title case values are supported for Static CMS compatibility. However, `None` is
985
+ * the same as `ascending`. Default: `ascending`.
986
+ */
987
+ direction?: "ascending" | "descending" | "Ascending" | "Descending" | "None";
988
+ };
989
+ /**
990
+ * A collection’s advanced sortable fields definition, which is compatible with Static CMS.
991
+ */
992
+ export type SortableFields = {
993
+ /**
994
+ * A list of sortable field names.
995
+ */
996
+ fields: FieldKeyPath[];
997
+ /**
998
+ * Default sort settings. See
999
+ * https://github.com/sveltia/sveltia-cms#specifying-default-sort-field-and-direction for details.
1000
+ */
1001
+ default?: SortableFieldsDefaultOptions;
1002
+ };
1003
+ /**
1004
+ * View filter.
1005
+ */
1006
+ export type ViewFilter = {
1007
+ /**
1008
+ * Label.
1009
+ */
1010
+ label: string;
1011
+ /**
1012
+ * Field name.
1013
+ */
1014
+ field: FieldKeyPath;
1015
+ /**
1016
+ * Regex matching pattern or exact value.
1017
+ */
1018
+ pattern: string | boolean;
1019
+ };
1020
+ /**
1021
+ * View group.
1022
+ */
1023
+ export type ViewGroup = {
1024
+ /**
1025
+ * Label.
1026
+ */
1027
+ label: string;
1028
+ /**
1029
+ * Field name.
1030
+ */
1031
+ field: FieldKeyPath;
1032
+ /**
1033
+ * Regex matching pattern or exact value.
1034
+ */
1035
+ pattern: string | boolean;
1036
+ };
1037
+ /**
1038
+ * Editor options.
1039
+ */
1040
+ export type EditorOptions = {
1041
+ /**
1042
+ * Whether to show the preview pane. Default: `true`.
1043
+ */
1044
+ preview: boolean;
1045
+ };
1046
+ /**
1047
+ * Nested collection options.
1048
+ */
1049
+ export type NestedCollectionOptions = {
1050
+ /**
1051
+ * Maximum depth to show nested items in the collection tree. Default:
1052
+ * infinity.
1053
+ */
1054
+ depth?: number;
1055
+ /**
1056
+ * Summary template for a tree item. Default: `{{title}}`.
1057
+ */
1058
+ summary?: string;
1059
+ };
1060
+ /**
1061
+ * Collection meta data’s path options.
1062
+ */
1063
+ export type CollectionMetaDataPath = {
1064
+ /**
1065
+ * Widget for editing the path name.
1066
+ */
1067
+ widget?: "string";
1068
+ /**
1069
+ * Label for the path editor.
1070
+ */
1071
+ label?: string;
1072
+ /**
1073
+ * Index file name to be used.
1074
+ */
1075
+ index_file?: string;
1076
+ };
1077
+ /**
1078
+ * Collection meta data.
1079
+ */
1080
+ export type CollectionMetaData = {
1081
+ /**
1082
+ * Entry path options.
1083
+ */
1084
+ path?: CollectionMetaDataPath;
1085
+ };
1086
+ /**
1087
+ * A raw collection defined in the configuration file. Note: In Sveltia CMS, a folder collection is
1088
+ * called an entry collection.
1089
+ */
1090
+ export type Collection = {
1091
+ /**
1092
+ * Unique identifier for the collection.
1093
+ */
1094
+ name: string;
1095
+ /**
1096
+ * Label of the field to be displayed in the editor UI. Default: `name`
1097
+ * option value.
1098
+ */
1099
+ label?: string;
1100
+ /**
1101
+ * Singular UI label. It will be Blog Post if the `label` is
1102
+ * Blog Posts, for example. Default: `label` option value.
1103
+ */
1104
+ label_singular?: string;
1105
+ /**
1106
+ * Short description of the collection to be displayed in the
1107
+ * editor UI.
1108
+ */
1109
+ description?: string;
1110
+ /**
1111
+ * Name of a Material Symbols icon to be displayed in the collection list.
1112
+ */
1113
+ icon?: string;
1114
+ /**
1115
+ * Field name to be used as the title and slug of an
1116
+ * entry. Entry collection only. Default: `title` or `name`.
1117
+ */
1118
+ identifier_field?: FieldKeyPath;
1119
+ /**
1120
+ * A set of files. File collection only.
1121
+ */
1122
+ files?: CollectionFile[];
1123
+ /**
1124
+ * Base folder path relative to the project root. Entry collection only.
1125
+ */
1126
+ folder?: string;
1127
+ /**
1128
+ * Set of fields to be included in entries. Entry collection only.
1129
+ */
1130
+ fields?: Field[];
1131
+ /**
1132
+ * File path relative to `folder`, without a file extension. Entry
1133
+ * collection only.
1134
+ */
1135
+ path?: string;
1136
+ /**
1137
+ * Internal media folder path for the collection. This overrides
1138
+ * the global `media_folder` option.
1139
+ */
1140
+ media_folder?: string;
1141
+ /**
1142
+ * Public media folder path for an entry collection. This
1143
+ * overrides the global `public_folder` option. Default: `media_folder` option value.
1144
+ */
1145
+ public_folder?: string;
1146
+ /**
1147
+ * Entry filter. Entry collection only.
1148
+ */
1149
+ filter?: CollectionFilter;
1150
+ /**
1151
+ * Whether to hide the collection in the UI. Default: `false`.
1152
+ */
1153
+ hide?: boolean;
1154
+ /**
1155
+ * Whether to allow users to create entries in the collection. Entry
1156
+ * collection only. Default: `false`.
1157
+ */
1158
+ create?: boolean;
1159
+ /**
1160
+ * Whether to allow users to delete entries in the collection. Entry
1161
+ * collection only. Default: `true`.
1162
+ */
1163
+ delete?: boolean;
1164
+ /**
1165
+ * Whether to show the publishing control UI for Editorial Workflow.
1166
+ * Default: `true`.
1167
+ */
1168
+ publish?: boolean;
1169
+ /**
1170
+ * File extension. Entry collection only. Default: `md`.
1171
+ */
1172
+ extension?: FileExtension;
1173
+ /**
1174
+ * File format. Entry collection only. Default: `yaml-frontmatter`.
1175
+ */
1176
+ format?: FileFormat;
1177
+ /**
1178
+ * Delimiters to be used for the front matter
1179
+ * format. Entry collection only. Default: depends on the front matter type.
1180
+ */
1181
+ frontmatter_delimiter?: string | string[];
1182
+ /**
1183
+ * Item slug template. Entry collection only. Default: `identifier_field`
1184
+ * option value.
1185
+ */
1186
+ slug?: string;
1187
+ /**
1188
+ * The maximum number of characters allowed for an entry slug.
1189
+ * Entry collection only. Default: infinity.
1190
+ */
1191
+ slug_length?: number;
1192
+ /**
1193
+ * Entry summary template. Entry collection only. Default:
1194
+ * `identifier_field`.
1195
+ */
1196
+ summary?: string;
1197
+ /**
1198
+ * Custom sortable fields. Entry
1199
+ * collection only. Default: `title`, `name`, `date`, `author` and `description`. For a Git backend,
1200
+ * commit author and commit date are also included by default.
1201
+ */
1202
+ sortable_fields?: FieldKeyPath[] | SortableFields;
1203
+ /**
1204
+ * View filters to be used in the entry list. Entry
1205
+ * collection only.
1206
+ */
1207
+ view_filters?: ViewFilter[];
1208
+ /**
1209
+ * View groups to be used in the entry list. Entry collection
1210
+ * only.
1211
+ */
1212
+ view_groups?: ViewGroup[];
1213
+ /**
1214
+ * I18n options. Default: `false`.
1215
+ */
1216
+ i18n?: I18nOptions | boolean;
1217
+ /**
1218
+ * Preview URL path template.
1219
+ */
1220
+ preview_path?: string;
1221
+ /**
1222
+ * Date field name used for `preview_path`.
1223
+ */
1224
+ preview_path_date_field?: string;
1225
+ /**
1226
+ * Editor view options.
1227
+ */
1228
+ editor?: EditorOptions;
1229
+ /**
1230
+ * Options for a nested collection. Entry collection
1231
+ * only.
1232
+ */
1233
+ nested?: NestedCollectionOptions;
1234
+ /**
1235
+ * Meta data for a nested collection. Entry collection only.
1236
+ */
1237
+ meta?: CollectionMetaData;
1238
+ /**
1239
+ * Whether to double-quote all the strings values if the YAML
1240
+ * format is used for file output. Default: `false`. DEPRECATED in favor of the global YAML format
1241
+ * options.
1242
+ */
1243
+ yaml_quote?: boolean;
1244
+ /**
1245
+ * A special option to make this collection a divider UI in the
1246
+ * collection list. Other options will be ignored, but you’ll still need `name`. Default: `false`.
1247
+ */
1248
+ divider?: boolean;
1249
+ /**
1250
+ * A field key path to be used to find an
1251
+ * entry thumbnail displayed on the entry list. A nested field can be specified using dot notation,
1252
+ * e.g. `heroImage.src`. A wildcard in the key path is also supported, e.g. `images.*.src`. Multiple
1253
+ * key paths can be specified as an array for fallbacks. If this option is omitted, the `name` of
1254
+ * any non-nested, non-empty field using the Image or File widget is used. Entry collection only.
1255
+ */
1256
+ thumbnail?: FieldKeyPath | FieldKeyPath[];
1257
+ /**
1258
+ * The maximum number of entries that can be created in the collection.
1259
+ * Entry collection only. Default: infinity.
1260
+ */
1261
+ limit?: number;
1262
+ };
1263
+ /**
1264
+ * Supported backend name.
1265
+ */
1266
+ export type BackendName = "github" | "gitlab";
1267
+ /**
1268
+ * Custom commit messages.
1269
+ */
1270
+ export type CommitMessages = {
1271
+ /**
1272
+ * Message to be used when a new entry is created.
1273
+ */
1274
+ create?: string;
1275
+ /**
1276
+ * Message to be used when existing entries are updated.
1277
+ */
1278
+ update?: string;
1279
+ /**
1280
+ * Message to be used when existing entries are deleted.
1281
+ */
1282
+ delete?: string;
1283
+ /**
1284
+ * Message to be used when new files are uploaded/updated.
1285
+ */
1286
+ uploadMedia?: string;
1287
+ /**
1288
+ * Message to be used when existing files are deleted.
1289
+ */
1290
+ deleteMedia?: string;
1291
+ /**
1292
+ * Message to be used when committed via a forked repository.
1293
+ */
1294
+ openAuthoring?: string;
1295
+ };
1296
+ /**
1297
+ * Backend options.
1298
+ */
1299
+ export type BackendOptions = {
1300
+ /**
1301
+ * Backend name.
1302
+ */
1303
+ name: BackendName;
1304
+ /**
1305
+ * Required for the GitHub and GitLab backends. GitHub: organization/user
1306
+ * name and repository name joined by a slash, e.g. `owner/repo`. GitLab: namespace and project name
1307
+ * joined by a slash, e.g. `group/project` or `group/subgroup/project`.
1308
+ */
1309
+ repo?: string;
1310
+ /**
1311
+ * Git branch name. If omitted, the default branch, usually `main` or
1312
+ * `master`, will be used.
1313
+ */
1314
+ branch?: string;
1315
+ /**
1316
+ * API endpoint of the backend. Required when using GitHub Enterprise
1317
+ * Server or a self-hosted GitLab instance. Default: `https://api.github.com` (GitHub) or
1318
+ * `https://gitlab.com/api/v4` (GitLab).
1319
+ */
1320
+ api_root?: string;
1321
+ /**
1322
+ * Site domain used for OAuth, which will be included in the
1323
+ * `site_id` param to be sent to the API endpoint. Default: `location.hostname`.
1324
+ */
1325
+ site_domain?: string;
1326
+ /**
1327
+ * OAuth base URL origin. Required when using an OAuth client other
1328
+ * than Netlify, including Sveltia CMS Authenticator. Default: `https://api.netlify.com`.
1329
+ */
1330
+ base_url?: string;
1331
+ /**
1332
+ * OAuth base URL path. Default: `auth` (GitHub) or
1333
+ * `oauth/authorize` (GitLab).
1334
+ */
1335
+ auth_endpoint?: string;
1336
+ /**
1337
+ * OAuth authentication method. GitLab only. Default:
1338
+ * `pkce`.
1339
+ */
1340
+ auth_type?: "pkce" | "implicit";
1341
+ /**
1342
+ * OAuth application ID. GitLab only.
1343
+ */
1344
+ app_id?: string;
1345
+ /**
1346
+ * Custom commit messages.
1347
+ */
1348
+ commit_messages?: CommitMessages;
1349
+ /**
1350
+ * Deploy preview link context. GitHub only.
1351
+ */
1352
+ preview_context?: string;
1353
+ /**
1354
+ * Pull request label prefix for Editorial Workflow. Default:
1355
+ * `sveltia-cms/`.
1356
+ */
1357
+ cms_label_prefix?: string;
1358
+ /**
1359
+ * Whether to use squash marge for Editorial Workflow. Default:
1360
+ * `false`.
1361
+ */
1362
+ squash_merges?: boolean;
1363
+ /**
1364
+ * Whether to use Open Authoring. Default: `false`.
1365
+ */
1366
+ open_authoring?: boolean;
1367
+ /**
1368
+ * Authentication scope for Open Authoring.
1369
+ */
1370
+ auth_scope?: "repo" | "public_repo";
1371
+ /**
1372
+ * Whether to enable or disable automatic deployments
1373
+ * with any connected CI/CD provider, such as GitHub Actions or Cloudflare Pages. If `false`, the
1374
+ * `[skip ci]` prefix will be added to commit messages. Git backends only. Default: undefined. See
1375
+ * https://github.com/sveltia/sveltia-cms#disabling-automatic-deployments for details.
1376
+ */
1377
+ automatic_deployments?: boolean;
1378
+ };
1379
+ /**
1380
+ * Global media library options.
1381
+ */
1382
+ export type GlobalMediaLibraryOptions = {
1383
+ /**
1384
+ * Library name.
1385
+ */
1386
+ name: MediaLibraryName;
1387
+ };
1388
+ /**
1389
+ * Entry slug options.
1390
+ */
1391
+ export type SlugOptions = {
1392
+ /**
1393
+ * Encoding option. Default: `unicode`.
1394
+ */
1395
+ encoding?: "unicode" | "ascii";
1396
+ /**
1397
+ * Whether to remove accents. Default: `false`.
1398
+ */
1399
+ clean_accents?: boolean;
1400
+ /**
1401
+ * String to replace sanitized characters. Default: `-`.
1402
+ */
1403
+ sanitize_replacement?: string;
1404
+ };
1405
+ /**
1406
+ * JSON format options.
1407
+ */
1408
+ export type JsonFormatOptions = {
1409
+ /**
1410
+ * Indent style. Default: 'space'.
1411
+ */
1412
+ indent_style?: "space" | "tab";
1413
+ /**
1414
+ * Indent size. Default: 2.
1415
+ */
1416
+ indent_size?: number;
1417
+ };
1418
+ /**
1419
+ * YAML format options.
1420
+ */
1421
+ export type YamlFormatOptions = {
1422
+ /**
1423
+ * Indent size. Default: 2.
1424
+ */
1425
+ indent_size?: number;
1426
+ /**
1427
+ * String value’s default quote type. Default:
1428
+ * 'none'.
1429
+ */
1430
+ quote?: "none" | "double" | "single";
1431
+ };
1432
+ /**
1433
+ * Data output options.
1434
+ */
1435
+ export type OutputOptions = {
1436
+ /**
1437
+ * Whether to prevent fields with `required: false`
1438
+ * and an empty value from being included in entry data output. Default: `false`.
1439
+ */
1440
+ omit_empty_optional_fields?: boolean;
1441
+ /**
1442
+ * JSON format options.
1443
+ */
1444
+ json?: JsonFormatOptions;
1445
+ /**
1446
+ * YAML format options.
1447
+ */
1448
+ yaml?: YamlFormatOptions;
1449
+ };
1450
+ /**
1451
+ * Site configuration.
1452
+ */
1453
+ export type SiteConfig = {
1454
+ /**
1455
+ * Whether to load the `config.yml` file when using manual
1456
+ * initialization. This works only in the `CMS.init()` method’s `config` option. Default: `true`.
1457
+ */
1458
+ load_config_file?: boolean;
1459
+ /**
1460
+ * Backend options.
1461
+ */
1462
+ backend: BackendOptions;
1463
+ /**
1464
+ * Publish mode. Default: simple.
1465
+ */
1466
+ publish_mode?: "simple" | "editorial_workflow" | "";
1467
+ /**
1468
+ * Global internal media folder path, relative to the project’s root
1469
+ * directory.
1470
+ */
1471
+ media_folder: string;
1472
+ /**
1473
+ * Global public media folder path, relative to the project’s
1474
+ * public URL. It must be an absolute path starting with `/`. Default: `media_folder` option value.
1475
+ */
1476
+ public_folder?: string;
1477
+ /**
1478
+ * Media library options.
1479
+ */
1480
+ media_library?: MediaLibrary & GlobalMediaLibraryOptions;
1481
+ /**
1482
+ * Site URL. Default: `location.origin`.
1483
+ */
1484
+ site_url?: string;
1485
+ /**
1486
+ * Site URL linked from the UI. Default: `site_url` option value.
1487
+ */
1488
+ display_url?: string;
1489
+ /**
1490
+ * Absolute URL or absolute path to the site logo that will be
1491
+ * displayed on the Sign-In page and the browser’s tab (favicon). A square image works best.
1492
+ * Default: Sveltia logo.
1493
+ */
1494
+ logo_url?: string;
1495
+ /**
1496
+ * Whether to show site preview links. Default: `true`.
1497
+ */
1498
+ show_preview_links?: boolean;
1499
+ /**
1500
+ * Entry slug options.
1501
+ */
1502
+ slug?: SlugOptions;
1503
+ /**
1504
+ * Set of collections.
1505
+ */
1506
+ collections: Collection[];
1507
+ /**
1508
+ * Global i18n options.
1509
+ */
1510
+ i18n?: I18nOptions;
1511
+ /**
1512
+ * Editor view options.
1513
+ */
1514
+ editor?: EditorOptions;
1515
+ /**
1516
+ * Data output options.
1517
+ */
1518
+ output?: OutputOptions;
1519
+ };
1520
+ /**
1521
+ * Entry file Parser.
1522
+ */
1523
+ export type FileParser = (text: string) => any | Promise<any>;
1524
+ /**
1525
+ * Entry file formatter.
1526
+ */
1527
+ export type FileFormatter = (value: any) => string | Promise<string>;
1528
+ /**
1529
+ * Custom editor component options.
1530
+ */
1531
+ export type EditorComponentDefinition = {
1532
+ /**
1533
+ * Unique identifier for the component.
1534
+ */
1535
+ id: string;
1536
+ /**
1537
+ * Label of the component to be displayed in the editor UI.
1538
+ */
1539
+ label: string;
1540
+ /**
1541
+ * Name of a Material Symbols icon to be displayed in the editor UI.
1542
+ */
1543
+ icon?: string;
1544
+ /**
1545
+ * Set of fields to be displayed in the component.
1546
+ */
1547
+ fields: Field[];
1548
+ /**
1549
+ * Regular expression to search a block from Markdown document.
1550
+ */
1551
+ pattern: RegExp;
1552
+ /**
1553
+ * Function to convert
1554
+ * the matching result to field properties. This can be omitted if the `pattern` regex contains
1555
+ * named capturing group(s) that will be passed directly to the internal `createNode` method.
1556
+ */
1557
+ fromBlock?: (match: RegExpMatchArray) => {
1558
+ [key: string]: any;
1559
+ };
1560
+ /**
1561
+ * Function to convert field
1562
+ * properties to Markdown content.
1563
+ */
1564
+ toBlock: (props: {
1565
+ [key: string]: any;
1566
+ }) => string;
1567
+ /**
1568
+ * Function to convert
1569
+ * field properties to field preview.
1570
+ */
1571
+ toPreview: (props: {
1572
+ [key: string]: any;
1573
+ }) => string | JSX.Element;
1574
+ };
1575
+ /**
1576
+ * Supported event type.
1577
+ */
1578
+ export type AppEventType = "prePublish" | "postPublish" | "preUnpublish" | "postUnpublish" | "preSave" | "postSave";
1579
+ /**
1580
+ * Event listener properties.
1581
+ */
1582
+ export type AppEventListener = {
1583
+ /**
1584
+ * Event type.
1585
+ */
1586
+ name: AppEventType;
1587
+ /**
1588
+ * Event handler.
1589
+ */
1590
+ handler: (args: {
1591
+ entry: Record<string, any>;
1592
+ author?: {
1593
+ login: string;
1594
+ name: string;
1595
+ };
1596
+ }) => any;
1597
+ };
1598
+ export type CustomPreviewTemplateProps = {
1599
+ entry: Record<string, any>;
1600
+ widgetFor: (name: string) => any;
1601
+ widgetsFor: (name: string) => any;
1602
+ getAsset: (name: string) => any;
1603
+ getCollection: (collectionName: string, slug?: string) => any;
1604
+ document: Document;
1605
+ window: Window;
1606
+ };
1607
+ export type CustomWidgetControlProps = {
1608
+ value: any;
1609
+ field: Record<string, any>;
1610
+ forID: string;
1611
+ classNameWrapper: string;
1612
+ onChange: (value: any) => void;
1613
+ };
1614
+ export type CustomWidgetPreviewProps = {
1615
+ value: any;
1616
+ field: Record<string, any>;
1617
+ metadata: Record<string, any>;
1618
+ entry: Record<string, any>;
1619
+ getAsset: (name: string) => any;
1620
+ fieldsMetaData: Record<string, any>;
1621
+ };
1622
+ export type CustomWidgetSchema = {
1623
+ properties: Record<string, any>;
1624
+ };
1625
+ import type { JSX } from 'react';