@cloudcannon/configuration-types 0.0.3 → 0.0.5

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
+ export 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 =
@@ -274,29 +466,56 @@ export interface BaseInputOptions<EmptyType = EmptyTypeText> {
274
466
  }
275
467
 
276
468
  export interface BaseInput<InputOptions = BaseInputOptions> {
469
+ type?: InputType | undefined | null;
277
470
  /**
278
- * Controls the type of input, changing how it is displayed and interacted with.
471
+ * Changes the subtext below the _Label_. Has no default. Supports a limited set of Markdown:
472
+ * links, bold, italic, subscript, superscript, and inline code elements are allowed.
279
473
  */
280
- type?: InputType;
474
+ comment?: string;
281
475
  /**
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.
476
+ * Adds an expandable section of rich text below the input.
283
477
  */
284
- comment?: string;
478
+ context?: {
479
+ /**
480
+ * The rich text content shown when opened. Supports a limited set of Markdown.
481
+ */
482
+ content?: string;
483
+ /**
484
+ * Makes the content visible initially.
485
+ */
486
+ open?: boolean;
487
+ /**
488
+ * The text shown when not open. Defaults to "Context" if unset.
489
+ */
490
+ title?: string;
491
+ /**
492
+ * The icon shown when not open.
493
+ */
494
+ icon?: Icon;
495
+ };
496
+ /**
497
+ * Provides a custom link for documentation for editors shown above input.
498
+ */
499
+ documentation?: Documentation;
285
500
  /**
286
501
  * Optionally changes the text above this input.
287
502
  */
288
503
  label?: string;
289
504
  /**
290
505
  * Toggles the visibility of this input.
506
+ *
291
507
  * @default false
292
508
  */
293
509
  hidden?: boolean | string;
294
510
  /**
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.
511
+ * Controls if and how the value of this input is instantiated when created. This occurs when
512
+ * creating files, or adding array items containing the configured input.
296
513
  */
297
514
  instance_value?: InstanceValue;
298
515
  /**
299
- * Specifies whether or not this input configuration should be merged with any matching, less specific configuration.
516
+ * Specifies whether or not this input configuration should be merged with any matching, less
517
+ * specific configuration.
518
+ *
300
519
  * @default true
301
520
  */
302
521
  cascade?: boolean;
@@ -316,7 +535,6 @@ export interface TextInputOptions extends BaseInputOptions {
316
535
  export interface TextInput extends BaseInput<TextInputOptions> {
317
536
  type:
318
537
  | 'text'
319
- | 'textarea'
320
538
  | 'email'
321
539
  | 'disabled'
322
540
  | 'pinterest'
@@ -326,19 +544,36 @@ export interface TextInput extends BaseInput<TextInputOptions> {
326
544
  | 'instagram';
327
545
  }
328
546
 
547
+ export interface TextareaInputOptions extends TextInputOptions {
548
+ /**
549
+ * Shows a character counter below the input if enabled.
550
+ */
551
+ show_count?: boolean;
552
+ }
553
+
554
+ export interface TextareaInput extends BaseInput<TextareaInputOptions> {
555
+ type: 'textarea';
556
+ }
557
+
329
558
  export interface CodeInputOptions extends BaseInputOptions, SourceEditor {
330
559
  /**
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.
560
+ * Sets the maximum number of visible lines for this input, effectively controlling maximum
561
+ * height. When the containing text exceeds this number, the input becomes a scroll area.
562
+ *
332
563
  * @default 30
333
564
  */
334
565
  max_visible_lines?: number;
335
566
  /**
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`.
567
+ * Sets the minimum number of visible lines for this input, effectively controlling initial
568
+ * height. When the containing text exceeds this number, the input grows line by line to the lines
569
+ * defined by `max_visible_lines`.
570
+ *
337
571
  * @default 10
338
572
  */
339
573
  min_visible_lines?: number;
340
574
  /**
341
- * Changes how the editor parses your content for syntax highlighting. Should be set to the language of the code going into the input.
575
+ * Changes how the editor parses your content for syntax highlighting. Should be set to the
576
+ * language of the code going into the input.
342
577
  */
343
578
  syntax?: Syntax;
344
579
  }
@@ -349,11 +584,13 @@ export interface CodeInput extends BaseInput<CodeInputOptions> {
349
584
 
350
585
  export interface ColorInputOptions extends BaseInputOptions {
351
586
  /**
352
- * Sets what format the color value is saved as. Defaults to the naming convention, or HEX if that is unset.
587
+ * Sets what format the color value is saved as. Defaults to the naming convention, or HEX if that
588
+ * is unset.
353
589
  */
354
590
  format?: 'rgb' | 'hex' | 'hsl' | 'hsv';
355
591
  /**
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".
592
+ * Toggles showing a control for adjusting the transparency of the selected color. Defaults to
593
+ * using the naming convention, enabled if the input key ends with "a".
357
594
  */
358
595
  alpha?: boolean;
359
596
  }
@@ -372,7 +609,8 @@ export interface NumberInputOptions extends BaseInputOptions<EmptyTypeNumber> {
372
609
  */
373
610
  max?: number;
374
611
  /**
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`.
612
+ * A number that specifies the granularity that the value must adhere to, or the special value
613
+ * any, which allows any decimal value between `max` and `min`.
376
614
  */
377
615
  step?: number;
378
616
  }
@@ -402,10 +640,6 @@ export interface RichTextInputOptions extends BaseInputOptions, ImageResizeable,
402
640
  * Shows or hides the resize handler to vertically resize the input.
403
641
  */
404
642
  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
643
  /**
410
644
  * Defines the initial height of this input in pixels (px).
411
645
  */
@@ -418,7 +652,8 @@ export interface RichTextInput extends BaseInput<RichTextInputOptions> {
418
652
 
419
653
  export interface DateInputOptions extends BaseInputOptions {
420
654
  /**
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`.
655
+ * Specifies the time zone that dates are displayed and edited in. Also changes the suffix the
656
+ * date is persisted to the file with. Defaults to the global `timezone`.
422
657
  */
423
658
  timezone?: Timezone;
424
659
  }
@@ -432,6 +667,11 @@ export interface FileInputOptions extends BaseInputOptions, WithReducedPaths {
432
667
  * Restricts which file types are available to select or upload to this input.
433
668
  */
434
669
  accepts_mime_types?: MimeType[] | '*';
670
+ /**
671
+ * If you have one or more DAMs connected to your site, you can use this key to list which asset
672
+ * sources can be uploaded to and selected from.
673
+ */
674
+ allowed_sources?: string[];
435
675
  }
436
676
 
437
677
  export interface FileInput extends BaseInput<FileInputOptions> {
@@ -447,22 +687,28 @@ export interface ImageInput extends BaseInput<ImageInputOptions> {
447
687
  export interface SelectInputOptions<EmptyType = EmptyTypeText> extends BaseInputOptions<EmptyType> {
448
688
  /**
449
689
  * Allows new text values to be created at edit time.
690
+ *
450
691
  * @default false
451
692
  */
452
693
  allow_create?: boolean;
453
694
  /**
454
695
  * Provides an empty option alongside the options provided by values.
696
+ *
455
697
  * @default true
456
698
  */
457
699
  allow_empty?: boolean;
458
700
  /**
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).
701
+ * Defines the values available to choose from. Optional, defaults to fetching values from the
702
+ * naming convention (e.g. colors or my_colors for data set colors).
460
703
  */
461
- values: SelectValues;
704
+ values?: SelectValues;
462
705
  /**
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.
706
+ * Defines the key used for mapping between saved values and objects in values. This changes how
707
+ * the input saves selected values to match. Defaults to checking for "id", "uuid", "path",
708
+ * "title", then "name". Has no effect unless values is an array of objects, the key is used
709
+ * instead for objects, and the value itself is used for primitive types.
464
710
  */
465
- value_key: string;
711
+ value_key?: string;
466
712
  }
467
713
 
468
714
  export interface SelectInput extends BaseInput<SelectInputOptions> {
@@ -480,7 +726,7 @@ export interface ChoiceInputOptions<EmptyType = EmptyTypeText>
480
726
  /**
481
727
  * The preview definition for changing the way selected and available options are displayed.
482
728
  */
483
- preview: SelectPreview;
729
+ preview?: SelectPreview;
484
730
  }
485
731
 
486
732
  export interface ChoiceInput extends BaseInput<ChoiceInputOptions> {
@@ -493,6 +739,14 @@ export interface MultichoiceInput extends BaseInput<MultichoiceInputOptions> {
493
739
  type: 'multichoice';
494
740
  }
495
741
 
742
+ export interface ObjectInputGroup {
743
+ heading?: string;
744
+ comment?: string;
745
+ collapsed?: boolean;
746
+ inputs?: string[];
747
+ documentation?: Documentation;
748
+ }
749
+
496
750
  export interface ObjectInputOptions extends BaseInputOptions<EmptyTypeObject> {
497
751
  /**
498
752
  * Changes the appearance and behavior of the input.
@@ -503,7 +757,9 @@ export interface ObjectInputOptions extends BaseInputOptions<EmptyTypeObject> {
503
757
  */
504
758
  entries?: {
505
759
  /**
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.
760
+ * Defines a limited set of keys that can exist on the data within an object input. This set is
761
+ * used when entries are added and renamed with `allow_create` enabled. Has no effect if
762
+ * `allow_create` is not enabled.
507
763
  */
508
764
  allowed_keys?: string[];
509
765
  /**
@@ -511,18 +767,40 @@ export interface ObjectInputOptions extends BaseInputOptions<EmptyTypeObject> {
511
767
  */
512
768
  assigned_structures?: Record<string, string[]>;
513
769
  /**
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.
770
+ * Provides data formats when adding entries to the data within this object input. When adding
771
+ * an entry, team members are prompted to choose from a number of values you have defined. Has
772
+ * no effect if `allow_create` is false. `entries.structures` applies to the entries within the
773
+ * object.
515
774
  */
516
775
  structures?: string | Structure;
517
776
  };
518
777
  /**
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.
778
+ * The preview definition for changing the way data within an object input is previewed before
779
+ * being expanded. If the input has `structures`, the preview from the structure value is used
780
+ * instead.
520
781
  */
521
782
  preview?: ObjectPreview;
522
783
  /**
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.
784
+ * Provides data formats for value of this object. When choosing an item, team members are
785
+ * prompted to choose from a number of values you have defined. `structures` applies to the object
786
+ * itself.
524
787
  */
525
788
  structures?: string | Structure;
789
+
790
+ /**
791
+ * Allows you to group the inputs inside this object together without changing the data structure.
792
+ */
793
+ groups?: ObjectInputGroup[];
794
+
795
+ /**
796
+ * Controls which order input groups and ungrouped inputs appear in.
797
+ */
798
+ place_groups_below?: boolean;
799
+
800
+ /**
801
+ * Controls whether or not labels on mutable object entries are formatted.
802
+ */
803
+ allow_label_formatting?: boolean;
526
804
  }
527
805
 
528
806
  export interface ObjectInput extends BaseInput<ObjectInputOptions> {
@@ -531,11 +809,14 @@ export interface ObjectInput extends BaseInput<ObjectInputOptions> {
531
809
 
532
810
  export interface ArrayInputOptions extends BaseInputOptions<EmptyTypeArray> {
533
811
  /**
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.
812
+ * The preview definition for changing the way data within an array input's items are previewed
813
+ * before being expanded. If the input has structures, the preview from the structure value is
814
+ * used instead.
535
815
  */
536
816
  preview?: ObjectPreview;
537
817
  /**
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.
818
+ * Provides data formats for value of this object. When choosing an item, team members are
819
+ * prompted to choose from a number of values you have defined.
539
820
  */
540
821
  structures?: string | Structure;
541
822
  }
@@ -544,8 +825,13 @@ export interface ArrayInput extends BaseInput<ArrayInputOptions> {
544
825
  type: 'array';
545
826
  }
546
827
 
828
+ export interface UnknownInput extends BaseInput<BaseInputOptions> {
829
+ type?: undefined | null;
830
+ }
831
+
547
832
  export type Input =
548
833
  | BaseInput
834
+ | UnknownInput
549
835
  | TextInput
550
836
  | CodeInput
551
837
  | ColorInput
@@ -564,8 +850,14 @@ export type Input =
564
850
  | ArrayInput;
565
851
 
566
852
  export interface ReducedPaths {
853
+ /**
854
+ * Location of assets that are statically copied to the output site. This prefix will be removed
855
+ * from the _Uploads_ path when CloudCannon outputs the URL of an asset.
856
+ */
857
+ static?: string;
567
858
  /**
568
859
  * Default location of newly uploaded site files.
860
+ *
569
861
  * @default 'uploads'
570
862
  */
571
863
  uploads?: string;
@@ -575,6 +867,7 @@ export interface ReducedPaths {
575
867
  uploads_filename?: string;
576
868
  /**
577
869
  * Default location of newly uploaded DAM files.
870
+ *
578
871
  * @default ''
579
872
  */
580
873
  dam_uploads?: string;
@@ -583,19 +876,22 @@ export interface ReducedPaths {
583
876
  */
584
877
  dam_uploads_filename?: string;
585
878
  /**
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.
879
+ * Location of statically copied assets for DAM files. This prefix will be removed from the _DAM
880
+ * Uploads_ path when CloudCannon outputs the URL of an asset.
881
+ *
587
882
  * @default ''
588
883
  */
589
884
  dam_static?: string;
885
+ /**
886
+ * When set to true, CloudCannon will reference files relative to the path of the file they were uploaded to.
887
+ */
888
+ uploads_use_relative_path?: boolean;
590
889
  }
591
890
 
592
891
  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
892
  /**
598
893
  * Parent folder of all collections.
894
+ *
599
895
  * @default ''
600
896
  */
601
897
  collections?: string;
@@ -604,11 +900,12 @@ export interface Paths extends ReducedPaths {
604
900
  */
605
901
  data?: string;
606
902
  /**
607
- * Parent folder of all site layout files. *Only applies to Jekyll, Hugo, and Eleventy sites*.
903
+ * Parent folder of all site layout files. _Only applies to Jekyll, Hugo, and Eleventy sites_.
608
904
  */
609
905
  layouts?: string;
610
906
  /**
611
- * Parent folder of all includes, partials, or shortcode files. *Only applies to Jekyll, Hugo, and Eleventy sites*.
907
+ * Parent folder of all includes, partials, or shortcode files. _Only applies to Jekyll, Hugo, and
908
+ * Eleventy sites_.
612
909
  */
613
910
  includes?: string;
614
911
  }
@@ -617,15 +914,18 @@ export type FilterBase = 'none' | 'all' | 'strict';
617
914
 
618
915
  export interface Filter {
619
916
  /**
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.
917
+ * Defines the initial set of visible files in the collection file list. Defaults to "all", or
918
+ * "strict" for the auto-discovered `pages` collection in Jekyll, Hugo, and Eleventy.
621
919
  */
622
920
  base?: FilterBase;
623
921
  /**
624
- * Add to the visible files set with `base`. Paths must be relative to the containing collection `path`.
922
+ * Add to the visible files set with `base`. Paths must be relative to the containing collection
923
+ * `path`.
625
924
  */
626
925
  include?: string[];
627
926
  /**
628
- * Remove from the visible files set with `base`. Paths must be relative to the containing collection `path`.
927
+ * Remove from the visible files set with `base`. Paths must be relative to the containing
928
+ * collection `path`.
629
929
  */
630
930
  exclude?: string[];
631
931
  }
@@ -736,29 +1036,43 @@ export interface AddOption {
736
1036
  */
737
1037
  name?: string;
738
1038
  /**
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.
1039
+ * The icon next to the text in the menu item. Defaults to using icon from the matching schema if
1040
+ * set, then falls back to add.
740
1041
  */
741
1042
  icon?: Icon;
742
1043
  /**
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.
1044
+ * The editor to open the new file in. Defaults to an appropriate editor for new file's type if
1045
+ * possible. If no default editor can be calculated, or the editor does not support the new file
1046
+ * type, a warning is shown in place of the editor.
744
1047
  */
745
1048
  editor?: EditorKey;
746
1049
  /**
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.
1050
+ * Enforces a path for new files to be created in, regardless of path the user is currently
1051
+ * navigated to within the collection file list. Relative to the path of the collection defined in
1052
+ * collection. Defaults to the path within the collection the user is currently navigated to.
748
1053
  */
749
1054
  base_path?: string;
750
1055
  /**
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.
1056
+ * Sets which collection this action is creating a file in. This is used when matching the value
1057
+ * for schema. Defaults to the containing collection these `add_options` are configured in.
752
1058
  */
753
1059
  collection?: string;
754
1060
  /**
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.
1061
+ * The schema that new files are created from with this action. This schema is not restricted to
1062
+ * the containing collection, and is instead relative to the collection specified with collection.
1063
+ * Defaults to default if schemas are configured for the collection.
756
1064
  */
757
1065
  schema?: string;
758
1066
  /**
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.
1067
+ * The path to a file used to populate the initial contents of a new file if no schemas are
1068
+ * configured. We recommend using schemas, and this is ignored if a schema is available.
760
1069
  */
761
1070
  default_content_file?: string;
1071
+ /**
1072
+ * The link that opens when the option is clicked. Can either be an external or internal link. If
1073
+ * internal, the link is relative to the current site.
1074
+ */
1075
+ href?: string;
762
1076
  }
763
1077
 
764
1078
  interface Previewable {
@@ -768,6 +1082,13 @@ interface Previewable {
768
1082
  preview?: Preview;
769
1083
  }
770
1084
 
1085
+ interface PickerPreviewable {
1086
+ /**
1087
+ * Changes the way items are previewed in the CMS while being chosen.
1088
+ */
1089
+ picker_preview?: Preview;
1090
+ }
1091
+
771
1092
  export interface Schema extends Cascade, Previewable, Schemalike {
772
1093
  /**
773
1094
  * The path to the schema file. Relative to the root folder of the site.
@@ -778,8 +1099,10 @@ export interface Schema extends Cascade, Previewable, Schemalike {
778
1099
  */
779
1100
  name?: string;
780
1101
  /**
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"
1102
+ * Displayed in the add menu when creating new files; also used as the icon for collection files
1103
+ * if no other preview is found.
1104
+ *
1105
+ * @default 'notes'
783
1106
  */
784
1107
  icon?: Icon;
785
1108
  /**
@@ -787,164 +1110,495 @@ export interface Schema extends Cascade, Previewable, Schemalike {
787
1110
  */
788
1111
  create?: Create;
789
1112
  /**
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.
1113
+ * Preview your unbuilt pages (e.g. drafts) to another page's output URL. The Visual Editor will
1114
+ * load that URL, where Data Bindings and Previews are available to render your new page without
1115
+ * saving.
791
1116
  */
792
1117
  new_preview_url?: string;
793
1118
  }
794
1119
 
795
1120
  export interface Sort {
1121
+ /**
1122
+ * Defines what field contains the value to sort on inside each collection item's data.
1123
+ */
796
1124
  key: string;
1125
+ /**
1126
+ * Controls which sort values come first.
1127
+ *
1128
+ * @default ascending
1129
+ */
797
1130
  order?: SortOrder;
798
1131
  }
799
1132
 
800
1133
  export interface SortOption extends Sort {
1134
+ /**
1135
+ * The text to display in the sort option list. Defaults to a generated label from key and order.
1136
+ */
801
1137
  label?: string;
802
1138
  }
803
1139
 
804
1140
  export interface Create extends ReducedCascade {
1141
+ /**
1142
+ * The raw template to be processed when creating files. Relative to the containing collection's
1143
+ * path.
1144
+ */
805
1145
  path: string;
1146
+ /**
1147
+ * Adds to the available data placeholders coming from the file. Entry values follow the same
1148
+ * format as path, and are processed sequentially before path. These values are not saved back to
1149
+ * your file.
1150
+ */
806
1151
  extra_data?: Record<string, string>;
1152
+ /**
1153
+ * Defines a target collection when publishing. When a file is published (currently only relevant
1154
+ * to Jekyll), the target collection's create definition is used instead.
1155
+ */
807
1156
  publish_to?: string;
808
1157
  }
809
1158
 
810
1159
  export interface CollectionConfig extends Cascade, Previewable {
1160
+ /**
1161
+ * The top-most folder where the files in this collection are stored. It is relative to source.
1162
+ * Each collection must have a unique path.
1163
+ */
811
1164
  path?: string;
1165
+ /**
1166
+ * Whether or not files in this collection produce files in the build output.
1167
+ */
812
1168
  output?: boolean;
1169
+ /**
1170
+ * Overrides how each file in the collection is read. Detected automatically from file extension
1171
+ * if unset.
1172
+ */
1173
+ parser?: 'csv' | 'front-matter' | 'json' | 'properties' | 'toml' | 'yaml';
1174
+ /**
1175
+ * Used to build the url field for items in the collection. Similar to permalink in many SSGs.
1176
+ * Defaults to ''
1177
+ */
813
1178
  url?: string;
1179
+ /**
1180
+ * Controls which files are displayed in the collection list. Does not change which files are
1181
+ * assigned to this collection.
1182
+ */
814
1183
  filter?: Filter | FilterBase;
1184
+ /**
1185
+ * The display name of this collection. Used in headings and in the context menu for items in the
1186
+ * collection. This is optional as CloudCannon auto-generates this from the collection key.
1187
+ */
815
1188
  name?: string;
1189
+ /**
1190
+ * Text or Markdown to show above the collection file list.
1191
+ */
816
1192
  description?: string;
1193
+ /**
1194
+ * Sets an icon to use alongside references to this collection.
1195
+ */
817
1196
  icon?: Icon;
1197
+ /**
1198
+ * Provides a custom link for documentation for editors shown above the collection file list.
1199
+ */
818
1200
  documentation?: Documentation;
1201
+ /**
1202
+ * Sets the default sorting for the collection file list. Defaults to the first option in
1203
+ * sort_options, then falls back descending path. As an exception, defaults to descending date for
1204
+ * blog-like collections.
1205
+ */
819
1206
  sort?: Sort;
1207
+ /**
1208
+ * Controls the available options in the sort menu. Defaults to generating the options from the
1209
+ * first item in the collection, falling back to ascending path and descending path.
1210
+ */
820
1211
  sort_options?: SortOption[];
1212
+ /**
1213
+ * Overrides the default singular display name of the collection. This is displayed in the
1214
+ * collection add menu and file context menu.
1215
+ */
821
1216
  singular_name?: string;
1217
+ /**
1218
+ * Overrides the default singular input key of the collection. This is used for naming conventions
1219
+ * for select and multiselect inputs.
1220
+ */
822
1221
  singular_key?: string;
823
1222
  /**
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.
1223
+ * Changes the options presented in the add menu in the collection file list. Defaults to an
1224
+ * automatically generated list from _Schemas_, or uses the first file in the collection if no
1225
+ * schemas are configured.
825
1226
  */
826
1227
  add_options?: AddOption[];
1228
+ /**
1229
+ * The create path definition to control where new files are saved to inside this collection.
1230
+ * Defaults to [relative_base_path]/{title|slugify}.md.
1231
+ */
827
1232
  create?: Create;
1233
+ /**
1234
+ * Prevents users from adding new files in the collection file list if true.
1235
+ *
1236
+ * Defaults to true for the Jekyll, Hugo and Eleventy data collection in the base data folder only
1237
+ * (data sub-folders act as non-output collections). Otherwise, defaults to false.
1238
+ */
828
1239
  disable_add?: boolean;
1240
+ /**
1241
+ * Prevents users from adding new folders in the collection file list if true.
1242
+ *
1243
+ * Defaults to true for the Jekyll, Hugo and Eleventy data collection in the base data folder only
1244
+ * (data sub-folders act as non-output collections). Otherwise, defaults to false.
1245
+ */
829
1246
  disable_add_folder?: boolean;
1247
+ /**
1248
+ * Prevents users from renaming, moving and deleting files in the collection file list if true.
1249
+ *
1250
+ * Defaults to true for the Jekyll, Hugo and Eleventy data collection in the base data folder only
1251
+ * (data sub-folders act as non-output collections). Otherwise, defaults to false.
1252
+ */
830
1253
  disable_file_actions?: boolean;
1254
+ /**
1255
+ * Preview your unbuilt pages (e.g. drafts) to another page’s output URL. The Visual Editor will
1256
+ * load that set preview URL and use the Data Bindings and Previews to render your new page
1257
+ * without saving.
1258
+ *
1259
+ * For example new_preview_url: /about/ will load the /about/ URL on new or unbuilt pages in the
1260
+ * Visual Editor.
1261
+ */
831
1262
  new_preview_url?: string;
1263
+ /**
1264
+ * The set of schemas for this collection. Schemas are used when creating and editing files in
1265
+ * this collection. Each entry corresponds to a schema that describes a data structure for this
1266
+ * collection.
1267
+ *
1268
+ * The keys in this object should match the values used for schema_key inside each of this
1269
+ * collection's files. default is a special entry and is used when a file has no schema.
1270
+ */
832
1271
  schemas?: Record<string, Schema>;
1272
+ /**
1273
+ * The key used in each file to identify the schema that file uses. The value this key represents
1274
+ * in each of this collection's files should match the keys in schemas. Defaults to _schema.
1275
+ */
833
1276
  schema_key?: string;
834
1277
  }
835
1278
 
836
1279
  export interface CollectionGroup {
1280
+ /**
1281
+ * Short, descriptive label for this group of collections.
1282
+ */
837
1283
  heading: string;
1284
+ /**
1285
+ * The collections shown in the sidebar for this group. Collections here are referenced by their
1286
+ * key within `collections_config`.
1287
+ */
838
1288
  collections: string[];
839
1289
  }
840
1290
 
841
1291
  interface Schemalike {
842
1292
  /**
843
- * If true, inputs are sorted to match when editing. Extra inputs are ordered after expected inputs, unless `remove_extra_inputs` is true.
1293
+ * If true, inputs are sorted to match when editing. Extra inputs are ordered after expected
1294
+ * inputs, unless `remove_extra_inputs` is true.
1295
+ *
844
1296
  * @default true
845
1297
  */
846
1298
  reorder_inputs?: boolean;
847
1299
  /**
848
1300
  * Hides unexpected inputs when editing. Has no effect if `remove_extra_inputs` is true.
1301
+ *
849
1302
  * @default false
850
1303
  */
851
1304
  hide_extra_inputs?: boolean;
852
1305
  /**
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.
1306
+ * If checked, empty inputs are removed from the source file on save. Removed inputs will be
1307
+ * available for editing again, provided they are in the matching schema/structure.
1308
+ *
854
1309
  * @default false
855
1310
  */
856
1311
  remove_empty_inputs?: boolean;
857
1312
  /**
858
1313
  * If checked, extra inputs are removed when editing.
1314
+ *
859
1315
  * @default true
860
1316
  */
861
1317
  remove_extra_inputs?: boolean;
862
1318
  }
863
1319
 
864
1320
  export interface Structure extends Schemalike {
1321
+ /**
1322
+ * Defines what values are available to add when using this structure.
1323
+ */
865
1324
  values: Array<StructureValue>;
1325
+ /**
1326
+ * Defines what key should be used to detect which structure an item is. If this key is not found
1327
+ * in the existing structure, a comparison of key names is used. Defaults to "_type".
1328
+ */
866
1329
  id_key?: string;
1330
+ /**
1331
+ * Defines whether options are shown to your editors in a select menu (select, default) or a modal
1332
+ * pop up window (modal) when adding a new item.
1333
+ */
867
1334
  style?: 'select' | 'modal';
868
1335
  }
869
1336
 
870
- export interface StructureValue extends Previewable, Schemalike {
1337
+ export interface StructureValue extends Previewable, PickerPreviewable, Schemalike {
1338
+ /**
1339
+ * A unique reference value used when referring to this structure value from the Object input's
1340
+ * assigned_structures option.
1341
+ */
871
1342
  id?: string;
1343
+ /**
1344
+ * If set to true, this item will be considered the default type for this structure. If the type
1345
+ * of a value within a structure cannot be inferred based on its id_key or matching fields, then
1346
+ * it will fall back to this item. If multiple items have default set to true, only the first item
1347
+ * will be used.
1348
+ */
872
1349
  default?: boolean;
873
- description?: string;
1350
+ /**
1351
+ * An icon used when displaying the structure (defaults to either format_list_bulleted for items
1352
+ * in arrays, or notes otherwise).
1353
+ */
874
1354
  icon?: Icon;
1355
+ /**
1356
+ * Path to an image in your source files used when displaying the structure. Can be either a
1357
+ * source (has priority) or output path.
1358
+ */
875
1359
  image?: string;
1360
+ /**
1361
+ * Used as the main text in the interface for this value.
1362
+ */
876
1363
  label?: string;
877
- picker_preview?: Preview;
1364
+ /**
1365
+ * Used to group and filter items when selecting from a modal.
1366
+ */
878
1367
  tags?: string[];
1368
+ /**
1369
+ * The actual value used when items are added after selection.
1370
+ */
879
1371
  value: any;
880
1372
  }
881
1373
 
882
1374
  export type SelectValues =
1375
+ | string
883
1376
  | Array<string>
884
1377
  | Record<string, string>
885
1378
  | Record<string, Record<string, any>>;
886
1379
 
887
1380
  export interface DataConfigEntry {
1381
+ /**
1382
+ * The path to a file or folder of files containing data.
1383
+ */
888
1384
  path: string;
1385
+ /**
1386
+ * Overrides how each file in the dataset is read. Detected automatically from file extension if
1387
+ * unset.
1388
+ */
889
1389
  parser?: 'csv' | 'front-matter' | 'json' | 'properties' | 'toml' | 'yaml';
890
1390
  }
891
1391
 
892
1392
  export interface Editor {
1393
+ /**
1394
+ * The URL used for the dashboard screenshot, and where the editor opens to when clicking the
1395
+ * dashboard "Edit Home" button.
1396
+ *
1397
+ * @default /
1398
+ */
893
1399
  default_path: string;
894
1400
  }
895
1401
 
896
1402
  export interface SourceEditor {
897
1403
  /**
898
1404
  * Defines how many spaces lines are auto indented by, and/or how many spaces tabs are shown as.
1405
+ *
899
1406
  * @default 2
900
1407
  */
901
1408
  tab_size?: number;
902
1409
  /**
903
1410
  * Changes the color scheme for syntax highlighting in the editor.
1411
+ *
904
1412
  * @default monokai
905
1413
  */
906
1414
  theme?: string;
907
1415
  /**
908
1416
  * Toggles displaying line numbers and code folding controls in the editor.
1417
+ *
909
1418
  * @default true
910
1419
  */
911
1420
  show_gutter?: boolean;
912
1421
  }
913
1422
 
914
- export interface DefaultConfiguration extends Cascade {
1423
+ export interface CommitTemplate {
1424
+ /**
1425
+ * Used to identify a commit template when multiple commit templates are available.
1426
+ */
1427
+ label?: string;
1428
+ /**
1429
+ * Set the string for the commit template. This will only be used if template_path is not set.
1430
+ */
1431
+ template_string?: string;
1432
+ /**
1433
+ * Sets the path for a file containing your commit template. The file path should be relative to
1434
+ * the root directory.
1435
+ */
1436
+ template_path?: string;
1437
+ /**
1438
+ * Define inputs used to populate data placeholders in the commit template.
1439
+ */
1440
+ _inputs?: Record<string, Input>;
1441
+ /**
1442
+ * Define additional template strings, for building nested templates.
1443
+ */
1444
+ extra_data?: Record<string, string>;
1445
+ }
1446
+
1447
+ export type SsgKey =
1448
+ | 'hugo'
1449
+ | 'jekyll'
1450
+ | 'eleventy'
1451
+ | 'astro'
1452
+ | 'lume'
1453
+ | 'mkdocs'
1454
+ | 'nextjs'
1455
+ | 'sveltekit'
1456
+ | 'bridgetown'
1457
+ | 'docusaurus'
1458
+ | 'gatsby'
1459
+ | 'hexo'
1460
+ | 'nuxtjs'
1461
+ | 'sphinx'
1462
+ | 'static'
1463
+ | 'unknown';
1464
+
1465
+ export interface DefaultConfiguration extends Cascade, WithSnippets {
1466
+ ssg?: SsgKey;
1467
+ /**
1468
+ * Base path to your site source files, relative to the root folder.
1469
+ */
915
1470
  source?: string;
1471
+ /**
1472
+ * Generates the integration file in another folder. Not applicable to Jekyll, Hugo, and Eleventy.
1473
+ * Defaults to the root folder.
1474
+ */
916
1475
  output?: string;
1476
+ /**
1477
+ * Global paths to common folders.
1478
+ */
917
1479
  paths?: Paths;
1480
+ /**
1481
+ * Definitions for your collections, which are the sets of content files for your site grouped by
1482
+ * folder. Entries are keyed by a chosen collection key, and contain configuration specific to
1483
+ * that collection.
1484
+ */
918
1485
  collections_config?: Record<string, CollectionConfig>;
1486
+ /**
1487
+ * Defines which collections are shown in the site navigation and how those collections are
1488
+ * grouped.
1489
+ */
919
1490
  collection_groups?: Array<CollectionGroup>;
1491
+ /**
1492
+ * The subpath where your output files are hosted.
1493
+ */
920
1494
  base_url?: string;
1495
+ /**
1496
+ * Controls what data sets are available to populate select and multiselect inputs.
1497
+ */
921
1498
  data_config?: Record<string, DataConfigEntry>;
1499
+ /**
1500
+ * Contains settings for the default editor actions on your site.
1501
+ */
922
1502
  editor?: Editor;
1503
+ /**
1504
+ * Settings for the behavior and appearance of the Source Editor.
1505
+ */
923
1506
  source_editor?: SourceEditor;
1507
+ commit_templates?: Array<CommitTemplate>;
924
1508
  /**
1509
+ * Contains settings for various Markdown engines.
1510
+ */
1511
+ generator?: {
1512
+ /**
1513
+ * Settings for various Markdown engines.
1514
+ */
1515
+ metadata?: {
1516
+ /**
1517
+ * The Markdown engine used on your site.
1518
+ */
1519
+ markdown: 'kramdown' | 'commonmark' | 'commonmarkghpages' | 'goldmark' | 'markdown-it';
1520
+ /**
1521
+ * Markdown options specific used when markdown is set to "kramdown".
1522
+ */
1523
+ kramdown?: Record<string, any>;
1524
+ /**
1525
+ * Markdown options specific used when markdown is set to "commonmark".
1526
+ */
1527
+ commonmark?: Record<string, any>;
1528
+ /**
1529
+ * Markdown options specific used when markdown is set to "commonmarkghpages".
1530
+ */
1531
+ commonmarkghpages?: Record<string, any>;
1532
+ /**
1533
+ * Markdown options specific used when markdown is set to "goldmark".
1534
+ */
1535
+ goldmark?: Record<string, any>;
1536
+ /**
1537
+ * Markdown options specific used when markdown is set to "markdown-it".
1538
+ */
1539
+ 'markdown-it'?: Record<string, any>;
1540
+ };
1541
+ };
1542
+ /**
1543
+ * Specifies the time zone that dates are displayed and edited in. Also changes the suffix the
1544
+ * date is persisted to the file with.
1545
+ *
925
1546
  * @default Etc/UTC
926
1547
  */
927
1548
  timezone?: Timezone;
928
1549
  }
929
1550
 
930
- export interface HugoCollectionConfig extends CollectionConfig {
1551
+ export interface HugoCollectionConfig extends Omit<CollectionConfig, 'url' | 'parser'> {
1552
+ /**
1553
+ * Controls whether branch index files (e.g. _index.md) are assigned to this collection or not.
1554
+ * The "pages" collection defaults this to true, and false otherwise.
1555
+ */
931
1556
  parse_branch_index?: boolean;
932
1557
  }
933
1558
 
934
1559
  export interface HugoConfiguration extends Omit<DefaultConfiguration, 'output' | 'data_config'> {
935
- collections_config_override?: boolean;
1560
+ ssg?: 'hugo';
1561
+
936
1562
  collections_config?: Record<string, HugoCollectionConfig>;
1563
+ /**
1564
+ * Prevents CloudCannon from automatically discovering collections for supported SSGs if true.
1565
+ * Defaults to false.
1566
+ */
1567
+ collections_config_override?: boolean;
1568
+ /**
1569
+ * Controls what data sets are available to populate select and multiselect inputs.
1570
+ */
937
1571
  data_config?: Record<string, boolean>;
938
1572
  }
939
1573
 
940
1574
  export interface JekyllConfiguration extends Omit<DefaultConfiguration, 'output' | 'data_config'> {
1575
+ ssg?: 'jekyll';
1576
+
1577
+ collections_config?: Record<string, Omit<CollectionConfig, 'url' | 'parser'>>;
1578
+ /**
1579
+ * Prevents CloudCannon from automatically discovering collections for supported SSGs if true.
1580
+ * Defaults to false.
1581
+ */
941
1582
  collections_config_override?: boolean;
1583
+ /**
1584
+ * Controls what data sets are available to populate select and multiselect inputs.
1585
+ */
942
1586
  data_config?: Record<string, boolean>;
943
1587
  }
944
1588
 
945
1589
  export interface EleventyConfiguration
946
1590
  extends Omit<DefaultConfiguration, 'output' | 'data_config'> {
1591
+ ssg?: 'eleventy';
1592
+
1593
+ collections_config?: Record<string, Omit<CollectionConfig, 'url' | 'parser'>>;
1594
+ /**
1595
+ * Prevents CloudCannon from automatically discovering collections for supported SSGs if true.
1596
+ * Defaults to false.
1597
+ */
947
1598
  collections_config_override?: boolean;
1599
+ /**
1600
+ * Controls what data sets are available to populate select and multiselect inputs.
1601
+ */
948
1602
  data_config?: Record<string, boolean>;
949
1603
  }
950
1604
 
@@ -953,3 +1607,76 @@ export type Configuration =
953
1607
  | HugoConfiguration
954
1608
  | JekyllConfiguration
955
1609
  | EleventyConfiguration;
1610
+
1611
+ export type ParsedDataset =
1612
+ | string[]
1613
+ | Record<string, string>
1614
+ | Record<string, Record<string, any>>
1615
+ | Record<string, any>[];
1616
+
1617
+ interface ParsedCollectionItem {
1618
+ [index: string]: any;
1619
+ /**
1620
+ * The path to the file this was parsed from.
1621
+ */
1622
+ path: 'string';
1623
+ /**
1624
+ * The collection key this is assigned to. Matches keys in `collections_config`.
1625
+ */
1626
+ collection: 'string';
1627
+ /**
1628
+ * The URL this file is served at once built.
1629
+ */
1630
+ url?: 'string';
1631
+ }
1632
+
1633
+ interface WithIntegrationOutput {
1634
+ /**
1635
+ * The error code encountered when attempting to create the integration output file.
1636
+ */
1637
+ error?: 'NO_CONTENT' | string;
1638
+ /**
1639
+ * The time this file was generated.
1640
+ */
1641
+ time?: string;
1642
+ /**
1643
+ * [DEPRECATED] The schema version of the integration output file.
1644
+ */
1645
+ version?: string; // This refers to an old schema, replaced by the IntegrationOutput type.
1646
+ /**
1647
+ * Details about the integration tool used to generate the integration output file.
1648
+ */
1649
+ cloudcannon?: {
1650
+ /**
1651
+ * Name of the integration tool used to generate the integration output file.
1652
+ */
1653
+ name: string;
1654
+ /**
1655
+ * Version of the integration tool used to generate the integration output file.
1656
+ */
1657
+ version: string;
1658
+ };
1659
+ /**
1660
+ * Map of data keys to parsed datasets. Keys match keys in `data_config`.
1661
+ */
1662
+ data?: Record<string, ParsedDataset>;
1663
+ /**
1664
+ * Map of collection keys to parsed collection files. Keys match keys in `collections_config`.
1665
+ */
1666
+ collections?: Record<string, ParsedCollectionItem>;
1667
+ /**
1668
+ * Map of build file paths to MD5s.
1669
+ */
1670
+ files?: Record<string, string>;
1671
+ }
1672
+
1673
+ export interface DefaultIntegrationOutput extends DefaultConfiguration, WithIntegrationOutput {}
1674
+ export interface HugoIntegrationOutput extends HugoConfiguration, WithIntegrationOutput {}
1675
+ export interface JekyllIntegrationOutput extends JekyllConfiguration, WithIntegrationOutput {}
1676
+ export interface EleventyIntegrationOutput extends EleventyConfiguration, WithIntegrationOutput {}
1677
+
1678
+ export type IntegrationOutput =
1679
+ | DefaultIntegrationOutput
1680
+ | HugoIntegrationOutput
1681
+ | JekyllIntegrationOutput
1682
+ | EleventyIntegrationOutput;