@cloudcannon/configuration-types 0.0.23 → 0.0.24

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.
@@ -1,1283 +1,14 @@
1
- import type Scrapbooker from '@cloudcannon/snippet-types';
2
-
3
- import type { Icon } from './icon';
4
- import type { MarkdownSettings } from './markdown';
5
- import type { MimeType } from './mime-type';
6
- import type { Syntax } from './syntax';
7
- import type { Theme } from './theme';
8
- import type { Timezone } from './timezone';
9
-
10
- export type InstanceValue = 'UUID' | 'NOW';
11
- export type EditorKey = 'visual' | 'content' | 'data';
12
- export type SortOrder = 'ascending' | 'descending' | 'asc' | 'desc';
13
-
14
- // TODO: use SnippetConfig from @cloudcannon/scrap-booker when ParserConfig issue resolved.
15
- export interface SnippetConfig extends ReducedCascade, WithPreview, WithPickerPreview {
16
- /**
17
- * Name of the snippet.
18
- */
19
- snippet?: string;
20
- /**
21
- * The template that this snippet should inherit, out of the available Shortcode Templates.
22
- */
23
- template?: string;
24
- /**
25
- * Whether this snippet can appear inline (within a sentence). Defaults to false, which will treat
26
- * this snippet as a block-level element in the content editor.
27
- */
28
- inline?: boolean;
29
- /**
30
- * Controls how selected items are rendered. Defaults to 'card', or 'inline' if `inline` is true.
31
- */
32
- view?: 'card' | 'inline' | 'gallery';
33
- /**
34
- * Whether this snippet treats whitespace as-is or not.
35
- */
36
- strict_whitespace?: boolean;
37
- /**
38
- * The variables required for the selected template.
39
- */
40
- definitions?: Record<string, unknown>;
41
- /**
42
- * Alternate configurations for this snippet.
43
- */
44
- alternate_formats?: SnippetConfig[];
45
- /**
46
- * The parameters of this snippet.
47
- */
48
- params?: Record<string, unknown>; // TODO: use ParserConfig from @cloudcannon/scrap-booker.
49
- }
50
-
51
- export interface SnippetsImports {
52
- /**
53
- * Default snippets for Hugo SSG.
54
- */
55
- hugo?:
56
- | boolean
57
- | {
58
- /**
59
- * The list of excluded snippets. If unset, all snippets are excluded unless defined in
60
- * `include`.
61
- *
62
- * @uniqueItems
63
- */
64
- exclude: Array<keyof typeof Scrapbooker.defaults.hugo.snippets>;
65
- }
66
- | {
67
- /**
68
- * The list of included snippets. If unset, all snippets are included unless defined in
69
- * `exclude`.
70
- *
71
- * @uniqueItems
72
- */
73
- include: Array<keyof typeof Scrapbooker.defaults.hugo.snippets>;
74
- };
75
- /**
76
- * Default snippets for Jekyll SSG.
77
- */
78
- jekyll?:
79
- | boolean
80
- | {
81
- /**
82
- * The list of excluded snippets. If unset, all snippets are excluded unless defined in
83
- * `include`.
84
- *
85
- * @uniqueItems
86
- */
87
- exclude: Array<keyof typeof Scrapbooker.defaults.jekyll.snippets>;
88
- }
89
- | {
90
- /**
91
- * The list of included snippets. If unset, all snippets are included unless defined in
92
- * `exclude`.
93
- *
94
- * @uniqueItems
95
- */
96
- include: Array<keyof typeof Scrapbooker.defaults.jekyll.snippets>;
97
- };
98
- /**
99
- * Default snippets for MDX-based content.
100
- */
101
- mdx?:
102
- | boolean
103
- | {
104
- /**
105
- * The list of excluded snippets. If unset, all snippets are excluded unless defined in
106
- * `include`.
107
- *
108
- * @uniqueItems
109
- */
110
- exclude: Array<keyof typeof Scrapbooker.defaults.mdx.snippets>;
111
- }
112
- | {
113
- /**
114
- * The list of included snippets. If unset, all snippets are included unless defined in
115
- * `exclude`.
116
- *
117
- * @uniqueItems
118
- */
119
- include: Array<keyof typeof Scrapbooker.defaults.mdx.snippets>;
120
- };
121
- /**
122
- * Default snippets for Eleventy SSG Liquid files.
123
- */
124
- eleventy_liquid?:
125
- | boolean
126
- | {
127
- /**
128
- * The list of excluded snippets. If unset, all snippets are excluded unless defined in
129
- * `include`.
130
- *
131
- * @uniqueItems
132
- */
133
- exclude: Array<keyof typeof Scrapbooker.defaults.eleventy_liquid.snippets>;
134
- }
135
- | {
136
- /**
137
- * The list of included snippets. If unset, all snippets are included unless defined in
138
- * `exclude`.
139
- *
140
- * @uniqueItems
141
- */
142
- include: Array<keyof typeof Scrapbooker.defaults.eleventy_liquid.snippets>;
143
- };
144
- /**
145
- * Default snippets for Eleventy SSG Nunjucks files.
146
- */
147
- eleventy_nunjucks?:
148
- | boolean
149
- | {
150
- /**
151
- * The list of excluded snippets. If unset, all snippets are excluded unless defined in
152
- * `include`.
153
- *
154
- * @uniqueItems
155
- */
156
- exclude: Array<keyof typeof Scrapbooker.defaults.eleventy_nunjucks.snippets>;
157
- }
158
- | {
159
- /**
160
- * The list of included snippets. If unset, all snippets are included unless defined in
161
- * `exclude`.
162
- *
163
- * @uniqueItems
164
- */
165
- include: Array<keyof typeof Scrapbooker.defaults.eleventy_nunjucks.snippets>;
166
- };
167
- /**
168
- * Default snippets for Markdoc-based content.
169
- */
170
- markdoc?:
171
- | boolean
172
- | {
173
- /**
174
- * The list of excluded snippets. If unset, all snippets are excluded unless defined in
175
- * `include`.
176
- *
177
- * @uniqueItems
178
- */
179
- exclude: Array<keyof typeof Scrapbooker.defaults.markdoc.snippets>;
180
- }
181
- | {
182
- /**
183
- * The list of included snippets. If unset, all snippets are included unless defined in
184
- * `exclude`.
185
- *
186
- * @uniqueItems
187
- */
188
- include: Array<keyof typeof Scrapbooker.defaults.markdoc.snippets>;
189
- };
190
- /**
191
- * Default snippets for content using Python markdown extensions.
192
- */
193
- python_markdown_extensions?:
194
- | boolean
195
- | {
196
- /**
197
- * The list of excluded snippets. If unset, all snippets are excluded unless defined in
198
- * `include`.
199
- *
200
- * @uniqueItems
201
- */
202
- exclude: Array<keyof typeof Scrapbooker.defaults.python_markdown_extensions.snippets>;
203
- }
204
- | {
205
- /**
206
- * The list of included snippets. If unset, all snippets are included unless defined in
207
- * `exclude`.
208
- *
209
- * @uniqueItems
210
- */
211
- include: Array<keyof typeof Scrapbooker.defaults.python_markdown_extensions.snippets>;
212
- };
213
- /**
214
- * Default snippets for Docusaurus SSG.
215
- */
216
- docusaurus_mdx?:
217
- | boolean
218
- | {
219
- /**
220
- * The list of excluded snippets. If unset, all snippets are excluded unless defined in
221
- * `include`.
222
- *
223
- * @uniqueItems
224
- */
225
- exclude: Array<keyof typeof Scrapbooker.defaults.docusaurus_mdx.snippets>;
226
- }
227
- | {
228
- /**
229
- * The list of included snippets. If unset, all snippets are included unless defined in
230
- * `exclude`.
231
- *
232
- * @uniqueItems
233
- */
234
- include: Array<keyof typeof Scrapbooker.defaults.docusaurus_mdx.snippets>;
235
- };
236
- }
237
-
238
- interface ImageResizeable {
239
- /**
240
- * Sets the format images are converted to prior to upload. The extension of the file is updated
241
- * to match. Defaults to keeping the mime type of the uploaded file.
242
- */
243
- mime_type?: 'image/jpeg' | 'image/png' | 'image/webp';
244
- /**
245
- * Sets how uploaded image files are resized with a bounding box defined by width and height prior
246
- * to upload. Has no effect when selecting existing images, or if width and height are unset.
247
- *
248
- * @default contain
249
- */
250
- resize_style?: 'cover' | 'contain' | 'stretch' | 'crop';
251
- /**
252
- * Defines the width of the bounding box used in the image resizing process defined with
253
- * resize_style.
254
- */
255
- width?: number;
256
- /**
257
- * Defines the height of the bounding box used in the image resizing process defined with
258
- * resize_style.
259
- */
260
- height?: number;
261
- /**
262
- * Controls whether or not images can be upscaled to fit the bounding box during resize prior to
263
- * upload. Has no effect if files are not resized.
264
- *
265
- * @default false
266
- */
267
- expandable?: boolean;
268
- /**
269
- * Instructs the editor to save `width` and `height` attributes on the image elements. This can
270
- * prevent pop-in as a page loads.
271
- *
272
- * @default true
273
- */
274
- image_size_attributes?: boolean;
275
- /**
276
- * If you have one or more DAMs connected to your site, you can use this key to list which asset
277
- * sources can be uploaded to and selected from.
278
- */
279
- allowed_sources?: string[];
280
- /**
281
- * Enable to skip the image resizing process configured for this input when selecting existing
282
- * images.
283
- *
284
- * @default false
285
- */
286
- prevent_resize_existing_files?: boolean;
287
- /**
288
- * Definitions for creating additional images of different sizes when uploading or selecting
289
- * existing files.
290
- */
291
- sizes?: {
292
- /**
293
- * A number suffixed with "x" (relative size) or "w" (fixed width) for setting the dimensions of
294
- * the image (e.g. 2x, 3x, 100w, 360w).
295
- */
296
- size: string;
297
- /**
298
- * A reference to another input that is given the path to this additional image file.
299
- */
300
- target?: string;
301
- }[];
302
- }
303
-
304
- export interface Editables {
305
- /**
306
- * Contains input options for the Content Editor.
307
- */
308
- content?: BlockEditable;
309
- /**
310
- * Contains input options for block Editable Regions.
311
- */
312
- block?: BlockEditable;
313
- /**
314
- * Contains input options for link Editable Regions.
315
- */
316
- link?: LinkEditable;
317
- /**
318
- * Contains input options for image Editable Regions.
319
- */
320
- image?: ImageEditable;
321
- /**
322
- * Contains input options for text Editable Regions.
323
- */
324
- text?: TextEditable;
325
- }
326
-
327
- export interface BlockEditable extends ImageResizeable, TextEditable {
328
- /**
329
- * Enables a control to wrap blocks of text in block quotes.
330
- *
331
- * @default true
332
- */
333
- blockquote?: boolean;
334
- /**
335
- * Enables a control to insert an unordered list, or to convert selected blocks of text into a
336
- * unordered list.
337
- *
338
- * @default true
339
- */
340
- bulletedlist?: boolean;
341
- /**
342
- * Enables a control to center align text by toggling a class name for a block of text. The value
343
- * is the class name the editor should add to align the text. The styles for this class need to be
344
- * listed in the `styles` file to take effect outside of the input.
345
- */
346
- center?: string;
347
- /**
348
- * Enables a control to create an inline code element, containing any selected text.
349
- *
350
- * @default false
351
- */
352
- code_inline?: boolean;
353
- /**
354
- * Enables a control to insert a code block.
355
- *
356
- * @default false
357
- */
358
- code_block?: boolean;
359
- /**
360
- * Enables both block and inline code controls: `code_block` and `code_inline`.
361
- *
362
- * @default false
363
- */
364
- code?: boolean;
365
- /**
366
- * Enables a control to insert a region of raw HTML, including YouTube, Vimeo, Tweets, and other
367
- * media. Embedded content is sanitized to mitigate XSS risks, which includes removing style tags.
368
- * Embeds containing script tags are not loaded in the editor.
369
- *
370
- * @default false
371
- */
372
- embed?: boolean;
373
- /**
374
- * Enables a drop down menu for structured text. Has options for "p", "h1", "h2", "h3", "h4",
375
- * "h5", "h6". Set as space separated options (e.g. "p h1 h2").
376
- *
377
- * @default p h1 h2 h3 h4 h5 h6
378
- */
379
- format?: string;
380
- /**
381
- * Enables a control to insert a horizontal rule.
382
- *
383
- * @default false
384
- */
385
- horizontalrule?: boolean;
386
- /**
387
- * Enables a control to insert an image. The image can be uploaded, existing or an external link.
388
- *
389
- * @default true
390
- */
391
- image?: boolean;
392
- /**
393
- * Enables a control to increase indentation for numbered and unordered lists.
394
- *
395
- * @default false
396
- */
397
- indent?: boolean;
398
- /**
399
- * Enables a control to justify text by toggling a class name for a block of text. The value is
400
- * the class name the editor should add to justify the text. The styles for this class need to be
401
- * listed in the `styles` file to take effect outside of the input.
402
- */
403
- justify?: string;
404
- /**
405
- * Enables a control to left align text by toggling a class name for a block of text. The value is
406
- * the class name the editor should add to align the text. The styles for this class need to be
407
- * listed in the `styles` file to take effect outside of the input.
408
- */
409
- left?: string;
410
- /**
411
- * Enables a control to insert a numbered list, or to convert selected blocks of text into a
412
- * numbered list.
413
- *
414
- * @default true
415
- */
416
- numberedlist?: boolean;
417
- /**
418
- * Enables a control to reduce indentation for numbered and unordered lists.
419
- *
420
- * @default false
421
- */
422
- outdent?: boolean;
423
- /**
424
- * Enables a control to right align text by toggling a class name for a block of text. The value
425
- * is the class name the editor should add to align the text. The styles for this class need to be
426
- * listed in the `styles` file to take effect outside of the input.
427
- */
428
- right?: string;
429
- /**
430
- * Enables a control to insert snippets, if any are available.
431
- *
432
- * @default true
433
- */
434
- snippet?: boolean;
435
- /**
436
- * Enables a drop down menu for editors to style selected text or blocks or text. Styles are the
437
- * combination of an element and class name. The value for this option is the path (either source
438
- * or build output) to the CSS file containing the styles.
439
- */
440
- styles?: string;
441
- /**
442
- * Enables a control to insert a table. Further options for table cells are available in the
443
- * context menu for cells within the editor.
444
- *
445
- * @default false
446
- */
447
- table?: boolean;
448
- }
449
-
450
- interface WithPaths {
451
- /**
452
- * Paths to where new asset files are uploaded to. They also set the default path when choosing
453
- * existing images, and linking to existing files. Each path is relative to global `source`.
454
- * Defaults to the global `paths`.
455
- */
456
- paths?: Paths;
457
- }
458
-
459
- export type ImageEditable = ImageResizeable & WithPaths;
460
-
461
- export type LinkEditable = WithPaths;
462
-
463
- export interface TextEditable extends WithPaths {
464
- /**
465
- * Enables a control to set selected text to bold.
466
- *
467
- * @default true
468
- */
469
- bold?: boolean;
470
- /**
471
- * Enables a control to copy formatting from text to other text. Only applies to formatting from
472
- * `bold`, `italic`, `underline`, `strike`, `subscript`, and `superscript`. Does not copy other
473
- * styles or formatting.
474
- *
475
- * @default false
476
- */
477
- copyformatting?: boolean;
478
- /**
479
- * Enables a control to italicize selected text.
480
- *
481
- * @default true
482
- */
483
- italic?: boolean;
484
- /**
485
- * Enables a control to create hyperlinks around selected text.
486
- *
487
- * @default true
488
- */
489
- link?: boolean;
490
- /**
491
- * Enables a control to redo recent edits undone with undo. Redo is always enabled through
492
- * standard OS-specific keyboard shortcuts.
493
- *
494
- * @default false
495
- */
496
- redo?: boolean;
497
- /**
498
- * Enables the control to remove formatting from text. Applies to formatting from `bold`,
499
- * `italic`, `underline`, `strike`, `subscript`, and `superscript`. Does not remove other styles
500
- * or formatting.
501
- *
502
- * @default true
503
- */
504
- removeformat?: boolean;
505
- /**
506
- * Enables a control to strike selected text.
507
- *
508
- * @default false
509
- */
510
- strike?: boolean;
511
- /**
512
- * Enables a control to set selected text to subscript.
513
- *
514
- * @default false
515
- */
516
- subscript?: boolean;
517
- /**
518
- * Enables a control to set selected text to superscript.
519
- *
520
- * @default false
521
- */
522
- superscript?: boolean;
523
- /**
524
- * Enables a control to underline selected text.
525
- *
526
- * @default false
527
- */
528
- underline?: boolean;
529
- /**
530
- * Enables a control to undo recent edits. Undo is always enabled through standard OS-specific
531
- * keyboard shortcuts.
532
- *
533
- * @default false
534
- */
535
- undo?: boolean;
536
- /**
537
- * Defines if the content should be stripped of "custom markup". It is recommended to have this
538
- * option turned on once you have all of your rich text options configured. Having
539
- * `allow_custom_markup` turned on disables this option. Defaults to false.
540
- */
541
- remove_custom_markup?: boolean;
542
- /**
543
- * Defines if the content can contain "custom markup". It is not recommended to have this option
544
- * turned on. Defaults to true for non-content editable regions, false otherwise.
545
- */
546
- allow_custom_markup?: boolean;
547
- }
548
-
549
- export interface ReducedCascade {
550
- /**
551
- * Controls the behavior and appearance of your inputs in all data editing interfaces.
552
- */
553
- _inputs?: Record<string, Input>;
554
- /**
555
- * Fixed datasets that can be referenced by the _Values_ configuration for _Select_ and
556
- * _Multiselect_ inputs.
557
- */
558
- _select_data?: Record<string, SelectValues>;
559
- /**
560
- * Structured values for editors adding new items to arrays and objects. Entries here can be
561
- * referenced in the configuration for `array` or `object` inputs.
562
- */
563
- _structures?: Record<string, Structure>;
564
- }
565
-
566
- export interface Cascade extends ReducedCascade {
567
- /**
568
- * Set a preferred editor and/or disable the others. The first value sets which editor opens by
569
- * default, and the following values specify which editors are accessible.
570
- *
571
- * @uniqueItems
572
- */
573
- _enabled_editors?: EditorKey[];
574
- /**
575
- * Contains input options for Editable Regions and the Content Editor.
576
- */
577
- _editables?: Editables;
578
- }
579
-
580
- export type InputType =
581
- | 'text'
582
- | 'textarea'
583
- | 'email'
584
- | 'disabled'
585
- | 'pinterest'
586
- | 'facebook'
587
- | 'twitter'
588
- | 'github'
589
- | 'instagram'
590
- | 'code'
591
- | 'checkbox'
592
- | 'switch'
593
- | 'color'
594
- | 'number'
595
- | 'range'
596
- | 'url'
597
- | 'html'
598
- | 'markdown'
599
- | 'date'
600
- | 'datetime'
601
- | 'time'
602
- | 'file'
603
- | 'image'
604
- | 'document'
605
- | 'select'
606
- | 'multiselect'
607
- | 'choice'
608
- | 'multichoice'
609
- | 'object'
610
- | 'array'
611
- | 'auto';
612
-
613
- interface WithEmptyTypeText {
614
- /**
615
- * Set how an ‘empty’ value will be saved. Does not apply to existing empty values.
616
- */
617
- empty_type?: 'null' | 'string';
618
- }
619
-
620
- interface WithEmptyTypeNumber {
621
- /**
622
- * Set how an ‘empty’ value will be saved. Does not apply to existing empty values.
623
- */
624
- empty_type?: 'null' | 'number';
625
- }
626
-
627
- interface WithEmptyTypeObject {
628
- /**
629
- * Set how an ‘empty’ value will be saved. Does not apply to existing empty values.
630
- */
631
- empty_type?: 'null' | 'object';
632
- }
633
-
634
- interface WithEmptyTypeArray {
635
- /**
636
- * Set how an ‘empty’ value will be saved. Does not apply to existing empty values.
637
- */
638
- empty_type?: 'null' | 'array';
639
- }
640
-
641
- export interface BaseInput {
642
- /**
643
- * Sets an input type, which controls how this input appears and behaves.
644
- */
645
- type?: InputType;
646
- /**
647
- * Options that are specific to this `type` of input.
648
- */
649
- options?: WithEmptyTypeText | WithEmptyTypeNumber | WithEmptyTypeObject | WithEmptyTypeArray;
650
- /**
651
- * Changes the subtext below the _Label_. Has no default. Supports a limited set of Markdown:
652
- * links, bold, italic, subscript, superscript, and inline code elements are allowed.
653
- */
654
- comment?: string;
655
- /**
656
- * Adds an expandable section of rich text below the input.
657
- */
658
- context?: {
659
- /**
660
- * The rich text content shown when opened. Supports a limited set of Markdown.
661
- */
662
- content?: string;
663
- /**
664
- * Makes the content visible initially.
665
- */
666
- open?: boolean;
667
- /**
668
- * The text shown when not open. Defaults to "Context" if unset.
669
- */
670
- title?: string;
671
- /**
672
- * The icon shown when not open.
673
- */
674
- icon?: Icon;
675
- };
676
- /**
677
- * Provides a custom link for documentation for editors shown above input.
678
- */
679
- documentation?: Documentation;
680
- /**
681
- * Optionally changes the text above this input.
682
- */
683
- label?: string;
684
- /**
685
- * Toggles the visibility of this input.
686
- *
687
- * @default false
688
- */
689
- hidden?: boolean | string;
690
- /**
691
- * Controls if and how the value of this input is instantiated when created. This occurs when
692
- * creating files, or adding array items containing the configured input.
693
- */
694
- instance_value?: InstanceValue;
695
- /**
696
- * Specifies whether or not this input configuration should be merged with any matching, less
697
- * specific configuration.
698
- */
699
- cascade?: boolean;
700
- }
701
-
702
- export interface TextInputOptions extends WithEmptyTypeText {
703
- /**
704
- * Text shown when this input has no value.
705
- */
706
- placeholder?: string;
707
- /**
708
- * Icon shown beside the input.
709
- */
710
- icon?: Icon;
711
- }
712
-
713
- export interface TextInput extends BaseInput {
714
- type:
715
- | 'text'
716
- | 'email'
717
- | 'disabled'
718
- | 'pinterest'
719
- | 'facebook'
720
- | 'twitter'
721
- | 'github'
722
- | 'instagram';
723
-
724
- /**
725
- * Options that are specific to this `type` of input.
726
- */
727
- options?: TextInputOptions;
728
- }
729
-
730
- export interface TextareaInputOptions extends TextInputOptions {
731
- /**
732
- * Shows a character counter below the input if enabled.
733
- *
734
- * @default false
735
- */
736
- show_count?: boolean;
737
- }
738
-
739
- export interface TextareaInput extends BaseInput {
740
- type: 'textarea';
741
- /**
742
- * Options that are specific to this `type` of input.
743
- */
744
- options?: TextareaInputOptions;
745
- }
746
-
747
- export interface CodeInputOptions extends WithEmptyTypeText, SourceEditor {
748
- /**
749
- * Sets the maximum number of visible lines for this input, effectively controlling maximum
750
- * height. When the containing text exceeds this number, the input becomes a scroll area.
751
- *
752
- * @default 30
753
- */
754
- max_visible_lines?: number;
755
- /**
756
- * Sets the minimum number of visible lines for this input, effectively controlling initial
757
- * height. When the containing text exceeds this number, the input grows line by line to the lines
758
- * defined by `max_visible_lines`.
759
- *
760
- * @default 10
761
- */
762
- min_visible_lines?: number;
763
- /**
764
- * Changes how the editor parses your content for syntax highlighting. Should be set to the
765
- * language of the code going into the input.
766
- */
767
- syntax?: Syntax;
768
- }
769
-
770
- export interface CodeInput extends BaseInput {
771
- type: 'code';
772
- /**
773
- * Options that are specific to this `type` of input.
774
- */
775
- options?: CodeInputOptions;
776
- }
777
-
778
- export interface ColorInputOptions extends WithEmptyTypeText {
779
- /**
780
- * Sets what format the color value is saved as. Defaults to the naming convention, or HEX if that
781
- * is unset.
782
- */
783
- format?: 'rgb' | 'hex' | 'hsl' | 'hsv';
784
- /**
785
- * Toggles showing a control for adjusting the transparency of the selected color. Defaults to
786
- * using the naming convention, enabled if the input key ends with "a".
787
- */
788
- alpha?: boolean;
789
- }
790
-
791
- export interface ColorInput extends BaseInput {
792
- type: 'color';
793
- /**
794
- * Options that are specific to this `type` of input.
795
- */
796
- options?: ColorInputOptions;
797
- }
798
-
799
- export interface BooleanInput extends Omit<BaseInput, 'options'> {
800
- type: 'checkbox' | 'switch';
801
- }
802
-
803
- export interface NumberInputOptions extends WithEmptyTypeNumber {
804
- /**
805
- * The lowest value in the range of permitted values.
806
- */
807
- min?: number;
808
- /**
809
- * The greatest value in the range of permitted values.
810
- */
811
- max?: number;
812
- /**
813
- * A number that specifies the granularity that the value must adhere to, or the special value
814
- * any, which allows any decimal value between `max` and `min`.
815
- */
816
- step?: number;
817
- }
818
-
819
- export interface NumberInput extends BaseInput {
820
- type: 'number';
821
- /**
822
- * Options that are specific to this `type` of input.
823
- */
824
- options?: NumberInputOptions;
825
- }
826
-
827
- export interface RangeInputOptions extends NumberInputOptions {
828
- /**
829
- * The lowest value in the range of permitted values.
830
- *
831
- * @default 0
832
- */
833
- min?: number;
834
- /**
835
- * The greatest value in the range of permitted values.
836
- *
837
- * @default 10
838
- */
839
- max?: number;
840
- /**
841
- * A number that specifies the granularity that the value must adhere to, or the special value
842
- * any, which allows any decimal value between `max` and `min`.
843
- *
844
- * @default 1
845
- */
846
- step?: number;
847
- }
848
-
849
- export interface RangeInput extends BaseInput {
850
- type: 'range';
851
- /**
852
- * Options that are specific to this `type` of input.
853
- */
854
- options?: RangeInputOptions;
855
- }
856
-
857
- export interface UrlInputOptions extends WithEmptyTypeText, WithPaths {}
858
-
859
- export interface UrlInput extends BaseInput {
860
- type: 'url';
861
- /**
862
- * Options that are specific to this `type` of input.
863
- */
864
- options?: UrlInputOptions;
865
- }
866
-
867
- export interface RichTextInputOptions extends WithEmptyTypeText, ImageResizeable, BlockEditable {
868
- /**
869
- * Shows or hides the resize handler to vertically resize the input.
870
- *
871
- * @default false
872
- */
873
- allow_resize?: boolean;
874
- /**
875
- * Defines the initial height of this input in pixels (px).
876
- *
877
- * @default 320
878
- */
879
- initial_height?: number;
880
- }
881
-
882
- export interface RichTextInput extends BaseInput {
883
- type: 'html' | 'markdown';
884
- /**
885
- * Options that are specific to this `type` of input.
886
- */
887
- options?: RichTextInputOptions;
888
- }
889
-
890
- export interface DateInputOptions extends WithEmptyTypeText {
891
- /**
892
- * Specifies the time zone that dates are displayed and edited in. Also changes the suffix the
893
- * date is persisted to the file with. Defaults to the global `timezone`.
894
- *
895
- * @default Etc/UTC
896
- */
897
- timezone?: Timezone;
898
- }
899
-
900
- export interface DateInput extends BaseInput {
901
- type: 'date' | 'datetime';
902
- /**
903
- * Options that are specific to Date inputs.
904
- */
905
- options?: DateInputOptions;
906
- }
907
-
908
- export interface TimeInput extends BaseInput {
909
- type: 'time';
910
- /**
911
- * Options that are specific to Time inputs.
912
- */
913
- options?: WithEmptyTypeText;
914
- }
915
-
916
- export interface FileInputOptions extends WithEmptyTypeText, WithPaths {
917
- /**
918
- * Restricts which file types are available to select or upload to this input. Accepted format is
919
- * an array or comma-separated string of MIME types. The special value '*' means any type is
920
- * accepted.
921
- */
922
- accepts_mime_types?: MimeType[] | string;
923
- /**
924
- * If you have one or more DAMs connected to your site, you can use this key to list which asset
925
- * sources can be uploaded to and selected from.
926
- */
927
- allowed_sources?: string[];
928
- }
929
-
930
- export interface FileInput extends BaseInput {
931
- type: 'file' | 'document';
932
- /**
933
- * Options that are specific to File inputs.
934
- */
935
- options?: FileInputOptions;
936
- }
937
-
938
- export type ImageInputOptions = FileInputOptions & ImageResizeable;
939
-
940
- export interface ImageInput extends BaseInput {
941
- type: 'image';
942
- /**
943
- * Options that are specific to Image inputs.
944
- */
945
- options?: ImageInputOptions;
946
- }
947
-
948
- export interface SelectInputOptions extends WithPreview, WithPickerPreview {
949
- /**
950
- * Allows new text values to be created at edit time.
951
- *
952
- * @default false
953
- */
954
- allow_create?: boolean;
955
- /**
956
- * Provides an empty option alongside the options provided by values.
957
- *
958
- * @default true
959
- */
960
- allow_empty?: boolean;
961
- /**
962
- * Defines the values available to choose from. Optional, defaults to fetching values from the
963
- * naming convention (e.g. colors or my_colors for data set colors).
964
- */
965
- values?: string | SelectValues;
966
- /**
967
- * Defines the key used for mapping between saved values and objects in values. This changes how
968
- * the input saves selected values to match. Defaults to checking for "id", "uuid", "path",
969
- * "title", then "name". Has no effect unless values is an array of objects, the key is used
970
- * instead for objects, and the value itself is used for primitive types.
971
- */
972
- value_key?: string;
973
- /**
974
- * Controls how selected items are rendered.
975
- */
976
- view?: 'card' | 'text' | 'gallery' | 'gallery-left';
977
- /**
978
- * Controls how selectable options are rendered.
979
- */
980
- picker_view?: 'card' | 'text' | 'gallery' | 'gallery-left';
981
- }
982
-
983
- export interface SelectInput extends BaseInput {
984
- type: 'select';
985
- /**
986
- * Options that are specific to this `type` of input.
987
- */
988
- options?: SelectInputOptions & WithEmptyTypeText;
989
- }
990
-
991
- export interface MultiselectInput extends BaseInput {
992
- type: 'multiselect';
993
- /**
994
- * Options that are specific to this `type` of input.
995
- */
996
- options?: SelectInputOptions & WithEmptyTypeArray;
997
- }
998
-
999
- export interface ChoiceInputOptions extends Omit<SelectInputOptions, 'allow_create'> {}
1000
-
1001
- export interface ChoiceInput extends BaseInput {
1002
- type: 'choice';
1003
- /**
1004
- * Options that are specific to this `type` of input.
1005
- */
1006
- options?: ChoiceInputOptions & WithEmptyTypeText;
1007
- }
1008
-
1009
- export interface MultichoiceInput extends BaseInput {
1010
- type: 'multichoice';
1011
- /**
1012
- * Options that are specific to this `type` of input.
1013
- */
1014
- options?: ChoiceInputOptions & WithEmptyTypeArray;
1015
- }
1016
-
1017
- export interface ObjectInputGroup {
1018
- /**
1019
- * The main text for the group shown when collapsed or expanded.
1020
- */
1021
- heading?: string;
1022
- /**
1023
- * Changes the subtext below the `heading`. Has no default. Supports a limited set of Markdown:
1024
- * links, bold, italic, subscript, superscript, and inline code elements are allowed.
1025
- */
1026
- comment?: string;
1027
- /**
1028
- * Controls if this group is collapsed or expanded when first viewed.
1029
- *
1030
- * @default false
1031
- */
1032
- collapsed?: boolean;
1033
- /**
1034
- * The keys of each input in this group.
1035
- */
1036
- inputs?: string[];
1037
- /**
1038
- * Provides a custom link for documentation for editors shown above the collection file list.
1039
- */
1040
- documentation?: Documentation;
1041
- }
1042
-
1043
- export interface ObjectInputOptions extends WithEmptyTypeObject, WithPreview {
1044
- /**
1045
- * Changes the appearance and behavior of the input.
1046
- *
1047
- * @default object
1048
- */
1049
- subtype?: 'object' | 'mutable' | 'tabbed';
1050
- /**
1051
- * Contains options for the "mutable" subtype.
1052
- */
1053
- entries?: {
1054
- /**
1055
- * Defines a limited set of keys that can exist on the data within an object input. This set is
1056
- * used when entries are added and renamed with `allow_create` enabled. Has no effect if
1057
- * `allow_create` is not enabled.
1058
- */
1059
- allowed_keys?: string[];
1060
- /**
1061
- * Limits available structures to specified keys.
1062
- */
1063
- assigned_structures?: Record<string, string[]>;
1064
- /**
1065
- * Provides data formats when adding entries to the data within this object input. When adding
1066
- * an entry, team members are prompted to choose from a number of values you have defined. Has
1067
- * no effect if `allow_create` is false. `entries.structures` applies to the entries within the
1068
- * object.
1069
- */
1070
- structures?: string | Structure;
1071
- };
1072
- /**
1073
- * Provides data formats for value of this object. When choosing an item, team members are
1074
- * prompted to choose from a number of values you have defined. `structures` applies to the object
1075
- * itself.
1076
- */
1077
- structures?: string | Structure;
1078
- /**
1079
- * Allows you to group the inputs inside this object together without changing the data structure.
1080
- */
1081
- groups?: ObjectInputGroup[];
1082
- /**
1083
- * Controls which order input groups and ungrouped inputs appear in.
1084
- *
1085
- * @default false
1086
- */
1087
- place_groups_below?: boolean;
1088
- /**
1089
- * Controls whether or not labels on mutable object entries are formatted.
1090
- *
1091
- * @default false
1092
- */
1093
- allow_label_formatting?: boolean;
1094
- /**
1095
- * Controls how object previews are rendered.
1096
- */
1097
- view?: 'card' | 'gallery' | 'gallery-left';
1098
- }
1099
-
1100
- export interface ObjectInput extends BaseInput {
1101
- type: 'object';
1102
- /**
1103
- * Options that are specific to this `type` of input.
1104
- */
1105
- options?: ObjectInputOptions;
1106
- }
1107
-
1108
- export interface ArrayInputOptions extends WithEmptyTypeArray {
1109
- /**
1110
- * Provides data formats for value of this object. When choosing an item, team members are
1111
- * prompted to choose from a number of values you have defined.
1112
- */
1113
- structures?: string | Structure;
1114
- }
1115
-
1116
- export interface ArrayInput extends BaseInput {
1117
- type: 'array';
1118
- /**
1119
- * Options that are specific to this `type` of input.
1120
- */
1121
- options?: ArrayInputOptions;
1122
- }
1123
-
1124
- export interface UnknownInput extends BaseInput {
1125
- type?: 'auto' | undefined;
1126
- }
1127
-
1128
- export type Input =
1129
- | BaseInput
1130
- | UnknownInput
1131
- | TextInput
1132
- | CodeInput
1133
- | ColorInput
1134
- | BooleanInput
1135
- | NumberInput
1136
- | RangeInput
1137
- | UrlInput
1138
- | RichTextInput
1139
- | DateInput
1140
- | TimeInput
1141
- | FileInput
1142
- | ImageInput
1143
- | SelectInput
1144
- | MultiselectInput
1145
- | ChoiceInput
1146
- | MultichoiceInput
1147
- | ObjectInput
1148
- | ArrayInput;
1149
-
1150
- export interface Paths {
1151
- /**
1152
- * Location of assets that are statically copied to the output site. This prefix will be removed
1153
- * from the _Uploads_ path when CloudCannon outputs the URL of an asset.
1154
- */
1155
- static?: string;
1156
- /**
1157
- * Default location of newly uploaded site files.
1158
- *
1159
- * @default uploads
1160
- */
1161
- uploads?: string;
1162
- /**
1163
- * Filename template for newly uploaded site files.
1164
- */
1165
- uploads_filename?: string;
1166
- /**
1167
- * Default location of newly uploaded DAM files.
1168
- */
1169
- dam_uploads?: string;
1170
- /**
1171
- * Filename template for newly uploaded DAM files.
1172
- */
1173
- dam_uploads_filename?: string;
1174
- /**
1175
- * Location of statically copied assets for DAM files. This prefix will be removed from the _DAM
1176
- * Uploads_ path when CloudCannon outputs the URL of an asset.
1177
- */
1178
- dam_static?: string;
1179
- /**
1180
- * When set to true, CloudCannon will reference files relative to the path of the file they were
1181
- * uploaded to.
1182
- */
1183
- uploads_use_relative_path?: boolean;
1184
- }
1185
-
1186
- export interface Documentation {
1187
- /**
1188
- * The "href" value of the link.
1189
- */
1190
- url: string;
1191
- /**
1192
- * The visible text used in the link.
1193
- */
1194
- text?: string;
1195
- /**
1196
- * The icon displayed next to the link.
1197
- *
1198
- * @default auto_stories
1199
- */
1200
- icon?: Icon;
1201
- }
1202
-
1203
- interface PreviewKeyEntry {
1204
- /**
1205
- * The key used to access the value used for the preview.
1206
- */
1207
- key: string;
1208
- }
1209
-
1210
- type PreviewEntry = Array<PreviewKeyEntry | string | boolean> | string | boolean;
1211
-
1212
- interface WithTextPreview {
1213
- /**
1214
- * Controls the main text shown per item.
1215
- */
1216
- text?: PreviewEntry;
1217
- }
1218
-
1219
- interface WithImagePreview {
1220
- /**
1221
- * Controls the image shown per item.
1222
- */
1223
- image?: PreviewEntry;
1224
- }
1225
-
1226
- interface WithSubtextPreview {
1227
- /**
1228
- * Controls the supporting text shown per item.
1229
- */
1230
- subtext?: PreviewEntry;
1231
- }
1232
-
1233
- interface WithIconPreview {
1234
- /**
1235
- * Controls the icon shown per item. Must result in a Material Icon name.
1236
- */
1237
- icon?: PreviewEntry;
1238
- }
1239
-
1240
- interface WithIconColorPreview {
1241
- /**
1242
- * Controls the color of the icon.
1243
- */
1244
- icon_color?: string;
1245
- }
1246
-
1247
- export interface PreviewGallery
1248
- extends WithTextPreview,
1249
- WithImagePreview,
1250
- WithIconPreview,
1251
- WithIconColorPreview {
1252
- /**
1253
- * Controls how the gallery image is positioned within the gallery.
1254
- *
1255
- * @default padded
1256
- */
1257
- fit?: 'padded' | 'cover' | 'contain' | 'cover-top';
1258
- }
1259
-
1260
- export interface PreviewMetadata
1261
- extends WithTextPreview,
1262
- WithImagePreview,
1263
- WithIconPreview,
1264
- WithIconColorPreview {}
1265
-
1266
- export interface Preview
1267
- extends WithTextPreview,
1268
- WithImagePreview,
1269
- WithIconPreview,
1270
- WithIconColorPreview,
1271
- WithSubtextPreview {
1272
- /**
1273
- * Defines a list of items that can contain an image, icon, and text.
1274
- */
1275
- metadata?: PreviewMetadata[];
1276
- /**
1277
- * Details for large image/icon preview per item.
1278
- */
1279
- gallery?: PreviewGallery;
1280
- }
1
+ import type { Cascade, EditorKey, ReducedCascade } from './cascade';
2
+ import type { Documentation } from './documentation';
3
+ import type { Icon } from './icon';
4
+ import type { Input } from './inputs';
5
+ import type { MarkdownSettings } from './markdown';
6
+ import type { WithPaths } from './paths';
7
+ import type { WithPreview } from './preview';
8
+ import type { SnippetConfig, SnippetsImports } from './snippets';
9
+ import type { SourceEditor } from './source-editor';
10
+ import type { StructureBase } from './structures';
11
+ import type { Timezone } from './timezone';
1281
12
 
1282
13
  export type HrefAddOption = {
1283
14
  /**
@@ -1337,44 +68,7 @@ export type AddOption = {
1337
68
  default_content_file?: string;
1338
69
  };
1339
70
 
1340
- interface WithPreview {
1341
- /**
1342
- * Changes the way items are previewed in the CMS.
1343
- */
1344
- preview?: Preview;
1345
- }
1346
-
1347
- interface WithPickerPreview {
1348
- /**
1349
- * Changes the way items are previewed in the CMS while being chosen.
1350
- */
1351
- picker_preview?: Preview;
1352
- }
1353
-
1354
- interface SchemaBase {
1355
- /**
1356
- * If true, inputs are sorted to match when editing. Extra inputs are ordered after expected
1357
- * inputs, unless `remove_extra_inputs` is true. Defaults to true.
1358
- */
1359
- reorder_inputs?: boolean;
1360
- /**
1361
- * Hides unexpected inputs when editing. Has no effect if `remove_extra_inputs` is true. Defaults
1362
- * to false.
1363
- */
1364
- hide_extra_inputs?: boolean;
1365
- /**
1366
- * If checked, empty inputs are removed from the source file on save. Removed inputs will be
1367
- * available for editing again, provided they are in the matching schema/structure. Defaults to
1368
- * false.
1369
- */
1370
- remove_empty_inputs?: boolean;
1371
- /**
1372
- * If checked, extra inputs are removed when editing. Defaults to true.
1373
- */
1374
- remove_extra_inputs?: boolean;
1375
- }
1376
-
1377
- export interface Schema extends Cascade, WithPreview, SchemaBase {
71
+ export interface Schema extends Cascade, WithPreview, StructureBase {
1378
72
  /**
1379
73
  * The path to the schema file. Relative to the root folder of the site.
1380
74
  */
@@ -1402,6 +96,8 @@ export interface Schema extends Cascade, WithPreview, SchemaBase {
1402
96
  new_preview_url?: string;
1403
97
  }
1404
98
 
99
+ export type SortOrder = 'ascending' | 'descending' | 'asc' | 'desc';
100
+
1405
101
  export interface Sort {
1406
102
  /**
1407
103
  * Defines what field contains the value to sort on inside each collection item's data.
@@ -1443,107 +139,421 @@ export interface Create extends ReducedCascade {
1443
139
 
1444
140
  export interface CollectionConfig extends Cascade, WithPreview {
1445
141
  /**
1446
- * The top-most folder where the files in this collection are stored. It is relative to `source`.
142
+ * This key defines the folder path for the collection key in which it is nested.
143
+ *
144
+ * The value for this key is relative to your Site `source`. Each Collection must have a unique
145
+ * path.
146
+ *
147
+ * This key has no default.
148
+ *
149
+ * https://cloudcannon.com/documentation/articles/collections-reference/#path
1447
150
  */
1448
151
  path: string;
1449
152
  /**
1450
- * Glob pattern(s) to include or exclude files from this collection. It is relative to `path`.
153
+ * This key defines globs which filter the files visible in the _Collection browser_ for a given
154
+ * Collection. Values in this array are relative to the Collection `path`.
155
+ *
156
+ * Globs can be positive (e.g. `*.yml`), or negative (e.g. `!**\/*.json`). Files are included in a
157
+ * Collection if they match any positive globs and do not match any negative globs. If you do not
158
+ * define any positive globs, CloudCannon will include all non-developer files in a Collection
159
+ * unless they match a negative glob.
160
+ *
161
+ * For more information about developer files, please read our documentation on the
162
+ * [`include_developer_files`](https://cloudcannon.com/documentation/articles/collections-reference/#include_developer_files)
163
+ * key.
164
+ *
165
+ * Defining a negative glob for a Collection does not remove a file from the associated Collection
166
+ * folder in your Git repository. Similarly, defining a positive glob for a file in a folder
167
+ * outside your Collection path does not move the file.
168
+ *
169
+ * This key has no default.
170
+ *
171
+ * https://cloudcannon.com/documentation/articles/collections-reference/#glob
1451
172
  */
1452
173
  glob?: string[] | string;
1453
174
  /**
1454
- * Used to build the url field for items in the collection. Similar to permalink in many SSGs.
1455
- * Defaults to '', in which case CloudCannon will attempt to guess the output URLs for each file.
175
+ * This key defines the output URL for files in a given Collection. CloudCannon uses the output
176
+ * URL in the Visual Editor, and when linking to your Testing Domain and Custom Domain.
177
+ *
178
+ * Values for this key can be a mix of plain text and template strings, and should begin with the
179
+ * `/` character. Template strings can contain data placeholders and fixed placeholders, which
180
+ * CloudCannon will replace with the data it references when generating the output URL.
181
+ *
182
+ * For more information about data placeholders and fixed placeholders, please read our
183
+ * documentation on [configuring your template
184
+ * strings](https://cloudcannon.com/documentation/articles/configure-your-template-strings/).
185
+ *
186
+ * This key has no default.
187
+ *
188
+ * https://cloudcannon.com/documentation/articles/collections-reference/#url
1456
189
  */
1457
190
  url?: string;
1458
191
  /**
1459
- * Prevents this collection from being assigned output URLs. Doing so will remove the Visual
1460
- * Editor as a possible option, and hide any UI elements referring to the output URL for a file.
192
+ * This key toggles whether CloudCannon will generate an output URL for a given Collection.
193
+ *
194
+ * Setting this key to `true` will prevent CloudCannon from generating an output URL for a
195
+ * Collection.
196
+ *
197
+ * By default, this key is `false` (i.e., generate an output URL for this Collection).
198
+ *
199
+ * https://cloudcannon.com/documentation/articles/collections-reference/#disable_url
200
+ *
201
+ * @default false
1461
202
  */
1462
203
  disable_url?: boolean;
1463
204
  /**
1464
- * If set, includes files usually reserved for your SSG and developer tooling as part of this
1465
- * collection. These files can then be filtered with `glob`.
205
+ * This key toggles whether CloudCannon removes developer files from your _Collection browser_.
206
+ * CloudCannon excludes files that probably shouldn't be edited in a CMS from your _Collection
207
+ * browser_, for example files like `README.md` or `package.json`. CloudCannon excludes these
208
+ * files even if you have configured globs to allow them.
209
+ *
210
+ * Setting this key to `true` will allow CloudCannon to show developer files, assuming they are
211
+ * not filtered out by any configured globs.
212
+ *
213
+ * By default, this key is `false` (i.e., do not include developer files).
214
+ *
215
+ * https://cloudcannon.com/documentation/articles/collections-reference/#include_developer_files
216
+ *
217
+ * @default false
1466
218
  */
1467
219
  include_developer_files?: boolean;
1468
220
  /**
1469
- * The display name of this collection. Used in headings and in the context menu for items in the
1470
- * collection. This is optional as CloudCannon auto-generates this from the collection key.
221
+ * This key defines the display name for a Collection. The name appears in the _Site Navigation_
222
+ * and at the top of the _Collection browser_. Changing the display name does not affect the
223
+ * Collection key name.
224
+ *
225
+ * By default, CloudCannon uses the Collection key name in title case (i.e., `blog_files` becomes
226
+ * "Blog Files").
227
+ *
228
+ * https://cloudcannon.com/documentation/articles/collections-reference/#name
1471
229
  */
1472
230
  name?: string;
1473
231
  /**
1474
- * Text or Markdown to show above the collection file list.
232
+ * This key defines the description text that appears on the _Collection browser_ page. Collection
233
+ * descriptions are useful for adding extra context for your team members.
234
+ *
235
+ * CloudCannon supports a limited selection of Markdown formatting for the value of this key:
236
+ * links, bold, italic, subscript, superscript, and inline code.
237
+ *
238
+ * This key has no default.
239
+ *
240
+ * https://cloudcannon.com/documentation/articles/collections-reference/#description
1475
241
  */
1476
242
  description?: string;
1477
243
  /**
1478
- * Sets an icon to use alongside references to this collection.
244
+ * This key defines the icon for a Collection. Collection icons appear in the _Site Navigation_
245
+ * and are the default icon for Collection file Cards if you have not defined `preview.icon`.
246
+ *
247
+ * For more information about the preview icon, please read our documentation on the
248
+ * [`preview`](https://cloudcannon.com/documentation/articles/configure-your-card-previews/) key.
249
+ *
250
+ * Values can be from [Google's Material Icons
251
+ * library](https://fonts.google.com/icons?icon.set=Material+Icons&icon.style=Rounded).
252
+ *
253
+ * By default, CloudCannon uses `notes` with some exceptions (e.g., `data_usage` for the `data`
254
+ * Collection).
255
+ *
256
+ * https://cloudcannon.com/documentation/articles/collections-reference/#icon
1479
257
  *
1480
258
  * @default notes
1481
259
  */
1482
260
  icon?: Icon;
1483
261
  /**
1484
- * Provides a custom link for documentation for editors shown above the collection file list.
262
+ * This key defines the documentation link at the top of a _Collection browser_. Collection
263
+ * documentation is useful for assisting your team members.
264
+ *
265
+ * The following nested keys are available:
266
+ *
267
+ * - `url` (required)
268
+ * - `text`
269
+ * - `icon`
270
+ *
271
+ * This key has no default.
272
+ *
273
+ * # Examples
274
+ *
275
+ * In this example, the documentation link for the `data` Collection goes to CloudCannon
276
+ * Documentation.
277
+ *
278
+ * ```yaml
279
+ * collections_config:
280
+ * data:
281
+ * documentation:
282
+ * url: https://cloudcannon.com/documentation/
283
+ * text: CloudCannon Documentation
284
+ * icon: star
285
+ * ```
286
+ *
287
+ * https://cloudcannon.com/documentation/articles/collections-reference/#documentation
1485
288
  */
1486
289
  documentation?: Documentation;
1487
290
  /**
1488
- * Sets the default sorting for the collection file list. Defaults to the first option in
1489
- * sort_options, then falls back descending path. As an exception, defaults to descending date for
1490
- * blog-like collections.
291
+ * This key defines how CloudCannon sorts your Collection files when you first open your
292
+ * _Collection browser_. Configuring this key allows you to sort your Collection using a
293
+ * structured data key in your files.
294
+ *
295
+ * The following nested keys are available:
296
+ *
297
+ * - `key` (required)
298
+ * - `order`
299
+ *
300
+ * By default, CloudCannon sorts your Collection files alphabetically by filename in ascending
301
+ * order by default. However, if you have configured the
302
+ * [`sort_options`](https://cloudcannon.com/documentation/articles/collections-reference/#sort_options)
303
+ * key, CloudCannon will use the first array item in `sort_options`.
304
+ *
305
+ * If you use the _Sort_ dropdown in your _Collection browser_ to order your Collection files,
306
+ * CloudCannon will preferentially use your most recent sorting method over the value configured
307
+ * in the `sort` key.
308
+ *
309
+ * https://cloudcannon.com/documentation/articles/collections-reference/#sort
1491
310
  */
1492
311
  sort?: Sort;
1493
312
  /**
1494
- * Controls the available options in the sort menu. Defaults to generating the options from the
1495
- * first item in the collection, falling back to ascending path and descending path.
313
+ * This key defines the options for the Sort dropdown in a _Collection browser_. Configuring sort
314
+ * options for a Collection will remove CloudCannon's default sorting options from the _Sort_
315
+ * dropdown.
316
+ *
317
+ * The following nested keys are available for each entry in the `sort_options` array:
318
+ *
319
+ * - `key` (required)
320
+ * - `order`
321
+ * - `label`
322
+ *
323
+ * By default, CloudCannon provides sorting options for path, file size, file creation time, and
324
+ * last modified, in ascending and descending order. CloudCannon will also read data keys from
325
+ * your early Collection files and provide options to sort by those key values.
326
+ *
327
+ * https://cloudcannon.com/documentation/articles/collections-reference/#sort_options
1496
328
  */
1497
329
  sort_options?: SortOption[];
1498
330
  /**
1499
- * Overrides the default singular display name of the collection. This is displayed in the
1500
- * collection add menu and file context menu.
331
+ * This key defines the singular noun for your Collection name. CloudCannon uses the singular noun
332
+ * in the _+ Add_ button in the top right of the _Collection browser_ when you select the option
333
+ * to add a new file. This is useful if your Collection name is an irregular plural (e.g.,
334
+ * "syllabi" or "syllabuses" to "syllabus").
335
+ *
336
+ * By default, CloudCannon creates a singular noun from the key, usually by removing the `s`
337
+ * character (e.g., "posts" to "post").
338
+ *
339
+ * This key has no default.
340
+ *
341
+ * https://cloudcannon.com/documentation/articles/collections-reference/#singular_name
1501
342
  */
1502
343
  singular_name?: string;
1503
344
  /**
1504
- * Changes the options presented in the add menu in the collection file list. Defaults to an
1505
- * automatically generated list from _Schemas_, or uses the first file in the collection if no
1506
- * schemas are configured.
345
+ * This key defines the options available in the _+ Add_ button dropdown at the top right of your
346
+ * _Collection browser_. Configuring add options for a Collection will remove CloudCannon's
347
+ * default "Add a file" option from the _+ Add_ button dropdown.
348
+ *
349
+ * The following nested keys are available for each standard entry in `add_options`:
350
+ *
351
+ * - `name`
352
+ * - `icon`
353
+ * - `editor`
354
+ * - `base_path`
355
+ * - `collection`
356
+ * - `schema`
357
+ * - `default_content_file`
358
+ *
359
+ * The following nested keys are available for each URL entry in `add_options`:
360
+ *
361
+ * - `name`
362
+ * - `icon`
363
+ * - `href`
364
+ *
365
+ * By default, CloudCannon adds the "Add a file" and "Create new folder" options to the _+ Add_
366
+ * dropdown. Additionally, any Schemas you have configured for a Collection will also appear in
367
+ * the _+ Add_ dropdown. For more information on these options, please read our reference
368
+ * documentation on
369
+ * [`disable_add`](https://cloudcannon.com/documentation/articles/collections-reference/#disable_add),
370
+ * [`disable_add_folder`](https://cloudcannon.com/documentation/articles/collections-reference/#disable_add_folder),
371
+ * and [`schemas`](https://cloudcannon.com/documentation/articles/schemas-reference/#schemas).
372
+ *
373
+ * # Examples
374
+ *
375
+ * In this example, we want team members in the `_posts` Collection to create new files in the
376
+ * `blog` subfolder of the `_drafts` Collection. CloudCannon will open these files in the [Content
377
+ * Editor](https://cloudcannon.com/documentation/articles/the-content-editor/).
378
+ *
379
+ * ```yaml
380
+ * collections_config:
381
+ * _posts:
382
+ * add_options:
383
+ * - name: Add draft blog
384
+ * icon: post_add
385
+ * editor: content
386
+ * base_path: /../_drafts/blog
387
+ * ```
388
+ *
389
+ * In this example, the _+ Add_ button dropdown in the team _Collection browser_ has a link to the
390
+ * Office Locations page on our live website.
391
+ *
392
+ * ```yaml
393
+ * collections_config:
394
+ * team:
395
+ * add_options:
396
+ * - name: Office Locations
397
+ * icon: map
398
+ * href: /our-offices
399
+ * ```
400
+ *
401
+ * https://cloudcannon.com/documentation/articles/collections-reference/#add_options
1507
402
  */
1508
403
  add_options?: (AddOption | HrefAddOption)[];
1509
404
  /**
1510
- * The create path definition to control where new files are saved to inside this collection.
1511
- * Defaults to [relative_base_path]/{title|slugify}.md.
405
+ * This key defines the path to which CloudCannon will save new files in a Collection. CloudCannon
406
+ * generates "Create Paths" when you open the _Review changes_ modal.
407
+ *
408
+ * The following nested keys are available:
409
+ *
410
+ * - `path` (required)
411
+ * - `extra_data`
412
+ * - `publish_to`
413
+ * - `_inputs`
414
+ * - `_select_data`
415
+ * - `_structures`
416
+ *
417
+ * This key has no default.
418
+ *
419
+ * For more information, please read our documentation on [Create
420
+ * Paths](https://cloudcannon.com/documentation/articles/set-the-path-for-new-files/).
421
+ *
422
+ * # Examples
423
+ *
424
+ * In this example, CloudCannon will generate a Create Path for new files in the `blog` Collection
425
+ * using the `date` and `title` structured data keys. For example, CloudCannon will generate a
426
+ * create path of `blog/2024-10-31-spooky-getaway.md` for a file with the date 31st October 2024
427
+ * and the title "Spooky Getaway".
428
+ *
429
+ * ```yaml
430
+ * collections_config:
431
+ * blog:
432
+ * create:
433
+ * extra_data:
434
+ * filename: '{date|year}-{date|month}-{date|day}-{title}'
435
+ * path: '[relative_base_path]/{filename|slugify}.[ext]'
436
+ * ```
437
+ *
438
+ * https://cloudcannon.com/documentation/articles/collections-reference/#create
1512
439
  */
1513
440
  create?: Create;
1514
441
  /**
1515
- * Prevents users from adding new files in the collection file list if true.
442
+ * This key toggles whether team members can use the _+ Add_ button in the top right of the
443
+ * _Collection browser_ to add files to a Collection. This key does not affect your ability to add
444
+ * files using the _File browser_.
445
+ *
446
+ * Setting this key to `true` will prevent team members from adding new files through the
447
+ * _Collection browser_.
448
+ *
449
+ * By default, this key is `false` (i.e., team members can add to the Collection) for most SSGs.
450
+ * For Eleventy, Hugo, and Jekyll, this key defaults to `true` for the data Collection (all
451
+ * subfolders in the `data` folder are non-output Collections).
452
+ *
453
+ * If both `disable_add` and `disable_add_folder` are set to `true`, and you have not defined any
454
+ * other `add_options`, then the _+ Add_ button will not appear in the top right of the
455
+ * _Collection browser_.
456
+ *
457
+ * https://cloudcannon.com/documentation/articles/collections-reference/#disable_add
1516
458
  */
1517
459
  disable_add?: boolean;
1518
460
  /**
1519
- * Prevents users from adding new folders in the collection file list if true.
461
+ * This key toggles whether team members can use the _+ Add_ button in the top right of the
462
+ * _Collection browser_ to add subfolders to a Collection. This key does not affect your ability
463
+ * to add subfolders using the _File browser_.
464
+ *
465
+ * Setting this key to `true` will prevent team members from adding new subfolders through the
466
+ * _Collection browser_.
467
+ *
468
+ * By default, this key is `false` (i.e., team members can add folders to the Collection) for most
469
+ * SSGs. For Eleventy, Hugo, and Jekyll, this key defaults to `true` for the `data` Collection
470
+ * (all subfolders in the `data` folder are non-output Collections).
471
+ *
472
+ * If both `disable_add` and `disable_add_folder` are set to `true`, and you have not defined any
473
+ * other `add_options`, then the _+ Add_ button will not appear in the top right of the
474
+ * _Collection browser_.
475
+ *
476
+ * https://cloudcannon.com/documentation/articles/collections-reference/#disable_add_folder
1520
477
  */
1521
478
  disable_add_folder?: boolean;
1522
479
  /**
1523
- * Prevents users from renaming, moving and deleting files in the collection file list if true.
480
+ * This key toggles whether team members can use the _+ Add_ button in the top right of the
481
+ * _Collection browser_ to add files to a Collection. This key does not affect your ability to add
482
+ * files using the _File browser_.
483
+ *
484
+ * Setting this key to `true` will prevent team members from adding new files through the
485
+ * _Collection browser_.
486
+ *
487
+ * By default, this key is `false` (i.e., team members can add to the Collection) for most SSGs.
488
+ * For Eleventy, Hugo, and Jekyll, this key defaults to `true` for the `data` Collection (all
489
+ * subfolders in the `data` folder are non-output Collections).
490
+ *
491
+ * If both `disable_add` and `disable_add_folder` are set to `true`, and you have not defined any
492
+ * other `add_options`, then the _+ Add_ button will not appear in the top right of the
493
+ * _Collection browser_.
494
+ *
495
+ * https://cloudcannon.com/documentation/articles/collections-reference/#disable_file_actions
1524
496
  */
1525
497
  disable_file_actions?: boolean;
1526
498
  /**
1527
- * Preview your unbuilt pages (e.g. drafts) to another page’s output URL. The Visual Editor will
1528
- * load that set preview URL and use the Data Bindings and Previews to render your new page
1529
- * without saving.
499
+ * This key defines a new URL for previewing your unbuilt pages in the [Visual
500
+ * Editor](https://cloudcannon.com/documentation/articles/the-visual-editor/). The Visual Editor
501
+ * will load the new preview URL and use Data Bindings and Previews to render your page without
502
+ * saving or building.
503
+ *
504
+ * This key does not affect the URL for your [Testing
505
+ * Domain](https://cloudcannon.com/documentation/articles/testing-domain/) or [Custom
506
+ * Domain](https://cloudcannon.com/documentation/articles/what-is-a-custom-domain/).
1530
507
  *
1531
- * For example new_preview_url: /about/ will load the /about/ URL on new or unbuilt pages in the
1532
- * Visual Editor.
508
+ * This key has no default.
509
+ *
510
+ * https://cloudcannon.com/documentation/articles/collections-reference/#new_preview_url
1533
511
  */
1534
512
  new_preview_url?: string;
1535
513
  /**
1536
- * The set of schemas for this collection. Schemas are used when creating and editing files in
1537
- * this collection. Each entry corresponds to a schema that describes a data structure for this
1538
- * collection.
1539
- *
1540
- * The keys in this object should match the values used for schema_key inside each of this
1541
- * collection's files. default is a special entry and is used when a file has no schema.
514
+ * This key defines which Schemas are available to populate files in this Collection. Defining a
515
+ * Schema for a collection will add it to the _+ Add_ button dropdown at the top right of the
516
+ * _Collection browser_.
517
+ *
518
+ * The following nested keys are available for each Schema insdie schemas:
519
+ *
520
+ * - `path`
521
+ * - `reorder_input`
522
+ * - `hide_extra_inputs`
523
+ * - `remove_empty_inputs`
524
+ * - `remove_extra_inputs`
525
+ * - `name`
526
+ * - `icon`
527
+ * - `preview`
528
+ * - `_editables`
529
+ * - `_enabled_editors`
530
+ * - `_inputs`
531
+ * - `_select_data`
532
+ * - `_structures`
533
+ * - `create`
534
+ * - `new_preview_url`
535
+ *
536
+ * This key has no default. If undefined, clicking the _+ Add_ button to add a new file to a
537
+ * Collection will clone the last file in the Collection and clear any markup content and the
538
+ * values of any structured data keys.
539
+ *
540
+ * For more information, please read our documentation on
541
+ * [Schemas](https://cloudcannon.com/documentation/articles/what-is-a-schema/).
542
+ *
543
+ * https://cloudcannon.com/documentation/articles/collections-reference/#schemas
1542
544
  */
1543
545
  schemas?: Record<string, Schema>;
1544
546
  /**
1545
- * The key used in each file to identify the schema that file uses. The value this key represents
1546
- * in each of this collection's files should match the keys in schemas. Defaults to _schema.
547
+ * This key defines the name for the structured data key that references the Schema a file uses.
548
+ * CloudCannon automatically adds this key to the top of your file when you create it using a
549
+ * Schema.
550
+ *
551
+ * Values which beginning with the `_` character are hidden from the Data Editor and the sidebar
552
+ * of the Content and Visual Editors.
553
+ *
554
+ * By default, this key is `_schema`.
555
+ *
556
+ * https://cloudcannon.com/documentation/articles/collections-reference/#schema_key
1547
557
  */
1548
558
  schema_key?: string;
1549
559
  }
@@ -1560,98 +570,6 @@ export interface CollectionGroup {
1560
570
  collections: string[];
1561
571
  }
1562
572
 
1563
- export interface Structure extends SchemaBase {
1564
- /**
1565
- * Defines what values are available to add when using this structure.
1566
- */
1567
- values: StructureValue[];
1568
- /**
1569
- * Defines what key should be used to detect which structure an item is. If this key is not found
1570
- * in the existing structure, a comparison of key names is used. Defaults to "_type".
1571
- */
1572
- id_key?: string;
1573
- /**
1574
- * Defines whether options are shown to your editors in a select menu (select, default) or a modal
1575
- * pop up window (modal) when adding a new item.
1576
- *
1577
- * @default select
1578
- */
1579
- style?: 'select' | 'modal';
1580
- }
1581
-
1582
- export interface StructureValue extends WithPreview, WithPickerPreview, SchemaBase, Cascade {
1583
- /**
1584
- * A unique reference value used when referring to this structure value from the Object input's
1585
- * assigned_structures option.
1586
- */
1587
- id?: string;
1588
- /**
1589
- * If set to true, this item will be considered the default type for this structure. If the type
1590
- * of a value within a structure cannot be inferred based on its id_key or matching fields, then
1591
- * it will fall back to this item. If multiple items have default set to true, only the first item
1592
- * will be used.
1593
- *
1594
- * @default false
1595
- */
1596
- default?: boolean;
1597
- /**
1598
- * An icon used when displaying the structure (defaults to either format_list_bulleted for items
1599
- * in arrays, or notes otherwise).
1600
- */
1601
- icon?: Icon;
1602
- /**
1603
- * Path to an image in your source files used when displaying the structure. Can be either a
1604
- * source (has priority) or output path.
1605
- */
1606
- image?: string;
1607
- /**
1608
- * Used as the main text in the interface for this value.
1609
- */
1610
- label?: string;
1611
- /**
1612
- * Used to group and filter items when selecting from a modal.
1613
- */
1614
- tags?: string[];
1615
- /**
1616
- * Allows you to group the inputs inside this object together without changing the data structure.
1617
- */
1618
- groups?: ObjectInputGroup[];
1619
- /**
1620
- * Controls which order input groups and ungrouped inputs appear in.
1621
- *
1622
- * @default false
1623
- */
1624
- place_groups_below?: boolean;
1625
- /**
1626
- * Show nested objects as tabs. Requires all top-level keys to be objects.
1627
- *
1628
- * @default false
1629
- */
1630
- tabbed?: boolean;
1631
- /**
1632
- * The actual value used when items are added after selection.
1633
- */
1634
- value: unknown;
1635
- /**
1636
- * Provides short descriptive text for editors shown in the Data Editor for expanded values
1637
- * matching this Structure value. Has no default. Supports a limited set of Markdown: links, bold,
1638
- * italic, subscript, superscript, and inline code elements are allowed.
1639
- */
1640
- comment?: string;
1641
- /**
1642
- * Provides a custom link for documentation for editors shown in the Data Editor for expanded
1643
- * values matching this Structure value. Has no default.
1644
- */
1645
- documentation?: Documentation;
1646
- }
1647
-
1648
- export type SelectValues =
1649
- | string[]
1650
- | Record<string, string>[]
1651
- | Record<string, string>
1652
- | Record<string, unknown>[]
1653
- | Record<string, unknown>;
1654
-
1655
573
  export interface DataConfigEntry {
1656
574
  /**
1657
575
  * The path to a file or folder of files containing data.
@@ -1676,27 +594,6 @@ export interface Editor {
1676
594
  default_path: string;
1677
595
  }
1678
596
 
1679
- export interface SourceEditor {
1680
- /**
1681
- * Defines how many spaces lines are auto indented by, and/or how many spaces tabs are shown as.
1682
- *
1683
- * @default 2
1684
- */
1685
- tab_size?: number;
1686
- /**
1687
- * Changes the color scheme for syntax highlighting in the editor.
1688
- *
1689
- * @default monokai
1690
- */
1691
- theme?: Theme;
1692
- /**
1693
- * Toggles displaying line numbers and code folding controls in the editor.
1694
- *
1695
- * @default true
1696
- */
1697
- show_gutter?: boolean;
1698
- }
1699
-
1700
597
  export interface CommitTemplate {
1701
598
  /**
1702
599
  * Used to identify a commit template when multiple commit templates are available.
@@ -1725,6 +622,10 @@ export interface CommitTemplate {
1725
622
  * The base format for the configuration file.
1726
623
  */
1727
624
  export interface Configuration extends Cascade, WithPaths {
625
+ /**
626
+ * Controls which schema this file is validated against. Defaults to the latest schema.
627
+ */
628
+ version?: 'latest';
1728
629
  /**
1729
630
  * This key defines the base path for your source files, relative to the root folder of your
1730
631
  * repository. Unless you use a nested folder as the source for your Site you can leave this key
@@ -1775,7 +676,17 @@ export interface Configuration extends Cascade, WithPaths {
1775
676
  */
1776
677
  editor?: Editor;
1777
678
  /**
1778
- * Settings for the behavior and appearance of the Source Editor.
679
+ * This key defines the appearance and behavior of the Source Editor. The following nested keys
680
+ * are available:
681
+ *
682
+ * - `tab_size`
683
+ * - `show_gutter`
684
+ * - `theme`
685
+ *
686
+ * This key has no default.
687
+ *
688
+ * For more information, please read our documentation on the [Source
689
+ * Editor](https://cloudcannon.com/documentation/articles/the-source-editor/).
1779
690
  *
1780
691
  * https://cloudcannon.com/documentation/articles/configuration-file-reference/#source_editor
1781
692
  */