@cloudcannon/configuration-types 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import Scrapbooker from '@cloudcannon/snippet-types';
2
+
1
3
  import type { Icon } from './icon';
2
4
  import type { Timezone } from './timezone';
3
5
  import type { MimeType } from './mime-type';
@@ -5,46 +7,189 @@ import type { Theme } from './theme';
5
7
  import type { Syntax } from './syntax';
6
8
 
7
9
  export type { Icon, Timezone, MimeType, Theme, Syntax };
8
-
9
10
  export type InstanceValue = 'UUID' | 'NOW';
10
-
11
11
  export type EditorKey = 'visual' | 'content' | 'data';
12
-
13
12
  export type SortOrder = 'ascending' | 'descending' | 'asc' | 'desc';
14
13
 
14
+ // TODO: use SnippetConfig from @cloudcannon/scrap-booker when ParserConfig issue resolved.
15
+ interface SnippetConfig extends ReducedCascade, Previewable, PickerPreviewable {
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
+ * Whether this snippet treats whitespace as-is or not.
31
+ */
32
+ strict_whitespace?: boolean;
33
+ /**
34
+ * The variables required for the selected template.
35
+ */
36
+ definitions?: Record<string, any>;
37
+ /**
38
+ * Alternate configurations for this snippet.
39
+ */
40
+ alternate_formats?: SnippetConfig[];
41
+ /**
42
+ * The parameters of this snippet.
43
+ */
44
+ params?: Record<string, any>; // TODO: use ParserConfig from @cloudcannon/scrap-booker.
45
+ }
46
+
47
+ type SnippetImportKey = keyof typeof Scrapbooker.defaults;
48
+
49
+ interface SnippetsImport<T> {
50
+ /**
51
+ * The list of excluded snippets. If unset, all snippets are excluded unless defined in `include`.
52
+ */
53
+ exclude?: Array<T>;
54
+ /**
55
+ * The list of included snippets. If unset, all snippets are included unless defined in `exclude`.
56
+ */
57
+ include?: Array<T>;
58
+ }
59
+
60
+ export interface SnippetsImports {
61
+ /**
62
+ * Default snippets for Hugo SSG.
63
+ */
64
+ hugo?: boolean | SnippetsImport<keyof typeof Scrapbooker.defaults.hugo.snippets>;
65
+ /**
66
+ * Default snippets for Jekyll SSG.
67
+ */
68
+ jekyll?: boolean | SnippetsImport<keyof typeof Scrapbooker.defaults.jekyll.snippets>;
69
+ /**
70
+ * Default snippets for MDX-based content.
71
+ */
72
+ mdx?: boolean | SnippetsImport<keyof typeof Scrapbooker.defaults.mdx.snippets>;
73
+ /**
74
+ * Default snippets for Eleventy SSG Liquid files.
75
+ */
76
+ eleventy_liquid?:
77
+ | boolean
78
+ | SnippetsImport<keyof typeof Scrapbooker.defaults.eleventy_liquid.snippets>;
79
+ /**
80
+ * Default snippets for Eleventy SSG Nunjucks files.
81
+ */
82
+ eleventy_nunjucks?:
83
+ | boolean
84
+ | SnippetsImport<keyof typeof Scrapbooker.defaults.eleventy_nunjucks.snippets>;
85
+ /**
86
+ * Default snippets for Markdoc-based content.
87
+ */
88
+ markdoc?: boolean | SnippetsImport<keyof typeof Scrapbooker.defaults.markdoc.snippets>;
89
+ /**
90
+ * Default snippets for content using Python markdown extensions.
91
+ */
92
+ python_markdown_extensions?:
93
+ | boolean
94
+ | SnippetsImport<keyof typeof Scrapbooker.defaults.python_markdown_extensions.snippets>;
95
+ /**
96
+ * Default snippets for Docusaurus SSG.
97
+ */
98
+ docusaurus_mdx?:
99
+ | boolean
100
+ | SnippetsImport<keyof typeof Scrapbooker.defaults.docusaurus_mdx.snippets>;
101
+ }
102
+
103
+ interface WithSnippets {
104
+ /**
105
+ * Configuration for custom snippets.
106
+ */
107
+ _snippets?: Record<string, SnippetConfig>;
108
+ /**
109
+ * Provides control over which snippets are available to use and/or extend within `_snippets`.
110
+ */
111
+ _snippets_imports?: SnippetsImports;
112
+ /**
113
+ * Extended option used when creating more complex custom snippets.
114
+ */
115
+ _snippets_templates?: Record<string, SnippetConfig>;
116
+ /**
117
+ * Extended option used when creating more complex custom snippets.
118
+ */
119
+ _snippets_definitions?: Record<string, SnippetConfig>;
120
+ }
121
+
15
122
  interface ImageResizeable {
16
123
  /**
17
- * Sets the format images are converted to prior to upload. The extension of the file is updated to match. Defaults to keeping the mime type of the uploaded file.
124
+ * Sets the format images are converted to prior to upload. The extension of the file is updated
125
+ * to match. Defaults to keeping the mime type of the uploaded file.
18
126
  */
19
127
  mime_type?: 'image/jpeg' | 'image/png';
20
128
  /**
21
- * Controls whether or not the JPEG headers defining how an image should be rotated before being displayed is baked into images prior to upload.
129
+ * Controls whether or not the JPEG headers defining how an image should be rotated before being
130
+ * displayed is baked into images prior to upload.
131
+ *
22
132
  * @default true
23
133
  */
24
134
  correct_orientation?: boolean;
25
135
  /**
26
- * Sets how uploaded image files are resized with a bounding box defined by width and height prior to upload. Has no effect when selecting existing images, or if width and height are unset.
136
+ * Sets how uploaded image files are resized with a bounding box defined by width and height prior
137
+ * to upload. Has no effect when selecting existing images, or if width and height are unset.
138
+ *
27
139
  * @default 'contain'
28
140
  */
29
- resize_style?: 'cover' | 'contain' | 'stretch';
141
+ resize_style?: 'cover' | 'contain' | 'stretch' | 'crop';
30
142
  /**
31
- * Defines the width of the bounding box used in the image resizing process defined with resize_style.
143
+ * Defines the width of the bounding box used in the image resizing process defined with
144
+ * resize_style.
32
145
  */
33
146
  width?: number;
34
147
  /**
35
- * Defines the height of the bounding box used in the image resizing process defined with resize_style.
148
+ * Defines the height of the bounding box used in the image resizing process defined with
149
+ * resize_style.
36
150
  */
37
151
  height?: number;
38
152
  /**
39
- * Controls whether or not images can be upscaled to fit the bounding box during resize prior to upload. Has no effect if files are not resized.
153
+ * Controls whether or not images can be upscaled to fit the bounding box during resize prior to
154
+ * upload. Has no effect if files are not resized.
155
+ *
40
156
  * @default false
41
157
  */
42
158
  expandable?: boolean;
43
159
  /**
44
- * Instructs the editor to save `width` and `height` attributes on the image elements. This can prevent pop-in as a page loads.
160
+ * Instructs the editor to save `width` and `height` attributes on the image elements. This can
161
+ * prevent pop-in as a page loads.
162
+ *
45
163
  * @default true
46
164
  */
47
165
  image_size_attributes?: boolean;
166
+ /**
167
+ * If you have one or more DAMs connected to your site, you can use this key to list which asset
168
+ * sources can be uploaded to and selected from.
169
+ */
170
+ allowed_sources?: string[];
171
+ /**
172
+ * Enable to skip the image resizing process configured for this input when selecting existing
173
+ * images.
174
+ *
175
+ * @default false
176
+ */
177
+ prevent_resize_existing_files?: boolean;
178
+ /**
179
+ * Definitions for creating additional images of different sizes when uploading or selecting
180
+ * existing files.
181
+ */
182
+ sizes?: {
183
+ /**
184
+ * A number suffixed with "x" (relative size) or "w" (fixed width) for setting the dimensions of
185
+ * the image (e.g. 2x, 3x, 100w, 360w).
186
+ */
187
+ size: 'string';
188
+ /**
189
+ * A reference to another input that is given the path to this additional image file.
190
+ */
191
+ target?: 'string';
192
+ };
48
193
  }
49
194
 
50
195
  export interface Editables {
@@ -76,23 +221,30 @@ export interface BlockEditable extends ImageResizeable, TextEditable {
76
221
  */
77
222
  blockquote?: boolean;
78
223
  /**
79
- * Enables a control to insert an unordered list, or to convert selected blocks of text into a unordered list.
224
+ * Enables a control to insert an unordered list, or to convert selected blocks of text into a
225
+ * unordered list.
80
226
  */
81
227
  bulletedlist?: boolean;
82
228
  /**
83
- * Enables a control to center align text by toggling a class name for a block of text. The value is the class name the editor should add to align the text. The styles for this class need to be listed in the `styles` file to take effect outside of the input.
229
+ * Enables a control to center align text by toggling a class name for a block of text. The value
230
+ * is the class name the editor should add to align the text. The styles for this class need to be
231
+ * listed in the `styles` file to take effect outside of the input.
84
232
  */
85
233
  center?: string;
86
234
  /**
87
- * Enables a control to set selected text to inline code, and unselected blocks of text to code blocks.
235
+ * Enables a control to set selected text to inline code, and unselected blocks of text to code
236
+ * blocks.
88
237
  */
89
238
  code?: boolean;
90
239
  /**
91
- * Enables a control to insert a region of raw HTML, including YouTube, Vimeo, Tweets, and other media. Embedded content is sanitized to mitigate XSS risks, which includes removing style tags. Embeds containing script tags are not loaded in the editor.
240
+ * Enables a control to insert a region of raw HTML, including YouTube, Vimeo, Tweets, and other
241
+ * media. Embedded content is sanitized to mitigate XSS risks, which includes removing style tags.
242
+ * Embeds containing script tags are not loaded in the editor.
92
243
  */
93
244
  embed?: boolean;
94
245
  /**
95
- * Enables a drop down menu for structured text. Has options for "p", "h1", "h2", "h3", "h4", "h5", "h6", "pre", "address", and "div". Set as space separated options (e.g. "p h1 h2").
246
+ * Enables a drop down menu for structured text. Has options for "p", "h1", "h2", "h3", "h4",
247
+ * "h5", "h6". Set as space separated options (e.g. "p h1 h2").
96
248
  */
97
249
  format?: string;
98
250
  /**
@@ -108,15 +260,20 @@ export interface BlockEditable extends ImageResizeable, TextEditable {
108
260
  */
109
261
  indent?: boolean;
110
262
  /**
111
- * Enables a control to justify text by toggling a class name for a block of text. The value is the class name the editor should add to justify the text. The styles for this class need to be listed in the `styles` file to take effect outside of the input.
263
+ * Enables a control to justify text by toggling a class name for a block of text. The value is
264
+ * the class name the editor should add to justify the text. The styles for this class need to be
265
+ * listed in the `styles` file to take effect outside of the input.
112
266
  */
113
267
  justify?: string;
114
268
  /**
115
- * Enables a control to left align text by toggling a class name for a block of text. The value is the class name the editor should add to align the text. The styles for this class need to be listed in the `styles` file to take effect outside of the input.
269
+ * Enables a control to left align text by toggling a class name for a block of text. The value is
270
+ * the class name the editor should add to align the text. The styles for this class need to be
271
+ * listed in the `styles` file to take effect outside of the input.
116
272
  */
117
273
  left?: string;
118
274
  /**
119
- * Enables a control to insert a numbered list, or to convert selected blocks of text into a numbered list.
275
+ * Enables a control to insert a numbered list, or to convert selected blocks of text into a
276
+ * numbered list.
120
277
  */
121
278
  numberedlist?: boolean;
122
279
  /**
@@ -124,7 +281,9 @@ export interface BlockEditable extends ImageResizeable, TextEditable {
124
281
  */
125
282
  outdent?: boolean;
126
283
  /**
127
- * Enables a control to right align text by toggling a class name for a block of text. The value is the class name the editor should add to align the text. The styles for this class need to be listed in the `styles` file to take effect outside of the input.
284
+ * Enables a control to right align text by toggling a class name for a block of text. The value
285
+ * is the class name the editor should add to align the text. The styles for this class need to be
286
+ * listed in the `styles` file to take effect outside of the input.
128
287
  */
129
288
  right?: string;
130
289
  /**
@@ -132,18 +291,23 @@ export interface BlockEditable extends ImageResizeable, TextEditable {
132
291
  */
133
292
  snippet?: boolean;
134
293
  /**
135
- * Enables a drop down menu for editors to style selected text or blocks or text. Styles are the combination of an element and class name. The value for this option is the path (either source or build output) to the CSS file containing the styles.
294
+ * Enables a drop down menu for editors to style selected text or blocks or text. Styles are the
295
+ * combination of an element and class name. The value for this option is the path (either source
296
+ * or build output) to the CSS file containing the styles.
136
297
  */
137
298
  styles?: string;
138
299
  /**
139
- * Enables a control to insert a table. Further options for table cells are available in the context menu for cells within the editor.
300
+ * Enables a control to insert a table. Further options for table cells are available in the
301
+ * context menu for cells within the editor.
140
302
  */
141
303
  table?: boolean;
142
304
  }
143
305
 
144
306
  interface WithReducedPaths {
145
307
  /**
146
- * Paths to where new asset files are uploaded to. They also set the default path when choosing existing images, and linking to existing files. Each path is relative to global `source`. Defaults to the global `paths`.
308
+ * Paths to where new asset files are uploaded to. They also set the default path when choosing
309
+ * existing images, and linking to existing files. Each path is relative to global `source`.
310
+ * Defaults to the global `paths`.
147
311
  */
148
312
  paths?: ReducedPaths;
149
313
  }
@@ -158,7 +322,9 @@ export interface TextEditable extends WithReducedPaths {
158
322
  */
159
323
  bold?: boolean;
160
324
  /**
161
- * Enables a control to copy formatting from text to other text. Only applies to formatting from `bold`, `italic`, `underline`, `strike`, `subscript`, and `superscript`. Does not copy other styles or formatting.
325
+ * Enables a control to copy formatting from text to other text. Only applies to formatting from
326
+ * `bold`, `italic`, `underline`, `strike`, `subscript`, and `superscript`. Does not copy other
327
+ * styles or formatting.
162
328
  */
163
329
  copyformatting?: boolean;
164
330
  /**
@@ -170,11 +336,14 @@ export interface TextEditable extends WithReducedPaths {
170
336
  */
171
337
  link?: boolean;
172
338
  /**
173
- * Enables a control to redo recent edits undone with undo. Redo is always enabled through standard OS-specific keyboard shortcuts.
339
+ * Enables a control to redo recent edits undone with undo. Redo is always enabled through
340
+ * standard OS-specific keyboard shortcuts.
174
341
  */
175
342
  redo?: boolean;
176
343
  /**
177
- * Enables the control to remove formatting from text. Applies to formatting from `bold`, `italic`, `underline`, `strike`, `subscript`, and `superscript`. Does not remove other styles or formatting.
344
+ * Enables the control to remove formatting from text. Applies to formatting from `bold`,
345
+ * `italic`, `underline`, `strike`, `subscript`, and `superscript`. Does not remove other styles
346
+ * or formatting.
178
347
  */
179
348
  removeformat?: boolean;
180
349
  /**
@@ -194,9 +363,21 @@ export interface TextEditable extends WithReducedPaths {
194
363
  */
195
364
  underline?: boolean;
196
365
  /**
197
- * Enables a control to undo recent edits. Undo is always enabled through standard OS-specific keyboard shortcuts.
366
+ * Enables a control to undo recent edits. Undo is always enabled through standard OS-specific
367
+ * keyboard shortcuts.
198
368
  */
199
369
  undo?: boolean;
370
+ /**
371
+ * Defines if the content should be stripped of "custom markup". It is recommended to have this
372
+ * option turned on once you have all of your rich text options configured. Having
373
+ * `allow_custom_markup` turned on disables this option. Defaults to false.
374
+ */
375
+ remove_custom_markup?: boolean;
376
+ /**
377
+ * Defines if the content can contain "custom markup". It is not recommended to have this option
378
+ * turned on. Defaults to true for non-content editable regions, false otherwise.
379
+ */
380
+ allow_custom_markup?: boolean;
200
381
  }
201
382
 
202
383
  export interface ReducedCascade {
@@ -205,28 +386,39 @@ export interface ReducedCascade {
205
386
  */
206
387
  _inputs?: Record<string, Input>;
207
388
  /**
208
- * Fixed datasets that can be referenced by the *Values* configuration for *Select* and *Multiselect* inputs.
389
+ * Fixed datasets that can be referenced by the _Values_ configuration for _Select_ and
390
+ * _Multiselect_ inputs.
209
391
  */
210
392
  _select_data?: Record<string, SelectValues>;
211
393
  /**
212
- * Structured values for editors adding new items to arrays and objects. Entries here can be referenced in the configuration for `array` or `object` inputs.
394
+ * Structured values for editors adding new items to arrays and objects. Entries here can be
395
+ * referenced in the configuration for `array` or `object` inputs.
213
396
  */
214
397
  _structures?: Record<string, Structure>;
215
398
  }
216
399
 
217
400
  export interface Cascade extends ReducedCascade {
218
401
  /**
219
- * Set a preferred editor and/or disable the others. The first value sets which editor opens by default, and the following values specify which editors are accessible.
402
+ * Set a preferred editor and/or disable the others. The first value sets which editor opens by
403
+ * default, and the following values specify which editors are accessible.
220
404
  */
221
405
  _enabled_editors?: Array<EditorKey>;
222
406
  /**
223
407
  * Contains input options for Editable Regions and the Content Editor.
224
408
  */
225
409
  _editables?: Editables;
226
-
227
- _array_structures?: Record<string, unknown>; // Legacy
228
- _comments?: Record<string, string>; // Legacy
229
- _options?: Record<string, Record<string, unknown>>; // Legacy
410
+ /**
411
+ * [DEPRECATED] Now known as _structures.
412
+ */
413
+ _array_structures?: Record<string, unknown>;
414
+ /**
415
+ * [DEPRECATED] Now part of _inputs.*.comment.
416
+ */
417
+ _comments?: Record<string, string>;
418
+ /**
419
+ * [DEPRECATED] Now part of _inputs.*.options.
420
+ */
421
+ _options?: Record<string, Record<string, unknown>>;
230
422
  }
231
423
 
232
424
  export type InputType =
@@ -279,24 +471,54 @@ export interface BaseInput<InputOptions = BaseInputOptions> {
279
471
  */
280
472
  type?: InputType;
281
473
  /**
282
- * Changes the subtext below the *Label*. Has no default. Supports a limited set of Markdown: links, bold, italic, subscript, superscript, and inline code elements are allowed.
474
+ * Changes the subtext below the _Label_. Has no default. Supports a limited set of Markdown:
475
+ * links, bold, italic, subscript, superscript, and inline code elements are allowed.
283
476
  */
284
477
  comment?: string;
478
+ /**
479
+ * Adds an expandable section of rich text below the input.
480
+ */
481
+ context?: {
482
+ /**
483
+ * The rich text content shown when opened. Supports a limited set of Markdown.
484
+ */
485
+ content?: string;
486
+ /**
487
+ * Makes the content visible initially.
488
+ */
489
+ open?: boolean;
490
+ /**
491
+ * The text shown when not open. Defaults to "Context" if unset.
492
+ */
493
+ title?: string;
494
+ /**
495
+ * The icon shown when not open.
496
+ */
497
+ icon?: Icon;
498
+ };
499
+ /**
500
+ * Provides a custom link for documentation for editors shown above input.
501
+ */
502
+ documentation?: Documentation;
285
503
  /**
286
504
  * Optionally changes the text above this input.
287
505
  */
288
506
  label?: string;
289
507
  /**
290
508
  * Toggles the visibility of this input.
509
+ *
291
510
  * @default false
292
511
  */
293
512
  hidden?: boolean | string;
294
513
  /**
295
- * Controls if and how the value of this input is instantiated when created. This occurs when creating files, or adding array items containing the configured input.
514
+ * Controls if and how the value of this input is instantiated when created. This occurs when
515
+ * creating files, or adding array items containing the configured input.
296
516
  */
297
517
  instance_value?: InstanceValue;
298
518
  /**
299
- * Specifies whether or not this input configuration should be merged with any matching, less specific configuration.
519
+ * Specifies whether or not this input configuration should be merged with any matching, less
520
+ * specific configuration.
521
+ *
300
522
  * @default true
301
523
  */
302
524
  cascade?: boolean;
@@ -316,7 +538,6 @@ export interface TextInputOptions extends BaseInputOptions {
316
538
  export interface TextInput extends BaseInput<TextInputOptions> {
317
539
  type:
318
540
  | 'text'
319
- | 'textarea'
320
541
  | 'email'
321
542
  | 'disabled'
322
543
  | 'pinterest'
@@ -326,19 +547,36 @@ export interface TextInput extends BaseInput<TextInputOptions> {
326
547
  | 'instagram';
327
548
  }
328
549
 
550
+ export interface TextareaInputOptions extends TextInputOptions {
551
+ /**
552
+ * Shows a character counter below the input if enabled.
553
+ */
554
+ show_count?: boolean;
555
+ }
556
+
557
+ export interface TextareaInput extends BaseInput<TextareaInputOptions> {
558
+ type: 'textarea';
559
+ }
560
+
329
561
  export interface CodeInputOptions extends BaseInputOptions, SourceEditor {
330
562
  /**
331
- * Sets the maximum number of visible lines for this input, effectively controlling maximum height. When the containing text exceeds this number, the input becomes a scroll area.
563
+ * Sets the maximum number of visible lines for this input, effectively controlling maximum
564
+ * height. When the containing text exceeds this number, the input becomes a scroll area.
565
+ *
332
566
  * @default 30
333
567
  */
334
568
  max_visible_lines?: number;
335
569
  /**
336
- * Sets the minimum number of visible lines for this input, effectively controlling initial height. When the containing text exceeds this number, the input grows line by line to the lines defined by `max_visible_lines`.
570
+ * Sets the minimum number of visible lines for this input, effectively controlling initial
571
+ * height. When the containing text exceeds this number, the input grows line by line to the lines
572
+ * defined by `max_visible_lines`.
573
+ *
337
574
  * @default 10
338
575
  */
339
576
  min_visible_lines?: number;
340
577
  /**
341
- * Changes how the editor parses your content for syntax highlighting. Should be set to the language of the code going into the input.
578
+ * Changes how the editor parses your content for syntax highlighting. Should be set to the
579
+ * language of the code going into the input.
342
580
  */
343
581
  syntax?: Syntax;
344
582
  }
@@ -349,11 +587,13 @@ export interface CodeInput extends BaseInput<CodeInputOptions> {
349
587
 
350
588
  export interface ColorInputOptions extends BaseInputOptions {
351
589
  /**
352
- * Sets what format the color value is saved as. Defaults to the naming convention, or HEX if that is unset.
590
+ * Sets what format the color value is saved as. Defaults to the naming convention, or HEX if that
591
+ * is unset.
353
592
  */
354
593
  format?: 'rgb' | 'hex' | 'hsl' | 'hsv';
355
594
  /**
356
- * Toggles showing a control for adjusting the transparency of the selected color. Defaults to using the naming convention, enabled if the input key ends with "a".
595
+ * Toggles showing a control for adjusting the transparency of the selected color. Defaults to
596
+ * using the naming convention, enabled if the input key ends with "a".
357
597
  */
358
598
  alpha?: boolean;
359
599
  }
@@ -372,7 +612,8 @@ export interface NumberInputOptions extends BaseInputOptions<EmptyTypeNumber> {
372
612
  */
373
613
  max?: number;
374
614
  /**
375
- * A number that specifies the granularity that the value must adhere to, or the special value any, which allows any decimal value between `max` and `min`.
615
+ * A number that specifies the granularity that the value must adhere to, or the special value
616
+ * any, which allows any decimal value between `max` and `min`.
376
617
  */
377
618
  step?: number;
378
619
  }
@@ -402,10 +643,6 @@ export interface RichTextInputOptions extends BaseInputOptions, ImageResizeable,
402
643
  * Shows or hides the resize handler to vertically resize the input.
403
644
  */
404
645
  allow_resize?: boolean;
405
- /**
406
- * If you have one or more DAMs connected to your site, you can use this key to list which asset sources can be uploaded to and selected from.
407
- */
408
- allowed_sources?: string[];
409
646
  /**
410
647
  * Defines the initial height of this input in pixels (px).
411
648
  */
@@ -418,7 +655,8 @@ export interface RichTextInput extends BaseInput<RichTextInputOptions> {
418
655
 
419
656
  export interface DateInputOptions extends BaseInputOptions {
420
657
  /**
421
- * Specifies the time zone that dates are displayed and edited in. Also changes the suffix the date is persisted to the file with. Defaults to the global `timezone`.
658
+ * Specifies the time zone that dates are displayed and edited in. Also changes the suffix the
659
+ * date is persisted to the file with. Defaults to the global `timezone`.
422
660
  */
423
661
  timezone?: Timezone;
424
662
  }
@@ -447,22 +685,28 @@ export interface ImageInput extends BaseInput<ImageInputOptions> {
447
685
  export interface SelectInputOptions<EmptyType = EmptyTypeText> extends BaseInputOptions<EmptyType> {
448
686
  /**
449
687
  * Allows new text values to be created at edit time.
688
+ *
450
689
  * @default false
451
690
  */
452
691
  allow_create?: boolean;
453
692
  /**
454
693
  * Provides an empty option alongside the options provided by values.
694
+ *
455
695
  * @default true
456
696
  */
457
697
  allow_empty?: boolean;
458
698
  /**
459
- * Defines the values available to choose from. Optional, defaults to fetching values from the naming convention (e.g. colors or my_colors for data set colors).
699
+ * Defines the values available to choose from. Optional, defaults to fetching values from the
700
+ * naming convention (e.g. colors or my_colors for data set colors).
460
701
  */
461
- values: SelectValues;
702
+ values?: SelectValues;
462
703
  /**
463
- * Defines the key used for mapping between saved values and objects in values. This changes how the input saves selected values to match. Defaults to checking for "id", "uuid", "path", "title", then "name". Has no effect unless values is an array of objects, the key is used instead for objects, and the value itself is used for primitive types.
704
+ * Defines the key used for mapping between saved values and objects in values. This changes how
705
+ * the input saves selected values to match. Defaults to checking for "id", "uuid", "path",
706
+ * "title", then "name". Has no effect unless values is an array of objects, the key is used
707
+ * instead for objects, and the value itself is used for primitive types.
464
708
  */
465
- value_key: string;
709
+ value_key?: string;
466
710
  }
467
711
 
468
712
  export interface SelectInput extends BaseInput<SelectInputOptions> {
@@ -480,7 +724,7 @@ export interface ChoiceInputOptions<EmptyType = EmptyTypeText>
480
724
  /**
481
725
  * The preview definition for changing the way selected and available options are displayed.
482
726
  */
483
- preview: SelectPreview;
727
+ preview?: SelectPreview;
484
728
  }
485
729
 
486
730
  export interface ChoiceInput extends BaseInput<ChoiceInputOptions> {
@@ -503,7 +747,9 @@ export interface ObjectInputOptions extends BaseInputOptions<EmptyTypeObject> {
503
747
  */
504
748
  entries?: {
505
749
  /**
506
- * Defines a limited set of keys that can exist on the data within an object input. This set is used when entries are added and renamed with `allow_create` enabled. Has no effect if `allow_create` is not enabled.
750
+ * Defines a limited set of keys that can exist on the data within an object input. This set is
751
+ * used when entries are added and renamed with `allow_create` enabled. Has no effect if
752
+ * `allow_create` is not enabled.
507
753
  */
508
754
  allowed_keys?: string[];
509
755
  /**
@@ -511,16 +757,23 @@ export interface ObjectInputOptions extends BaseInputOptions<EmptyTypeObject> {
511
757
  */
512
758
  assigned_structures?: Record<string, string[]>;
513
759
  /**
514
- * Provides data formats when adding entries to the data within this object input. When adding an entry, team members are prompted to choose from a number of values you have defined. Has no effect if `allow_create` is false. `entries.structures` applies to the entries within the object.
760
+ * Provides data formats when adding entries to the data within this object input. When adding
761
+ * an entry, team members are prompted to choose from a number of values you have defined. Has
762
+ * no effect if `allow_create` is false. `entries.structures` applies to the entries within the
763
+ * object.
515
764
  */
516
765
  structures?: string | Structure;
517
766
  };
518
767
  /**
519
- * The preview definition for changing the way data within an object input is previewed before being expanded. If the input has `structures`, the preview from the structure value is used instead.
768
+ * The preview definition for changing the way data within an object input is previewed before
769
+ * being expanded. If the input has `structures`, the preview from the structure value is used
770
+ * instead.
520
771
  */
521
772
  preview?: ObjectPreview;
522
773
  /**
523
- * Provides data formats for value of this object. When choosing an item, team members are prompted to choose from a number of values you have defined. `structures` applies to the object itself.
774
+ * Provides data formats for value of this object. When choosing an item, team members are
775
+ * prompted to choose from a number of values you have defined. `structures` applies to the object
776
+ * itself.
524
777
  */
525
778
  structures?: string | Structure;
526
779
  }
@@ -531,11 +784,14 @@ export interface ObjectInput extends BaseInput<ObjectInputOptions> {
531
784
 
532
785
  export interface ArrayInputOptions extends BaseInputOptions<EmptyTypeArray> {
533
786
  /**
534
- * The preview definition for changing the way data within an array input's items are previewed before being expanded. If the input has structures, the preview from the structure value is used instead.
787
+ * The preview definition for changing the way data within an array input's items are previewed
788
+ * before being expanded. If the input has structures, the preview from the structure value is
789
+ * used instead.
535
790
  */
536
791
  preview?: ObjectPreview;
537
792
  /**
538
- * Provides data formats for value of this object. When choosing an item, team members are prompted to choose from a number of values you have defined.
793
+ * Provides data formats for value of this object. When choosing an item, team members are
794
+ * prompted to choose from a number of values you have defined.
539
795
  */
540
796
  structures?: string | Structure;
541
797
  }
@@ -564,8 +820,14 @@ export type Input =
564
820
  | ArrayInput;
565
821
 
566
822
  export interface ReducedPaths {
823
+ /**
824
+ * Location of assets that are statically copied to the output site. This prefix will be removed
825
+ * from the _Uploads_ path when CloudCannon outputs the URL of an asset.
826
+ */
827
+ static?: string;
567
828
  /**
568
829
  * Default location of newly uploaded site files.
830
+ *
569
831
  * @default 'uploads'
570
832
  */
571
833
  uploads?: string;
@@ -575,6 +837,7 @@ export interface ReducedPaths {
575
837
  uploads_filename?: string;
576
838
  /**
577
839
  * Default location of newly uploaded DAM files.
840
+ *
578
841
  * @default ''
579
842
  */
580
843
  dam_uploads?: string;
@@ -583,19 +846,18 @@ export interface ReducedPaths {
583
846
  */
584
847
  dam_uploads_filename?: string;
585
848
  /**
586
- * Location of statically copied assets for DAM files. This prefix will be removed from the *DAM Uploads* path when CloudCannon outputs the URL of an asset.
849
+ * Location of statically copied assets for DAM files. This prefix will be removed from the _DAM
850
+ * Uploads_ path when CloudCannon outputs the URL of an asset.
851
+ *
587
852
  * @default ''
588
853
  */
589
854
  dam_static?: string;
590
855
  }
591
856
 
592
857
  export interface Paths extends ReducedPaths {
593
- /**
594
- * Location of assets that are statically copied to the output site. This prefix will be removed from the *Uploads* path when CloudCannon outputs the URL of an asset.
595
- */
596
- static?: string;
597
858
  /**
598
859
  * Parent folder of all collections.
860
+ *
599
861
  * @default ''
600
862
  */
601
863
  collections?: string;
@@ -604,11 +866,12 @@ export interface Paths extends ReducedPaths {
604
866
  */
605
867
  data?: string;
606
868
  /**
607
- * Parent folder of all site layout files. *Only applies to Jekyll, Hugo, and Eleventy sites*.
869
+ * Parent folder of all site layout files. _Only applies to Jekyll, Hugo, and Eleventy sites_.
608
870
  */
609
871
  layouts?: string;
610
872
  /**
611
- * Parent folder of all includes, partials, or shortcode files. *Only applies to Jekyll, Hugo, and Eleventy sites*.
873
+ * Parent folder of all includes, partials, or shortcode files. _Only applies to Jekyll, Hugo, and
874
+ * Eleventy sites_.
612
875
  */
613
876
  includes?: string;
614
877
  }
@@ -617,15 +880,18 @@ export type FilterBase = 'none' | 'all' | 'strict';
617
880
 
618
881
  export interface Filter {
619
882
  /**
620
- * Defines the initial set of visible files in the collection file list. Defaults to "all", or "strict" for the auto-discovered `pages` collection in Jekyll, Hugo, and Eleventy.
883
+ * Defines the initial set of visible files in the collection file list. Defaults to "all", or
884
+ * "strict" for the auto-discovered `pages` collection in Jekyll, Hugo, and Eleventy.
621
885
  */
622
886
  base?: FilterBase;
623
887
  /**
624
- * Add to the visible files set with `base`. Paths must be relative to the containing collection `path`.
888
+ * Add to the visible files set with `base`. Paths must be relative to the containing collection
889
+ * `path`.
625
890
  */
626
891
  include?: string[];
627
892
  /**
628
- * Remove from the visible files set with `base`. Paths must be relative to the containing collection `path`.
893
+ * Remove from the visible files set with `base`. Paths must be relative to the containing
894
+ * collection `path`.
629
895
  */
630
896
  exclude?: string[];
631
897
  }
@@ -736,29 +1002,43 @@ export interface AddOption {
736
1002
  */
737
1003
  name?: string;
738
1004
  /**
739
- * The icon next to the text in the menu item. Defaults to using icon from the matching schema if set, then falls back to add.
1005
+ * The icon next to the text in the menu item. Defaults to using icon from the matching schema if
1006
+ * set, then falls back to add.
740
1007
  */
741
1008
  icon?: Icon;
742
1009
  /**
743
- * The editor to open the new file in. Defaults to an appropriate editor for new file's type if possible. If no default editor can be calculated, or the editor does not support the new file type, a warning is shown in place of the editor.
1010
+ * The editor to open the new file in. Defaults to an appropriate editor for new file's type if
1011
+ * possible. If no default editor can be calculated, or the editor does not support the new file
1012
+ * type, a warning is shown in place of the editor.
744
1013
  */
745
1014
  editor?: EditorKey;
746
1015
  /**
747
- * Enforces a path for new files to be created in, regardless of path the user is currently navigated to within the collection file list. Relative to the path of the collection defined in collection. Defaults to the path within the collection the user is currently navigated to.
1016
+ * Enforces a path for new files to be created in, regardless of path the user is currently
1017
+ * navigated to within the collection file list. Relative to the path of the collection defined in
1018
+ * collection. Defaults to the path within the collection the user is currently navigated to.
748
1019
  */
749
1020
  base_path?: string;
750
1021
  /**
751
- * Sets which collection this action is creating a file in. This is used when matching the value for schema. Defaults to the containing collection these `add_options` are configured in.
1022
+ * Sets which collection this action is creating a file in. This is used when matching the value
1023
+ * for schema. Defaults to the containing collection these `add_options` are configured in.
752
1024
  */
753
1025
  collection?: string;
754
1026
  /**
755
- * The schema that new files are created from with this action. This schema is not restricted to the containing collection, and is instead relative to the collection specified with collection. Defaults to default if schemas are configured for the collection.
1027
+ * The schema that new files are created from with this action. This schema is not restricted to
1028
+ * the containing collection, and is instead relative to the collection specified with collection.
1029
+ * Defaults to default if schemas are configured for the collection.
756
1030
  */
757
1031
  schema?: string;
758
1032
  /**
759
- * The path to a file used to populate the initial contents of a new file if no schemas are configured. We recommend using schemas, and this is ignored if a schema is available.
1033
+ * The path to a file used to populate the initial contents of a new file if no schemas are
1034
+ * configured. We recommend using schemas, and this is ignored if a schema is available.
760
1035
  */
761
1036
  default_content_file?: string;
1037
+ /**
1038
+ * The link that opens when the option is clicked. Can either be an external or internal link. If
1039
+ * internal, the link is relative to the current site.
1040
+ */
1041
+ href?: string;
762
1042
  }
763
1043
 
764
1044
  interface Previewable {
@@ -768,6 +1048,13 @@ interface Previewable {
768
1048
  preview?: Preview;
769
1049
  }
770
1050
 
1051
+ interface PickerPreviewable {
1052
+ /**
1053
+ * Changes the way items are previewed in the CMS while being chosen.
1054
+ */
1055
+ picker_preview?: Preview;
1056
+ }
1057
+
771
1058
  export interface Schema extends Cascade, Previewable, Schemalike {
772
1059
  /**
773
1060
  * The path to the schema file. Relative to the root folder of the site.
@@ -778,8 +1065,10 @@ export interface Schema extends Cascade, Previewable, Schemalike {
778
1065
  */
779
1066
  name?: string;
780
1067
  /**
781
- * Displayed in the add menu when creating new files; also used as the icon for collection files if no other preview is found.
782
- * @default "notes"
1068
+ * Displayed in the add menu when creating new files; also used as the icon for collection files
1069
+ * if no other preview is found.
1070
+ *
1071
+ * @default 'notes'
783
1072
  */
784
1073
  icon?: Icon;
785
1074
  /**
@@ -787,164 +1076,495 @@ export interface Schema extends Cascade, Previewable, Schemalike {
787
1076
  */
788
1077
  create?: Create;
789
1078
  /**
790
- * Preview your unbuilt pages (e.g. drafts) to another page's output URL. The Visual Editor will load that URL, where Data Bindings and Previews are available to render your new page without saving.
1079
+ * Preview your unbuilt pages (e.g. drafts) to another page's output URL. The Visual Editor will
1080
+ * load that URL, where Data Bindings and Previews are available to render your new page without
1081
+ * saving.
791
1082
  */
792
1083
  new_preview_url?: string;
793
1084
  }
794
1085
 
795
1086
  export interface Sort {
1087
+ /**
1088
+ * Defines what field contains the value to sort on inside each collection item's data.
1089
+ */
796
1090
  key: string;
1091
+ /**
1092
+ * Controls which sort values come first.
1093
+ *
1094
+ * @default ascending
1095
+ */
797
1096
  order?: SortOrder;
798
1097
  }
799
1098
 
800
1099
  export interface SortOption extends Sort {
1100
+ /**
1101
+ * The text to display in the sort option list. Defaults to a generated label from key and order.
1102
+ */
801
1103
  label?: string;
802
1104
  }
803
1105
 
804
1106
  export interface Create extends ReducedCascade {
1107
+ /**
1108
+ * The raw template to be processed when creating files. Relative to the containing collection's
1109
+ * path.
1110
+ */
805
1111
  path: string;
1112
+ /**
1113
+ * Adds to the available data placeholders coming from the file. Entry values follow the same
1114
+ * format as path, and are processed sequentially before path. These values are not saved back to
1115
+ * your file.
1116
+ */
806
1117
  extra_data?: Record<string, string>;
1118
+ /**
1119
+ * Defines a target collection when publishing. When a file is published (currently only relevant
1120
+ * to Jekyll), the target collection's create definition is used instead.
1121
+ */
807
1122
  publish_to?: string;
808
1123
  }
809
1124
 
810
1125
  export interface CollectionConfig extends Cascade, Previewable {
1126
+ /**
1127
+ * The top-most folder where the files in this collection are stored. It is relative to source.
1128
+ * Each collection must have a unique path.
1129
+ */
811
1130
  path?: string;
1131
+ /**
1132
+ * Whether or not files in this collection produce files in the build output.
1133
+ */
812
1134
  output?: boolean;
1135
+ /**
1136
+ * Overrides how each file in the collection is read. Detected automatically from file extension
1137
+ * if unset.
1138
+ */
1139
+ parser?: 'csv' | 'front-matter' | 'json' | 'properties' | 'toml' | 'yaml';
1140
+ /**
1141
+ * Used to build the url field for items in the collection. Similar to permalink in many SSGs.
1142
+ * Defaults to ''
1143
+ */
813
1144
  url?: string;
1145
+ /**
1146
+ * Controls which files are displayed in the collection list. Does not change which files are
1147
+ * assigned to this collection.
1148
+ */
814
1149
  filter?: Filter | FilterBase;
1150
+ /**
1151
+ * The display name of this collection. Used in headings and in the context menu for items in the
1152
+ * collection. This is optional as CloudCannon auto-generates this from the collection key.
1153
+ */
815
1154
  name?: string;
1155
+ /**
1156
+ * Text or Markdown to show above the collection file list.
1157
+ */
816
1158
  description?: string;
1159
+ /**
1160
+ * Sets an icon to use alongside references to this collection.
1161
+ */
817
1162
  icon?: Icon;
1163
+ /**
1164
+ * Provides a custom link for documentation for editors shown above the collection file list.
1165
+ */
818
1166
  documentation?: Documentation;
1167
+ /**
1168
+ * Sets the default sorting for the collection file list. Defaults to the first option in
1169
+ * sort_options, then falls back descending path. As an exception, defaults to descending date for
1170
+ * blog-like collections.
1171
+ */
819
1172
  sort?: Sort;
1173
+ /**
1174
+ * Controls the available options in the sort menu. Defaults to generating the options from the
1175
+ * first item in the collection, falling back to ascending path and descending path.
1176
+ */
820
1177
  sort_options?: SortOption[];
1178
+ /**
1179
+ * Overrides the default singular display name of the collection. This is displayed in the
1180
+ * collection add menu and file context menu.
1181
+ */
821
1182
  singular_name?: string;
1183
+ /**
1184
+ * Overrides the default singular input key of the collection. This is used for naming conventions
1185
+ * for select and multiselect inputs.
1186
+ */
822
1187
  singular_key?: string;
823
1188
  /**
824
- * Changes the options presented in the add menu in the collection file list. Defaults to an automatically generated list from *Schemas*, or uses the first file in the collection if no schemas are configured.
1189
+ * Changes the options presented in the add menu in the collection file list. Defaults to an
1190
+ * automatically generated list from _Schemas_, or uses the first file in the collection if no
1191
+ * schemas are configured.
825
1192
  */
826
1193
  add_options?: AddOption[];
1194
+ /**
1195
+ * The create path definition to control where new files are saved to inside this collection.
1196
+ * Defaults to [relative_base_path]/{title|slugify}.md.
1197
+ */
827
1198
  create?: Create;
1199
+ /**
1200
+ * Prevents users from adding new files in the collection file list if true.
1201
+ *
1202
+ * Defaults to true for the Jekyll, Hugo and Eleventy data collection in the base data folder only
1203
+ * (data sub-folders act as non-output collections). Otherwise, defaults to false.
1204
+ */
828
1205
  disable_add?: boolean;
1206
+ /**
1207
+ * Prevents users from adding new folders in the collection file list if true.
1208
+ *
1209
+ * Defaults to true for the Jekyll, Hugo and Eleventy data collection in the base data folder only
1210
+ * (data sub-folders act as non-output collections). Otherwise, defaults to false.
1211
+ */
829
1212
  disable_add_folder?: boolean;
1213
+ /**
1214
+ * Prevents users from renaming, moving and deleting files in the collection file list if true.
1215
+ *
1216
+ * Defaults to true for the Jekyll, Hugo and Eleventy data collection in the base data folder only
1217
+ * (data sub-folders act as non-output collections). Otherwise, defaults to false.
1218
+ */
830
1219
  disable_file_actions?: boolean;
1220
+ /**
1221
+ * Preview your unbuilt pages (e.g. drafts) to another page’s output URL. The Visual Editor will
1222
+ * load that set preview URL and use the Data Bindings and Previews to render your new page
1223
+ * without saving.
1224
+ *
1225
+ * For example new_preview_url: /about/ will load the /about/ URL on new or unbuilt pages in the
1226
+ * Visual Editor.
1227
+ */
831
1228
  new_preview_url?: string;
1229
+ /**
1230
+ * The set of schemas for this collection. Schemas are used when creating and editing files in
1231
+ * this collection. Each entry corresponds to a schema that describes a data structure for this
1232
+ * collection.
1233
+ *
1234
+ * The keys in this object should match the values used for schema_key inside each of this
1235
+ * collection's files. default is a special entry and is used when a file has no schema.
1236
+ */
832
1237
  schemas?: Record<string, Schema>;
1238
+ /**
1239
+ * The key used in each file to identify the schema that file uses. The value this key represents
1240
+ * in each of this collection's files should match the keys in schemas. Defaults to _schema.
1241
+ */
833
1242
  schema_key?: string;
834
1243
  }
835
1244
 
836
1245
  export interface CollectionGroup {
1246
+ /**
1247
+ * Short, descriptive label for this group of collections.
1248
+ */
837
1249
  heading: string;
1250
+ /**
1251
+ * The collections shown in the sidebar for this group. Collections here are referenced by their
1252
+ * key within `collections_config`.
1253
+ */
838
1254
  collections: string[];
839
1255
  }
840
1256
 
841
1257
  interface Schemalike {
842
1258
  /**
843
- * If true, inputs are sorted to match when editing. Extra inputs are ordered after expected inputs, unless `remove_extra_inputs` is true.
1259
+ * If true, inputs are sorted to match when editing. Extra inputs are ordered after expected
1260
+ * inputs, unless `remove_extra_inputs` is true.
1261
+ *
844
1262
  * @default true
845
1263
  */
846
1264
  reorder_inputs?: boolean;
847
1265
  /**
848
1266
  * Hides unexpected inputs when editing. Has no effect if `remove_extra_inputs` is true.
1267
+ *
849
1268
  * @default false
850
1269
  */
851
1270
  hide_extra_inputs?: boolean;
852
1271
  /**
853
- * If checked, empty inputs are removed from the source file on save. Removed inputs will be available for editing again, provided they are in the matching schema/structure.
1272
+ * If checked, empty inputs are removed from the source file on save. Removed inputs will be
1273
+ * available for editing again, provided they are in the matching schema/structure.
1274
+ *
854
1275
  * @default false
855
1276
  */
856
1277
  remove_empty_inputs?: boolean;
857
1278
  /**
858
1279
  * If checked, extra inputs are removed when editing.
1280
+ *
859
1281
  * @default true
860
1282
  */
861
1283
  remove_extra_inputs?: boolean;
862
1284
  }
863
1285
 
864
1286
  export interface Structure extends Schemalike {
1287
+ /**
1288
+ * Defines what values are available to add when using this structure.
1289
+ */
865
1290
  values: Array<StructureValue>;
1291
+ /**
1292
+ * Defines what key should be used to detect which structure an item is. If this key is not found
1293
+ * in the existing structure, a comparison of key names is used. Defaults to "_type".
1294
+ */
866
1295
  id_key?: string;
1296
+ /**
1297
+ * Defines whether options are shown to your editors in a select menu (select, default) or a modal
1298
+ * pop up window (modal) when adding a new item.
1299
+ */
867
1300
  style?: 'select' | 'modal';
868
1301
  }
869
1302
 
870
- export interface StructureValue extends Previewable, Schemalike {
1303
+ export interface StructureValue extends Previewable, PickerPreviewable, Schemalike {
1304
+ /**
1305
+ * A unique reference value used when referring to this structure value from the Object input's
1306
+ * assigned_structures option.
1307
+ */
871
1308
  id?: string;
1309
+ /**
1310
+ * If set to true, this item will be considered the default type for this structure. If the type
1311
+ * of a value within a structure cannot be inferred based on its id_key or matching fields, then
1312
+ * it will fall back to this item. If multiple items have default set to true, only the first item
1313
+ * will be used.
1314
+ */
872
1315
  default?: boolean;
873
- description?: string;
1316
+ /**
1317
+ * An icon used when displaying the structure (defaults to either format_list_bulleted for items
1318
+ * in arrays, or notes otherwise).
1319
+ */
874
1320
  icon?: Icon;
1321
+ /**
1322
+ * Path to an image in your source files used when displaying the structure. Can be either a
1323
+ * source (has priority) or output path.
1324
+ */
875
1325
  image?: string;
1326
+ /**
1327
+ * Used as the main text in the interface for this value.
1328
+ */
876
1329
  label?: string;
877
- picker_preview?: Preview;
1330
+ /**
1331
+ * Used to group and filter items when selecting from a modal.
1332
+ */
878
1333
  tags?: string[];
1334
+ /**
1335
+ * The actual value used when items are added after selection.
1336
+ */
879
1337
  value: any;
880
1338
  }
881
1339
 
882
1340
  export type SelectValues =
1341
+ | string
883
1342
  | Array<string>
884
1343
  | Record<string, string>
885
1344
  | Record<string, Record<string, any>>;
886
1345
 
887
1346
  export interface DataConfigEntry {
1347
+ /**
1348
+ * The path to a file or folder of files containing data.
1349
+ */
888
1350
  path: string;
1351
+ /**
1352
+ * Overrides how each file in the dataset is read. Detected automatically from file extension if
1353
+ * unset.
1354
+ */
889
1355
  parser?: 'csv' | 'front-matter' | 'json' | 'properties' | 'toml' | 'yaml';
890
1356
  }
891
1357
 
892
1358
  export interface Editor {
1359
+ /**
1360
+ * The URL used for the dashboard screenshot, and where the editor opens to when clicking the
1361
+ * dashboard "Edit Home" button.
1362
+ *
1363
+ * @default /
1364
+ */
893
1365
  default_path: string;
894
1366
  }
895
1367
 
896
1368
  export interface SourceEditor {
897
1369
  /**
898
1370
  * Defines how many spaces lines are auto indented by, and/or how many spaces tabs are shown as.
1371
+ *
899
1372
  * @default 2
900
1373
  */
901
1374
  tab_size?: number;
902
1375
  /**
903
1376
  * Changes the color scheme for syntax highlighting in the editor.
1377
+ *
904
1378
  * @default monokai
905
1379
  */
906
1380
  theme?: string;
907
1381
  /**
908
1382
  * Toggles displaying line numbers and code folding controls in the editor.
1383
+ *
909
1384
  * @default true
910
1385
  */
911
1386
  show_gutter?: boolean;
912
1387
  }
913
1388
 
914
- export interface DefaultConfiguration extends Cascade {
1389
+ export interface CommitTemplate {
1390
+ /**
1391
+ * Used to identify a commit template when multiple commit templates are available.
1392
+ */
1393
+ label?: string;
1394
+ /**
1395
+ * Set the string for the commit template. This will only be used if template_path is not set.
1396
+ */
1397
+ template_string?: string;
1398
+ /**
1399
+ * Sets the path for a file containing your commit template. The file path should be relative to
1400
+ * the root directory.
1401
+ */
1402
+ template_path?: string;
1403
+ /**
1404
+ * Define inputs used to populate data placeholders in the commit template.
1405
+ */
1406
+ _inputs?: Record<string, Input>;
1407
+ /**
1408
+ * Define additional template strings, for building nested templates.
1409
+ */
1410
+ extra_data?: Record<string, string>;
1411
+ }
1412
+
1413
+ export type SsgKey =
1414
+ | 'hugo'
1415
+ | 'jekyll'
1416
+ | 'eleventy'
1417
+ | 'astro'
1418
+ | 'lume'
1419
+ | 'mkdocs'
1420
+ | 'nextjs'
1421
+ | 'sveltekit'
1422
+ | 'bridgetown'
1423
+ | 'docusaurus'
1424
+ | 'gatsby'
1425
+ | 'hexo'
1426
+ | 'nuxtjs'
1427
+ | 'sphinx'
1428
+ | 'static'
1429
+ | 'unknown';
1430
+
1431
+ export interface DefaultConfiguration extends Cascade, WithSnippets {
1432
+ ssg?: SsgKey;
1433
+ /**
1434
+ * Base path to your site source files, relative to the root folder.
1435
+ */
915
1436
  source?: string;
1437
+ /**
1438
+ * Generates the integration file in another folder. Not applicable to Jekyll, Hugo, and Eleventy.
1439
+ * Defaults to the root folder.
1440
+ */
916
1441
  output?: string;
1442
+ /**
1443
+ * Global paths to common folders.
1444
+ */
917
1445
  paths?: Paths;
1446
+ /**
1447
+ * Definitions for your collections, which are the sets of content files for your site grouped by
1448
+ * folder. Entries are keyed by a chosen collection key, and contain configuration specific to
1449
+ * that collection.
1450
+ */
918
1451
  collections_config?: Record<string, CollectionConfig>;
1452
+ /**
1453
+ * Defines which collections are shown in the site navigation and how those collections are
1454
+ * grouped.
1455
+ */
919
1456
  collection_groups?: Array<CollectionGroup>;
1457
+ /**
1458
+ * The subpath where your output files are hosted.
1459
+ */
920
1460
  base_url?: string;
1461
+ /**
1462
+ * Controls what data sets are available to populate select and multiselect inputs.
1463
+ */
921
1464
  data_config?: Record<string, DataConfigEntry>;
1465
+ /**
1466
+ * Contains settings for the default editor actions on your site.
1467
+ */
922
1468
  editor?: Editor;
1469
+ /**
1470
+ * Settings for the behavior and appearance of the Source Editor.
1471
+ */
923
1472
  source_editor?: SourceEditor;
1473
+ commit_templates?: Array<CommitTemplate>;
1474
+ /**
1475
+ * Contains settings for various Markdown engines.
1476
+ */
1477
+ generator?: {
1478
+ /**
1479
+ * Settings for various Markdown engines.
1480
+ */
1481
+ metadata?: {
1482
+ /**
1483
+ * The Markdown engine used on your site.
1484
+ */
1485
+ markdown: 'kramdown' | 'commonmark' | 'commonmarkghpages' | 'goldmark' | 'markdown-it';
1486
+ /**
1487
+ * Markdown options specific used when markdown is set to "kramdown".
1488
+ */
1489
+ kramdown?: Record<string, any>;
1490
+ /**
1491
+ * Markdown options specific used when markdown is set to "commonmark".
1492
+ */
1493
+ commonmark?: Record<string, any>;
1494
+ /**
1495
+ * Markdown options specific used when markdown is set to "commonmarkghpages".
1496
+ */
1497
+ commonmarkghpages?: Record<string, any>;
1498
+ /**
1499
+ * Markdown options specific used when markdown is set to "goldmark".
1500
+ */
1501
+ goldmark?: Record<string, any>;
1502
+ /**
1503
+ * Markdown options specific used when markdown is set to "markdown-it".
1504
+ */
1505
+ 'markdown-it'?: Record<string, any>;
1506
+ };
1507
+ };
924
1508
  /**
1509
+ * Specifies the time zone that dates are displayed and edited in. Also changes the suffix the
1510
+ * date is persisted to the file with.
1511
+ *
925
1512
  * @default Etc/UTC
926
1513
  */
927
1514
  timezone?: Timezone;
928
1515
  }
929
1516
 
930
- export interface HugoCollectionConfig extends CollectionConfig {
1517
+ export interface HugoCollectionConfig extends Omit<CollectionConfig, 'url' | 'parser'> {
1518
+ /**
1519
+ * Controls whether branch index files (e.g. _index.md) are assigned to this collection or not.
1520
+ * The "pages" collection defaults this to true, and false otherwise.
1521
+ */
931
1522
  parse_branch_index?: boolean;
932
1523
  }
933
1524
 
934
1525
  export interface HugoConfiguration extends Omit<DefaultConfiguration, 'output' | 'data_config'> {
935
- collections_config_override?: boolean;
1526
+ ssg?: 'hugo';
1527
+
936
1528
  collections_config?: Record<string, HugoCollectionConfig>;
1529
+ /**
1530
+ * Prevents CloudCannon from automatically discovering collections for supported SSGs if true.
1531
+ * Defaults to false.
1532
+ */
1533
+ collections_config_override?: boolean;
1534
+ /**
1535
+ * Controls what data sets are available to populate select and multiselect inputs.
1536
+ */
937
1537
  data_config?: Record<string, boolean>;
938
1538
  }
939
1539
 
940
1540
  export interface JekyllConfiguration extends Omit<DefaultConfiguration, 'output' | 'data_config'> {
1541
+ ssg?: 'jekyll';
1542
+
1543
+ collections_config?: Record<string, Omit<CollectionConfig, 'url' | 'parser'>>;
1544
+ /**
1545
+ * Prevents CloudCannon from automatically discovering collections for supported SSGs if true.
1546
+ * Defaults to false.
1547
+ */
941
1548
  collections_config_override?: boolean;
1549
+ /**
1550
+ * Controls what data sets are available to populate select and multiselect inputs.
1551
+ */
942
1552
  data_config?: Record<string, boolean>;
943
1553
  }
944
1554
 
945
1555
  export interface EleventyConfiguration
946
1556
  extends Omit<DefaultConfiguration, 'output' | 'data_config'> {
1557
+ ssg?: 'eleventy';
1558
+
1559
+ collections_config?: Record<string, Omit<CollectionConfig, 'url' | 'parser'>>;
1560
+ /**
1561
+ * Prevents CloudCannon from automatically discovering collections for supported SSGs if true.
1562
+ * Defaults to false.
1563
+ */
947
1564
  collections_config_override?: boolean;
1565
+ /**
1566
+ * Controls what data sets are available to populate select and multiselect inputs.
1567
+ */
948
1568
  data_config?: Record<string, boolean>;
949
1569
  }
950
1570
 
@@ -953,3 +1573,76 @@ export type Configuration =
953
1573
  | HugoConfiguration
954
1574
  | JekyllConfiguration
955
1575
  | EleventyConfiguration;
1576
+
1577
+ export type ParsedDataset =
1578
+ | string[]
1579
+ | Record<string, string>
1580
+ | Record<string, Record<string, any>>
1581
+ | Record<string, any>[];
1582
+
1583
+ interface ParsedCollectionItem {
1584
+ [index: string]: any;
1585
+ /**
1586
+ * The path to the file this was parsed from.
1587
+ */
1588
+ path: 'string';
1589
+ /**
1590
+ * The collection key this is assigned to. Matches keys in `collections_config`.
1591
+ */
1592
+ collection: 'string';
1593
+ /**
1594
+ * The URL this file is served at once built.
1595
+ */
1596
+ url?: 'string';
1597
+ }
1598
+
1599
+ interface WithIntegrationOutput {
1600
+ /**
1601
+ * The error code encountered when attempting to create the integration output file.
1602
+ */
1603
+ error?: 'NO_CONTENT' | string;
1604
+ /**
1605
+ * The time this file was generated.
1606
+ */
1607
+ time?: string;
1608
+ /**
1609
+ * [DEPRECATED] The schema version of the integration output file.
1610
+ */
1611
+ version?: string; // This refers to an old schema, replaced by the IntegrationOutput type.
1612
+ /**
1613
+ * Details about the integration tool used to generate the integration output file.
1614
+ */
1615
+ cloudcannon?: {
1616
+ /**
1617
+ * Name of the integration tool used to generate the integration output file.
1618
+ */
1619
+ name: string;
1620
+ /**
1621
+ * Version of the integration tool used to generate the integration output file.
1622
+ */
1623
+ version: string;
1624
+ };
1625
+ /**
1626
+ * Map of data keys to parsed datasets. Keys match keys in `data_config`.
1627
+ */
1628
+ data?: Record<string, ParsedDataset>;
1629
+ /**
1630
+ * Map of collection keys to parsed collection files. Keys match keys in `collections_config`.
1631
+ */
1632
+ collections?: Record<string, ParsedCollectionItem>;
1633
+ /**
1634
+ * Map of build file paths to MD5s.
1635
+ */
1636
+ files?: Record<string, string>;
1637
+ }
1638
+
1639
+ export interface DefaultIntegrationOutput extends DefaultConfiguration, WithIntegrationOutput {}
1640
+ export interface HugoIntegrationOutput extends HugoConfiguration, WithIntegrationOutput {}
1641
+ export interface JekyllIntegrationOutput extends JekyllConfiguration, WithIntegrationOutput {}
1642
+ export interface EleventyIntegrationOutput extends EleventyConfiguration, WithIntegrationOutput {}
1643
+
1644
+ export type IntegrationOutput =
1645
+ | DefaultIntegrationOutput
1646
+ | HugoIntegrationOutput
1647
+ | JekyllIntegrationOutput
1648
+ | EleventyIntegrationOutput;